decoder/ffmpeg: move code to IsAudio()
This commit is contained in:
parent
70986bc120
commit
d1c5bb956a
|
@ -76,13 +76,19 @@ ffmpeg_init(gcc_unused const config_param ¶m)
|
|||
return true;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
static bool
|
||||
IsAudio(const AVStream &stream)
|
||||
{
|
||||
return stream.codec->codec_type == AVMEDIA_TYPE_AUDIO;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
static int
|
||||
ffmpeg_find_audio_stream(const AVFormatContext &format_context)
|
||||
{
|
||||
for (unsigned i = 0; i < format_context.nb_streams; ++i)
|
||||
if (format_context.streams[i]->codec->codec_type ==
|
||||
AVMEDIA_TYPE_AUDIO)
|
||||
if (IsAudio(*format_context.streams[i]))
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue