Module: wine Branch: master Commit: 2ba08dc0ada8449c9312ca26d3df69740c38ac52 URL: https://gitlab.winehq.org/wine/wine/-/commit/2ba08dc0ada8449c9312ca26d3df697...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Aug 22 14:57:10 2022 +0200
winegstreamer: Implement IWMSyncReader2_GetAllocateForStream.
---
dlls/winegstreamer/wm_reader.c | 26 ++++++++++++++++++++++---- dlls/wmvcore/tests/wmvcore.c | 14 -------------- 2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 6c9c0514347..bd6d9064171 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -2497,11 +2497,29 @@ static HRESULT WINAPI reader_SetAllocateForStream(IWMSyncReader2 *iface, DWORD s return S_OK; }
-static HRESULT WINAPI reader_GetAllocateForStream(IWMSyncReader2 *iface, DWORD stream_num, IWMReaderAllocatorEx **allocator) +static HRESULT WINAPI reader_GetAllocateForStream(IWMSyncReader2 *iface, DWORD stream_number, IWMReaderAllocatorEx **allocator) { - struct wm_reader *This = impl_from_IWMSyncReader2(iface); - FIXME("(%p)->(%lu %p): stub!\n", This, stream_num, allocator); - return E_NOTIMPL; + struct wm_reader *reader = impl_from_IWMSyncReader2(iface); + struct wm_stream *stream; + + TRACE("reader %p, stream_number %lu, allocator %p.\n", reader, stream_number, allocator); + + if (!allocator) + return E_INVALIDARG; + + EnterCriticalSection(&reader->cs); + + if (!(stream = wm_reader_get_stream_by_stream_number(reader, stream_number))) + { + LeaveCriticalSection(&reader->cs); + return E_INVALIDARG; + } + + if ((*allocator = stream->stream_allocator)) + IWMReaderAllocatorEx_AddRef(*allocator); + + LeaveCriticalSection(&reader->cs); + return S_OK; }
static const IWMSyncReader2Vtbl reader_vtbl = diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 948d6b54340..5ba280c3222 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -3481,12 +3481,10 @@ static void test_sync_reader_allocator(void) hr = IWMSyncReader2_GetAllocateForOutput(reader, -1, &allocator); ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); hr = IWMSyncReader2_GetAllocateForStream(reader, 0, &allocator); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, NULL); ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); hr = IWMSyncReader2_GetAllocateForStream(reader, 1, NULL); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); hr = IWMSyncReader2_SetAllocateForOutput(reader, -1, &callback.IWMReaderAllocatorEx_iface); ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); @@ -3500,9 +3498,7 @@ static void test_sync_reader_allocator(void) ok(!allocator, "Got allocator %p.\n", allocator); allocator = (void *)0xdeadbeef; hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!allocator, "Got allocator %p.\n", allocator);
@@ -3514,14 +3510,10 @@ static void test_sync_reader_allocator(void) ok(!allocator, "Got allocator %p.\n", allocator); allocator = (void *)0xdeadbeef; hr = IWMSyncReader2_GetAllocateForStream(reader, 2, &allocator); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!allocator, "Got allocator %p.\n", allocator); hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(allocator == &callback.IWMReaderAllocatorEx_iface, "Got allocator %p.\n", allocator);
hr = IWMSyncReader2_SetAllocateForStream(reader, 1, NULL); @@ -3532,9 +3524,7 @@ static void test_sync_reader_allocator(void) ok(!allocator, "Got allocator %p.\n", allocator); allocator = (void *)0xdeadbeef; hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!allocator, "Got allocator %p.\n", allocator);
@@ -3546,9 +3536,7 @@ static void test_sync_reader_allocator(void) ok(!allocator, "Got allocator %p.\n", allocator); allocator = (void *)0xdeadbeef; hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!allocator, "Got allocator %p.\n", allocator); hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator); ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -3562,9 +3550,7 @@ static void test_sync_reader_allocator(void) ok(!allocator, "Got allocator %p.\n", allocator); allocator = (void *)0xdeadbeef; hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!allocator, "Got allocator %p.\n", allocator);