git: 5b23aaf61ef5 - main - emulators/ppsspp: simplify ffmpeg >= 5 fix after 18fb7d59e952

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 01 May 2023 18:44:23 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5b23aaf61ef5ea6dcb30cefbaf0951f6b644dc8f

commit 5b23aaf61ef5ea6dcb30cefbaf0951f6b644dc8f
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-05-01 17:22:10 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-05-01 18:41:14 +0000

    emulators/ppsspp: simplify ffmpeg >= 5 fix after 18fb7d59e952
---
 emulators/ppsspp/files/patch-ffmpeg5 | 14 ++++++++++---
 emulators/ppsspp/files/patch-revert  | 40 ------------------------------------
 2 files changed, 11 insertions(+), 43 deletions(-)

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
@@ -40,7 +40,7 @@ https://github.com/hrydgard/ppsspp/issues/15308
  	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"
@@ -53,7 +53,7 @@ https://github.com/hrydgard/ppsspp/issues/15308
  }
  #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
@@ -65,7 +65,15 @@ https://github.com/hrydgard/ppsspp/issues/15308
  			// 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)
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<AVCodecContext *> m_codecsToClose;
- 	AVIOContext *m_pIOContext = nullptr;
- 	SwsContext *m_sws_ctx = nullptr;
- #endif