From f07f2873958cfb56abc7c322aafbcee58d7e9723 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 25 Oct 2022 13:31:09 +1100 Subject: [PATCH] Updated mfplat-streaming-support patchset Re-enabled. 0065 Disabled until it can properly be rebased. Patch 0055 - Helps some games which request ARB32 output but doesn't always draw well. --- ...er-Allow-videoconvert-to-parallelize.patch | 10 ++-- ...port-streams-backwards-in-media-sour.patch | 11 ++-- ...-the-default-configuration-select-on.patch | 12 ++-- ...date-offset-according-to-the-size-of.patch | 12 ++-- ...negstreamer-Implement-MF_SD_LANGUAGE.patch | 59 ++++++++++--------- ...d-MFVideoFormat_ARGB32-output-for-th.patch | 12 ++-- ...pport-XMAudio2-input-format-in-WMA-d.xxxx} | 0 patches/mfplat-streaming-support/definition | 1 - patches/patchinstall.sh | 22 +++++++ 9 files changed, 80 insertions(+), 59 deletions(-) rename patches/mfplat-streaming-support/{0065-winegstreamer-Support-XMAudio2-input-format-in-WMA-d.patch => 0065-winegstreamer-Support-XMAudio2-input-format-in-WMA-d.xxxx} (100%) diff --git a/patches/mfplat-streaming-support/0008-winegstreamer-Allow-videoconvert-to-parallelize.patch b/patches/mfplat-streaming-support/0008-winegstreamer-Allow-videoconvert-to-parallelize.patch index a89d3e9d..19362baa 100644 --- a/patches/mfplat-streaming-support/0008-winegstreamer-Allow-videoconvert-to-parallelize.patch +++ b/patches/mfplat-streaming-support/0008-winegstreamer-Allow-videoconvert-to-parallelize.patch @@ -1,7 +1,7 @@ -From 6e5861b34f4359129d0ebec199e2106db4b7be43 Mon Sep 17 00:00:00 2001 +From eba9e414d60a33dfde7e7b978fcdddbaf9bfe5b6 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 21 Oct 2020 16:03:21 -0500 -Subject: [PATCH 08/88] winegstreamer: Allow videoconvert to parallelize. +Subject: [PATCH] winegstreamer: Allow videoconvert to parallelize. Not sure if this should be called a hack. It's not the *best* solution to the problem, but it's not a wrong one either. @@ -11,10 +11,10 @@ Signed-off-by: Zebediah Figura 1 file changed, 3 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 0a6cf927187..5f3b4375b4c 100644 +index 0573c99858b..5df08dc5fd7 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -1189,6 +1189,9 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) +@@ -760,6 +760,9 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) if (!(vconv = create_element("videoconvert", "base"))) goto out; @@ -25,5 +25,5 @@ index 0a6cf927187..5f3b4375b4c 100644 if (!(flip = create_element("videoflip", "good"))) goto out; -- -2.34.1 +2.37.2 diff --git a/patches/mfplat-streaming-support/0025-winegstreamer-Report-streams-backwards-in-media-sour.patch b/patches/mfplat-streaming-support/0025-winegstreamer-Report-streams-backwards-in-media-sour.patch index ed95c67d..e9cb583c 100644 --- a/patches/mfplat-streaming-support/0025-winegstreamer-Report-streams-backwards-in-media-sour.patch +++ b/patches/mfplat-streaming-support/0025-winegstreamer-Report-streams-backwards-in-media-sour.patch @@ -1,8 +1,7 @@ -From 9986fba2a9fd7f37a9d27a0257c8b20f59c56d8f Mon Sep 17 00:00:00 2001 +From bd90f10550e2de898517d0a41b94f76f23fc9601 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 19 Mar 2021 17:01:54 -0400 -Subject: [PATCH 25/88] winegstreamer: Report streams backwards in media - source. +Subject: [PATCH] winegstreamer: Report streams backwards in media source. Signed-off-by: Derek Lesho --- @@ -10,10 +9,10 @@ Signed-off-by: Derek Lesho 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index bccbf888a4a..2ed31666cad 100644 +index 43beb71838a..d39b01b8578 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -1491,7 +1491,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ +@@ -1480,7 +1480,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ descriptors = malloc(object->stream_count * sizeof(IMFStreamDescriptor *)); for (i = 0; i < object->stream_count; i++) { @@ -23,5 +22,5 @@ index bccbf888a4a..2ed31666cad 100644 if (FAILED(hr = MFCreatePresentationDescriptor(object->stream_count, descriptors, &object->pres_desc))) -- -2.34.1 +2.37.2 diff --git a/patches/mfplat-streaming-support/0038-winegstreamer-In-the-default-configuration-select-on.patch b/patches/mfplat-streaming-support/0038-winegstreamer-In-the-default-configuration-select-on.patch index 11ff0ba2..f70ac614 100644 --- a/patches/mfplat-streaming-support/0038-winegstreamer-In-the-default-configuration-select-on.patch +++ b/patches/mfplat-streaming-support/0038-winegstreamer-In-the-default-configuration-select-on.patch @@ -1,7 +1,7 @@ -From 856636245cd3de1bc91d76146e18fef864ec7065 Mon Sep 17 00:00:00 2001 +From 1913dfb174c48d60d0b81aba3fb9f03b5cef78c2 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 4 Dec 2020 16:17:11 -0500 -Subject: [PATCH 38/88] winegstreamer: In the default configuration, select one +Subject: [PATCH] winegstreamer: In the default configuration, select one stream of each major type. --- @@ -9,10 +9,10 @@ Subject: [PATCH 38/88] winegstreamer: In the default configuration, select one 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 2ed31666cad..c97348cc2d6 100644 +index d39b01b8578..de6a2c2b232 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -1397,6 +1397,7 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = +@@ -1386,6 +1386,7 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_source **out_media_source) { @@ -20,7 +20,7 @@ index 2ed31666cad..c97348cc2d6 100644 IMFStreamDescriptor **descriptors = NULL; unsigned int stream_count = UINT_MAX; struct media_source *object; -@@ -1497,9 +1498,28 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ +@@ -1486,9 +1487,28 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ if (FAILED(hr = MFCreatePresentationDescriptor(object->stream_count, descriptors, &object->pres_desc))) goto fail; @@ -51,5 +51,5 @@ index 2ed31666cad..c97348cc2d6 100644 } free(descriptors); -- -2.34.1 +2.37.2 diff --git a/patches/mfplat-streaming-support/0043-winegstreamer-Update-offset-according-to-the-size-of.patch b/patches/mfplat-streaming-support/0043-winegstreamer-Update-offset-according-to-the-size-of.patch index 1eea1fe4..371bc8e3 100644 --- a/patches/mfplat-streaming-support/0043-winegstreamer-Update-offset-according-to-the-size-of.patch +++ b/patches/mfplat-streaming-support/0043-winegstreamer-Update-offset-according-to-the-size-of.patch @@ -1,18 +1,18 @@ -From 6c81e31b53f5b3f3fd798e3d3fb43f9a2df8fa5b Mon Sep 17 00:00:00 2001 +From 7649a8e89c0dff9ecba0314234bedb507c6ade87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 15 Dec 2021 11:51:33 +0100 -Subject: [PATCH 43/88] winegstreamer: Update offset according to the size of - the buffer read. +Subject: [PATCH] winegstreamer: Update offset according to the size of the + buffer read. --- dlls/winegstreamer/wg_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index a11fc8c4f68..42c727fbd0b 100644 +index 5df08dc5fd7..6ec8e1bdbd8 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -1642,7 +1642,7 @@ static void *push_data(void *arg) +@@ -998,7 +998,7 @@ static void *push_data(void *arg) break; } @@ -22,5 +22,5 @@ index a11fc8c4f68..42c727fbd0b 100644 buffer->duration = buffer->pts = -1; if ((ret = gst_pad_push(parser->my_src, buffer)) < 0) -- -2.34.1 +2.37.2 diff --git a/patches/mfplat-streaming-support/0050-winegstreamer-Implement-MF_SD_LANGUAGE.patch b/patches/mfplat-streaming-support/0050-winegstreamer-Implement-MF_SD_LANGUAGE.patch index 23a956d5..fbb46a17 100644 --- a/patches/mfplat-streaming-support/0050-winegstreamer-Implement-MF_SD_LANGUAGE.patch +++ b/patches/mfplat-streaming-support/0050-winegstreamer-Implement-MF_SD_LANGUAGE.patch @@ -1,21 +1,21 @@ -From 3d8fddbac3026e1eed86f718452f833ac2d6b5c6 Mon Sep 17 00:00:00 2001 +From bdf230e4b3fedad3cf63d612dbc57e68fd33094a Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Thu, 18 Mar 2021 15:25:17 -0400 -Subject: [PATCH 50/88] winegstreamer: Implement MF_SD_LANGUAGE. +Subject: [PATCH] winegstreamer: Implement MF_SD_LANGUAGE. --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 12 ++++++++++++ dlls/winegstreamer/media_source.c | 20 +++++++++++++++++++- dlls/winegstreamer/unixlib.h | 8 ++++++++ - dlls/winegstreamer/wg_parser.c | 30 ++++++++++++++++++++++++++++++ - 5 files changed, 70 insertions(+), 1 deletion(-) + dlls/winegstreamer/wg_parser.c | 31 +++++++++++++++++++++++++++++++ + 5 files changed, 71 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h -index 6e7c53782c8..49879fe416d 100644 +index c33a89afd5b..21aef431039 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h -@@ -94,6 +94,7 @@ void wg_parser_stream_notify_qos(struct wg_parser_stream *stream, +@@ -95,6 +95,7 @@ void wg_parser_stream_notify_qos(struct wg_parser_stream *stream, /* Returns the duration in 100-nanosecond units. */ uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream); @@ -24,10 +24,10 @@ index 6e7c53782c8..49879fe416d 100644 void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c -index 316becdbc97..a9a9c72136d 100644 +index 2efa3bd26ac..2b9f10e7b37 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c -@@ -253,6 +253,18 @@ uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream) +@@ -271,6 +271,18 @@ uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream) return params.duration; } @@ -47,10 +47,10 @@ index 316becdbc97..a9a9c72136d 100644 uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags) { diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index fd6479d9879..11040ac159a 100644 +index 042c635ae93..7c58dce5e27 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -1492,7 +1492,25 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ +@@ -1482,7 +1482,25 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ descriptors = malloc(object->stream_count * sizeof(IMFStreamDescriptor *)); for (i = 0; i < object->stream_count; i++) { @@ -78,10 +78,10 @@ index fd6479d9879..11040ac159a 100644 if (FAILED(hr = MFCreatePresentationDescriptor(object->stream_count, descriptors, &object->pres_desc))) diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h -index 17b5c606014..fdcecfc96d5 100644 +index 9c53ecbfbc3..0c0fec0e966 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h -@@ -254,6 +254,13 @@ struct wg_parser_stream_get_duration_params +@@ -249,6 +249,13 @@ struct wg_parser_stream_get_duration_params UINT64 duration; }; @@ -95,27 +95,27 @@ index 17b5c606014..fdcecfc96d5 100644 struct wg_parser_stream_seek_params { struct wg_parser_stream *stream; -@@ -290,6 +297,7 @@ enum unix_funcs +@@ -309,6 +316,7 @@ enum unix_funcs unix_wg_parser_stream_notify_qos, unix_wg_parser_stream_get_duration, + unix_wg_parser_stream_get_language, unix_wg_parser_stream_seek, - unix_wg_parser_stream_drain, + unix_wg_transform_create, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 06e07b874bf..dc655b275bd 100644 +index 6ec8e1bdbd8..6fa712dd1fb 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -110,6 +110,7 @@ struct wg_parser_stream +@@ -109,6 +109,7 @@ struct wg_parser_stream bool flushing, eos, enabled, has_caps; uint64_t duration; + gchar *language_code; }; - static enum wg_audio_format wg_audio_format_from_gst(GstAudioFormat format) -@@ -871,6 +872,14 @@ static NTSTATUS wg_parser_stream_get_duration(void *args) + static NTSTATUS wg_parser_get_stream_count(void *args) +@@ -350,6 +351,14 @@ static NTSTATUS wg_parser_stream_get_duration(void *args) return S_OK; } @@ -130,7 +130,7 @@ index 06e07b874bf..dc655b275bd 100644 static NTSTATUS wg_parser_stream_seek(void *args) { GstSeekType start_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET; -@@ -1321,6 +1330,9 @@ static void free_stream(struct wg_parser_stream *stream) +@@ -723,6 +732,9 @@ static void free_stream(struct wg_parser_stream *stream) pthread_cond_destroy(&stream->event_cond); pthread_cond_destroy(&stream->event_empty_cond); @@ -140,7 +140,7 @@ index 06e07b874bf..dc655b275bd 100644 free(stream); } -@@ -1931,6 +1943,22 @@ static gboolean src_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -1187,6 +1199,22 @@ static gboolean src_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) return ret; } @@ -160,25 +160,26 @@ index 06e07b874bf..dc655b275bd 100644 + return ret; +} + - static HRESULT wg_parser_connect_inner(struct wg_parser *parser) + static NTSTATUS wg_parser_connect(void *args) { - GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE("wine_src", -@@ -2066,6 +2094,7 @@ static NTSTATUS wg_parser_connect(void *args) - pthread_cond_wait(&parser->init_cond, &parser->mutex); - } - } + GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE("quartz_src", +@@ -1315,6 +1343,8 @@ static NTSTATUS wg_parser_connect(void *args) + * attempting to read anything), but we don't want to waste CPU time + * trying to decode them. */ + stream->enabled = true; ++ + stream->language_code = query_language(stream->their_src); } pthread_mutex_unlock(&parser->mutex); -@@ -2561,6 +2590,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = +@@ -1631,6 +1661,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_parser_stream_notify_qos), X(wg_parser_stream_get_duration), + X(wg_parser_stream_get_language), X(wg_parser_stream_seek), - X(wg_parser_stream_drain), + X(wg_transform_create), -- -2.34.1 +2.37.2 diff --git a/patches/mfplat-streaming-support/0055-winegstreamer-Add-MFVideoFormat_ARGB32-output-for-th.patch b/patches/mfplat-streaming-support/0055-winegstreamer-Add-MFVideoFormat_ARGB32-output-for-th.patch index a2a693bc..5337abaf 100644 --- a/patches/mfplat-streaming-support/0055-winegstreamer-Add-MFVideoFormat_ARGB32-output-for-th.patch +++ b/patches/mfplat-streaming-support/0055-winegstreamer-Add-MFVideoFormat_ARGB32-output-for-th.patch @@ -1,7 +1,7 @@ -From 5ebda711a9d8b5e3194464eab3fecf52ed3c8b59 Mon Sep 17 00:00:00 2001 +From 56ad22a46d27fdc5313aff459f6334bb0051e21a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 12 Jan 2022 22:48:35 +0300 -Subject: [PATCH 55/88] winegstreamer: Add MFVideoFormat_ARGB32 output for the +Subject: [PATCH] winegstreamer: Add MFVideoFormat_ARGB32 output for the source. (cherry picked from commit 9812591f0003c5c611faa59ab9b3cb73a85be637) @@ -12,10 +12,10 @@ CW-Bug-Id: #19975 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index e5f25eed63a..9d5a8b831b9 100644 +index de6a2c2b232..042c635ae93 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -873,7 +873,7 @@ static HRESULT new_media_stream(struct media_source *source, +@@ -855,7 +855,7 @@ static HRESULT new_media_stream(struct media_source *source, static HRESULT media_stream_init_desc(struct media_stream *stream) { IMFMediaTypeHandler *type_handler = NULL; @@ -24,7 +24,7 @@ index e5f25eed63a..9d5a8b831b9 100644 struct wg_format format; DWORD type_count = 0; unsigned int i; -@@ -892,6 +892,7 @@ static HRESULT media_stream_init_desc(struct media_stream *stream) +@@ -874,6 +874,7 @@ static HRESULT media_stream_init_desc(struct media_stream *stream) &MFVideoFormat_YUY2, &MFVideoFormat_IYUV, &MFVideoFormat_I420, @@ -33,5 +33,5 @@ index e5f25eed63a..9d5a8b831b9 100644 IMFMediaType *base_type = mf_media_type_from_wg_format(&format); -- -2.34.1 +2.37.2 diff --git a/patches/mfplat-streaming-support/0065-winegstreamer-Support-XMAudio2-input-format-in-WMA-d.patch b/patches/mfplat-streaming-support/0065-winegstreamer-Support-XMAudio2-input-format-in-WMA-d.xxxx similarity index 100% rename from patches/mfplat-streaming-support/0065-winegstreamer-Support-XMAudio2-input-format-in-WMA-d.patch rename to patches/mfplat-streaming-support/0065-winegstreamer-Support-XMAudio2-input-format-in-WMA-d.xxxx diff --git a/patches/mfplat-streaming-support/definition b/patches/mfplat-streaming-support/definition index e91efdc2..00ba0f55 100644 --- a/patches/mfplat-streaming-support/definition +++ b/patches/mfplat-streaming-support/definition @@ -1,2 +1 @@ Fixes: [49692] Multiple applications need a Media Foundation media source implementation -Disabled: True diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index aeb6c0cd..0a966ab5 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -122,6 +122,7 @@ patch_enable_all () enable_krnl386_exe16_GDT_LDT_Emulation="$1" enable_krnl386_exe16_Invalid_Console_Handles="$1" enable_loader_KeyboardLayouts="$1" + enable_mfplat_streaming_support="$1" enable_mmsystem_dll16_MIDIHDR_Refcount="$1" enable_mountmgr_DosDevices="$1" enable_mscoree_CorValidateImage="$1" @@ -382,6 +383,9 @@ patch_enable () loader-KeyboardLayouts) enable_loader_KeyboardLayouts="$2" ;; + mfplat-streaming-support) + enable_mfplat_streaming_support="$2" + ;; mmsystem.dll16-MIDIHDR_Refcount) enable_mmsystem_dll16_MIDIHDR_Refcount="$2" ;; @@ -1997,6 +2001,24 @@ if test "$enable_loader_KeyboardLayouts" -eq 1; then patch_apply loader-KeyboardLayouts/0002-user32-Improve-GetKeyboardLayoutList.patch fi +# Patchset mfplat-streaming-support +# | +# | This patchset fixes the following Wine bugs: +# | * [#49692] Multiple applications need a Media Foundation media source implementation +# | +# | Modified files: +# | * dlls/winegstreamer/gst_private.h, dlls/winegstreamer/main.c, dlls/winegstreamer/media_source.c, +# | dlls/winegstreamer/unixlib.h, dlls/winegstreamer/wg_parser.c +# | +if test "$enable_mfplat_streaming_support" -eq 1; then + patch_apply mfplat-streaming-support/0008-winegstreamer-Allow-videoconvert-to-parallelize.patch + patch_apply mfplat-streaming-support/0025-winegstreamer-Report-streams-backwards-in-media-sour.patch + patch_apply mfplat-streaming-support/0038-winegstreamer-In-the-default-configuration-select-on.patch + patch_apply mfplat-streaming-support/0043-winegstreamer-Update-offset-according-to-the-size-of.patch + patch_apply mfplat-streaming-support/0050-winegstreamer-Implement-MF_SD_LANGUAGE.patch + patch_apply mfplat-streaming-support/0055-winegstreamer-Add-MFVideoFormat_ARGB32-output-for-th.patch +fi + # Patchset mmsystem.dll16-MIDIHDR_Refcount # | # | This patchset fixes the following Wine bugs: