mfplat-streaming-support: Remove hacks for the Proton runtime environment.

Upstream Wine doesn't need these.
This commit is contained in:
Zebediah Figura 2022-09-03 14:58:31 -05:00
parent 4ecbce03f5
commit 55c3361918
5 changed files with 0 additions and 329 deletions

View File

@ -1,40 +0,0 @@
From 1fa010a636a2a30224ce07081d94bd3e6d9597c8 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Thu, 30 Jan 2020 10:16:19 -0600
Subject: [PATCH 01/88] winegstreamer: HACK: Use a different gst registry file
per architecture
---
dlls/winegstreamer/wg_parser.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 5a2e970a4dd..40c394c3caf 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -1556,6 +1556,22 @@ static void init_gstreamer_once(void)
int argc = ARRAY_SIZE(args) - 1;
char **argv = args;
GError *err;
+ const char *e;
+
+ if ((e = getenv("WINE_GST_REGISTRY_DIR")))
+ {
+ char gst_reg[PATH_MAX];
+#if defined(__x86_64__)
+ const char *arch = "/registry.x86_64.bin";
+#elif defined(__i386__)
+ const char *arch = "/registry.i386.bin";
+#else
+#error Bad arch
+#endif
+ strcpy(gst_reg, e);
+ strcat(gst_reg, arch);
+ setenv("GST_REGISTRY_1_0", gst_reg, 1);
+ }
if (!gst_init_check(&argc, &argv, &err))
{
--
2.34.1

View File

@ -1,60 +0,0 @@
From effc9dd4081fe44b67080b3cb73f51be21e0bd51 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 28 Jan 2020 14:30:43 -0600
Subject: [PATCH 02/88] winegstreamer: HACK: Try harder to register
winegstreamer filters.
---
dlls/quartz/filtergraph.c | 17 +++++++++++++++++
dlls/winegstreamer/main.c | 2 ++
2 files changed, 19 insertions(+)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 1849174cf97..55462244ea9 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -5600,11 +5600,28 @@ static const IUnknownVtbl IInner_VTable =
FilterGraphInner_Release
};
+static BOOL CALLBACK register_winegstreamer_proc(INIT_ONCE *once, void *param, void **ctx)
+{
+ HMODULE mod = LoadLibraryW(L"winegstreamer.dll");
+ if (mod)
+ {
+ HRESULT (WINAPI *proc)(void) = (void *)GetProcAddress(mod, "DllRegisterServer");
+ proc();
+ FreeLibrary(mod);
+ }
+ return TRUE;
+}
+
static HRESULT filter_graph_common_create(IUnknown *outer, IUnknown **out, BOOL threaded)
{
+ static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
struct filter_graph *object;
HRESULT hr;
+ /* HACK: our build system makes it difficult to load gstreamer on prefix
+ * creation, so it won't get registered. Do that here instead. */
+ InitOnceExecuteOnce(&once, register_winegstreamer_proc, NULL, NULL);
+
*out = NULL;
if (!(object = calloc(1, sizeof(*object))))
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
index f85e9995525..95b22abebb7 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -564,6 +564,8 @@ HRESULT WINAPI DllRegisterServer(void)
TRACE(".\n");
+ init_gstreamer();
+
if (FAILED(hr = __wine_register_resources()))
return hr;
--
2.34.1

View File

@ -1,50 +0,0 @@
From 3487366d10a749104ac47d0dda66ab54843a94a3 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Fri, 18 Dec 2020 14:08:04 -0600
Subject: [PATCH 03/88] mfplat: Register winegstreamer interfaces on load
See also "winegstreamer: HACK: Try harder to register winegstreamer
filters."
---
dlls/mfplat/main.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 7991152f7a7..72ce560c772 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -1583,6 +1583,18 @@ HRESULT WINAPI MFTGetInfo(CLSID clsid, WCHAR **name, MFT_REGISTER_TYPE_INFO **in
return hr;
}
+static BOOL CALLBACK register_winegstreamer_proc(INIT_ONCE *once, void *param, void **ctx)
+{
+ HMODULE mod = LoadLibraryW(L"winegstreamer.dll");
+ if (mod)
+ {
+ HRESULT (WINAPI *proc)(void) = (void *)GetProcAddress(mod, "DllRegisterServer");
+ proc();
+ FreeLibrary(mod);
+ }
+ return TRUE;
+}
+
/***********************************************************************
* MFStartup (mfplat.@)
*/
@@ -1590,9 +1602,12 @@ HRESULT WINAPI MFStartup(ULONG version, DWORD flags)
{
#define MF_VERSION_XP MAKELONG( MF_API_VERSION, 1 )
#define MF_VERSION_WIN7 MAKELONG( MF_API_VERSION, 2 )
+ static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
TRACE("%#lx, %#lx.\n", version, flags);
+ InitOnceExecuteOnce(&once, register_winegstreamer_proc, NULL, NULL);
+
if (version != MF_VERSION_XP && version != MF_VERSION_WIN7)
return MF_E_BAD_STARTUP_VERSION;
--
2.34.1

View File

@ -1,154 +0,0 @@
From 66297c1fc47704e3df28d8b199bdad62d66ed569 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Mon, 24 Jan 2022 00:46:03 -0500
Subject: [PATCH 85/88] winegstreamer: After failing to create decodebin
parser, try protonvideoconv.
---
dlls/winegstreamer/wg_parser.c | 69 +++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 1 deletion(-)
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 8e64735bd64..0b4e488bea6 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -91,6 +91,8 @@ struct wg_parser
bool unlimited_buffering;
struct wg_format input_format;
+
+ bool use_mediaconv;
};
struct wg_parser_stream
@@ -1019,6 +1021,34 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad,
return GST_AUTOPLUG_SELECT_TRY;
}
+static gint find_videoconv_cb(gconstpointer a, gconstpointer b)
+{
+ const GValue *val_a = a, *val_b = b;
+ GstElementFactory *factory_a = g_value_get_object(val_a), *factory_b = g_value_get_object(val_b);
+ const char *name_a = gst_element_factory_get_longname(factory_a), *name_b = gst_element_factory_get_longname(factory_b);
+
+ if (!strcmp(name_a, "Proton video converter"))
+ return -1;
+ if (!strcmp(name_b, "Proton video converter"))
+ return 1;
+ return 0;
+}
+
+static GValueArray *autoplug_sort_cb(GstElement *bin, GstPad *pad,
+ GstCaps *caps, GValueArray *factories, gpointer user)
+{
+ struct wg_parser *parser = user;
+ GValueArray *ret = g_value_array_copy(factories);
+
+ if (!parser->use_mediaconv)
+ return NULL;
+
+ GST_DEBUG("parser %p.", parser);
+
+ g_value_array_sort(ret, find_videoconv_cb);
+ return ret;
+}
+
static void no_more_pads_cb(GstElement *element, gpointer user)
{
struct wg_parser *parser = user;
@@ -1877,9 +1907,12 @@ static gboolean src_activate_mode_cb(GstPad *pad, GstObject *parent, GstPadMode
return FALSE;
}
+static BOOL decodebin_parser_init_gst(struct wg_parser *parser);
+
static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer user)
{
struct wg_parser *parser = user;
+ const GstStructure *structure;
gchar *dbg_info = NULL;
GError *err = NULL;
@@ -1914,6 +1947,21 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use
pthread_cond_signal(&parser->init_cond);
break;
+ case GST_MESSAGE_ELEMENT:
+ structure = gst_message_get_structure(msg);
+ if (gst_structure_has_name(structure, "missing-plugin"))
+ {
+ pthread_mutex_lock(&parser->mutex);
+ if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst)
+ {
+ GST_WARNING("Autoplugged element failed to initialise, trying again with protonvideoconvert.");
+ parser->error = true;
+ pthread_cond_signal(&parser->init_cond);
+ }
+ pthread_mutex_unlock(&parser->mutex);
+ }
+ break;
+
default:
break;
}
@@ -2052,6 +2100,7 @@ static NTSTATUS wg_parser_connect(void *args)
{
const struct wg_parser_connect_params *params = args;
struct wg_parser *parser = params->parser;
+ bool use_mediaconv = false;
unsigned int i;
HRESULT hr;
int ret;
@@ -2069,9 +2118,16 @@ static NTSTATUS wg_parser_connect(void *args)
if (!parser->pull_mode)
gst_pad_set_active(parser->my_src, 1);
ret = gst_element_get_state(parser->container, NULL, NULL, -1);
+
if (ret == GST_STATE_CHANGE_FAILURE)
{
- GST_ERROR("Failed to play stream.\n");
+ if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst && parser->pull_mode)
+ {
+ GST_WARNING("Failed to play media, trying again with protonvideoconvert.");
+ use_mediaconv = true;
+ }
+ else
+ GST_ERROR("Failed to play stream.\n");
goto out;
}
@@ -2081,6 +2137,8 @@ static NTSTATUS wg_parser_connect(void *args)
pthread_cond_wait(&parser->init_cond, &parser->mutex);
if (parser->error)
{
+ if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst)
+ use_mediaconv = true;
pthread_mutex_unlock(&parser->mutex);
goto out;
}
@@ -2189,6 +2247,14 @@ out:
pthread_mutex_unlock(&parser->mutex);
pthread_cond_signal(&parser->read_cond);
+ if (use_mediaconv)
+ {
+ parser->use_mediaconv = true;
+ hr = wg_parser_connect(args);
+ parser->use_mediaconv = false;
+ return hr;
+ }
+
return E_FAIL;
}
@@ -2303,6 +2369,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser)
g_signal_connect(element, "pad-added", G_CALLBACK(pad_added_cb), parser);
g_signal_connect(element, "pad-removed", G_CALLBACK(pad_removed_cb), parser);
g_signal_connect(element, "autoplug-select", G_CALLBACK(autoplug_select_cb), parser);
+ g_signal_connect(element, "autoplug-sort", G_CALLBACK(autoplug_sort_cb), parser);
g_signal_connect(element, "no-more-pads", G_CALLBACK(no_more_pads_cb), parser);
parser->their_sink = gst_element_get_static_pad(element, "sink");
--
2.34.1

View File

@ -1,25 +0,0 @@
From 550f10b3410363b4d2b15f2825dd25323181edb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 15 Feb 2022 10:51:42 +0100
Subject: [PATCH 86/88] fixup! winegstreamer: After failing to create decodebin
parser, try protonvideoconv.
---
dlls/winegstreamer/wg_parser.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 0b4e488bea6..9773ff176d2 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -30,6 +30,7 @@
#include <stdarg.h>
#include <stdio.h>
+#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_30
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/audio/audio.h>
--
2.34.1