aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
diff options
context:
space:
mode:
authorMary-nyan <mary@mary.zone>2022-11-02 09:26:50 +0100
committerGitHub <noreply@github.com>2022-11-02 09:26:50 +0100
commit7d8e198c33b7ad283db53315129209a2bd310f23 (patch)
treec5fb9e6ab0b5d6d16070d1881bcc923228eb265a /Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
parent3d98e1361b2f1c3993aa7f1e9b1ac49fc5b6e512 (diff)
fix: Support FFmpeg 5.1.x for decoding (#3816)1.1.336
For some reason FFmpeg 5.1.x reverted part of the changes made in 5.0.x on AVCodec. This fix decoding issues with it.
Diffstat (limited to 'Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs')
-rw-r--r--Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs b/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
index 8c2e94c3..572ceaaa 100644
--- a/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
+++ b/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
@@ -7,7 +7,9 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg
{
unsafe class FFmpegContext : IDisposable
{
- private readonly FFCodec.AVCodec_decode _decodeFrame;
+ private unsafe delegate int AVCodec_decode(AVCodecContext* avctx, void* outdata, int* got_frame_ptr, AVPacket* avpkt);
+
+ private readonly AVCodec_decode _decodeFrame;
private static readonly FFmpegApi.av_log_set_callback_callback _logFunc;
private readonly AVCodec* _codec;
private AVPacket* _packet;
@@ -53,17 +55,17 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg
// libavcodec 59.24 changed AvCodec to move its private API and also move the codec function to an union.
if (avCodecMajorVersion > 59 || (avCodecMajorVersion == 59 && avCodecMinorVersion > 24))
{
- _decodeFrame = Marshal.GetDelegateForFunctionPointer<FFCodec.AVCodec_decode>(((FFCodec*)_codec)->CodecCallback);
+ _decodeFrame = Marshal.GetDelegateForFunctionPointer<AVCodec_decode>(((FFCodec<AVCodec>*)_codec)->CodecCallback);
}
// libavcodec 59.x changed AvCodec private API layout.
else if (avCodecMajorVersion == 59)
{
- _decodeFrame = Marshal.GetDelegateForFunctionPointer<FFCodec.AVCodec_decode>(((FFCodecLegacy<AVCodec>*)_codec)->Decode);
+ _decodeFrame = Marshal.GetDelegateForFunctionPointer<AVCodec_decode>(((FFCodecLegacy<AVCodec501>*)_codec)->Decode);
}
// libavcodec 58.x and lower
else
{
- _decodeFrame = Marshal.GetDelegateForFunctionPointer<FFCodec.AVCodec_decode>(((FFCodecLegacy<AVCodecLegacy>*)_codec)->Decode);
+ _decodeFrame = Marshal.GetDelegateForFunctionPointer<AVCodec_decode>(((FFCodecLegacy<AVCodec>*)_codec)->Decode);
}
}