summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_demux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-05-07 18:14:46 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-15 13:32:01 +0200
commit9429624a76107020b5911f8307f366fed386b336 (patch)
tree93e3832b8aa73f265d543c83dc9786780a751ea6 /fftools/ffmpeg_demux.c
parentf9657b7443f674c159f305a6033b985d034d0f3b (diff)
downloadffmpeg-9429624a76107020b5911f8307f366fed386b336.tar.gz
fftools/ffmpeg: move discarding unused programs to ffmpeg_demux
This is a more appropriate place for this code.
Diffstat (limited to 'fftools/ffmpeg_demux.c')
-rw-r--r--fftools/ffmpeg_demux.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index aff80b1cd3..579dbcbe35 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -525,6 +525,21 @@ static void readrate_sleep(Demuxer *d)
}
}
+static void discard_unused_programs(InputFile *ifile)
+{
+ for (int j = 0; j < ifile->ctx->nb_programs; j++) {
+ 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) {
+ discard = AVDISCARD_DEFAULT;
+ break;
+ }
+ p->discard = discard;
+ }
+}
+
static void thread_set_name(InputFile *f)
{
char name[16];
@@ -548,6 +563,8 @@ static void *input_thread(void *arg)
thread_set_name(f);
+ discard_unused_programs(f);
+
d->wallclock_start = av_gettime_relative();
while (1) {