[FFmpeg-cvslog] [ffmpeg-radio] 02/06: avradio/sdr: Factor bug workaround detection code out.

Michael Niedermayer ffmpeg-git at ffmpeg.org
Thu Jul 27 23:29:25 EEST 2023


This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository libavradio.

commit dec1c1eebd4cb05261e81e61b1de5136990154c0
Author:     Michael Niedermayer <michael at niedermayer.cc>
AuthorDate: Mon Jul 24 19:21:39 2023 +0200
Commit:     Michael Niedermayer <michael at niedermayer.cc>
CommitDate: Mon Jul 24 19:21:39 2023 +0200

    avradio/sdr: Factor bug workaround detection code out.
    
    Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavradio/sdr.h        | 5 +++++
 libavradio/sdrdemux.c   | 8 ++++++++
 libavradio/sdrinradio.c | 5 +----
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/libavradio/sdr.h b/libavradio/sdr.h
index de0a479d26..7d7bfd6806 100644
--- a/libavradio/sdr.h
+++ b/libavradio/sdr.h
@@ -290,6 +290,11 @@ extern const AVOption ff_sdr_options[];
 
 extern ModulationDescriptor ff_sdr_modulation_descs[];
 
+/**
+ * Detect hw bug specific workarounds.
+ */
+void ff_sdr_autodetect_workarounds(SDRContext *sdr);
+
 /**
  * Set the center frequency of the hardware
  * this will check the argument and call set_frequency_callback()
diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index bb33c69668..b0b63827eb 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -99,6 +99,14 @@ static void apply_deemphasis(SDRContext *sdr, AVComplexFloat *data, int len, int
     }
 }
 
+void ff_sdr_autodetect_workarounds(SDRContext *sdr)
+{
+    if (sdr->rtlsdr_fixes < 0)
+        sdr->rtlsdr_fixes = !strcmp(sdr->driver_name, "rtlsdr");
+    if (sdr->sdrplay_fixes < 0)
+        sdr->sdrplay_fixes = !strcmp(sdr->driver_name, "sdrplay");
+}
+
 static void free_station(Station *station)
 {
     if (station->stream)
diff --git a/libavradio/sdrinradio.c b/libavradio/sdrinradio.c
index 5c14250f8c..2865b6a9a6 100644
--- a/libavradio/sdrinradio.c
+++ b/libavradio/sdrinradio.c
@@ -212,10 +212,7 @@ static int sdrindev_initial_hw_setup(AVFormatContext *s)
     if (!sdr->driver_name)
         return AVERROR(EINVAL); //No driver specified and none found
 
-    if (sdr->rtlsdr_fixes < 0)
-        sdr->rtlsdr_fixes = !strcmp(sdr->driver_name, "rtlsdr");
-    if (sdr->sdrplay_fixes < 0)
-        sdr->sdrplay_fixes = !strcmp(sdr->driver_name, "sdrplay");
+    ff_sdr_autodetect_workarounds(sdr);
 
     SoapySDRKwargs_set(&args, "driver", sdr->driver_name);
     sdr->soapy = soapy = SoapySDRDevice_make(&args);



More information about the ffmpeg-cvslog mailing list