[FFmpeg-cvslog] r13648 - trunk/libavformat/utils.c

aurel subversion
Tue Jun 3 17:19:43 CEST 2008


Author: aurel
Date: Tue Jun  3 17:19:43 2008
New Revision: 13648

Log:
Ensure the first audio stream is selected as the default stream
when no video stream is present.


Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Tue Jun  3 17:19:43 2008
@@ -1004,6 +1004,7 @@ static void flush_packet_queue(AVFormatC
 
 int av_find_default_stream_index(AVFormatContext *s)
 {
+    int first_audio_index = -1;
     int i;
     AVStream *st;
 
@@ -1014,8 +1015,10 @@ int av_find_default_stream_index(AVForma
         if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
             return i;
         }
+        if (first_audio_index < 0 && st->codec->codec_type == CODEC_TYPE_AUDIO)
+            first_audio_index = i;
     }
-    return 0;
+    return first_audio_index >= 0 ? first_audio_index : 0;
 }
 
 /**




More information about the ffmpeg-cvslog mailing list