[FFmpeg-cvslog] Fix av_find_best_stream when using a program

Balint Marton git
Wed Feb 16 23:18:32 CET 2011


ffmpeg | branch: master | Balint Marton <cus at passwd.hu> | Wed Feb 16 00:17:13 2011 +0000| [33af787d8a892b51b7386a051f0cc0174c7e34ea] | committer: Michael Niedermayer

Fix av_find_best_stream when using a program

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.

Signed-off-by: Mans Rullgard <mans at mansr.com>
(cherry picked from commit 22ec6b738f1608e4b959fb655cf37c3343ec7e9f)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33af787d8a892b51b7386a051f0cc0174c7e34ea
---

 libavformat/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2827930..73f26b3 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;




More information about the ffmpeg-cvslog mailing list