On 07/02/18 12:14, Josh de Kock wrote:
> ---
>  fftools/cmdutils.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> index 0b06ccc71a..8bb9952016 100644
> --- a/fftools/cmdutils.c
> +++ b/fftools/cmdutils.c
> @@ -1424,11 +1424,14 @@ static char get_media_type_char(enum AVMediaType type)
>  static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec 
> *prev,
>                                          int encoder)
>  {
> +    const AVCodec *next = NULL;
>      void *i = 0;
> -    while ((prev = av_codec_iterate(&i))) {
> -        if (prev->id == id &&
> -            (encoder ? av_codec_is_encoder(prev) : 
> av_codec_is_decoder(prev)))
> -            return prev;
> +
> +    while ((next = av_codec_iterate(&i))) {
> +        if (next->id == id &&
> +            (!prev || (strcmp(next->name, prev->name) > 0)) &&
> +            (encoder ? av_codec_is_encoder(next) : 
> av_codec_is_decoder(next)))
> +            return next;
>      }
>      return NULL;
>  }
> 

This is wrong - the strcmp() will skip over matching codecs found later which 
have names earlier in the alphabet.  For example, for H.264 once you've found 
"libx264" (which is first) you skip over all of the "h264_foo" codecs which 
should be found after it after it because 'h' < 'l'.

- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to