aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-06-03 15:19:43 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-06-03 15:19:43 +0000
commitca162a5004fcd2209b6ee1eeb92731cfe1142ca1 (patch)
tree49b767f4c89db97579489652ba0e65af410b0914 /libavformat/utils.c
parent401cdd519c16c738321b28e837aaddf9182602a2 (diff)
downloadffmpeg-ca162a5004fcd2209b6ee1eeb92731cfe1142ca1.tar.gz
Ensure the first audio stream is selected as the default stream
when no video stream is present. Originally committed as revision 13648 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 032ef2ceed..e7e3128a35 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1004,6 +1004,7 @@ static void flush_packet_queue(AVFormatContext *s)
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(AVFormatContext *s)
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;
}
/**