diff --git a/av/src/AudioDecoder.cc b/av/src/AudioDecoder.cc index a1f7b29c..a9969484 100644 --- a/av/src/AudioDecoder.cc +++ b/av/src/AudioDecoder.cc @@ -52,7 +52,13 @@ common::AudioDecoder::Implementation::~Implementation() { // Close the codec if (this->codecCtx) + { +#if LIBAVFORMAT_VERSION_MAJOR < 59 avcodec_close(this->codecCtx); +#else + avcodec_free_context(&this->codecCtx); +#endif + } // Close the audio file if (this->formatCtx) diff --git a/av/src/Video.cc b/av/src/Video.cc index 4958b85e..75376ae5 100644 --- a/av/src/Video.cc +++ b/av/src/Video.cc @@ -114,7 +114,11 @@ void Video::Cleanup() avformat_close_input(&this->dataPtr->formatCtx); // Close the codec +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101) + avcodec_free_context(&this->dataPtr->codecCtx); +#else avcodec_close(this->dataPtr->codecCtx); +#endif av_free(this->dataPtr->avFrameDst); }