aboutsummaryrefslogtreecommitdiff
path: root/emulators/ppsspp/files/patch-ffmpeg5
blob: 2c74a66afe6e2e8acdcd14684f0f429135d20a02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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-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
 
@@ -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;
 			}
 
+#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_;