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

Michael Niedermayer michael at niedermayer.cc
Mon Jul 31 01:11:22 EEST 2023


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavdevice/sdrindev.c | 4 ++++
 1 file changed, 4 insertions(+)

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());
-- 
2.31.1



More information about the ffmpeg-devel mailing list