From d30508ac43b871ced38360fbecbfe68130f4adf2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 10 Oct 2015 19:44:39 -0700 Subject: [PATCH] Buildfix for Symbian/Blackberry/etc. --- Core/HLE/sceAtrac.cpp | 8 ++++++++ Core/HW/SimpleAudioDec.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index b39b27a0fa..870a6904e6 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -307,8 +307,16 @@ struct Atrac { // All of these allow null pointers. av_freep(&pFrame); swr_free(&pSwrCtx); +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 52, 0) // If necessary, extradata is automatically freed. avcodec_free_context(&pCodecCtx); +#else + // Future versions may add other things to free, but avcodec_free_context didn't exist yet here. + avcodec_close(pCodecCtx); + av_freep(&pCodecCtx->extradata); + av_freep(&pCodecCtx->subtitle_header); + av_freep(&pCodecCtx); +#endif av_free_packet(packet); delete packet; packet = nullptr; diff --git a/Core/HW/SimpleAudioDec.cpp b/Core/HW/SimpleAudioDec.cpp index 4dc0a9591f..f8074f0e99 100644 --- a/Core/HW/SimpleAudioDec.cpp +++ b/Core/HW/SimpleAudioDec.cpp @@ -133,7 +133,15 @@ SimpleAudio::~SimpleAudio() { #ifdef USE_FFMPEG swr_free(&swrCtx_); av_frame_free(&frame_); +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 52, 0) avcodec_free_context(&codecCtx_); +#else + // Future versions may add other things to free, but avcodec_free_context didn't exist yet here. + avcodec_close(codecCtx_); + av_freep(&codecCtx_->extradata); + av_freep(&codecCtx_->subtitle_header); + av_freep(&codecCtx_); +#endif codec_ = 0; #endif // USE_FFMPEG }