[FFmpeg-devel] [PATCH] Fix av_find_best_stream when using a program

Måns Rullgård mans
Wed Feb 16 12:54:29 CET 2011


Balint Marton <cus at passwd.hu> writes:

> Hi,
>
> The current implementation has a bug, it is returning the stream index
> in the found program, and not the stream index in the list of all
> streams. The attached patch fixes this issue.
>
> Regards,
>   Marton
>
> commit 37072d91f5f9976e703cfa926274f4143a5349ec
> Author: Marton Balint <cus at fazekas.hu>
> Date:   Wed Feb 16 00:57:56 2011 +0100
>
>     Fix av_find_best_stream when using programs
> ---
>  libavformat/utils.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 870a287..8862eab 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2529,7 +2529,7 @@ int av_find_best_stream(AVFormatContext *ic,
>          if (best_count >= st->codec_info_nb_frames)
>              continue;
>          best_count = st->codec_info_nb_frames;
> -        ret = i;
> +        ret = program ? program[i] : i;
>          best_decoder = decoder;
>          if (program && i == nb_streams - 1 && ret < 0) {
>              program = NULL;

Looks good.  Queued.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list