winegstreamer: Implement IWMSyncReader2_GetAllocateForStream.

This commit is contained in:
Rémi Bernon 2022-08-22 14:57:10 +02:00 committed by Alexandre Julliard
parent 5aa60f778a
commit 2ba08dc0ad
2 changed files with 22 additions and 18 deletions

View file

@ -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 =

View file

@ -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);