Commit d1c5bb95 authored by Max Kellermann's avatar Max Kellermann

decoder/ffmpeg: move code to IsAudio()

parent 70986bc1
...@@ -77,12 +77,18 @@ ffmpeg_init(gcc_unused const config_param &param) ...@@ -77,12 +77,18 @@ ffmpeg_init(gcc_unused const config_param &param)
} }
gcc_pure gcc_pure
static bool
IsAudio(const AVStream &stream)
{
return stream.codec->codec_type == AVMEDIA_TYPE_AUDIO;
}
gcc_pure
static int static int
ffmpeg_find_audio_stream(const AVFormatContext &format_context) ffmpeg_find_audio_stream(const AVFormatContext &format_context)
{ {
for (unsigned i = 0; i < format_context.nb_streams; ++i) for (unsigned i = 0; i < format_context.nb_streams; ++i)
if (format_context.streams[i]->codec->codec_type == if (IsAudio(*format_context.streams[i]))
AVMEDIA_TYPE_AUDIO)
return i; return i;
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment