Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
Re: UPDATE: ppsspp - FFmpeg
To:
Brad Smith <brad@comstyle.com>
Cc:
bentley@openbsd.org, ports@openbsd.org
Date:
Sun, 10 Nov 2024 15:53:06 +0100

Download raw body.

Thread
On Sun Nov 10, 2024 at 12:42:30AM -0500, Brad Smith wrote:
> Here is a diff to fix ppsspp building with newer FFmpeg.
> 
> Builds with 4.4 and 6.1.
> 

Tested and committed, thanks. Lets move forward.

> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/emulators/ppsspp/Makefile,v
> retrieving revision 1.30
> diff -u -p -u -p -r1.30 Makefile
> --- Makefile	6 Nov 2024 09:19:15 -0000	1.30
> +++ Makefile	10 Nov 2024 05:35:51 -0000
> @@ -5,7 +5,7 @@ COMMENT =	Sony PlayStation Portable emul
>  
>  DISTNAME =	ppsspp-$V
>  V =		1.18.1
> -
> +REVISION =	0
>  SITES =		https://github.com/hrydgard/ppsspp/releases/download/v$V/
>  
>  EXTRACT_SUFX =	.tar.xz
> Index: patches/patch-Core_AVIDump_cpp
> ===================================================================
> RCS file: patches/patch-Core_AVIDump_cpp
> diff -N patches/patch-Core_AVIDump_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-Core_AVIDump_cpp	10 Nov 2024 05:35:51 -0000
> @@ -0,0 +1,14 @@
> +Build with newer FFmpeg
> +
> +Index: Core/AVIDump.cpp
> +--- Core/AVIDump.cpp.orig
> ++++ Core/AVIDump.cpp
> +@@ -93,7 +93,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();
> Index: patches/patch-Core_HLE_sceMpeg_cpp
> ===================================================================
> RCS file: patches/patch-Core_HLE_sceMpeg_cpp
> diff -N patches/patch-Core_HLE_sceMpeg_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-Core_HLE_sceMpeg_cpp	10 Nov 2024 05:35:51 -0000
> @@ -0,0 +1,14 @@
> +Build with newer FFmpeg
> +
> +Index: Core/HLE/sceMpeg.cpp
> +--- Core/HLE/sceMpeg.cpp.orig
> ++++ Core/HLE/sceMpeg.cpp
> +@@ -805,7 +805,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(Log::ME, "Can not find H264 codec, please update ffmpeg");
> + 		return false;
> 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	10 Nov 2024 05:35:51 -0000
> @@ -0,0 +1,32 @@
> +Build with newer FFmpeg
> +
> +Index: Core/HW/MediaEngine.cpp
> +--- Core/HW/MediaEngine.cpp.orig
> ++++ Core/HW/MediaEngine.cpp
> +@@ -416,7 +416,7 @@ bool MediaEngine::addVideoStream(int streamNum, int st
> + 		// no need to add an existing stream.
> + 		if ((u32)streamNum < m_pFormatCtx->nb_streams)
> + 			return true;
> +-		AVCodec *h264_codec = avcodec_find_decoder(AV_CODEC_ID_H264);
> ++		const AVCodec *h264_codec = avcodec_find_decoder(AV_CODEC_ID_H264);
> + 		if (!h264_codec)
> + 			return false;
> + 		AVStream *stream = avformat_new_stream(m_pFormatCtx, h264_codec);
> +@@ -439,7 +439,7 @@ bool MediaEngine::addVideoStream(int streamNum, int st
> + 			}
> + 
> + #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 16, 100)
> +-			AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);
> ++			const AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);
> + 			AVCodecContext *codecCtx = avcodec_alloc_context3(codec);
> + #else
> + 			AVCodecContext *codecCtx = stream->codec;
> +@@ -527,7 +527,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(Log::ME, "Could not find decoder for %d", (int)stream->codecpar->codec_id);
> + 			return false;
> Index: patches/patch-Core_HW_SimpleAudioDec_cpp
> ===================================================================
> RCS file: patches/patch-Core_HW_SimpleAudioDec_cpp
> diff -N patches/patch-Core_HW_SimpleAudioDec_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-Core_HW_SimpleAudioDec_cpp	10 Nov 2024 05:35:51 -0000
> @@ -0,0 +1,14 @@
> +Build with newer FFmpeg
> +
> +Index: Core/HW/SimpleAudioDec.cpp
> +--- Core/HW/SimpleAudioDec.cpp.orig
> ++++ Core/HW/SimpleAudioDec.cpp
> +@@ -118,7 +118,7 @@ class FFmpegAudioDecoder : public AudioDecoder { (priv
> + 	int channels_;
> + 
> + 	AVFrame *frame_ = nullptr;
> +-	AVCodec *codec_ = nullptr;
> ++	const AVCodec *codec_ = nullptr;
> + 	AVCodecContext  *codecCtx_ = nullptr;
> + 	SwrContext      *swrCtx_ = nullptr;
> + 
>