Saturday, May 01, 2021

Unbreak ppsspp-1.10.3 with ffmpeg-4.4

Antoine pointed out that the ffmpeg-4.4v1 breaks ppsspp. There is a
patch which merge the ffmpeg bits from upstream.

bin/PPSSPPSDL starts fine, could someone confirm that it works?

Rafael

Index: patches/patch-Core_HW_MediaEngine_cpp
===================================================================
RCS file: patches/patch-Core_HW_MediaEngine_cpp
diff -N patches/patch-Core_HW_MediaEngine_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Core_HW_MediaEngine_cpp 1 May 2021 19:55:06 -0000
@@ -0,0 +1,225 @@
+$OpenBSD$
+
+Fix build with ffmpeg-4.4 from upstream
+
+Index: Core/HW/MediaEngine.cpp
+--- Core/HW/MediaEngine.cpp.orig
++++ Core/HW/MediaEngine.cpp
+@@ -131,6 +131,7 @@ MediaEngine::MediaEngine(): m_pdata(0) {
+ m_videoStream = -1;
+ m_audioStream = -1;
+
++ m_expectedVideoStreams = 0;
+ m_desWidth = 0;
+ m_desHeight = 0;
+ m_decodingsize = 0;
+@@ -186,6 +187,11 @@ void MediaEngine::DoState(PointerWrap &p) {
+ } else {
+ m_mpegheaderReadPos = m_mpegheaderSize;
+ }
++ if (s >= 6) {
++ p.Do(m_expectedVideoStreams);
++ } else {
++ m_expectedVideoStreams = 0;
++ }
+
+ p.Do(m_ringbuffersize);
+
+@@ -257,21 +263,21 @@ bool MediaEngine::SetupStreams() {
+ }
+
+ // Looking good. Let's add those streams.
+- const AVCodec *h264_codec = avcodec_find_decoder(AV_CODEC_ID_H264);
++ int videoStreamNum = -1;
+ for (int i = 0; i < numStreams; i++) {
+ const u8 *const currentStreamAddr = m_mpegheader + 0x82 + i * 16;
+ int streamId = currentStreamAddr[0];
+
+ // We only set video streams. We demux the audio stream separately.
+ if ((streamId & PSMF_VIDEO_STREAM_ID) == PSMF_VIDEO_STREAM_ID) {
+- AVStream *stream = avformat_new_stream(m_pFormatCtx, h264_codec);
+- stream->id = 0x00000100 | streamId;
+- stream->request_probe = 0;
+- stream->need_parsing = AVSTREAM_PARSE_FULL;
+- // We could set the width here, but we don't need to.
++ ++videoStreamNum;
++ addVideoStream(videoStreamNum, streamId);
+ }
+ }
+-
++ // Add the streams to meet the expectation.
++ for (int i = videoStreamNum + 1; i < m_expectedVideoStreams; i++) {
++ addVideoStream(i);
++ }
+

No comments:

Post a Comment