mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
mfplat-streaming-support: Remove patch 0080.
Per private correspondence with Rémi, this is correctly implemented upstream in a different way, on the wg_transform side.
This commit is contained in:
parent
129ce257fd
commit
7e2f1d392c
@ -1,112 +0,0 @@
|
||||
From db138323808ecd9938a0f40b810ad68fc39b389c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 10 Feb 2022 09:58:20 +0100
|
||||
Subject: [PATCH 80/88] winegstreamer: Fixup H264 decoder NV12 plane alignment.
|
||||
|
||||
To match what native does. Many games that use the H264 decoder directly
|
||||
rely on this as they hardcode various aspects of the alignment in their
|
||||
logic (and each game a different one).
|
||||
|
||||
Note: There may be a way to have it done by GStreamer, as libav natively
|
||||
decode H264 into aligned planes, but somehow and somewhere in the chain
|
||||
the planes are re-aligned.
|
||||
|
||||
Hard Reset Redux crashes if MF_MT_MINIMUM_DISPLAY_APERTURE attribute is
|
||||
set (and it doesn't need it as its videos are 720p).
|
||||
|
||||
For: Call of Duty III, Shadow Warrior 2.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
|
||||
CW-Bug-Id: #16839
|
||||
CW-Bug-Id: #18678
|
||||
CW-Bug-Id: #19362
|
||||
---
|
||||
dlls/winegstreamer/h264_decoder.c | 40 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c
|
||||
index 219790128da..66ecfad84de 100644
|
||||
--- a/dlls/winegstreamer/h264_decoder.c
|
||||
+++ b/dlls/winegstreamer/h264_decoder.c
|
||||
@@ -86,6 +86,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
|
||||
static HRESULT fill_output_media_type(IMFMediaType *media_type, IMFMediaType *default_type)
|
||||
{
|
||||
UINT32 value, width, height;
|
||||
+ MFVideoArea aperture = {0};
|
||||
UINT64 value64;
|
||||
GUID subtype;
|
||||
HRESULT hr;
|
||||
@@ -177,6 +178,17 @@ static HRESULT fill_output_media_type(IMFMediaType *media_type, IMFMediaType *de
|
||||
return hr;
|
||||
}
|
||||
|
||||
+ if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, NULL)))
|
||||
+ {
|
||||
+ if (default_type && SUCCEEDED(hr = IMFMediaType_GetBlob(default_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
||||
+ (BYTE *)&aperture, sizeof(aperture), NULL)))
|
||||
+ {
|
||||
+ if (FAILED(hr = IMFMediaType_SetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
||||
+ (BYTE *)&aperture, sizeof(aperture))))
|
||||
+ return hr;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -551,7 +563,9 @@ static HRESULT WINAPI h264_decoder_ProcessOutput(IMFTransform *iface, DWORD flag
|
||||
struct wg_sample wg_sample = {0};
|
||||
IMFMediaBuffer *media_buffer;
|
||||
MFT_OUTPUT_STREAM_INFO info;
|
||||
+ MFVideoArea aperture = {0};
|
||||
IMFMediaType *media_type;
|
||||
+ UINT32 align, offset;
|
||||
DWORD buffer_size;
|
||||
HRESULT hr;
|
||||
|
||||
@@ -593,6 +607,17 @@ static HRESULT WINAPI h264_decoder_ProcessOutput(IMFTransform *iface, DWORD flag
|
||||
IMFSample_SetSampleTime(samples[0].pSample, wg_sample.pts);
|
||||
if (wg_sample.flags & WG_SAMPLE_FLAG_HAS_DURATION)
|
||||
IMFSample_SetSampleDuration(samples[0].pSample, wg_sample.duration);
|
||||
+
|
||||
+ if (decoder->wg_format.u.video.format == WG_VIDEO_FORMAT_NV12 &&
|
||||
+ (align = decoder->wg_format.u.video.height & 15))
|
||||
+ {
|
||||
+ offset = decoder->wg_format.u.video.width * decoder->wg_format.u.video.height;
|
||||
+ align = (16 - align) * decoder->wg_format.u.video.width;
|
||||
+ memmove(wg_sample.data + offset + align, wg_sample.data + offset,
|
||||
+ wg_sample.size - offset);
|
||||
+ wg_sample.size += align;
|
||||
+ }
|
||||
+
|
||||
hr = IMFMediaBuffer_SetCurrentLength(media_buffer, wg_sample.size);
|
||||
}
|
||||
else if (hr == MF_E_TRANSFORM_STREAM_CHANGE)
|
||||
@@ -603,6 +628,21 @@ static HRESULT WINAPI h264_decoder_ProcessOutput(IMFTransform *iface, DWORD flag
|
||||
IMFMediaType_DeleteItem(decoder->output_type, &MF_MT_DEFAULT_STRIDE);
|
||||
fill_output_media_type(media_type, decoder->output_type);
|
||||
|
||||
+ if (decoder->wg_format.u.video.format == WG_VIDEO_FORMAT_NV12 &&
|
||||
+ (align = decoder->wg_format.u.video.height & 15))
|
||||
+ {
|
||||
+ aperture.Area.cx = decoder->wg_format.u.video.width;
|
||||
+ aperture.Area.cy = decoder->wg_format.u.video.height;
|
||||
+ IMFMediaType_SetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
||||
+ (BYTE *)&aperture, sizeof(aperture));
|
||||
+
|
||||
+ aperture.Area.cy += 16 - align;
|
||||
+ IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE,
|
||||
+ (UINT64)aperture.Area.cx << 32 | aperture.Area.cy);
|
||||
+ IMFMediaType_SetUINT32(media_type, &MF_MT_SAMPLE_SIZE,
|
||||
+ aperture.Area.cx * aperture.Area.cy * 3 / 2);
|
||||
+ }
|
||||
+
|
||||
IMFMediaType_Release(decoder->output_type);
|
||||
decoder->output_type = media_type;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
Loading…
Reference in New Issue
Block a user