Commit 57afb52d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Implement IWMSyncReader2_GetAllocateForOutput.

parent 7eb50d5e
......@@ -2444,11 +2444,30 @@ static HRESULT WINAPI reader_SetAllocateForOutput(IWMSyncReader2 *iface, DWORD o
return S_OK;
}
static HRESULT WINAPI reader_GetAllocateForOutput(IWMSyncReader2 *iface, DWORD output_num, IWMReaderAllocatorEx **allocator)
static HRESULT WINAPI reader_GetAllocateForOutput(IWMSyncReader2 *iface, DWORD output, IWMReaderAllocatorEx **allocator)
{
struct wm_reader *This = impl_from_IWMSyncReader2(iface);
FIXME("(%p)->(%lu %p): stub!\n", This, output_num, allocator);
return E_NOTIMPL;
struct wm_reader *reader = impl_from_IWMSyncReader2(iface);
struct wm_stream *stream;
TRACE("reader %p, output %lu, allocator %p.\n", reader, output, allocator);
if (!allocator)
return E_INVALIDARG;
EnterCriticalSection(&reader->cs);
if (!(stream = get_stream_by_output_number(reader, output)))
{
LeaveCriticalSection(&reader->cs);
return E_INVALIDARG;
}
stream = reader->streams + output;
if ((*allocator = stream->output_allocator))
IWMReaderAllocatorEx_AddRef(*allocator);
LeaveCriticalSection(&reader->cs);
return S_OK;
}
static HRESULT WINAPI reader_SetAllocateForStream(IWMSyncReader2 *iface, DWORD stream_num, IWMReaderAllocatorEx *allocator)
......
......@@ -3479,13 +3479,11 @@ static void test_sync_reader_allocator(void)
hr = IWMSyncReader2_GetAllocateForOutput(reader, -1, &allocator);
todo_wine
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);
todo_wine
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IWMSyncReader2_GetAllocateForStream(reader, 1, NULL);
todo_wine
......@@ -3499,9 +3497,7 @@ static void test_sync_reader_allocator(void)
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator);
todo_wine
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine
ok(!allocator, "Got allocator %p.\n", allocator);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator);
......@@ -3516,9 +3512,7 @@ static void test_sync_reader_allocator(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator);
todo_wine
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine
ok(!allocator, "Got allocator %p.\n", allocator);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForStream(reader, 2, &allocator);
......@@ -3537,9 +3531,7 @@ static void test_sync_reader_allocator(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator);
todo_wine
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine
ok(!allocator, "Got allocator %p.\n", allocator);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator);
......@@ -3553,9 +3545,7 @@ static void test_sync_reader_allocator(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForOutput(reader, 1, &allocator);
todo_wine
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine
ok(!allocator, "Got allocator %p.\n", allocator);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator);
......@@ -3564,18 +3554,14 @@ static void test_sync_reader_allocator(void)
todo_wine
ok(!allocator, "Got allocator %p.\n", allocator);
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &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_SetAllocateForOutput(reader, 0, NULL);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator);
todo_wine
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine
ok(!allocator, "Got allocator %p.\n", allocator);
allocator = (void *)0xdeadbeef;
hr = IWMSyncReader2_GetAllocateForStream(reader, 1, &allocator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment