Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 115 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 6597f2f..27906ce 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1562,6 +1562,119 @@ static void test_aggregate_filter_graph(void) IUnknown_Release(pgraph); }
+/* Test how methods from "control" interfaces (IBasicAudio, IBasicVideo, + * IVideoWindow) are delegated to filters exposing those interfaces. */ +static void test_control_delegation(void) +{ + IFilterGraph2 *graph = create_graph(); + IBasicAudio *audio, *filter_audio; + IBaseFilter *renderer; + IVideoWindow *window; + IBasicVideo *video; + HRESULT hr; + LONG val; + + /* IBasicAudio */ + + hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicAudio, (void **)&audio); + ok(hr == S_OK, "got %#x\n", hr); + +todo_wine { + hr = IBasicAudio_put_Volume(audio, -10); + ok(hr == E_NOTIMPL, "got %#x\n", hr); + hr = IBasicAudio_get_Volume(audio, &val); + ok(hr == E_NOTIMPL, "got %#x\n", hr); + hr = IBasicAudio_put_Balance(audio, 10); + ok(hr == E_NOTIMPL, "got %#x\n", hr); + hr = IBasicAudio_get_Balance(audio, &val); + ok(hr == E_NOTIMPL, "got %#x\n", hr); +} + + hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&renderer); + if (hr != VFW_E_NO_AUDIO_HARDWARE) + { + ok(hr == S_OK, "got %#x\n", hr); + + hr = IFilterGraph2_AddFilter(graph, renderer, NULL); + ok(hr == S_OK, "got %#x\n", hr); + + hr = IBasicAudio_put_Volume(audio, -10); + ok(hr == S_OK, "got %#x\n", hr); + hr = IBasicAudio_get_Volume(audio, &val); + ok(hr == S_OK, "got %#x\n", hr); + ok(val == -10, "got %d\n", val); + hr = IBasicAudio_put_Balance(audio, 10); + ok(hr == S_OK || hr == VFW_E_MONO_AUDIO_HW, "got %#x\n", hr); + hr = IBasicAudio_get_Balance(audio, &val); + ok(hr == S_OK || hr == VFW_E_MONO_AUDIO_HW, "got %#x\n", hr); + if (hr == S_OK) + ok(val == 10, "got balance %d\n", val); + + hr = IBaseFilter_QueryInterface(renderer, &IID_IBasicAudio, (void **)&filter_audio); + ok(hr == S_OK, "got %#x\n", hr); + + hr = IBasicAudio_get_Volume(filter_audio, &val); + ok(hr == S_OK, "got %#x\n", hr); + ok(val == -10, "got volume %d\n", val); + + hr = IFilterGraph2_RemoveFilter(graph, renderer); + ok(hr == S_OK, "got %#x\n", hr); + + IBaseFilter_Release(renderer); + IBasicAudio_Release(filter_audio); + } + +todo_wine { + hr = IBasicAudio_put_Volume(audio, -10); + ok(hr == E_NOTIMPL, "got %#x\n", hr); + hr = IBasicAudio_get_Volume(audio, &val); + ok(hr == E_NOTIMPL, "got %#x\n", hr); + hr = IBasicAudio_put_Balance(audio, 10); + ok(hr == E_NOTIMPL, "got %#x\n", hr); + hr = IBasicAudio_get_Balance(audio, &val); + ok(hr == E_NOTIMPL, "got %#x\n", hr); +} + + IBasicAudio_Release(audio); + + /* IBasicVideo and IVideoWindow */ + + hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicVideo, (void **)&video); + ok(hr == S_OK, "got %#x\n", hr); + hr = IFilterGraph2_QueryInterface(graph, &IID_IVideoWindow, (void **)&window); + ok(hr == S_OK, "got %#x\n", hr); + + /* Unlike IBasicAudio, these return E_NOINTERFACE. */ + hr = IBasicVideo_get_BitRate(video, &val); + ok(hr == E_NOINTERFACE, "got %#x\n", hr); + hr = IVideoWindow_SetWindowForeground(window, OATRUE); + ok(hr == E_NOINTERFACE, "got %#x\n", hr); + + hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&renderer); + ok(hr == S_OK, "got %#x\n", hr); + + hr = IFilterGraph2_AddFilter(graph, renderer, NULL); + ok(hr == S_OK, "got %#x\n", hr); + + hr = IBasicVideo_get_BitRate(video, &val); + ok(hr == VFW_E_NOT_CONNECTED, "got %#x\n", hr); + hr = IVideoWindow_SetWindowForeground(window, OATRUE); + ok(hr == VFW_E_NOT_CONNECTED, "got %#x\n", hr); + + hr = IFilterGraph2_RemoveFilter(graph, renderer); + ok(hr == S_OK, "got %#x\n", hr); + + hr = IBasicVideo_get_BitRate(video, &val); + ok(hr == E_NOINTERFACE, "got %#x\n", hr); + hr = IVideoWindow_SetWindowForeground(window, OATRUE); + ok(hr == E_NOINTERFACE, "got %#x\n", hr); + + IBaseFilter_Release(renderer); + IBasicVideo_Release(video); + IVideoWindow_Release(window); + IFilterGraph2_Release(graph); +} + START_TEST(filtergraph) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -1571,6 +1684,8 @@ START_TEST(filtergraph) test_graph_builder(); test_render_filter_priority(); test_aggregate_filter_graph(); + test_control_delegation(); + CoUninitialize(); test_render_with_multithread(); }
Based on a patch by Alistair Leslie-Hughes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45366 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filtergraph.c | 8 ++++++++ dlls/quartz/tests/filtergraph.c | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index d1643c3..48aff98 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -3140,6 +3140,8 @@ static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface, LONG lVolume) EnterCriticalSection(&This->cs);
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio); + if (hr == E_NOINTERFACE) + hr = E_NOTIMPL;
if (hr == S_OK) hr = IBasicAudio_put_Volume(pBasicAudio, lVolume); @@ -3160,6 +3162,8 @@ static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface, LONG *plVolume) EnterCriticalSection(&This->cs);
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio); + if (hr == E_NOINTERFACE) + hr = E_NOTIMPL;
if (hr == S_OK) hr = IBasicAudio_get_Volume(pBasicAudio, plVolume); @@ -3180,6 +3184,8 @@ static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface, LONG lBalance) EnterCriticalSection(&This->cs);
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio); + if (hr == E_NOINTERFACE) + hr = E_NOTIMPL;
if (hr == S_OK) hr = IBasicAudio_put_Balance(pBasicAudio, lBalance); @@ -3200,6 +3206,8 @@ static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface, LONG *plBalance EnterCriticalSection(&This->cs);
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio); + if (hr == E_NOINTERFACE) + hr = E_NOTIMPL;
if (hr == S_OK) hr = IBasicAudio_get_Balance(pBasicAudio, plBalance); diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 27906ce..5ca4bfc 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1579,7 +1579,6 @@ static void test_control_delegation(void) hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicAudio, (void **)&audio); ok(hr == S_OK, "got %#x\n", hr);
-todo_wine { hr = IBasicAudio_put_Volume(audio, -10); ok(hr == E_NOTIMPL, "got %#x\n", hr); hr = IBasicAudio_get_Volume(audio, &val); @@ -1588,7 +1587,6 @@ todo_wine { ok(hr == E_NOTIMPL, "got %#x\n", hr); hr = IBasicAudio_get_Balance(audio, &val); ok(hr == E_NOTIMPL, "got %#x\n", hr); -}
hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&renderer); if (hr != VFW_E_NO_AUDIO_HARDWARE) @@ -1624,7 +1622,6 @@ todo_wine { IBasicAudio_Release(filter_audio); }
-todo_wine { hr = IBasicAudio_put_Volume(audio, -10); ok(hr == E_NOTIMPL, "got %#x\n", hr); hr = IBasicAudio_get_Volume(audio, &val); @@ -1633,7 +1630,6 @@ todo_wine { ok(hr == E_NOTIMPL, "got %#x\n", hr); hr = IBasicAudio_get_Balance(audio, &val); ok(hr == E_NOTIMPL, "got %#x\n", hr); -}
IBasicAudio_Release(audio);