From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 73D7E44FEC for ; Tue, 18 Jul 2023 21:46:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10B4A68C59F; Wed, 19 Jul 2023 00:45:56 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A5E4268C562 for ; Wed, 19 Jul 2023 00:45:47 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id DCB6F20003 for ; Tue, 18 Jul 2023 21:45:46 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 18 Jul 2023 23:45:32 +0200 Message-Id: <20230718214542.685375-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230718214542.685375-1-michael@niedermayer.cc> References: <20230718214542.685375-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 04/14] avradio/sdrdemux: snap2station() should look only at the vissible window X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Otherwise we can skip over areas not leaving time to scan them Signed-off-by: Michael Niedermayer --- libavradio/sdrdemux.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c index ca0a9c5cf9..f189c85a0d 100644 --- a/libavradio/sdrdemux.c +++ b/libavradio/sdrdemux.c @@ -1291,11 +1291,11 @@ static int snap2station(SDRContext *sdr, int *seek_direction) { AVFormatContext *avfmt = sdr->avfmt; AVStream *st = avfmt->streams[sdr->single_ch_audio_st_index]; SDRStream *sst = st->priv_data; - double current_freq; + double current_freq, current_view; double best_distance = INT64_MAX; Station *best_station = NULL; Station *station_list[MAX_STATIONS]; - 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)); + int nb_stations; if (sst->station) { current_freq = sst->station->frequency; @@ -1304,6 +1304,15 @@ static int snap2station(SDRContext *sdr, int *seek_direction) { } else current_freq = sdr->block_center_freq; + if (sdr->block_center_freq) { + current_view = sdr->block_center_freq; + } else if (sst->station) { + current_view = sst->station->frequency; + } else + current_view = sdr->station_freq; + + nb_stations = ff_sdr_find_stations(sdr, current_view, sdr->sdr_sample_rate*0.5, station_list, FF_ARRAY_ELEMS(station_list)); + for(int i = 0; ifrequency - current_freq; -- 2.31.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".