From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 04/12] fftools/ffmpeg: move InputStream.discard to private data Date: Wed, 13 Dec 2023 20:29:59 +0100 Message-ID: <20231213193007.17471-4-anton@khirnov.net> (raw) In-Reply-To: <20231213193007.17471-1-anton@khirnov.net> It is not used outside of ffmpeg_demux. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_demux.c | 23 +++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 63e72e4fbc..0bab44cefc 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -339,7 +339,6 @@ typedef struct InputStream { int index; AVStream *st; - int discard; /* true if stream data should be discarded */ int user_set_discard; int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */ #define DECODING_FOR_OST 1 diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 61fb856106..9779580819 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -63,6 +63,9 @@ typedef struct DemuxStream { double ts_scale; + /* true if stream data should be discarded */ + int discard; + // scheduler returned EOF for this stream int finished; @@ -136,7 +139,8 @@ static Demuxer *demuxer_from_ifile(InputFile *f) InputStream *ist_find_unused(enum AVMediaType type) { for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) { - if (ist->par->codec_type == type && ist->discard && + DemuxStream *ds = ds_from_ist(ist); + if (ist->par->codec_type == type && ds->discard && ist->user_set_discard != AVDISCARD_ALL) return ist; } @@ -556,11 +560,14 @@ static void discard_unused_programs(InputFile *ifile) AVProgram *p = ifile->ctx->programs[j]; int discard = AVDISCARD_ALL; - for (int k = 0; k < p->nb_stream_indexes; k++) - if (!ifile->streams[p->stream_index[k]]->discard) { + for (int k = 0; k < p->nb_stream_indexes; k++) { + DemuxStream *ds = ds_from_ist(ifile->streams[p->stream_index[k]]); + + if (!ds->discard) { discard = AVDISCARD_DEFAULT; break; } + } p->discard = discard; } } @@ -637,7 +644,7 @@ static void *input_thread(void *arg) dynamically in stream : we ignore them */ ds = pkt->stream_index < f->nb_streams ? ds_from_ist(f->streams[pkt->stream_index]) : NULL; - if (!ds || ds->ist.discard || ds->finished) { + if (!ds || ds->discard || ds->finished) { report_new_stream(d, pkt); av_packet_unref(pkt); continue; @@ -689,7 +696,7 @@ static void demux_final_stats(Demuxer *d) DemuxStream *ds = ds_from_ist(ist); enum AVMediaType type = ist->par->codec_type; - if (ist->discard || type == AVMEDIA_TYPE_ATTACHMENT) + if (ds->discard || type == AVMEDIA_TYPE_ATTACHMENT) continue; total_size += ds->data_size; @@ -777,8 +784,8 @@ static int ist_use(InputStream *ist, int decoding_needed) ds->sch_idx_stream = ret; } - if (ist->discard) { - ist->discard = 0; + if (ds->discard) { + ds->discard = 0; d->nb_streams_used++; } @@ -1024,7 +1031,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) ist = &ds->ist; - ist->discard = 1; + ds->discard = 1; st->discard = AVDISCARD_ALL; ds->first_dts = AV_NOPTS_VALUE; ds->next_dts = AV_NOPTS_VALUE; -- 2.42.0 _______________________________________________ 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".
next prev parent reply other threads:[~2023-12-13 19:30 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-13 19:29 [FFmpeg-devel] [PATCH 01/12] fftools/ffmpeg_filter: move FilterGraph.graph to FilterGraphThread Anton Khirnov 2023-12-13 19:29 ` [FFmpeg-devel] [PATCH 02/12] fftools/ffmpeg: replace InputStream.file_index by a pointer Anton Khirnov 2023-12-13 19:29 ` [FFmpeg-devel] [PATCH 03/12] fftools/ffmpeg: replace OutputStream.file_index " Anton Khirnov 2023-12-14 19:20 ` Michael Niedermayer 2023-12-14 19:34 ` Anton Khirnov 2023-12-14 19:53 ` James Almer 2023-12-13 19:29 ` Anton Khirnov [this message] 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 05/12] fftools/ffmpeg: move InputStream.codec_desc to private data Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 06/12] fftools/ffmpeg: drop unused InputFile.eof_reached Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 07/12] fftools/ffmpeg_demux: move InputFile.readrate to private data Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 08/12] fftools/ffmpeg_mux: move OutputStream.sq_idx_mux " Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 09/12] fftools/ffmpeg: drop OutputFile.sq_encode Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 10/12] fftools/ffmpeg_sched: move trailing_dts() higher up Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 11/12] fftools/ffmpeg: update the reported timestamp at the end Anton Khirnov 2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 12/12] fftools/ffmpeg_sched: track dts+duration as last_dts Anton Khirnov
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=20231213193007.17471-4-anton@khirnov.net \ --to=anton@khirnov.net \ --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