# HG changeset patch # User aurel # Date 1212506383 0 # Node ID 613aff5476551047b3d0938936f880703b595641 # Parent 6ff296d8b28446e7ef8e6b6c0bca61fb2666581d Ensure the first audio stream is selected as the default stream when no video stream is present. diff -r 6ff296d8b284 -r 613aff547655 utils.c --- 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; } /**