From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/qasf/tests/dmowrapper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/qasf/tests/dmowrapper.c b/dlls/qasf/tests/dmowrapper.c index 4ade744d105..00f3290c233 100644 --- a/dlls/qasf/tests/dmowrapper.c +++ b/dlls/qasf/tests/dmowrapper.c @@ -78,6 +78,7 @@ static DWORD testdmo_output_size = 123; static DWORD testdmo_output_alignment = 1;
static unsigned int got_Flush, got_Discontinuity, got_ProcessInput, got_ProcessOutput, got_Receive; +static unsigned int got_AllocateStreamingResources, got_FreeStreamingResources;
static IMediaBuffer *testdmo_buffer;
@@ -271,12 +272,14 @@ static HRESULT WINAPI dmo_Discontinuity(IMediaObject *iface, DWORD index) static HRESULT WINAPI dmo_AllocateStreamingResources(IMediaObject *iface) { if (winetest_debug > 1) trace("AllocateStreamingResources()\n"); + ++got_AllocateStreamingResources; return S_OK; }
static HRESULT WINAPI dmo_FreeStreamingResources(IMediaObject *iface) { if (winetest_debug > 1) trace("FreeStreamingResources()\n"); + ++got_FreeStreamingResources; return S_OK; }
@@ -1390,6 +1393,8 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, IMediaSample *sample; HRESULT hr;
+ got_AllocateStreamingResources = got_FreeStreamingResources = 0; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt2); ok(hr == S_OK, "Got hr %#lx.\n", hr);
@@ -1404,15 +1409,23 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0); ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
+ ok(!got_AllocateStreamingResources, "Got %u calls to AllocateStreamingResources().\n", + got_AllocateStreamingResources); hr = IMediaControl_Pause(control); ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(got_AllocateStreamingResources == 1, "Got %u calls to AllocateStreamingResources().\n", + got_AllocateStreamingResources);
hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#lx.\n", hr); IMediaSample_Release(sample);
+ ok(!got_FreeStreamingResources, "Got %u calls to FreeStreamingResources().\n", + got_FreeStreamingResources); hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(got_FreeStreamingResources == 1, "Got %u calls to FreeStreamingResources().\n", + got_FreeStreamingResources);
hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0); ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr); @@ -2203,6 +2216,9 @@ static void test_uninitialized(void) CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter); ok(hr == S_OK, "Got hr %#lx.\n", hr);
+ hr = IBaseFilter_Pause(filter); + todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr); + hr = IBaseFilter_Stop(filter); ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/qasf/dmowrapper.c | 3 +++ dlls/qasf/tests/dmowrapper.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/qasf/dmowrapper.c b/dlls/qasf/dmowrapper.c index 7c6358b6029..ead4e50229c 100644 --- a/dlls/qasf/dmowrapper.c +++ b/dlls/qasf/dmowrapper.c @@ -684,6 +684,9 @@ static HRESULT dmo_wrapper_init_stream(struct strmbase_filter *iface) struct dmo_wrapper *filter = impl_from_strmbase_filter(iface); DWORD i;
+ if (!filter->dmo) + return E_FAIL; + for (i = 0; i < filter->source_count; ++i) { if (filter->sources[i].pin.pin.peer) diff --git a/dlls/qasf/tests/dmowrapper.c b/dlls/qasf/tests/dmowrapper.c index 00f3290c233..f4fa3513139 100644 --- a/dlls/qasf/tests/dmowrapper.c +++ b/dlls/qasf/tests/dmowrapper.c @@ -2217,7 +2217,7 @@ static void test_uninitialized(void) ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IBaseFilter_Pause(filter); - todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr); + ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
hr = IBaseFilter_Stop(filter); ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/qasf/dmowrapper.c | 13 +++++++++++++ dlls/qasf/tests/dmowrapper.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/qasf/dmowrapper.c b/dlls/qasf/dmowrapper.c index ead4e50229c..0e6408c06d4 100644 --- a/dlls/qasf/dmowrapper.c +++ b/dlls/qasf/dmowrapper.c @@ -682,17 +682,29 @@ static HRESULT dmo_wrapper_query_interface(struct strmbase_filter *iface, REFIID static HRESULT dmo_wrapper_init_stream(struct strmbase_filter *iface) { struct dmo_wrapper *filter = impl_from_strmbase_filter(iface); + IMediaObject *dmo; + HRESULT hr; DWORD i;
if (!filter->dmo) return E_FAIL;
+ IUnknown_QueryInterface(filter->dmo, &IID_IMediaObject, (void **)&dmo); + + if (FAILED(hr = IMediaObject_AllocateStreamingResources(dmo))) + { + ERR("AllocateStreamingResources() failed, hr %#lx.\n", hr); + IMediaObject_Release(dmo); + return hr; + } + for (i = 0; i < filter->source_count; ++i) { if (filter->sources[i].pin.pin.peer) IMemAllocator_Commit(filter->sources[i].pin.pAllocator); }
+ IMediaObject_Release(dmo); return S_OK; }
@@ -715,6 +727,7 @@ static HRESULT dmo_wrapper_cleanup_stream(struct strmbase_filter *iface) }
IMediaObject_Flush(dmo); + IMediaObject_FreeStreamingResources(dmo);
IMediaObject_Release(dmo); LeaveCriticalSection(&filter->filter.stream_cs); diff --git a/dlls/qasf/tests/dmowrapper.c b/dlls/qasf/tests/dmowrapper.c index f4fa3513139..941267761cd 100644 --- a/dlls/qasf/tests/dmowrapper.c +++ b/dlls/qasf/tests/dmowrapper.c @@ -1413,7 +1413,7 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, got_AllocateStreamingResources); hr = IMediaControl_Pause(control); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(got_AllocateStreamingResources == 1, "Got %u calls to AllocateStreamingResources().\n", + ok(got_AllocateStreamingResources == 1, "Got %u calls to AllocateStreamingResources().\n", got_AllocateStreamingResources);
hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0); @@ -1424,7 +1424,7 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, got_FreeStreamingResources); hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(got_FreeStreamingResources == 1, "Got %u calls to FreeStreamingResources().\n", + ok(got_FreeStreamingResources == 1, "Got %u calls to FreeStreamingResources().\n", got_FreeStreamingResources);
hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/qasf/dmowrapper.c | 4 +++- dlls/qasf/tests/dmowrapper.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/qasf/dmowrapper.c b/dlls/qasf/dmowrapper.c index 0e6408c06d4..578e51b8ba0 100644 --- a/dlls/qasf/dmowrapper.c +++ b/dlls/qasf/dmowrapper.c @@ -108,7 +108,9 @@ static HRESULT WINAPI buffer_GetBufferAndLength(IMediaBuffer *iface, BYTE **data TRACE("iface %p, data %p, len %p.\n", iface, data, len);
*len = IMediaSample_GetActualDataLength(buffer->sample); - return IMediaSample_GetPointer(buffer->sample, data); + if (data) + return IMediaSample_GetPointer(buffer->sample, data); + return S_OK; }
static const IMediaBufferVtbl buffer_vtbl = diff --git a/dlls/qasf/tests/dmowrapper.c b/dlls/qasf/tests/dmowrapper.c index 941267761cd..3ac49dfba9d 100644 --- a/dlls/qasf/tests/dmowrapper.c +++ b/dlls/qasf/tests/dmowrapper.c @@ -302,6 +302,12 @@ static HRESULT WINAPI dmo_ProcessInput(IMediaObject *iface, DWORD index,
++got_ProcessInput;
+ len = 0xdeadbeef; + hr = IMediaBuffer_GetBufferAndLength(buffer, NULL, &len); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(len == 200, "Got length %lu.\n", len); + + len = 0xdeadbeef; hr = IMediaBuffer_GetBufferAndLength(buffer, &data, &len); ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(len == 200, "Got length %lu.\n", len);