mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-16 05:56:24 +00:00
winegstreamer: Implement IWMSyncReader2_SetAllocateForStream.
This commit is contained in:
parent
57afb52dfc
commit
5aa60f778a
|
@ -160,6 +160,7 @@ struct wm_stream
|
|||
bool read_compressed;
|
||||
|
||||
IWMReaderAllocatorEx *output_allocator;
|
||||
IWMReaderAllocatorEx *stream_allocator;
|
||||
};
|
||||
|
||||
struct wm_reader
|
||||
|
|
|
@ -1623,6 +1623,9 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA
|
|||
if (!stream->read_compressed && stream->output_allocator)
|
||||
hr = IWMReaderAllocatorEx_AllocateForOutputEx(stream->output_allocator, stream->index,
|
||||
wg_buffer.size, &sample, 0, 0, 0, NULL);
|
||||
else if (stream->read_compressed && stream->stream_allocator)
|
||||
hr = IWMReaderAllocatorEx_AllocateForStreamEx(stream->stream_allocator, stream->index + 1,
|
||||
wg_buffer.size, &sample, 0, 0, 0, NULL);
|
||||
else if (callback_advanced && stream->read_compressed && stream->allocate_stream)
|
||||
hr = IWMReaderCallbackAdvanced_AllocateForStream(callback_advanced,
|
||||
stream->index + 1, wg_buffer.size, &sample, NULL);
|
||||
|
@ -2470,11 +2473,28 @@ static HRESULT WINAPI reader_GetAllocateForOutput(IWMSyncReader2 *iface, DWORD o
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI reader_SetAllocateForStream(IWMSyncReader2 *iface, DWORD stream_num, IWMReaderAllocatorEx *allocator)
|
||||
static HRESULT WINAPI reader_SetAllocateForStream(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);
|
||||
|
||||
EnterCriticalSection(&reader->cs);
|
||||
|
||||
if (!(stream = wm_reader_get_stream_by_stream_number(reader, stream_number)))
|
||||
{
|
||||
LeaveCriticalSection(&reader->cs);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (stream->stream_allocator)
|
||||
IWMReaderAllocatorEx_Release(stream->stream_allocator);
|
||||
if ((stream->stream_allocator = allocator))
|
||||
IWMReaderAllocatorEx_AddRef(stream->stream_allocator);
|
||||
|
||||
LeaveCriticalSection(&reader->cs);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI reader_GetAllocateForStream(IWMSyncReader2 *iface, DWORD stream_num, IWMReaderAllocatorEx **allocator)
|
||||
|
|
|
@ -3491,7 +3491,6 @@ static void test_sync_reader_allocator(void)
|
|||
hr = IWMSyncReader2_SetAllocateForOutput(reader, -1, &callback.IWMReaderAllocatorEx_iface);
|
||||
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
||||
hr = IWMSyncReader2_SetAllocateForStream(reader, 0, &callback.IWMReaderAllocatorEx_iface);
|
||||
todo_wine
|
||||
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
||||
|
||||
|
||||
|
@ -3508,7 +3507,6 @@ static void test_sync_reader_allocator(void)
|
|||
|
||||
|
||||
hr = IWMSyncReader2_SetAllocateForStream(reader, 1, &callback.IWMReaderAllocatorEx_iface);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
allocator = (void *)0xdeadbeef;
|
||||
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator);
|
||||
|
@ -3527,7 +3525,6 @@ static void test_sync_reader_allocator(void)
|
|||
ok(allocator == &callback.IWMReaderAllocatorEx_iface, "Got allocator %p.\n", allocator);
|
||||
|
||||
hr = IWMSyncReader2_SetAllocateForStream(reader, 1, NULL);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
allocator = (void *)0xdeadbeef;
|
||||
hr = IWMSyncReader2_GetAllocateForOutput(reader, 0, &allocator);
|
||||
|
@ -3574,7 +3571,6 @@ static void test_sync_reader_allocator(void)
|
|||
hr = IWMSyncReader2_GetStreamNumberForOutput(reader, 0, &stream_num);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
hr = IWMSyncReader2_SetAllocateForStream(reader, stream_num, &callback.IWMReaderAllocatorEx_iface);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
hr = IWMSyncReader2_SetReadStreamSamples(reader, stream_num, TRUE);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
@ -3588,7 +3584,6 @@ static void test_sync_reader_allocator(void)
|
|||
hr = IWMSyncReader2_GetNextSample(reader, stream_num, &sample, &pts, &duration, &flags,
|
||||
&output_num, &stream_num);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(sample->lpVtbl == &buffer_vtbl, "Buffer vtbl didn't match.\n");
|
||||
INSSBuffer_Release(sample);
|
||||
|
||||
|
|
Loading…
Reference in a new issue