diff --git a/emulators/ppsspp/files/patch-ffmpeg5 b/emulators/ppsspp/files/patch-ffmpeg5 index 051628becfe7..2c74a66afe6e 100644 --- a/emulators/ppsspp/files/patch-ffmpeg5 +++ b/emulators/ppsspp/files/patch-ffmpeg5 @@ -1,106 +1,114 @@ https://github.com/hrydgard/ppsspp/issues/15308 --- Core/AVIDump.cpp.orig 2023-01-03 10:14:31 UTC +++ Core/AVIDump.cpp @@ -91,7 +91,7 @@ bool AVIDump::CreateAVI() { bool AVIDump::CreateAVI() { #ifdef USE_FFMPEG - AVCodec *codec = nullptr; + const AVCodec *codec = nullptr; // Use gameID_EmulatedTimestamp for filename std::string discID = g_paramSFO.GetDiscID(); --- Core/HLE/sceAtrac.cpp.orig 2023-01-03 10:14:31 UTC +++ Core/HLE/sceAtrac.cpp @@ -123,6 +123,7 @@ extern "C" { #ifdef USE_FFMPEG extern "C" { +#include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libswresample/swresample.h" #include "libavutil/samplefmt.h" --- Core/HLE/sceMpeg.cpp.orig 2023-01-03 10:14:31 UTC +++ Core/HLE/sceMpeg.cpp @@ -108,6 +108,7 @@ extern "C" { #ifdef USE_FFMPEG extern "C" { +#include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavutil/imgutils.h" #include "libswscale/swscale.h" @@ -801,7 +802,7 @@ static bool InitPmp(MpegContext * ctx){ pmp_want_pix_fmt = AV_PIX_FMT_RGBA; // Create H264 video codec - AVCodec * pmp_Codec = avcodec_find_decoder(AV_CODEC_ID_H264); + const AVCodec * pmp_Codec = avcodec_find_decoder(AV_CODEC_ID_H264); if (pmp_Codec == NULL){ ERROR_LOG(ME, "Can not find H264 codec, please update ffmpeg"); return false; ---- Core/HW/MediaEngine.cpp.orig 2023-01-03 10:14:31 UTC +--- Core/HW/MediaEngine.cpp.orig 2023-04-30 11:42:05 UTC +++ Core/HW/MediaEngine.cpp @@ -38,6 +38,10 @@ extern "C" { #include "libavutil/imgutils.h" #include "libswscale/swscale.h" +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 23, 100) + // private libavformat api (see demux.h in ffmpeg src tree) + void avpriv_stream_set_need_parsing(AVStream *st, enum AVStreamParseType type); +#endif } #endif // USE_FFMPEG -@@ -434,7 +438,11 @@ bool MediaEngine::addVideoStream(int streamNum, int st +@@ -410,13 +414,19 @@ bool MediaEngine::addVideoStream(int streamNum, int st #else stream->request_probe = 0; #endif +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 23, 100) + avpriv_stream_set_need_parsing(stream, AVSTREAM_PARSE_FULL); +#else stream->need_parsing = AVSTREAM_PARSE_FULL; +#endif // We could set the width here, but we don't need to. if (streamNum >= m_expectedVideoStreams) { ++m_expectedVideoStreams; -@@ -521,7 +529,7 @@ bool MediaEngine::setVideoStream(int streamNum, bool f + } + ++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 33, 100) + m_codecsToClose.push_back(stream->codec); ++#endif + return true; + } + } +@@ -499,7 +509,7 @@ bool MediaEngine::setVideoStream(int streamNum, bool f AVStream *stream = m_pFormatCtx->streams[streamNum]; #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100) - AVCodec *pCodec = avcodec_find_decoder(stream->codecpar->codec_id); + const AVCodec *pCodec = avcodec_find_decoder(stream->codecpar->codec_id); if (!pCodec) { WARN_LOG_REPORT(ME, "Could not find decoder for %d", (int)stream->codecpar->codec_id); return false; --- Core/HW/SimpleAudioDec.cpp.orig 2023-01-03 10:14:31 UTC +++ Core/HW/SimpleAudioDec.cpp @@ -28,6 +28,7 @@ extern "C" { #ifdef USE_FFMPEG extern "C" { +#include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libswresample/swresample.h" #include "libavutil/samplefmt.h" --- Core/HW/SimpleAudioDec.h.orig 2023-01-03 10:14:31 UTC +++ Core/HW/SimpleAudioDec.h @@ -23,7 +23,7 @@ struct AVFrame; #include "Core/HLE/sceAudio.h" struct AVFrame; -struct AVCodec; +const struct AVCodec; struct AVCodecContext; struct SwrContext; @@ -78,7 +78,7 @@ class SimpleAudio { (private) int wanted_resample_freq; // wanted resampling rate/frequency AVFrame *frame_; - AVCodec *codec_; + const AVCodec *codec_; AVCodecContext *codecCtx_; SwrContext *swrCtx_; diff --git a/emulators/ppsspp/files/patch-revert b/emulators/ppsspp/files/patch-revert deleted file mode 100644 index ec87d81bc36f..000000000000 --- a/emulators/ppsspp/files/patch-revert +++ /dev/null @@ -1,40 +0,0 @@ -Temporarily revert https://github.com/hrydgard/ppsspp/commit/94bab4506f2e -until files/patch-ffmpeg5 is adapted - -Core/HW/MediaEngine.cpp:427:38: error: no member named 'codec' in 'AVStream' - m_codecsToClose.push_back(stream->codec); - ~~~~~~ ^ - ---- Core/HW/MediaEngine.cpp.orig 2023-04-30 11:42:05 UTC -+++ Core/HW/MediaEngine.cpp -@@ -351,11 +351,6 @@ void MediaEngine::closeContext() - #endif - } - m_pCodecCtxs.clear(); -- // These are streams allocated from avformat_new_stream. -- for (auto it : m_codecsToClose) { -- avcodec_close(it); -- } -- m_codecsToClose.clear(); - if (m_pFormatCtx) - avformat_close_input(&m_pFormatCtx); - sws_freeContext(m_sws_ctx); -@@ -415,8 +410,6 @@ bool MediaEngine::addVideoStream(int streamNum, int streamId) { - if (streamNum >= m_expectedVideoStreams) { - ++m_expectedVideoStreams; - } -- -- m_codecsToClose.push_back(stream->codec); - return true; - } - } ---- Core/HW/MediaEngine.h.orig 2023-04-30 11:42:05 UTC -+++ Core/HW/MediaEngine.h -@@ -126,7 +126,6 @@ class MediaEngine - #ifdef USE_FFMPEG - // Video ffmpeg context - not used for audio - AVFormatContext *m_pFormatCtx = nullptr; -- std::vector m_codecsToClose; - AVIOContext *m_pIOContext = nullptr; - SwsContext *m_sws_ctx = nullptr; - #endif