diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 566688de1..5b452de73 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -197,9 +197,14 @@ cDvbSubtitleConverter::cDvbSubtitleConverter(void) cDvbSubtitleConverter::~cDvbSubtitleConverter() { - if (avctx) { + if (avctx) + { +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 83, 100) avcodec_close(avctx); av_free(avctx); +#else + avcodec_free_context(&avctx); +#endif avctx = NULL; } delete bitmaps; diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 0d2d6ca76..40a41fa2f 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -218,6 +218,7 @@ void CFfmpegDec::DeInit(void) { #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 83, 100) avcodec_close(c); + avcodec_free_context(&c); #else avcodec_free_context(&c); #endif @@ -285,7 +286,12 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, SwrContext *swr = swr_alloc(); if (!swr) { mutex.lock(); +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 83, 100) avcodec_close(c); + avcodec_free_context(&c); +#else + avcodec_free_context(&c); +#endif mutex.unlock(); DeInit(); Status=DATA_ERR;