diff mbox series

[FFmpeg-devel,3/6] avradio/sdrdemux: Call ff_sdr_autodetect_workarounds() from common init

Message ID 20230724183535.2677937-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avradio/sdrinradio: Check tuner before applying rtlsdr frequency correction | 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 24, 2023, 6:35 p.m. UTC
This way it is also available for file input from specific hw

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavradio/sdrdemux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index b0b63827eb..123a1a9d0f 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -101,9 +101,9 @@  static void apply_deemphasis(SDRContext *sdr, AVComplexFloat *data, int len, int
 
 void ff_sdr_autodetect_workarounds(SDRContext *sdr)
 {
-    if (sdr->rtlsdr_fixes < 0)
+    if (sdr-> rtlsdr_fixes < 0 && sdr->driver_name)
         sdr->rtlsdr_fixes = !strcmp(sdr->driver_name, "rtlsdr");
-    if (sdr->sdrplay_fixes < 0)
+    if (sdr->sdrplay_fixes < 0 && sdr->driver_name)
         sdr->sdrplay_fixes = !strcmp(sdr->driver_name, "sdrplay");
 }
 
@@ -1537,6 +1537,8 @@  int ff_sdr_common_init(AVFormatContext *s)
     sdr->avfmt = s;
     s->ctx_flags |= AVFMTCTX_NOHEADER;
 
+    ff_sdr_autodetect_workarounds(sdr);
+
     if (sdr->bandwidth > sdr->sdr_sample_rate * 7 / 8)
         av_log(s, AV_LOG_WARNING, "Bandwidth looks suspicious\n");