@@ -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()
@@ -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)
@@ -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);
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavradio/sdr.h | 5 +++++ libavradio/sdrdemux.c | 8 ++++++++ libavradio/sdrinradio.c | 5 +---- 3 files changed, 14 insertions(+), 4 deletions(-)