Rebase against 93107c08f5aa7f37ad7ece9cd7ca248dba3030ce.

This commit is contained in:
Zebediah Figura 2020-10-26 18:36:59 -05:00
parent 534f6ae34e
commit 40dda2bf72
8 changed files with 4 additions and 352 deletions

View File

@ -1,174 +0,0 @@
From 2e4958801053b8318417b903334fd4c6be817e8e Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 25 Aug 2020 17:35:49 -0500
Subject: [PATCH] winegstreamer: Insert videoconvert into decoded-video
streams.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
---
dlls/winegstreamer/media_source.c | 125 ++++++++++++++++++++++++++----
1 file changed, 111 insertions(+), 14 deletions(-)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 5f3c43a0204..258b8c2dfb1 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -384,6 +384,43 @@ static const IMFMediaStreamVtbl media_stream_vtbl =
media_stream_RequestSample
};
+/* Setup a chain of elements which should hopefully allow transformations to any IMFMediaType
+ the user throws at us through gstreamer's caps negotiation. */
+static HRESULT media_stream_connect_to_sink(struct media_stream *stream)
+{
+ GstCaps *source_caps = gst_pad_query_caps(stream->their_src, NULL);
+ const gchar *stream_type;
+
+ if (!source_caps)
+ return E_FAIL;
+
+ stream_type = gst_structure_get_name(gst_caps_get_structure(source_caps, 0));
+ gst_caps_unref(source_caps);
+
+ if (!strcmp(stream_type, "video/x-raw"))
+ {
+ GstElement *videoconvert = gst_element_factory_make("videoconvert", NULL);
+
+ gst_bin_add(GST_BIN(stream->parent_source->container), videoconvert);
+
+ stream->my_sink = gst_element_get_static_pad(videoconvert, "sink");
+
+ if (!gst_element_link(videoconvert, stream->appsink))
+ return E_FAIL;
+
+ gst_element_sync_state_with_parent(videoconvert);
+ }
+ else
+ {
+ stream->my_sink = gst_element_get_static_pad(stream->appsink, "sink");
+ }
+
+ if (gst_pad_link(stream->their_src, stream->my_sink) != GST_PAD_LINK_OK)
+ return E_FAIL;
+
+ return S_OK;
+}
+
static HRESULT new_media_stream(struct media_source *source, GstPad *pad, DWORD stream_id, struct media_stream **out_stream)
{
struct media_stream *object = heap_alloc_zero(sizeof(*object));
@@ -414,8 +451,8 @@ static HRESULT new_media_stream(struct media_source *source, GstPad *pad, DWORD
g_object_set(object->appsink, "sync", FALSE, NULL);
g_object_set(object->appsink, "max-buffers", 5, NULL);
- object->my_sink = gst_element_get_static_pad(object->appsink, "sink");
- gst_pad_link(object->their_src, object->my_sink);
+ if (FAILED(hr = media_stream_connect_to_sink(object)))
+ goto fail;
gst_element_sync_state_with_parent(object->appsink);
@@ -435,28 +472,88 @@ static HRESULT media_stream_init_desc(struct media_stream *stream)
{
GstCaps *current_caps = gst_pad_get_current_caps(stream->their_src);
IMFMediaTypeHandler *type_handler;
+ IMFMediaType **stream_types = NULL;
IMFMediaType *stream_type = NULL;
+ DWORD type_count = 0;
+ const gchar *major_type;
+ unsigned int i;
HRESULT hr;
- stream_type = mf_media_type_from_caps(current_caps);
- gst_caps_unref(current_caps);
- if (!stream_type)
- return E_FAIL;
+ major_type = gst_structure_get_name(gst_caps_get_structure(current_caps, 0));
+
+ if (!strcmp(major_type, "video/x-raw"))
+ {
+ /* These are the most common native output types of decoders:
+ https://docs.microsoft.com/en-us/windows/win32/medfound/mft-decoder-expose-output-types-in-native-order */
+ static const GUID *const video_types[] =
+ {
+ &MFVideoFormat_NV12,
+ &MFVideoFormat_YV12,
+ &MFVideoFormat_YUY2,
+ &MFVideoFormat_IYUV,
+ &MFVideoFormat_I420,
+ };
- hr = MFCreateStreamDescriptor(stream->stream_id, 1, &stream_type, &stream->descriptor);
+ IMFMediaType *base_type = mf_media_type_from_caps(current_caps);
+ GUID base_subtype;
- IMFMediaType_Release(stream_type);
+ IMFMediaType_GetGUID(base_type, &MF_MT_SUBTYPE, &base_subtype);
- if (FAILED(hr))
- return hr;
+ stream_types = heap_alloc( sizeof(IMFMediaType *) * ARRAY_SIZE(video_types) + 1);
- if (FAILED(hr = IMFStreamDescriptor_GetMediaTypeHandler(stream->descriptor, &type_handler)))
- return hr;
+ stream_types[0] = base_type;
+ type_count = 1;
- hr = IMFMediaTypeHandler_SetCurrentMediaType(type_handler, stream_type);
+ for (i = 0; i < ARRAY_SIZE(video_types); i++)
+ {
+ IMFMediaType *new_type;
- IMFMediaTypeHandler_Release(type_handler);
+ if (IsEqualGUID(&base_subtype, video_types[i]))
+ continue;
+ if (FAILED(hr = MFCreateMediaType(&new_type)))
+ goto done;
+ stream_types[type_count++] = new_type;
+
+ if (FAILED(hr = IMFMediaType_CopyAllItems(base_type, (IMFAttributes *) new_type)))
+ goto done;
+ if (FAILED(hr = IMFMediaType_SetGUID(new_type, &MF_MT_SUBTYPE, video_types[i])))
+ goto done;
+ }
+ }
+ else
+ {
+ stream_type = mf_media_type_from_caps(current_caps);
+ if (stream_type)
+ {
+ stream_types = &stream_type;
+ type_count = 1;
+ }
+ }
+
+ if (!type_count)
+ {
+ ERR("Failed to establish an IMFMediaType from any of the possible stream caps!\n");
+ return E_FAIL;
+ }
+
+ if (FAILED(hr = MFCreateStreamDescriptor(stream->stream_id, type_count, stream_types, &stream->descriptor)))
+ goto done;
+
+ if (FAILED(hr = IMFStreamDescriptor_GetMediaTypeHandler(stream->descriptor, &type_handler)))
+ goto done;
+
+ if (FAILED(hr = IMFMediaTypeHandler_SetCurrentMediaType(type_handler, stream_types[0])))
+ goto done;
+
+done:
+ gst_caps_unref(current_caps);
+ if (type_handler)
+ IMFMediaTypeHandler_Release(type_handler);
+ for (i = 0; i < type_count; i++)
+ IMFMediaType_Release(stream_types[i]);
+ if (stream_types != &stream_type)
+ heap_free(stream_types);
return hr;
}
--
2.28.0

View File

@ -1,38 +0,0 @@
From d25d65e440a32d9a5f5d933084ff0d2d81c1427d Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 25 Aug 2020 17:37:28 -0500
Subject: [PATCH] winegstreamer: Insert audioconvert into decoded audio
streams.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
---
dlls/winegstreamer/media_source.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 258b8c2dfb1..d6c7837e544 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -410,6 +410,19 @@ static HRESULT media_stream_connect_to_sink(struct media_stream *stream)
gst_element_sync_state_with_parent(videoconvert);
}
+ else if (!strcmp(stream_type, "audio/x-raw"))
+ {
+ GstElement *audioconvert = gst_element_factory_make("audioconvert", NULL);
+
+ gst_bin_add(GST_BIN(stream->parent_source->container), audioconvert);
+
+ stream->my_sink = gst_element_get_static_pad(audioconvert, "sink");
+
+ if (!gst_element_link(audioconvert, stream->appsink))
+ return E_FAIL;
+
+ gst_element_sync_state_with_parent(audioconvert);
+ }
else
{
stream->my_sink = gst_element_get_static_pad(stream->appsink, "sink");
--
2.28.0

View File

@ -1 +1,2 @@
Fixes: [49692] mfplat: Improved support for multiple video formats.
Fixes: [49692] Multiple applications need a Media Foundation media source implementation
Disabled: true

View File

@ -1,2 +1 @@
Fixes: [49192] ntdll: NtQuerySystemInformation support SystemCodeIntegrityInformation
Depends: ntdll-SystemExtendedProcessInformation

View File

@ -1,30 +0,0 @@
From a74718ea86178b8aa580d542bed872a313bdd546 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 6 Apr 2019 21:31:55 -0500
Subject: [PATCH] ntdll: Add stub for
NtQuerySystemInformation(SystemExtendedProcessInformation).
---
dlls/ntdll/unix/system.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 68de16b7e5b..c5b2018bf30 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2145,6 +2145,12 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
break;
}
+ case SystemExtendedProcessInformation:
+ FIXME("SystemExtendedProcessInformation, size %u, info %p, stub!\n", size, info);
+ memset( info, 0, size );
+ ret = STATUS_SUCCESS;
+ break;
+
default:
FIXME( "(0x%08x,%p,0x%08x,%p) stub\n", class, info, size, ret_size );
--
2.27.0

View File

@ -1 +0,0 @@
Fixes: [46870] League of Legends 8.12+ fails to start a game in Vista+ mode (anticheat engine, SystemExtendedProcessInformation)

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "6373792eec0f122295723cae77b0115e6c96c3e4"
echo "93107c08f5aa7f37ad7ece9cd7ca248dba3030ce"
}
# Show version information
@ -145,7 +145,6 @@ 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"
@ -186,7 +185,6 @@ patch_enable_all ()
enable_ntdll_Status_Mapping="$1"
enable_ntdll_Syscall_Emulation="$1"
enable_ntdll_SystemCodeIntegrityInformation="$1"
enable_ntdll_SystemExtendedProcessInformation="$1"
enable_ntdll_SystemModuleInformation="$1"
enable_ntdll_WRITECOPY="$1"
enable_ntdll_Zero_mod_name="$1"
@ -524,9 +522,6 @@ 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"
;;
@ -647,9 +642,6 @@ patch_enable ()
ntdll-SystemCodeIntegrityInformation)
enable_ntdll_SystemCodeIntegrityInformation="$2"
;;
ntdll-SystemExtendedProcessInformation)
enable_ntdll_SystemExtendedProcessInformation="$2"
;;
ntdll-SystemModuleInformation)
enable_ntdll_SystemModuleInformation="$2"
;;
@ -1589,13 +1581,6 @@ if test "$enable_nvcuvid_CUDA_Video_Support" -eq 1; then
enable_nvapi_Stub_DLL=1
fi
if test "$enable_ntdll_SystemCodeIntegrityInformation" -eq 1; then
if test "$enable_ntdll_SystemExtendedProcessInformation" -gt 1; then
abort "Patchset ntdll-SystemExtendedProcessInformation disabled, but ntdll-SystemCodeIntegrityInformation depends on that."
fi
enable_ntdll_SystemExtendedProcessInformation=1
fi
if test "$enable_ntdll_Syscall_Emulation" -eq 1; then
if test "$enable_winebuild_pe_syscall_thunks" -gt 1; then
abort "Patchset winebuild-pe_syscall_thunks disabled, but ntdll-Syscall_Emulation depends on that."
@ -2843,80 +2828,6 @@ 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] mfplat: Improved support for multiple video formats.
# |
# | Modified files:
# | * dlls/mf/Makefile.in, dlls/mf/handler.c, dlls/mf/handler.h, dlls/mf/main.c, dlls/mf/session.c, dlls/mf/tests/mf.c,
# | dlls/mf/topology.c, dlls/mfmediaengine/main.c, dlls/mfplat/mediatype.c, dlls/mfplat/tests/mfplat.c,
# | dlls/mfplat/tests/test.mp4, dlls/mfreadwrite/reader.c, dlls/mfreadwrite/tests/mfplat.c,
# | dlls/mfreadwrite/tests/resource.rc, dlls/mfreadwrite/tests/test.mp4, dlls/winegstreamer/Makefile.in,
# | dlls/winegstreamer/audioconvert.c, dlls/winegstreamer/colorconvert.c, dlls/winegstreamer/gst_cbs.c,
# | dlls/winegstreamer/gst_cbs.h, dlls/winegstreamer/gst_private.h, dlls/winegstreamer/main.c,
# | dlls/winegstreamer/media_source.c, dlls/winegstreamer/mf_decode.c, dlls/winegstreamer/mfplat.c,
# | dlls/winegstreamer/winegstreamer_classes.idl, include/mfidl.idl, tools/make_makefiles, tools/makedep.c
# |
if test "$enable_mfplat_streaming_support" -eq 1; then
patch_apply mfplat-streaming-support/0001-mfmediaengine-Provide-the-partial-topology-to-the-me.patch
patch_apply mfplat-streaming-support/0002-mfmediaengine-Issue-MF_MEDIA_ENGINE_EVENT_CANPLAY-up.patch
patch_apply mfplat-streaming-support/0003-mfmediaengine-Issue-MF_MEDIA_ENGINE_EVENT_PLAYING-up.patch
patch_apply mfplat-streaming-support/0004-mfmediaengine-Issue-MF_MEDIA_ENGINE_EVENT_ENDED-upon.patch
patch_apply mfplat-streaming-support/0005-mf-Unconditionally-deliver-NULL-EOS-samples.patch
patch_apply mfplat-streaming-support/0006-winegstreamer-Insert-videoconvert-into-decoded-video.patch
patch_apply mfplat-streaming-support/0007-winegstreamer-Insert-audioconvert-into-decoded-audio.patch
patch_apply mfplat-streaming-support/0008-winegstreamer-Implement-IMFMediaSource-CreatePresent.patch
patch_apply mfplat-streaming-support/0009-winegstreamer-Implement-IMFMediaSource-Start.patch
patch_apply mfplat-streaming-support/0010-winegstreamer-Implement-IMFMediaStream-RequestSample.patch
patch_apply mfplat-streaming-support/0011-winegstreamer-Insert-parser-into-pipeline-to-rectify.patch
patch_apply mfplat-streaming-support/0012-winegstreamer-Translate-H.264-caps-to-attributes.patch
patch_apply mfplat-streaming-support/0013-winegstreamer-Translate-WMV-caps-to-attributes.patch
patch_apply mfplat-streaming-support/0014-winegstreamer-Translate-AAC-caps-to-attributes.patch
patch_apply mfplat-streaming-support/0015-winegstreamer-Translate-MPEG-4-Section-2-caps-to-att.patch
patch_apply mfplat-streaming-support/0016-winegstreamer-Translate-WMA-caps-to-attributes.patch
patch_apply mfplat-streaming-support/0017-winegstreamer-Translate-H.264-attributes-to-caps.patch
patch_apply mfplat-streaming-support/0018-winegstreamer-Translate-WMV-attributes-to-caps.patch
patch_apply mfplat-streaming-support/0019-winegstreamer-Translate-AAC-attributes-to-caps.patch
patch_apply mfplat-streaming-support/0020-winegstreamer-Translate-MPEG-4-Section-2-attributes-.patch
patch_apply mfplat-streaming-support/0021-winegstreamer-Translate-WMA-attributes-to-caps.patch
patch_apply mfplat-streaming-support/0022-winegstreamer-Implement-IMFMediaSource-GetCharacteri.patch
patch_apply mfplat-streaming-support/0023-winegstreamer-Calculate-the-MF_PD_DURATION-of-the-me.patch
patch_apply mfplat-streaming-support/0024-tools-Add-support-for-multiple-parent-directories.patch
patch_apply mfplat-streaming-support/0025-mf-Introduce-handler-helper.patch
patch_apply mfplat-streaming-support/0026-Introduce-IMFSample-GstBuffer-converter.patch
patch_apply mfplat-streaming-support/0027-winegstreamer-Implement-decoder-MFT-on-gstreamer.patch
patch_apply mfplat-streaming-support/0028-mfreadwrite-Select-all-streams-when-creating-a-sourc.patch
patch_apply mfplat-streaming-support/0029-Miscellaneous.patch
patch_apply mfplat-streaming-support/0030-WMV.patch
patch_apply mfplat-streaming-support/0031-mf-Ask-for-more-samples-from-upstream-node-when-upon.patch
patch_apply mfplat-streaming-support/0032-winegstreamer-Implement-IMFMedisStream-GetMediaSourc.patch
patch_apply mfplat-streaming-support/0033-Expose-PCM-output-type-on-AAC-decoder.patch
patch_apply mfplat-streaming-support/0034-mfplat-Add-I420-format-information.patch
patch_apply mfplat-streaming-support/0035-winegstreamer-Implement-Color-Converter-MFT.patch
patch_apply mfplat-streaming-support/0036-HACK-Set-BPS-to-16-for-output-template.patch
patch_apply mfplat-streaming-support/0037-Improve-tests.patch
patch_apply mfplat-streaming-support/0038-Revert-Improve-tests.patch
patch_apply mfplat-streaming-support/0039-Report-streams-backwards-and-only-select-one-of-each.patch
patch_apply mfplat-streaming-support/0040-winegstreamer-Implement-IMFMediaSource-Stop.patch
patch_apply mfplat-streaming-support/0041-winegstreamer-Introduce-MPEG-4-Section-2-video-decod.patch
patch_apply mfplat-streaming-support/0042-HACK-Switch-between-all-selection-streams-on-MF_SOUR.patch
patch_apply mfplat-streaming-support/0043-winegstreamer-Introduce-WMA-audio-decoder.patch
patch_apply mfplat-streaming-support/0044-Support-stereo-down-folding.patch
patch_apply mfplat-streaming-support/0045-winegstreamer-Implement-MF_SD_LANGUAGE.patch
patch_apply mfplat-streaming-support/0046-Revert-mf-topoloader-Add-a-structure-for-iterative-b.patch
patch_apply mfplat-streaming-support/0047-Revert-mf-topoloader-Clone-source-nodes-as-a-first-l.patch
patch_apply mfplat-streaming-support/0048-Revert-mf-topoloader-Switch-to-public-interface-for-.patch
patch_apply mfplat-streaming-support/0049-mf-Partially-implement-the-topology-loader.patch
patch_apply mfplat-streaming-support/0050-mf-Miscelaneous-fixes-to-topology-resolution.patch
patch_apply mfplat-streaming-support/0051-Rewrite-branch-resolver.patch
patch_apply mfplat-streaming-support/0053-winegstreamer-Implement-audio-conversion-MFT.patch
patch_apply mfplat-streaming-support/0054-HACK-Shutdown-media-sinks-on-session-shutdown.patch
patch_apply mfplat-streaming-support/0055-HACK-Flush-decoder-when-changing-times.patch
patch_apply mfplat-streaming-support/0056-mfmediaengine-Implement-GetNativeVideoSize.patch
patch_apply mfplat-streaming-support/0060-winegstreamer-Support-eAVEncH264VProfile_Constrained.patch
fi
# Patchset mmsystem.dll16-MIDIHDR_Refcount
# |
# | This patchset fixes the following Wine bugs:
@ -3370,24 +3281,8 @@ if test "$enable_ntdll_Syscall_Emulation" -eq 1; then
patch_apply ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch
fi
# Patchset ntdll-SystemExtendedProcessInformation
# |
# | This patchset fixes the following Wine bugs:
# | * [#46870] League of Legends 8.12+ fails to start a game in Vista+ mode (anticheat engine,
# | SystemExtendedProcessInformation)
# |
# | Modified files:
# | * dlls/ntdll/unix/system.c
# |
if test "$enable_ntdll_SystemExtendedProcessInformation" -eq 1; then
patch_apply ntdll-SystemExtendedProcessInformation/0001-ntdll-Add-stub-for-NtQuerySystemInformation-SystemEx.patch
fi
# Patchset ntdll-SystemCodeIntegrityInformation
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-SystemExtendedProcessInformation
# |
# | This patchset fixes the following Wine bugs:
# | * [#49192] ntdll: NtQuerySystemInformation support SystemCodeIntegrityInformation
# |

View File

@ -1 +1 @@
f6a5a3d03c1eb914444af96352ca54eec79d7e2c
93107c08f5aa7f37ad7ece9cd7ca248dba3030ce