Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 11/12] avradio/sdr: Pass AVStream instead of int to demodulate
Date: Tue, 11 Jul 2023 23:19:09 +0200
Message-ID: <20230711211910.1257355-11-michael@niedermayer.cc> (raw)
In-Reply-To: <20230711211910.1257355-1-michael@niedermayer.cc>

thats less errror prone and simpler

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 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".

  parent reply	other threads:[~2023-07-11 21:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 21:18 [FFmpeg-devel] [PATCH 01/12] avradio/sdrdemux: Fix use of uninitialized memory Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 02/12] avradio/rds: Implement burst error decoder Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 03/12] avradio/rds: Keep track of program_id Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 04/12] avradio/sdr: Move rds_ring to Station Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 05/12] avradio/rds: move phase 2 window to main context Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 06/12] avradio/sdr: Warnings cleanup Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 07/12] avradio/rds: warnings cleanup Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 08/12] avradio/sdr: Move IFFT and block size to main context Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 09/12] avradio/sdr: Move per stream arraies " Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 10/12] avradio/sdr: Move tx contexts out of stream so its not duplicated Michael Niedermayer
2023-07-11 21:19 ` Michael Niedermayer [this message]
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 12/12] avradio/sdr: Process RDS of all stations not just the current one Michael Niedermayer
2023-07-12 23:26 ` [FFmpeg-devel] [PATCH 01/12] avradio/sdrdemux: Fix use of uninitialized memory Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230711211910.1257355-11-michael@niedermayer.cc \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git