diff --git a/NEWS b/NEWS index 5470a208c..88ee88970 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ver 0.19.18 (not yet released) * decoder - ffmpeg: fix crash with older FFmpeg versions (< 3.0) - ffmpeg: log detailed error message + - ffmpeg: support FFmpeg 3.1 ver 0.19.17 (2016/07/09) * decoder diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index ad6657a2d..92ac764e8 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -76,6 +76,24 @@ ffmpeg_init(gcc_unused const config_param ¶m) return true; } +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 5, 0) + +gcc_pure +static const AVCodecParameters & +GetCodecParameters(const AVStream &stream) +{ + return *stream.codecpar; +} + +gcc_pure +static AVSampleFormat +GetSampleFormat(const AVCodecParameters &codec_params) +{ + return AVSampleFormat(codec_params.format); +} + +#else + gcc_pure static const AVCodecContext & GetCodecParameters(const AVStream &stream) @@ -90,6 +108,8 @@ GetSampleFormat(const AVCodecContext &codec_context) return codec_context.sample_fmt; } +#endif + gcc_pure static bool IsAudio(const AVStream &stream)