From 18ea1e7a9489bf811dd33b7652866015f6340432 Mon Sep 17 00:00:00 2001 From: aneejit1 Date: Fri, 20 May 2022 13:12:12 +0000 Subject: [PATCH] Fix problems for older ffmpeg versions Fix the following issues when building against older ffmpeg versions - the call to avcodec_free_context exceptions as avformat_close_input already performs cleanup of the AVCodecContext, so link the calling of avcodec_free_context in k3bffmpegwrapper.cpp to the version of libavformat in which codecpar appeared rather than when avcodec_free_context appeared. - avcodec_decode_audio4 was deprecated in libavcodec 57.106.100, not 57.12.100, so the version has been corrected. Signed-off-by: aneejit1 --- plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp index 4c4496b..983c808 100644 --- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp +++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp @@ -232,7 +232,7 @@ void K3bFFMpegFile::close() { d->packetData = NULL; if (d->codec) { -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 63, 100) +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100) ::avcodec_free_context(&d->audio_stream_ctx); #else ::avcodec_close(d->audio_stream_ctx); @@ -358,7 +358,7 @@ int K3bFFMpegFile::fillOutputBuffer() { } int gotFrame = 0; -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 106, 100) int len = avcodec_receive_frame(d->audio_stream_ctx, d->frame); if (len == 0) { gotFrame = 1;