From a3d020eff9ee88f5f990dbf914c037e285cdba8e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 27 Jul 2016 15:06:42 +0200 Subject: decoder/ffmpeg: use AVCodecParameters on FFmpeg 3.1 The AVCodecContext attribute is deprecated. --- src/decoder/plugins/FfmpegDecoderPlugin.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/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) -- cgit v1.2.3