Mercurial > libavformat.hg
diff utils.c @ 3423:613aff547655 libavformat
Ensure the first audio stream is selected as the default stream
when no video stream is present.
author | aurel |
---|---|
date | Tue, 03 Jun 2008 15:19:43 +0000 |
parents | 1e1c7967ba6c |
children | 670052821b9f |
line wrap: on
line diff
--- a/utils.c Tue Jun 03 15:14:21 2008 +0000 +++ b/utils.c Tue Jun 03 15:19:43 2008 +0000 @@ -1004,6 +1004,7 @@ int av_find_default_stream_index(AVFormatContext *s) { + int first_audio_index = -1; int i; AVStream *st; @@ -1014,8 +1015,10 @@ 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; } /**