decoder/ffmpeg: use AVCodecParameters on FFmpeg 3.1

The AVCodecContext attribute is deprecated.
This commit is contained in:
Max Kellermann 2016-07-27 15:06:42 +02:00
parent 8412d94d05
commit a3d020eff9
2 changed files with 21 additions and 0 deletions

1
NEWS
View File

@ -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

View File

@ -76,6 +76,24 @@ ffmpeg_init(gcc_unused const config_param &param)
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)