Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 168 +++++++++++++++------------------------- 1 file changed, 63 insertions(+), 105 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 5fd3107..1f2fe20 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -283,6 +283,68 @@ static void test_basic_video(void) IBasicVideo_Release(pbv); }
+static void test_mediacontrol(void) +{ + IMediaSeeking *seeking; + IMediaFilter *filter; + IMediaControl *control; + LONGLONG pos; + GUID format; + HRESULT hr; + + IGraphBuilder_SetDefaultSyncSource(pgraph); + hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaSeeking, (void**) &seeking); + ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr); + + hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaFilter, (void**) &filter); + ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %08x\n", hr); + + hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaControl, (void**) &control); + ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr); + + format = GUID_NULL; + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + ok(hr == S_OK, "GetTimeFormat failed: %#x\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "got %s\n", wine_dbgstr_guid(&format)); + + pos = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, NULL, 0x123456789a, NULL); + ok(hr == S_OK, "ConvertTimeFormat failed: %#x\n", hr); + ok(pos == 0x123456789a, "got %s\n", wine_dbgstr_longlong(pos)); + + pos = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL); + ok(hr == S_OK, "ConvertTimeFormat failed: %#x\n", hr); + ok(pos == 0x123456789a, "got %s\n", wine_dbgstr_longlong(pos)); + + pos = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "ConvertTimeFormat failed: %#x\n", hr); + ok(pos == 0x123456789a, "got %s\n", wine_dbgstr_longlong(pos)); + + hr = IMediaSeeking_GetCurrentPosition(seeking, &pos); + ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr); + ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos)); + + hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_ReturnTime, NULL, AM_SEEKING_NoPositioning); + ok(hr == S_OK, "SetPositions failed: %#x\n", hr); + hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_NoPositioning, NULL, AM_SEEKING_ReturnTime); + ok(hr == S_OK, "SetPositions failed: %#x\n", hr); + + IMediaFilter_SetSyncSource(filter, NULL); + pos = 0xdeadbeef; + hr = IMediaSeeking_GetCurrentPosition(seeking, &pos); + ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr); + ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos)); + + hr = IMediaControl_GetState(control, 1000, NULL); + ok(hr == E_POINTER, "expected E_POINTER, got %#x\n", hr); + + IMediaControl_Release(control); + IMediaSeeking_Release(seeking); + IMediaFilter_Release(filter); +} + static void rungraph(void) { HRESULT hr; @@ -304,6 +366,7 @@ static void rungraph(void) IMediaFilter_Release(pmf);
test_basic_video(); + test_mediacontrol();
hr = IMediaControl_Run(pmc); ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr); @@ -555,109 +618,6 @@ static void test_graph_builder(void) releasefiltergraph(); }
-static void test_graph_builder_addfilter(void) -{ - HRESULT hr; - IBaseFilter *pF = NULL; - static const WCHAR testFilterW[] = {'t','e','s','t','F','i','l','t','e','r',0}; - - if (!createfiltergraph()) - return; - - hr = IGraphBuilder_AddFilter(pgraph, NULL, testFilterW); - ok(hr == E_POINTER, "IGraphBuilder_AddFilter returned: %x\n", hr); - - /* create video filter */ - hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, - &IID_IBaseFilter, (LPVOID*)&pF); - ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr); - ok(pF != NULL, "pF is NULL\n"); - if (!pF) { - skip("failed to created filter, skipping\n"); - return; - } - - hr = IGraphBuilder_AddFilter(pgraph, pF, NULL); - ok(hr == S_OK, "IGraphBuilder_AddFilter returned: %x\n", hr); - IBaseFilter_Release(pF); -} - -static void test_mediacontrol(void) -{ - HRESULT hr; - LONGLONG pos = 0xdeadbeef; - GUID format = GUID_NULL; - IMediaSeeking *seeking = NULL; - IMediaFilter *filter = NULL; - IMediaControl *control = NULL; - - IGraphBuilder_SetDefaultSyncSource(pgraph); - hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaSeeking, (void**) &seeking); - ok(hr == S_OK, "QueryInterface IMediaControl failed: %08x\n", hr); - if (FAILED(hr)) - return; - - hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaFilter, (void**) &filter); - ok(hr == S_OK, "QueryInterface IMediaFilter failed: %08x\n", hr); - if (FAILED(hr)) - { - IMediaSeeking_Release(seeking); - return; - } - - hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaControl, (void**) &control); - ok(hr == S_OK, "QueryInterface IMediaControl failed: %08x\n", hr); - if (FAILED(hr)) - { - IMediaSeeking_Release(seeking); - IMediaFilter_Release(filter); - return; - } - - format = GUID_NULL; - hr = IMediaSeeking_GetTimeFormat(seeking, &format); - ok(hr == S_OK, "GetTimeFormat failed: %08x\n", hr); - ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "GetTimeFormat: unexpected format %s\n", wine_dbgstr_guid(&format)); - - pos = 0xdeadbeef; - hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, NULL, 0x123456789a, NULL); - ok(hr == S_OK, "ConvertTimeFormat failed: %08x\n", hr); - ok(pos == 0x123456789a, "ConvertTimeFormat: expected 123456789a, got (%s)\n", wine_dbgstr_longlong(pos)); - - pos = 0xdeadbeef; - hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL); - ok(hr == S_OK, "ConvertTimeFormat failed: %08x\n", hr); - ok(pos == 0x123456789a, "ConvertTimeFormat: expected 123456789a, got (%s)\n", wine_dbgstr_longlong(pos)); - - pos = 0xdeadbeef; - hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME); - ok(hr == S_OK, "ConvertTimeFormat failed: %08x\n", hr); - ok(pos == 0x123456789a, "ConvertTimeFormat: expected 123456789a, got (%s)\n", wine_dbgstr_longlong(pos)); - - hr = IMediaSeeking_GetCurrentPosition(seeking, &pos); - ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr); - ok(pos == 0, "Position != 0 (%s)\n", wine_dbgstr_longlong(pos)); - - hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_ReturnTime, NULL, AM_SEEKING_NoPositioning); - ok(hr == S_OK, "SetPositions failed: %08x\n", hr); - hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_NoPositioning, NULL, AM_SEEKING_ReturnTime); - ok(hr == S_OK, "SetPositions failed: %08x\n", hr); - - IMediaFilter_SetSyncSource(filter, NULL); - pos = 0xdeadbeef; - hr = IMediaSeeking_GetCurrentPosition(seeking, &pos); - ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr); - ok(pos == 0, "Position != 0 (%s)\n", wine_dbgstr_longlong(pos)); - - hr = IMediaControl_GetState(control, 1000, NULL); - ok(hr == E_POINTER, "GetState expected %08x, got %08x\n", E_POINTER, hr); - - IMediaControl_Release(control); - IMediaSeeking_Release(seeking); - IMediaFilter_Release(filter); - releasefiltergraph(); -} - static void test_filter_graph2(void) { HRESULT hr; @@ -2344,8 +2304,6 @@ START_TEST(filtergraph) test_render_run(avifile); test_render_run(mpegfile); test_graph_builder(); - test_graph_builder_addfilter(); - test_mediacontrol(); test_filter_graph2(); test_render_filter_priority(); test_aggregate_filter_graph();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 111 ++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 73 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 1f2fe20..17b2df1 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -67,22 +67,23 @@ static WCHAR *load_resource(const WCHAR *name) return pathW; }
-static IGraphBuilder *pgraph; - -static int createfiltergraph(void) +static IFilterGraph2 *create_graph(void) { - return S_OK == CoCreateInstance( - &CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&pgraph); + IFilterGraph2 *ret; + HRESULT hr; + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret); + ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr); + return ret; }
-static void test_basic_video(void) +static void test_basic_video(IFilterGraph2 *graph) { IBasicVideo* pbv; LONG video_width, video_height, window_width; LONG left, top, width, height; HRESULT hr;
- hr = IGraphBuilder_QueryInterface(pgraph, &IID_IBasicVideo, (LPVOID*)&pbv); + hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicVideo, (void **)&pbv); ok(hr==S_OK, "Cannot get IBasicVideo interface returned: %x\n", hr);
/* test get video size */ @@ -283,7 +284,7 @@ static void test_basic_video(void) IBasicVideo_Release(pbv); }
-static void test_mediacontrol(void) +static void test_mediacontrol(IFilterGraph2 *graph) { IMediaSeeking *seeking; IMediaFilter *filter; @@ -292,14 +293,14 @@ static void test_mediacontrol(void) GUID format; HRESULT hr;
- IGraphBuilder_SetDefaultSyncSource(pgraph); - hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaSeeking, (void**) &seeking); + IFilterGraph2_SetDefaultSyncSource(graph); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaSeeking, (void **)&seeking); ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr);
- hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaFilter, (void**) &filter); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter); ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %08x\n", hr);
- hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaControl, (void**) &control); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr);
format = GUID_NULL; @@ -345,7 +346,7 @@ static void test_mediacontrol(void) IMediaFilter_Release(filter); }
-static void rungraph(void) +static void rungraph(IFilterGraph2 *graph) { HRESULT hr; IMediaControl* pmc; @@ -353,10 +354,10 @@ static void rungraph(void) IMediaFilter* pmf; HANDLE hEvent;
- hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaControl, (LPVOID*)&pmc); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&pmc); ok(hr==S_OK, "Cannot get IMediaControl interface returned: %x\n", hr);
- hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaFilter, (LPVOID*)&pmf); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&pmf); ok(hr==S_OK, "Cannot get IMediaFilter interface returned: %x\n", hr);
IMediaControl_Stop(pmc); @@ -365,8 +366,8 @@ static void rungraph(void)
IMediaFilter_Release(pmf);
- test_basic_video(); - test_mediacontrol(); + test_basic_video(graph); + test_mediacontrol(graph);
hr = IMediaControl_Run(pmc); ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr); @@ -377,7 +378,7 @@ static void rungraph(void) hr = IMediaControl_Stop(pmc); ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr);
- IGraphBuilder_SetDefaultSyncSource(pgraph); + IFilterGraph2_SetDefaultSyncSource(graph);
Sleep(10); trace("stop -> pause\n"); @@ -412,7 +413,7 @@ static void rungraph(void) hr = IMediaControl_Run(pmc); ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr);
- hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaEvent, (LPVOID*)&pme); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (LPVOID*)&pme); ok(hr==S_OK, "Cannot get IMediaEvent interface returned: %x\n", hr);
hr = IMediaEvent_GetEventHandle(pme, (OAEVENT*)&hEvent); @@ -430,19 +431,12 @@ static void rungraph(void) ok(hr==1, "Releasing mediacontrol returned: %x\n", hr); }
-static void releasefiltergraph(void) -{ - HRESULT hr; - - hr = IGraphBuilder_Release(pgraph); - ok(hr==0, "Releasing filtergraph returned: %x\n", hr); -} - static void test_render_run(const WCHAR *file) { + IFilterGraph2 *graph; HANDLE h; HRESULT hr; - + LONG refs; WCHAR *filename = load_resource(file);
h = CreateFileW(filename, 0, 0, NULL, OPEN_EXISTING, 0, NULL); @@ -453,22 +447,21 @@ static void test_render_run(const WCHAR *file) } CloseHandle(h);
- if (!createfiltergraph()) - { - DeleteFileW(filename); - return; - } + trace("running %s\n", wine_dbgstr_w(file)); + + graph = create_graph();
- hr = IGraphBuilder_RenderFile(pgraph, filename, NULL); + hr = IFilterGraph2_RenderFile(graph, filename, NULL); if (hr == VFW_E_CANNOT_RENDER) skip("%s: codec not supported; skipping test\n", wine_dbgstr_w(file)); else { ok(hr == S_OK || hr == VFW_S_AUDIO_NOT_RENDERED, "RenderFile failed: %x\n", hr); - rungraph(); + rungraph(graph); }
- releasefiltergraph(); + refs = IFilterGraph2_Release(graph); + ok(!refs, "Graph has %u references\n", refs);
/* check reference leaks */ h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); @@ -557,6 +550,7 @@ static void test_render_with_multithread(void) static void test_graph_builder(void) { HRESULT hr; + IGraphBuilder *pgraph; IBaseFilter *pF = NULL; IBaseFilter *pF2 = NULL; IPin *pIn = NULL; @@ -565,8 +559,7 @@ static void test_graph_builder(void) static const WCHAR testFilterW[] = {'t','e','s','t','F','i','l','t','e','r',0}; static const WCHAR fooBarW[] = {'f','o','o','B','a','r',0};
- if (!createfiltergraph()) - return; + pgraph = (IGraphBuilder *)create_graph();
/* create video filter */ hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, @@ -614,22 +607,7 @@ static void test_graph_builder(void) if (pEnum) IEnumPins_Release(pEnum); if (pF) IBaseFilter_Release(pF); if (pF2) IBaseFilter_Release(pF2); - - releasefiltergraph(); -} - -static void test_filter_graph2(void) -{ - HRESULT hr; - IFilterGraph2 *pF = NULL; - - hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, - &IID_IFilterGraph2, (LPVOID*)&pF); - ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr); - ok(pF != NULL, "pF is NULL\n"); - - hr = IFilterGraph2_Release(pF); - ok(hr == 0, "IFilterGraph2_Release returned: %x\n", hr); + IGraphBuilder_Release(pgraph); }
/* IEnumMediaTypes implementation (supporting code for Render() test.) */ @@ -1884,8 +1862,7 @@ static void test_render_filter_priority(void) * (one is "exact" match, other is "wildcard" match. Seems to depend * on the order in which filters are added to the graph, thus indicating * no preference given to exact match. */ - hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2); - ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + pgraph2 = create_graph(); if (!pgraph2) return;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); @@ -1930,8 +1907,7 @@ static void test_render_filter_priority(void) return; }
- hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2); - ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + pgraph2 = create_graph(); if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); @@ -1979,8 +1955,7 @@ static void test_render_filter_priority(void) an existing renderer which renders the pin indirectly, through an additional middle filter, again trying different orders of creation. Native appears not to give a preference. */
- hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2); - ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + pgraph2 = create_graph(); if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); @@ -2031,8 +2006,7 @@ static void test_render_filter_priority(void) IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); ptestfilter2 = NULL;
- hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2); - ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + pgraph2 = create_graph(); if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); @@ -2086,8 +2060,7 @@ static void test_render_filter_priority(void) ptestfilter2 = NULL;
/* Test if renderers are tried before non-renderers (intermediary filters). */ - hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2); - ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + pgraph2 = create_graph(); if (!pgraph2) goto out;
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pMapper2); @@ -2292,19 +2265,11 @@ static void test_aggregate_filter_graph(void)
START_TEST(filtergraph) { - HRESULT hr; CoInitializeEx(NULL, COINIT_MULTITHREADED); - hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, - &IID_IGraphBuilder, (LPVOID*)&pgraph); - if (FAILED(hr)) { - skip("Creating filtergraph returned %08x, skipping tests\n", hr); - return; - } - IGraphBuilder_Release(pgraph); + test_render_run(avifile); test_render_run(mpegfile); test_graph_builder(); - test_filter_graph2(); test_render_filter_priority(); test_aggregate_filter_graph(); CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filtergraph.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index f9bc47b..0113674 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -1049,6 +1049,7 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut, if (IsEqualGUID(&clsid, &FilterCLSID)) { /* Skip filter (same as the one the output pin belongs to) */ IBaseFilter_Release(pfilter); + pfilter = NULL; goto error; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 17b2df1..8e9d17e 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -431,6 +431,49 @@ static void rungraph(IFilterGraph2 *graph) ok(hr==1, "Releasing mediacontrol returned: %x\n", hr); }
+static void test_graph_builder_connect(WCHAR *filename) +{ + static const WCHAR outputW[] = {'O','u','t','p','u','t',0}; + static const WCHAR inW[] = {'I','n',0}; + IBaseFilter *source_filter, *video_filter; + IPin *pin_in, *pin_out; + IFilterGraph2 *graph; + IVideoWindow *window; + HRESULT hr; + + graph = create_graph(); + + hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, &IID_IVideoWindow, (void **)&window); + ok(hr == S_OK, "Failed to create VideoRenderer: %#x\n", hr); + + hr = IFilterGraph2_AddSourceFilter(graph, filename, NULL, &source_filter); + ok(hr == S_OK, "AddSourceFilter failed: %#x\n", hr); + + hr = IVideoWindow_QueryInterface(window, &IID_IBaseFilter, (void **)&video_filter); + ok(hr == S_OK, "QueryInterface(IBaseFilter) failed: %#x\n", hr); + hr = IFilterGraph2_AddFilter(graph, video_filter, NULL); + ok(hr == S_OK, "AddFilter failed: %#x\n", hr); + + hr = IBaseFilter_FindPin(source_filter, outputW, &pin_out); + ok(hr == S_OK, "FindPin failed: %#x\n", hr); + hr = IBaseFilter_FindPin(video_filter, inW, &pin_in); + ok(hr == S_OK, "FindPin failed: %#x\n", hr); + hr = IFilterGraph2_Connect(graph, pin_out, pin_in); + + if (hr != VFW_E_NO_ACCEPTABLE_TYPES) + { + ok(SUCCEEDED(hr), "Connect failed: %#x\n", hr); + rungraph(graph); + } + + IPin_Release(pin_in); + IPin_Release(pin_out); + IBaseFilter_Release(source_filter); + IBaseFilter_Release(video_filter); + IVideoWindow_Release(window); + IFilterGraph2_Release(graph); +} + static void test_render_run(const WCHAR *file) { IFilterGraph2 *graph; @@ -463,6 +506,8 @@ static void test_render_run(const WCHAR *file) refs = IFilterGraph2_Release(graph); ok(!refs, "Graph has %u references\n", refs);
+ test_graph_builder_connect(filename); + /* check reference leaks */ h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%d\n", GetLastError());