[FFmpeg-devel] [PATCH 02/14] avradio/sdr: Factor demodulate_all_fm out

Michael Niedermayer michael at niedermayer.cc
Thu Jul 13 02:36:54 EEST 2023


This is cleaner

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavradio/sdr.h      | 1 +
 libavradio/sdrdemux.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavradio/sdr.h b/libavradio/sdr.h
index 6c4647823e..29ac4a2963 100644
--- a/libavradio/sdr.h
+++ b/libavradio/sdr.h
@@ -130,6 +130,7 @@ typedef struct SDRContext {
     int width, height;
     int single_ch_audio_st_index;
     int waterfall_st_index;
+    int demodulate_all_fm;
     int64_t freq;
     int64_t min_freq;
     int64_t max_freq;
diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index e93cf4dd98..2103feaca8 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -1439,6 +1439,7 @@ int ff_sdr_common_init(AVFormatContext *s)
         st->codecpar->height = sdr->height;
         avpriv_set_pts_info(st, 64, 1, (48000/128) << FREQ_BITS);
         sdr->waterfall_st_index = st->index;
+        sdr->demodulate_all_fm = 1;
     } else
         sdr->waterfall_st_index = -1;
 
@@ -1679,7 +1680,7 @@ process_next_block:
         }
     }
 
-    if (sdr->width > 1) {
+    if (sdr->demodulate_all_fm) {
         Station *station_list[1000];
         int nb_stations = ff_sdr_find_stations(sdr, sdr->block_center_freq, sdr->sdr_sample_rate*0.5, station_list, FF_ARRAY_ELEMS(station_list));
         for (int i= 0; i<nb_stations; i++) {
-- 
2.31.1



More information about the ffmpeg-devel mailing list