diff mbox series

[FFmpeg-devel,03/12] avradio/avdevice/sdrindev: Soapy / RTLSDR ignores gain in direct sampling mode

Message ID 20230730221131.1205193-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/12] avradio/avformat/sdrdemux: Move agc_gain into local variable | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Michael Niedermayer July 30, 2023, 10:11 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavdevice/sdrindev.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavdevice/sdrindev.c b/libavdevice/sdrindev.c
index f07bd6b154..8766fc2f34 100644
--- a/libavdevice/sdrindev.c
+++ b/libavdevice/sdrindev.c
@@ -88,6 +88,10 @@  static int sdrindev_set_gain_callback(SDRContext *sdr, float gain)
         }
 
         if (sdr->sdr_gain != GAIN_SDR_AGC) {
+            if (sdr->current_direct_samp && !strcmp(sdr->current_direct_samp, "2")) {
+                return -1; // soapy ignores gain in direct sampling mode
+            }
+
             ret = SoapySDRDevice_setGain(soapy, SOAPY_SDR_RX, 0, gain);
             if (ret) {
                 av_log(avfmt, AV_LOG_WARNING, "Failed to set gain to %f (%s)\n", gain, SoapySDRDevice_lastError());