Updated mfplat-streaming-support patchset

This commit is contained in:
Alistair Leslie-Hughes 2021-06-28 09:48:50 +10:00
parent 1c9c21dc1c
commit 1af6d6980c
3 changed files with 31 additions and 126 deletions

View File

@ -0,0 +1,25 @@
From 7fb19224f43a76744fa44f25c4d9c50eba568c98 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 28 Jun 2021 14:54:19 +1000
Subject: [PATCH] mfplat: Fix copy/paste error
---
dlls/mfplat/buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index c1829043e1b..9081dc39eab 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -1473,7 +1473,7 @@ static HRESULT create_dxgi_surface_buffer(IUnknown *surface, unsigned int sub_re
object->_2d.width = stride;
object->_2d.height = desc.Height;
object->max_length = object->_2d.plane_size;
- object->_2d.copy_image = get_2d_buffer_copy_func(desc.Format);
+ object->_2d.copy_image = get_2d_buffer_copy_func(format);
if (FAILED(hr = init_attributes_object(&object->dxgi_surface.attributes, 0)))
{
--
2.30.2

View File

@ -1,120 +0,0 @@
From a3c6815e44291b10a7756c8821e820b71be91fc6 Mon Sep 17 00:00:00 2001
From: Giovanni Mascellani <gmascellani@codeweavers.com>
Date: Mon, 22 Mar 2021 15:59:49 +0100
Subject: [PATCH 38/39] mfreadwrite: Unset seeking flag also on SourceStarted
and SourceStopped.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
dlls/mfplat/buffer.c | 18 ++++++++++++++++--
dlls/mfreadwrite/tests/mfplat.c | 6 ++++++
dlls/winegstreamer/main.c | 1 +
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index c1829043e1b..96eb02b3a61 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -68,6 +68,7 @@ struct buffer
ID3D11Texture2D *texture;
unsigned int sub_resource_idx;
ID3D11Texture2D *rb_texture;
+ DXGI_FORMAT rb_texture_format;
D3D11_MAPPED_SUBRESOURCE map_desc;
struct attributes attributes;
} dxgi_surface;
@@ -890,6 +891,7 @@ static HRESULT dxgi_surface_buffer_create_readback_texture(struct buffer *buffer
texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
texture_desc.MiscFlags = 0;
texture_desc.MipLevels = 1;
+ buffer->dxgi_surface.rb_texture_format = texture_desc.Format;
if (FAILED(hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &buffer->dxgi_surface.rb_texture)))
WARN("Failed to create readback texture, hr %#x.\n", hr);
@@ -947,6 +949,7 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock(IMFMediaBuffer *iface, BYTE **dat
{
struct buffer *buffer = impl_from_IMFMediaBuffer(iface);
HRESULT hr = S_OK;
+ DWORD lines;
TRACE("%p, %p, %p, %p.\n", iface, data, max_length, current_length);
@@ -967,8 +970,13 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock(IMFMediaBuffer *iface, BYTE **dat
hr = dxgi_surface_buffer_map(buffer);
if (SUCCEEDED(hr))
{
+ if (buffer->dxgi_surface.rb_texture_format == DXGI_FORMAT_NV12)
+ lines = buffer->_2d.height * 3 / 2;
+ else
+ lines = buffer->_2d.height;
+
copy_image(buffer, buffer->_2d.linear_buffer, buffer->_2d.width, buffer->dxgi_surface.map_desc.pData,
- buffer->dxgi_surface.map_desc.RowPitch, buffer->_2d.width, buffer->_2d.height);
+ buffer->dxgi_surface.map_desc.RowPitch, buffer->_2d.width, lines);
}
}
}
@@ -992,6 +1000,7 @@ static HRESULT WINAPI dxgi_surface_buffer_Unlock(IMFMediaBuffer *iface)
{
struct buffer *buffer = impl_from_IMFMediaBuffer(iface);
HRESULT hr = S_OK;
+ DWORD lines;
TRACE("%p.\n", iface);
@@ -1001,8 +1010,13 @@ static HRESULT WINAPI dxgi_surface_buffer_Unlock(IMFMediaBuffer *iface)
hr = HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED);
else if (!--buffer->_2d.locks)
{
+ if (buffer->dxgi_surface.rb_texture_format == DXGI_FORMAT_NV12)
+ lines = buffer->_2d.height * 3 / 2;
+ else
+ lines = buffer->_2d.height;
+
copy_image(buffer, buffer->dxgi_surface.map_desc.pData, buffer->dxgi_surface.map_desc.RowPitch,
- buffer->_2d.linear_buffer, buffer->_2d.width, buffer->_2d.width, buffer->_2d.height);
+ buffer->_2d.linear_buffer, buffer->_2d.width, buffer->_2d.width, lines);
dxgi_surface_buffer_unmap(buffer);
free(buffer->_2d.linear_buffer);
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c
index e3ff7f6e7aa..ba821df2190 100644
--- a/dlls/mfreadwrite/tests/mfplat.c
+++ b/dlls/mfreadwrite/tests/mfplat.c
@@ -508,6 +508,7 @@ static IMFMediaSource *create_test_source(int stream_count)
{
struct test_source *source;
int i;
+ PROPVARIANT pos;
source = heap_alloc_zero(sizeof(*source));
source->IMFMediaSource_iface.lpVtbl = &test_source_vtbl;
@@ -924,6 +925,11 @@ static void test_source_reader_from_media_source(void)
hr = IMFSourceReader_SetCurrentPosition(reader, &GUID_NULL, &pos);
ok(hr == S_OK, "Failed to seek to beginning of stream, hr %#x.\n", hr);
+ pos.vt = VT_I8;
+ pos.hVal.QuadPart = 0;
+ hr = IMFSourceReader_SetCurrentPosition(reader, &GUID_NULL, &pos);
+ ok(hr == S_OK, "Failed to seek to beginning of stream, hr %#x.\n", hr);
+
hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_ANY_STREAM, 0, &actual_index, &stream_flags,
&timestamp, &sample);
ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr);
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
index 16fd6147ddf..f6206fa5e2b 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -39,6 +39,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
{
DisableThreadLibraryCalls(instance);
__wine_init_unix_lib(instance, reason, NULL, &unix_funcs);
+ init_gstreamer();
}
return TRUE;
}
--
2.30.2

View File

@ -2454,11 +2454,11 @@ fi
# | * [#49692] Multiple applications need a Media Foundation media source implementation
# |
# | Modified files:
# | * dlls/mf/topology.c, dlls/mfplat/buffer.c, dlls/mfplat/main.c, dlls/mfreadwrite/tests/mfplat.c,
# | dlls/winegstreamer/Makefile.in, dlls/winegstreamer/audioconvert.c, dlls/winegstreamer/colorconvert.c,
# | dlls/winegstreamer/decode_transform.c, dlls/winegstreamer/gst_private.h, dlls/winegstreamer/main.c,
# | dlls/winegstreamer/media_source.c, dlls/winegstreamer/mfplat.c, dlls/winegstreamer/quartz_parser.c,
# | dlls/winegstreamer/wg_parser.c, dlls/winegstreamer/winegstreamer_classes.idl, include/mfidl.idl, include/wmcodecdsp.idl
# | * dlls/mf/topology.c, dlls/mfplat/buffer.c, dlls/mfplat/main.c, dlls/winegstreamer/Makefile.in,
# | dlls/winegstreamer/audioconvert.c, dlls/winegstreamer/colorconvert.c, dlls/winegstreamer/decode_transform.c,
# | dlls/winegstreamer/gst_private.h, dlls/winegstreamer/media_source.c, dlls/winegstreamer/mfplat.c,
# | dlls/winegstreamer/quartz_parser.c, dlls/winegstreamer/wg_parser.c, dlls/winegstreamer/winegstreamer_classes.idl,
# | include/mfidl.idl, include/wmcodecdsp.idl
# |
if test "$enable_mfplat_streaming_support" -eq 1; then
patch_apply mfplat-streaming-support/0001-winegstreamer-Activate-source-pad-in-push-mode-if-it.patch
@ -2498,7 +2498,7 @@ if test "$enable_mfplat_streaming_support" -eq 1; then
patch_apply mfplat-streaming-support/0035-mfplat-Stub-out-MFCreateDXGIDeviceManager-to-avoid-t.patch
patch_apply mfplat-streaming-support/0036-winegstreamer-Don-t-rely-on-max_size-in-unseekable-p.patch
patch_apply mfplat-streaming-support/0037-winegstreamer-Implement-MFT_MESSAGE_COMMAND_FLUSH-fo.patch
patch_apply mfplat-streaming-support/0038-mfreadwrite-Unset-seeking-flag-also-on-SourceStarted.patch
patch_apply mfplat-streaming-support/0038-mfplat-Fix-copy-paste-error.patch
patch_apply mfplat-streaming-support/0039-winegstreamer-Default-Frame-size-if-one-isn-t-availa.patch
fi