File ppsspp-support_ffmpeg5.patch of Package ppsspp
diff --git a/Core/AVIDump.cpp b/Core/AVIDump.cpp
index 99c74af..a7d7207 100644
--- a/Core/AVIDump.cpp
+++ b/Core/AVIDump.cpp
@@ -91,7 +91,7 @@ bool AVIDump::Start(int w, int h)
bool AVIDump::CreateAVI() {
#ifdef USE_FFMPEG
- AVCodec *codec = nullptr;
+ const AVCodec *codec = nullptr;
// Use gameID_EmulatedTimestamp for filename
std::string discID = g_paramSFO.GetDiscID();
diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp
index bf16281..4b194b2 100644
--- a/Core/HLE/sceAtrac.cpp
+++ b/Core/HLE/sceAtrac.cpp
@@ -123,6 +123,7 @@ static const int atracDecodeDelay = 2300;
#ifdef USE_FFMPEG
extern "C" {
+#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswresample/swresample.h"
#include "libavutil/samplefmt.h"
diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp
index 2f8cb86..15b074c 100644
--- a/Core/HLE/sceMpeg.cpp
+++ b/Core/HLE/sceMpeg.cpp
@@ -108,6 +108,7 @@ static bool useRingbufferPutCallbackMulti = true;
#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;
diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp
index fa4b819..40356bb 100644
--- a/Core/HW/MediaEngine.cpp
+++ b/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
@@ -410,13 +414,19 @@ bool MediaEngine::addVideoStream(int streamNum, int streamId) {
#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;
}
+#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 force) {
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;
diff --git a/Core/HW/SimpleAudioDec.cpp b/Core/HW/SimpleAudioDec.cpp
index 8f250ab..dd8fa14 100644
--- a/Core/HW/SimpleAudioDec.cpp
+++ b/Core/HW/SimpleAudioDec.cpp
@@ -28,6 +28,7 @@
#ifdef USE_FFMPEG
extern "C" {
+#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswresample/swresample.h"
#include "libavutil/samplefmt.h"
diff --git a/Core/HW/SimpleAudioDec.h b/Core/HW/SimpleAudioDec.h
index ec792c9..c96715b 100644
--- a/Core/HW/SimpleAudioDec.h
+++ b/Core/HW/SimpleAudioDec.h
@@ -78,7 +78,7 @@ private:
int wanted_resample_freq; // wanted resampling rate/frequency
AVFrame *frame_;
- AVCodec *codec_;
+ const AVCodec *codec_;
AVCodecContext *codecCtx_;
SwrContext *swrCtx_;