[FFmpeg-devel] [PATCH 1/2] ffmpeg: skip disabled streams
Michael Niedermayer
michael at niedermayer.cc
Wed Jan 2 23:54:36 EET 2019
On Mon, Dec 31, 2018 at 10:33:37AM +0530, Gyan wrote:
>
> On 31-12-2018 06:50 AM, Michael Niedermayer wrote:
> >On Sat, Dec 29, 2018 at 04:39:18PM +0530, Gyan wrote:
> >>At Michael's suggestion, earlier patch broken into two. This one stops
> >>discarded streams from being processed. A few more checks added.
> >>
> >>Gyan
> >>
> >[...]
> >>diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> >>index d4851a2cd8..4ee7dbbe01 100644
> >>--- a/fftools/ffmpeg_opt.c
> >>+++ b/fftools/ffmpeg_opt.c
> >>@@ -268,7 +268,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
> >> {
> >> OptionsContext *o = optctx;
> >> StreamMap *m = NULL;
> >>- int i, negative = 0, file_idx;
> >>+ int i, negative = 0, file_idx, disabled;
> >> int sync_file_idx = -1, sync_stream_idx = 0;
> >> char *p, *sync;
> >> char *map;
> >>@@ -303,6 +303,11 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
> >> "match any streams.\n", arg);
> >> exit_program(1);
> >> }
> >>+ if (input_streams[input_files[sync_file_idx]->ist_index + sync_stream_idx]->user_set_discard == AVDISCARD_ALL) {
> >>+ av_log(NULL, AV_LOG_FATAL, "Sync stream specification in map %s matches a disabled input "
> >>+ "stream.\n", arg);
> >>+ exit_program(1);
> >>+ }
> >> }
> >>@@ -339,6 +344,10 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
> >> if (check_stream_specifier(input_files[file_idx]->ctx, input_files[file_idx]->ctx->streams[i],
> >> *p == ':' ? p + 1 : p) <= 0)
> >> continue;
> >>+ if (input_streams[input_files[file_idx]->ist_index + i]->user_set_discard == AVDISCARD_ALL) {
> >>+ disabled = 1;
> >>+ continue;
> >>+ }
> >> GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
> >> m = &o->stream_maps[o->nb_stream_maps - 1];
> >>@@ -358,6 +367,10 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
> >> if (!m) {
> >> if (allow_unused) {
> >> av_log(NULL, AV_LOG_VERBOSE, "Stream map '%s' matches no streams; ignoring.\n", arg);
> >>+ } else if (disabled) {
> >disabled is set to 1 and otherwise is uninitialized, this doesnt look intended
>
> Revised.
>
> ffmpeg_filter.c | 7 +++++++
> ffmpeg_opt.c | 31 +++++++++++++++++++++++++++++--
> 2 files changed, 36 insertions(+), 2 deletions(-)
> 433387cfb362b3c52c8af2c0872ce10121a62622 v2-0001-ffmpeg-skip-disabled-streams.patch
> From b6a32a981d8bd0d77b7607a2ca61989e5bbc79cc Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <ffmpeg at gyani.pro>
> Date: Sat, 29 Dec 2018 16:17:05 +0530
> Subject: [PATCH v2 1/2] ffmpeg: skip disabled streams
>
> Fully discarded streams can't be selected for output or mapped or filtered.
> Previously, a few packets from such streams, probably buffered for
> stream probing, would get smuggled into output files.
will apply
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190102/adf2043b/attachment.sig>
More information about the ffmpeg-devel
mailing list