mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
mfplat-streaming-support: Remove more hacks.
These are not going in the right direction, and accordingly we don't want them in wine-staging.
This commit is contained in:
parent
c61fed05c0
commit
d6a9c88bf3
@ -1,95 +0,0 @@
|
||||
From 6317747d6b4ec2e94d92bd5f1dd4b73710cf02c4 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Tue, 20 Oct 2020 17:03:24 -0500
|
||||
Subject: [PATCH 09/88] HACK: winegstreamer: Use capssetter to ignore
|
||||
non-default YUV color spaces.
|
||||
|
||||
---
|
||||
dlls/winegstreamer/wg_parser.c | 53 ++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 51 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
|
||||
index 5f3b4375b4c..b93b2c182ae 100644
|
||||
--- a/dlls/winegstreamer/wg_parser.c
|
||||
+++ b/dlls/winegstreamer/wg_parser.c
|
||||
@@ -1176,7 +1176,53 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user)
|
||||
|
||||
if (!strcmp(name, "video/x-raw"))
|
||||
{
|
||||
- GstElement *deinterlace, *vconv, *flip, *vconv2;
|
||||
+ GstElement *capssetter, *deinterlace, *vconv, *flip, *vconv2;
|
||||
+
|
||||
+ /* Hack?: Flatten down the colorimetry to default values, without
|
||||
+ * actually modifying the video at all.
|
||||
+ *
|
||||
+ * We want to do color matrix conversions when converting from YUV to
|
||||
+ * RGB or vice versa. We do *not* want to do color matrix conversions
|
||||
+ * when converting YUV <-> YUV or RGB <-> RGB, because these are slow
|
||||
+ * (it essentially means always using the slow path, never going through
|
||||
+ * liborc). However, we have two videoconvert elements, and it's
|
||||
+ * basically impossible to know what conversions each is going to do
|
||||
+ * until caps are negotiated (without depending on some implementation
|
||||
+ * details, and even then it'snot exactly trivial). And setting
|
||||
+ * matrix-mode after caps are negotiated has no effect.
|
||||
+ *
|
||||
+ * Nor can we just retain colorimetry information the way we retain
|
||||
+ * other caps values, because videoconvert automatically clears it if
|
||||
+ * not doing passthrough. I think that this would only happen if we have
|
||||
+ * to do a double conversion, but that is possible. Not likely, but I
|
||||
+ * don't want to have to be the one to find out that there's still a
|
||||
+ * game broken.
|
||||
+ *
|
||||
+ * [Note that we'd actually kind of like to retain colorimetry
|
||||
+ * information, just in case it does ever become relevant to pass that
|
||||
+ * on to the next DirectShow filter. Hence I think the correct solution
|
||||
+ * for upstream is to get videoconvert to Not Do That.]
|
||||
+ *
|
||||
+ * So as a fallback solution, we force an identity transformation of
|
||||
+ * the caps to those with a "default" color matrix—i.e. transform the
|
||||
+ * caps, but not the data. We do this by *pre*pending a capssetter to
|
||||
+ * the front of the chain, and we remove the matrix-mode setting for the
|
||||
+ * videoconvert elements.
|
||||
+ */
|
||||
+ if (!(capssetter = gst_element_factory_make("capssetter", NULL)))
|
||||
+ {
|
||||
+ GST_ERROR("Failed to create capssetter, are %u-bit GStreamer \"good\" plugins installed?\n",
|
||||
+ 8 * (int)sizeof(void *));
|
||||
+ goto out;
|
||||
+ }
|
||||
+ gst_util_set_object_arg(G_OBJECT(capssetter), "join", "true");
|
||||
+ /* Actually, this is invalid, but it causes videoconvert to use default
|
||||
+ * colorimetry as a result. Yes, this is depending on undocumented
|
||||
+ * implementation details. It's a hack.
|
||||
+ *
|
||||
+ * Sadly there doesn't seem to be a way to get capssetter to clear
|
||||
+ * certain fields while leaving others untouched. */
|
||||
+ gst_util_set_object_arg(G_OBJECT(capssetter), "caps", "video/x-raw,colorimetry=0:0:0:0");
|
||||
|
||||
/* DirectShow can express interlaced video, but downstream filters can't
|
||||
* necessarily consume it. In particular, the video renderer can't. */
|
||||
@@ -1202,6 +1248,8 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user)
|
||||
goto out;
|
||||
|
||||
/* The bin takes ownership of these elements. */
|
||||
+ gst_bin_add(GST_BIN(parser->container), capssetter);
|
||||
+ gst_element_sync_state_with_parent(capssetter);
|
||||
gst_bin_add(GST_BIN(parser->container), deinterlace);
|
||||
gst_element_sync_state_with_parent(deinterlace);
|
||||
gst_bin_add(GST_BIN(parser->container), vconv);
|
||||
@@ -1211,11 +1259,12 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user)
|
||||
gst_bin_add(GST_BIN(parser->container), vconv2);
|
||||
gst_element_sync_state_with_parent(vconv2);
|
||||
|
||||
+ gst_element_link(capssetter, deinterlace);
|
||||
gst_element_link(deinterlace, vconv);
|
||||
gst_element_link(vconv, flip);
|
||||
gst_element_link(flip, vconv2);
|
||||
|
||||
- stream->post_sink = gst_element_get_static_pad(deinterlace, "sink");
|
||||
+ stream->post_sink = gst_element_get_static_pad(capssetter, "sink");
|
||||
stream->post_src = gst_element_get_static_pad(vconv2, "src");
|
||||
stream->flip = flip;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,34 +0,0 @@
|
||||
From aaa59bf183211a525221252672fdfc7be6de01e6 Mon Sep 17 00:00:00 2001
|
||||
From: Derek Lesho <dlesho@codeweavers.com>
|
||||
Date: Thu, 18 Mar 2021 16:54:44 -0400
|
||||
Subject: [PATCH 11/88] mfplat: Stub out MFCreateDXGIDeviceManager, to avoid
|
||||
the d3d path.
|
||||
|
||||
---
|
||||
dlls/mfplat/main.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
|
||||
index 72ce560c772..ba2f46693a8 100644
|
||||
--- a/dlls/mfplat/main.c
|
||||
+++ b/dlls/mfplat/main.c
|
||||
@@ -9246,9 +9246,16 @@ static const IMFDXGIDeviceManagerVtbl dxgi_device_manager_vtbl =
|
||||
HRESULT WINAPI MFCreateDXGIDeviceManager(UINT *token, IMFDXGIDeviceManager **manager)
|
||||
{
|
||||
struct dxgi_device_manager *object;
|
||||
+ const char *do_not_create = getenv("PROTON_DO_NOT_CREATE_DXGI_DEVICE_MANAGER");
|
||||
|
||||
TRACE("%p, %p.\n", token, manager);
|
||||
|
||||
+ if (do_not_create && do_not_create[0] != '\0')
|
||||
+ {
|
||||
+ FIXME("stubbing out\n");
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+
|
||||
if (!token || !manager)
|
||||
return E_POINTER;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,106 +0,0 @@
|
||||
From 292b80383163c9537733b47c27c6f2144edb18b5 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:32 +0100
|
||||
Subject: [PATCH 82/88] HACK: winegstreamer: Fake H264 timestamps if framerate
|
||||
cannot be trusted.
|
||||
|
||||
Fixes MK11 video framerate.
|
||||
|
||||
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 | 12 ++++++++++++
|
||||
dlls/winegstreamer/wg_transform.c | 10 ++++++++--
|
||||
2 files changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c
|
||||
index 66ecfad84de..ba6e681890b 100644
|
||||
--- a/dlls/winegstreamer/h264_decoder.c
|
||||
+++ b/dlls/winegstreamer/h264_decoder.c
|
||||
@@ -52,6 +52,7 @@ struct h264_decoder
|
||||
|
||||
struct wg_transform *wg_transform;
|
||||
struct wg_format wg_format;
|
||||
+ ULONGLONG last_pts;
|
||||
};
|
||||
|
||||
static struct h264_decoder *impl_from_IMFTransform(IMFTransform *iface)
|
||||
@@ -75,6 +76,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
|
||||
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
|
||||
return MF_E_INVALIDMEDIATYPE;
|
||||
|
||||
+ decoder->last_pts = 0;
|
||||
decoder->wg_transform = wg_transform_create(&input_format, &output_format);
|
||||
if (decoder->wg_transform)
|
||||
return S_OK;
|
||||
@@ -567,6 +569,7 @@ static HRESULT WINAPI h264_decoder_ProcessOutput(IMFTransform *iface, DWORD flag
|
||||
IMFMediaType *media_type;
|
||||
UINT32 align, offset;
|
||||
DWORD buffer_size;
|
||||
+ UINT64 framerate;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, flags %#lx, count %lu, samples %p, status %p.\n", iface, flags, count, samples, status);
|
||||
@@ -603,6 +606,15 @@ static HRESULT WINAPI h264_decoder_ProcessOutput(IMFTransform *iface, DWORD flag
|
||||
hr = MF_E_BUFFERTOOSMALL;
|
||||
else if (SUCCEEDED(hr = wg_transform_read_data(decoder->wg_transform, &wg_sample)))
|
||||
{
|
||||
+ if (!(wg_sample.flags & (WG_SAMPLE_FLAG_HAS_PTS|WG_SAMPLE_FLAG_HAS_DURATION)))
|
||||
+ {
|
||||
+ IMFMediaType_GetUINT64(decoder->output_type, &MF_MT_FRAME_RATE, &framerate);
|
||||
+ wg_sample.pts = decoder->last_pts;
|
||||
+ wg_sample.duration = (UINT64)10000000 * (UINT32)framerate / (framerate >> 32);
|
||||
+ wg_sample.flags |= (WG_SAMPLE_FLAG_HAS_PTS|WG_SAMPLE_FLAG_HAS_DURATION);
|
||||
+ decoder->last_pts += wg_sample.duration;
|
||||
+ }
|
||||
+
|
||||
if (wg_sample.flags & WG_SAMPLE_FLAG_HAS_PTS)
|
||||
IMFSample_SetSampleTime(samples[0].pSample, wg_sample.pts);
|
||||
if (wg_sample.flags & WG_SAMPLE_FLAG_HAS_DURATION)
|
||||
diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
|
||||
index e3b7d8ed056..1c9dc6f72bb 100644
|
||||
--- a/dlls/winegstreamer/wg_transform.c
|
||||
+++ b/dlls/winegstreamer/wg_transform.c
|
||||
@@ -522,6 +522,7 @@ NTSTATUS wg_transform_read_data(void *args)
|
||||
struct wg_sample *read_sample = params->sample;
|
||||
struct wg_transform_sample *transform_sample;
|
||||
struct wg_format buffer_format;
|
||||
+ bool broken_timestamp = false;
|
||||
GstBuffer *buffer;
|
||||
struct list *head;
|
||||
GstMapInfo info;
|
||||
@@ -549,6 +550,11 @@ NTSTATUS wg_transform_read_data(void *args)
|
||||
pthread_mutex_unlock(&transform->mutex);
|
||||
return MF_E_TRANSFORM_STREAM_CHANGE;
|
||||
}
|
||||
+
|
||||
+ if (buffer_format.major_type == WG_MAJOR_TYPE_VIDEO
|
||||
+ && buffer_format.u.video.fps_n <= 1
|
||||
+ && buffer_format.u.video.fps_d <= 1)
|
||||
+ broken_timestamp = true;
|
||||
}
|
||||
|
||||
gst_buffer_map(buffer, &info, GST_MAP_READ);
|
||||
@@ -557,12 +563,12 @@ NTSTATUS wg_transform_read_data(void *args)
|
||||
memcpy(read_sample->data, info.data, read_sample->size);
|
||||
gst_buffer_unmap(buffer, &info);
|
||||
|
||||
- if (buffer->pts != GST_CLOCK_TIME_NONE)
|
||||
+ if (buffer->pts != GST_CLOCK_TIME_NONE && !broken_timestamp)
|
||||
{
|
||||
read_sample->flags |= WG_SAMPLE_FLAG_HAS_PTS;
|
||||
read_sample->pts = buffer->pts / 100;
|
||||
}
|
||||
- if (buffer->duration != GST_CLOCK_TIME_NONE)
|
||||
+ if (buffer->duration != GST_CLOCK_TIME_NONE && !broken_timestamp)
|
||||
{
|
||||
read_sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION;
|
||||
read_sample->duration = buffer->duration / 100;
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 04d3388c51df8a235c8267af1f4fa9087b0cd210 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <zfigura@codeweavers.com>
|
||||
Date: Thu, 28 Oct 2021 17:46:32 -0500
|
||||
Subject: [PATCH 87/88] winegstreamer: Use unlimited buffering for the WM
|
||||
reader objects.
|
||||
|
||||
---
|
||||
dlls/winegstreamer/wm_reader.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c
|
||||
index 569560d054e..baf764ca9fb 100644
|
||||
--- a/dlls/winegstreamer/wm_reader.c
|
||||
+++ b/dlls/winegstreamer/wm_reader.c
|
||||
@@ -1455,7 +1455,7 @@ static HRESULT init_stream(struct wm_reader *reader, QWORD file_size)
|
||||
HRESULT hr;
|
||||
WORD i;
|
||||
|
||||
- if (!(wg_parser = wg_parser_create(WG_PARSER_DECODEBIN, false)))
|
||||
+ if (!(wg_parser = wg_parser_create(WG_PARSER_DECODEBIN, true)))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
reader->wg_parser = wg_parser;
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 308a46c504a4efa2eb866709055739325236be5b Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <zfigura@codeweavers.com>
|
||||
Date: Thu, 28 Oct 2021 17:47:48 -0500
|
||||
Subject: [PATCH 88/88] HACK: winegstreamer: Report streams in reverse order
|
||||
for wmvcore.
|
||||
|
||||
---
|
||||
dlls/winegstreamer/wm_reader.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c
|
||||
index baf764ca9fb..ff3dfcd5d2c 100644
|
||||
--- a/dlls/winegstreamer/wm_reader.c
|
||||
+++ b/dlls/winegstreamer/wm_reader.c
|
||||
@@ -1484,7 +1484,7 @@ static HRESULT init_stream(struct wm_reader *reader, QWORD file_size)
|
||||
{
|
||||
struct wm_stream *stream = &reader->streams[i];
|
||||
|
||||
- stream->wg_stream = wg_parser_get_stream(reader->wg_parser, i);
|
||||
+ stream->wg_stream = wg_parser_get_stream(reader->wg_parser, reader->stream_count - i - 1);
|
||||
stream->reader = reader;
|
||||
stream->index = i;
|
||||
stream->selection = WMT_ON;
|
||||
--
|
||||
2.34.1
|
||||
|
Loading…
Reference in New Issue
Block a user