mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
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
This commit is contained in:
parent
401cdd519c
commit
ca162a5004
@ -1004,6 +1004,7 @@ static void flush_packet_queue(AVFormatContext *s)
|
|||||||
|
|
||||||
int av_find_default_stream_index(AVFormatContext *s)
|
int av_find_default_stream_index(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
|
int first_audio_index = -1;
|
||||||
int i;
|
int i;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
|
||||||
@ -1014,8 +1015,10 @@ int av_find_default_stream_index(AVFormatContext *s)
|
|||||||
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
||||||
return i;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user