[FFmpeg-devel] [PATCH 1/2] ffmpeg: skip disabled streams

Michael Niedermayer michael at niedermayer.cc
Mon Dec 31 03:20:49 EET 2018


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

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- 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/20181231/14f1f21a/attachment.sig>


More information about the ffmpeg-devel mailing list