From patchwork Tue Jul 11 21:19:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42602 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp1731214pzb; Tue, 11 Jul 2023 14:20:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlELvxamvVnjFg+6nk/T7nMlBVuesa4OUNI9JLZJHUdhoaWJnqdk8QItorxJdcJLGhQ9mIiC X-Received: by 2002:a05:6402:b33:b0:51d:d3d4:d02d with SMTP id bo19-20020a0564020b3300b0051dd3d4d02dmr57623edb.5.1689110417649; Tue, 11 Jul 2023 14:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689110417; cv=none; d=google.com; s=arc-20160816; b=JKX8+aqhi1ZoeEmjgra2VvLTMOBYr9eBBweXN1o06jxLnKCs8LRHf1dzdtkkRd54qJ QEVkbIbfNr0jcxdC3FVK2CpoDZ9i5IPRZ6IRWkwwiiW0s0ZIeIcgkj9XfdGt9pQQTcOM b8wwOCx2YzqCuBVcH0uvwbqVRO6wrjt1NGtAw0jYilGjovGXlLw+H/n4HrRRQWlhHRQb hAqutHpU0+KonsbfQ4pYuTIdKk2Oj8njQ5uVqI33uihjXbo75Ob2/bW5ofg7pacUK5YG 3L4ZqakaFAyKc94HggKZ5J0F2Zk4wRIv5Za4wteJgyXUA0bsTEaeL4TP42K9c8YLl4Tk 553Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=z5Org0XpBGDi2A4lYjtKCOeW94WAZj1UFCLgLMxBOmM=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=mC0XgKWJP9y8BQt9X9LKLXFlv5IMTGlom/pnGBTpsHYubmWTLJbjp7uNTVqxkoTZAk Z9ZQd/VNKHm+O3xvDoIuniUNeE7c3m97Oyn1vQ3lsmnyqD2FR1Jj945GsXNHReu5uiBT +gSlkrirdFivQSFaNs3ZyXfXOhiP9mtEl9zAjTreH+A+fqLwdpOZWl3jDud8k9e8xhh9 mtAwwkSnJ/1L71T++NyIUQZ53JAqVR+jia97dTM/f+yJ8wrs+OOlo6j9FtU9tBB/hUV2 rwDCVhgL/XG5rkEugwIWcZ/mMW6wnfl1IYKNpfYSpGEgNIKOhV4S38/T4e995hwpgGJ7 SI/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j14-20020aa7c40e000000b0051df648a32esi2811917edq.61.2023.07.11.14.20.17; Tue, 11 Jul 2023 14:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7BED068C34E; Wed, 12 Jul 2023 00:19:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: IeDXkrggrvYL 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); }