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 2C88146DB3 for ; Tue, 11 Jul 2023 21:20:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 51C6068C194; Wed, 12 Jul 2023 00:19:26 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 608F668C613 for ; Wed, 12 Jul 2023 00:19:24 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B2D4560003 for ; Tue, 11 Jul 2023 21:19:23 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 11 Jul 2023 23:19:09 +0200 Message-Id: <20230711211910.1257355-11-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230711211910.1257355-1-michael@niedermayer.cc> References: <20230711211910.1257355-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 11/12] avradio/sdr: Pass AVStream instead of int to demodulate 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: thats less errror prone and simpler Signed-off-by: Michael Niedermayer --- libavradio/sdr.h | 2 +- libavradio/sdrdemux.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libavradio/sdr.h b/libavradio/sdr.h index cb4b6dc68b..3297584eae 100644 --- a/libavradio/sdr.h +++ b/libavradio/sdr.h @@ -241,7 +241,7 @@ typedef struct ModulationDescriptor { /** * Demodulate given station into packet */ - int (*demodulate)(SDRContext *sdr, int stream_index, AVPacket *pkt); + int (*demodulate)(SDRContext *sdr, AVStream *st, AVPacket *pkt); } ModulationDescriptor; typedef struct BandDescriptor { diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c index 5d58d81843..19dd0ef381 100644 --- a/libavradio/sdrdemux.c +++ b/libavradio/sdrdemux.c @@ -665,9 +665,8 @@ static av_always_inline void synchronous_am_demodulationN(AVComplexFloat *iblock } } -static int demodulate_am(SDRContext *sdr, int stream_index, AVPacket *pkt) +static int demodulate_am(SDRContext *sdr, AVStream *st, AVPacket *pkt) { - AVStream *st = sdr->avfmt->streams[stream_index]; SDRStream *sst = st->priv_data; double freq = sst->station->frequency; int64_t bandwidth = sst->station->bandwidth; @@ -934,9 +933,8 @@ static int probe_fm(SDRContext *sdr) return 0; } -static int demodulate_fm(SDRContext *sdr, int stream_index, AVPacket *pkt) +static int demodulate_fm(SDRContext *sdr, AVStream *st, AVPacket *pkt) { - AVStream *st = sdr->avfmt->streams[stream_index]; SDRStream *sst = st->priv_data; Station *station = sst->station; @@ -1653,7 +1651,7 @@ process_next_block: } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { if (sst->station) { skip = 0; - ret = ff_sdr_modulation_descs[ sst->station->modulation ].demodulate(sdr, stream_index, pkt); + ret = ff_sdr_modulation_descs[ sst->station->modulation ].demodulate(sdr, st, pkt); if (ret < 0) { av_log(s, AV_LOG_ERROR, "demodulation failed ret = %d\n", ret); } -- 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".