Rebase against 0fe562b4ae3f66f9c0e29ab8f27a4abf2ac78501.

This commit is contained in:
Alistair Leslie-Hughes 2022-12-03 14:30:04 +11:00
parent ab806dce36
commit cc4bced66e
4 changed files with 12 additions and 199 deletions

View File

@ -1,4 +1,4 @@
From bd90f10550e2de898517d0a41b94f76f23fc9601 Mon Sep 17 00:00:00 2001
From e1c18d8fda84e300fc6ae2b90bf3770c4f2bb2c7 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Fri, 19 Mar 2021 17:01:54 -0400
Subject: [PATCH] winegstreamer: Report streams backwards in media source.
@ -9,18 +9,18 @@ Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 43beb71838a..d39b01b8578 100644
index 542189b28f5..a9e97f545dd 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -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++)
{
@@ -1496,7 +1496,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
DWORD len;
char *str;
- IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[i]);
+ IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[object->stream_count - 1 - i]);
}
if (FAILED(hr = MFCreatePresentationDescriptor(object->stream_count, descriptors, &object->pres_desc)))
for (j = 0; j < ARRAY_SIZE(tags); ++j)
{
--
2.37.2
2.38.1

View File

@ -1,185 +0,0 @@
From bdf230e4b3fedad3cf63d612dbc57e68fd33094a Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Thu, 18 Mar 2021 15:25:17 -0400
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 | 31 +++++++++++++++++++++++++++++++
5 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index c33a89afd5b..21aef431039 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -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);
+bool wg_parser_stream_get_language(struct wg_parser_stream *stream, char *buffer, uint32_t size);
/* start_pos and stop_pos are in 100-nanosecond units. */
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 2efa3bd26ac..2b9f10e7b37 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -271,6 +271,18 @@ uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream)
return params.duration;
}
+bool wg_parser_stream_get_language(struct wg_parser_stream *stream, char *buffer, uint32_t size)
+{
+ struct wg_parser_stream_get_language_params params =
+ {
+ .stream = stream,
+ .buffer = buffer,
+ .size = size,
+ };
+
+ return !__wine_unix_call(__wine_unixlib_handle, unix_wg_parser_stream_get_language, &params);
+}
+
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/media_source.c b/dlls/winegstreamer/media_source.c
index 042c635ae93..7c58dce5e27 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -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++)
{
- IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[object->stream_count - 1 - i]);
+ IMFStreamDescriptor **descriptor = &descriptors[object->stream_count - 1 - i];
+ char language[128];
+ DWORD language_len;
+ WCHAR *languageW;
+
+ IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, descriptor);
+
+ if (wg_parser_stream_get_language(object->streams[i]->wg_stream, language, sizeof(language)))
+ {
+ if ((language_len = MultiByteToWideChar(CP_UTF8, 0, language, -1, NULL, 0)))
+ {
+ languageW = malloc(language_len * sizeof(WCHAR));
+ if (MultiByteToWideChar(CP_UTF8, 0, language, -1, languageW, language_len))
+ {
+ IMFStreamDescriptor_SetString(*descriptor, &MF_SD_LANGUAGE, languageW);
+ }
+ free(languageW);
+ }
+ }
}
if (FAILED(hr = MFCreatePresentationDescriptor(object->stream_count, descriptors, &object->pres_desc)))
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h
index 9c53ecbfbc3..0c0fec0e966 100644
--- a/dlls/winegstreamer/unixlib.h
+++ b/dlls/winegstreamer/unixlib.h
@@ -249,6 +249,13 @@ struct wg_parser_stream_get_duration_params
UINT64 duration;
};
+struct wg_parser_stream_get_language_params
+{
+ struct wg_parser_stream *stream;
+ char *buffer;
+ UINT32 size;
+};
+
struct wg_parser_stream_seek_params
{
struct wg_parser_stream *stream;
@@ -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_transform_create,
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 6ec8e1bdbd8..6fa712dd1fb 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -109,6 +109,7 @@ struct wg_parser_stream
bool flushing, eos, enabled, has_caps;
uint64_t duration;
+ gchar *language_code;
};
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;
}
+static NTSTATUS wg_parser_stream_get_language(void *args)
+{
+ struct wg_parser_stream_get_language_params *params = args;
+ if (params->stream->language_code)
+ lstrcpynA(params->buffer, params->stream->language_code, params->size);
+ return params->stream->language_code ? S_OK : E_FAIL;
+}
+
static NTSTATUS wg_parser_stream_seek(void *args)
{
GstSeekType start_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET;
@@ -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);
+ if (stream->language_code)
+ g_free(stream->language_code);
+
free(stream);
}
@@ -1187,6 +1199,22 @@ static gboolean src_event_cb(GstPad *pad, GstObject *parent, GstEvent *event)
return ret;
}
+static gchar *query_language(GstPad *pad)
+{
+ GstTagList *tag_list;
+ GstEvent *tag_event;
+ gchar *ret = NULL;
+
+ if ((tag_event = gst_pad_get_sticky_event(pad, GST_EVENT_TAG, 0)))
+ {
+ gst_event_parse_tag(tag_event, &tag_list);
+ gst_tag_list_get_string(tag_list, "language-code", &ret);
+ gst_event_unref(tag_event);
+ }
+
+ return ret;
+}
+
static NTSTATUS wg_parser_connect(void *args)
{
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);
@@ -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_transform_create),
--
2.37.2

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4febd9d880abe22e77a3d8283de245a691cf2b7f"
echo "0fe562b4ae3f66f9c0e29ab8f27a4abf2ac78501"
}
# Show version information
@ -1962,15 +1962,13 @@ fi
# | * [#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
# | * dlls/winegstreamer/media_source.c, 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

View File

@ -1 +1 @@
4febd9d880abe22e77a3d8283de245a691cf2b7f
0fe562b4ae3f66f9c0e29ab8f27a4abf2ac78501