ports/emulators/ppsspp/files/patch-ffmpeg5
Jan Beich e316451d37 emulators/ppsspp: unbreak on DragonFly after deb6e280f4
In file included from Core/HLE/sceAudiocodec.cpp:25:
Core/HW/SimpleAudioDec.h:26:1: error: 'const' can only be specified for objects and functions
 const struct AVCodec;
 ^~~~~

Reported by:	DPorts
2023-05-25 08:14:26 +00:00

105 lines
3.3 KiB
Text

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
@@ -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_;