Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/avisplit.c | 116 +++++++++++++---------------------- 1 file changed, 44 insertions(+), 72 deletions(-)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index be9ec18e94..2ad7e0f36f 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -1,5 +1,5 @@ /* - * Unit tests for the avi splitter functions + * AVI splitter filter unit tests * * Copyright (C) 2007 Google (Lei Zhang) * Copyright (C) 2008 Google (Maarten Lankhorst) @@ -20,62 +20,56 @@ */
#define COBJMACROS - -#include "wine/test.h" #include "dshow.h" -#include "tlhelp32.h" - -static IUnknown *pAviSplitter = NULL; +#include "wine/test.h"
-static BOOL create_avisplitter(void) +static IBaseFilter *create_avi_splitter(void) { - HRESULT hr; - - hr = CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (LPVOID*)&pAviSplitter); - return (hr == S_OK && pAviSplitter != NULL); + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + return filter; }
-static void release_avisplitter(void) +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) { - HRESULT hr; - - Sleep(1000); - hr = IUnknown_Release(pAviSplitter); + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk;
- /* Looks like wine has a reference leak somewhere on test_threads tests, - * it passes in windows - */ - ok(hr == 0, "IUnknown_Release failed with %d\n", (INT)hr); + expected_hr = supported ? S_OK : E_NOINTERFACE;
- while (hr > 0) - hr = IUnknown_Release(pAviSplitter); - pAviSplitter = NULL; + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); }
-static void test_query_interface(void) +static void test_interfaces(void) { - HRESULT hr; - ULONG ref; - IUnknown *iface= NULL; - -#define TEST_INTERFACE(riid,expected) do { \ - hr = IUnknown_QueryInterface(pAviSplitter, &riid, (void**)&iface); \ - ok( hr == expected, #riid" should %s got %08X\n", expected==S_OK ? "exist" : "not be present", GetLastError() ); \ - if (hr == S_OK) { \ - ref = IUnknown_Release(iface); \ - ok(ref == 1, "Reference is %u, expected 1\n", ref); \ - } \ - iface = NULL; \ - } while(0) - - TEST_INTERFACE(IID_IBaseFilter,S_OK); - TEST_INTERFACE(IID_IMediaSeeking,E_NOINTERFACE); - TEST_INTERFACE(IID_IKsPropertySet,E_NOINTERFACE); - TEST_INTERFACE(IID_IMediaPosition,E_NOINTERFACE); - TEST_INTERFACE(IID_IQualityControl,E_NOINTERFACE); - TEST_INTERFACE(IID_IQualProp,E_NOINTERFACE); -#undef TEST_INTERFACE + IBaseFilter *filter = create_avi_splitter(); + + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); + check_interface(filter, &IID_IBasicAudio, FALSE); + check_interface(filter, &IID_IBasicVideo, FALSE); + check_interface(filter, &IID_IKsPropertySet, FALSE); + check_interface(filter, &IID_IMediaPosition, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IPersistPropertyBag, FALSE); + check_interface(filter, &IID_IPin, FALSE); + check_interface(filter, &IID_IQualityControl, FALSE); + check_interface(filter, &IID_IQualProp, FALSE); + check_interface(filter, &IID_IReferenceClock, FALSE); + check_interface(filter, &IID_IVideoWindow, FALSE); + + IBaseFilter_Release(filter); }
static void test_pin(IPin *pin) @@ -93,19 +87,11 @@ static void test_pin(IPin *pin) static void test_basefilter(void) { IEnumPins *pin_enum = NULL; - IBaseFilter *base = NULL; + IBaseFilter *base = create_avi_splitter(); IPin *pins[2]; ULONG ref; HRESULT hr;
- IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter, (void **)&base); - if (base == NULL) - { - /* test_query_interface handles this case */ - skip("No IBaseFilter\n"); - return; - } - hr = IBaseFilter_EnumPins(base, NULL); ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
@@ -169,7 +155,7 @@ static WCHAR *load_resource(const WCHAR *name) static void test_filter_graph(void) { IFileSourceFilter *pfile = NULL; - IBaseFilter *preader = NULL, *pavi = NULL; + IBaseFilter *preader = NULL, *pavi = create_avi_splitter(); IEnumPins *enumpins = NULL; IPin *filepin = NULL, *avipin = NULL; HRESULT hr; @@ -202,7 +188,7 @@ static void test_filter_graph(void) return; }
- hr = IUnknown_QueryInterface(pAviSplitter, &IID_IFileSourceFilter, + hr = IUnknown_QueryInterface(pavi, &IID_IFileSourceFilter, (void **)&pfile); ok(hr == E_NOINTERFACE, "Avi splitter returns unexpected error: %08x\n", hr); @@ -222,12 +208,6 @@ static void test_filter_graph(void) if (hr != S_OK) goto fail;
- hr = IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter, - (void**)&pavi); - ok(hr == S_OK, "Could not get base filter: %08x\n", hr); - if (hr != S_OK) - goto fail; - hr = IFileSourceFilter_Load(pfile, filename, NULL); if (hr != S_OK) { @@ -418,17 +398,9 @@ START_TEST(avisplit) { CoInitialize(NULL);
- if (!create_avisplitter()) - { - skip("Could not create avisplitter\n"); - return; - } - - test_query_interface(); + test_interfaces(); test_basefilter(); test_filter_graph();
- release_avisplitter(); - CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 49b0adf6f5..664cecf07d 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -85,7 +85,7 @@ static LONG WINAPI Parser_GetPinCount(BaseFilter *iface)
TRACE("%p->()\n", This);
- return This->cStreams; + return This->cStreams + 1; }
static const BaseFilterFuncTable BaseFuncTable = {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/avisplit.c | 245 ++++++++++++++++++++++++++--------- 1 file changed, 185 insertions(+), 60 deletions(-)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index 2ad7e0f36f..418fcb9fc0 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -23,6 +23,8 @@ #include "dshow.h" #include "wine/test.h"
+static const WCHAR sink_name[] = {'i','n','p','u','t',' ','p','i','n',0}; + static IBaseFilter *create_avi_splitter(void) { IBaseFilter *filter = NULL; @@ -32,6 +34,72 @@ static IBaseFilter *create_avi_splitter(void) return filter; }
+static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0}; + +static WCHAR *load_resource(const WCHAR *name) +{ + static WCHAR pathW[MAX_PATH]; + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempPathW(ARRAY_SIZE(pathW), pathW); + lstrcatW(pathW, name); + + file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n", + wine_dbgstr_w(pathW), GetLastError()); + + res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA); + ok(!!res, "Failed to load resource, error %u.\n", GetLastError()); + ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); + WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL); + ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n"); + CloseHandle(file); + + return pathW; +} + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +static IFilterGraph2 *connect_input(IBaseFilter *splitter, const WCHAR *filename) +{ + static const WCHAR outputW[] = {'O','u','t','p','u','t',0}; + IFileSourceFilter *filesource; + IFilterGraph2 *graph; + IBaseFilter *reader; + IPin *source, *sink; + HRESULT hr; + + CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&reader); + IBaseFilter_QueryInterface(reader, &IID_IFileSourceFilter, (void **)&filesource); + IFileSourceFilter_Load(filesource, filename, NULL); + + CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterGraph2, (void **)&graph); + IFilterGraph2_AddFilter(graph, reader, NULL); + IFilterGraph2_AddFilter(graph, splitter, NULL); + + IBaseFilter_FindPin(splitter, sink_name, &sink); + IBaseFilter_FindPin(reader, outputW, &source); + + hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(source); + IPin_Release(sink); + IBaseFilter_Release(reader); + IFileSourceFilter_Release(filesource); + return graph; +} + #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) { @@ -72,84 +140,141 @@ static void test_interfaces(void) IBaseFilter_Release(filter); }
-static void test_pin(IPin *pin) +static void test_enum_pins(void) { - IMemInputPin *mpin = NULL; + const WCHAR *filename = load_resource(avifile); + IBaseFilter *filter = create_avi_splitter(); + IEnumPins *enum1, *enum2; + IFilterGraph2 *graph; + ULONG count, ref; + IPin *pins[3]; + HRESULT hr; + BOOL ret;
- IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin); + ref = get_refcount(filter); + ok(ref == 1, "Got unexpected refcount %d.\n", ref);
- ok(mpin == NULL, "IMemInputPin found!\n"); - if (mpin) - IMemInputPin_Release(mpin); - /* TODO */ -} + hr = IBaseFilter_EnumPins(filter, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
-static void test_basefilter(void) -{ - IEnumPins *pin_enum = NULL; - IBaseFilter *base = create_avi_splitter(); - IPin *pins[2]; - ULONG ref; - HRESULT hr; + hr = IBaseFilter_EnumPins(filter, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref);
- hr = IBaseFilter_EnumPins(base, NULL); - ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr); + hr = IEnumPins_Next(enum1, 1, NULL, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
- hr= IBaseFilter_EnumPins(base, &pin_enum); - ok(hr == S_OK, "hr = %08x and not S_OK\n", hr); + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); +todo_wine + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pins[0]); +todo_wine + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + IPin_Release(pins[0]); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = IEnumPins_Next(pin_enum, 1, NULL, NULL); - ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr); + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]);
- hr = IEnumPins_Next(pin_enum, 2, pins, NULL); - ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr); + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count);
- pins[0] = (void *)0xdead; - pins[1] = (void *)0xdeed; + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = IEnumPins_Next(pin_enum, 2, pins, &ref); - ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr); - ok(pins[0] != (void *)0xdead && pins[0] != NULL, - "pins[0] = %p\n", pins[0]); - if (pins[0] != (void *)0xdead && pins[0] != NULL) - { - test_pin(pins[0]); - IPin_Release(pins[0]); - } + hr = IEnumPins_Next(enum1, 2, pins, NULL); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
- ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]); + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]);
- ref = IEnumPins_Release(pin_enum); - ok(ref == 0, "ref is %u and not 0!\n", ref); + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr);
- IBaseFilter_Release(base); -} + hr = IEnumPins_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#x.\n", hr);
-static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0}; + hr = IEnumPins_Skip(enum1, 2); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-static WCHAR *load_resource(const WCHAR *name) -{ - static WCHAR pathW[MAX_PATH]; - DWORD written; - HANDLE file; - HRSRC res; - void *ptr; + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_OK, "Got hr %#x.\n", hr);
- GetTempPathW(ARRAY_SIZE(pathW), pathW); - lstrcatW(pathW, name); + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
- file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); - ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW), - GetLastError()); + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
- res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA); - ok( res != 0, "couldn't find resource\n" ); - ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res )); - WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL ); - ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" ); - CloseHandle( file ); + hr = IEnumPins_Next(enum2, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]);
- return pathW; + IEnumPins_Release(enum2); + + graph = connect_input(filter, filename); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); +todo_wine + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 3, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + IEnumPins_Release(enum1); + IFilterGraph2_Release(graph); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); }
static void test_filter_graph(void) @@ -399,7 +524,7 @@ START_TEST(avisplit) CoInitialize(NULL);
test_interfaces(); - test_basefilter(); + test_enum_pins(); test_filter_graph();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/avisplit.c | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index 418fcb9fc0..a13660f833 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -24,6 +24,7 @@ #include "wine/test.h"
static const WCHAR sink_name[] = {'i','n','p','u','t',' ','p','i','n',0}; +static const WCHAR source0_name[] = {'S','t','r','e','a','m',' ','0','0',0};
static IBaseFilter *create_avi_splitter(void) { @@ -277,6 +278,61 @@ todo_wine ok(ret, "Failed to delete file, error %u.\n", GetLastError()); }
+static void test_find_pin(void) +{ + static const WCHAR inputW[] = {'I','n','p','u','t',0}; + const WCHAR *filename = load_resource(avifile); + IBaseFilter *filter = create_avi_splitter(); + IFilterGraph2 *graph; + IEnumPins *enum_pins; + IPin *pin, *pin2; + HRESULT hr; + ULONG ref; + BOOL ret; + + hr = IBaseFilter_FindPin(filter, sink_name, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pin); + + hr = IBaseFilter_FindPin(filter, source0_name, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, inputW, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + graph = connect_input(filter, filename); + + hr = IBaseFilter_EnumPins(filter, &enum_pins); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, source0_name, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); +todo_wine + ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin); + IPin_Release(pin); + IPin_Release(pin2); + + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, sink_name, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); +todo_wine + ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin); + IPin_Release(pin); + IPin_Release(pin2); + + IEnumPins_Release(enum_pins); + IFilterGraph2_Release(graph); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); +} + static void test_filter_graph(void) { IFileSourceFilter *pfile = NULL; @@ -525,6 +581,7 @@ START_TEST(avisplit)
test_interfaces(); test_enum_pins(); + test_find_pin(); test_filter_graph();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/avisplit.c | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index a13660f833..633f1647c0 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -333,6 +333,81 @@ todo_wine ok(ret, "Failed to delete file, error %u.\n", GetLastError()); }
+static void test_pin_info(void) +{ + const WCHAR *filename = load_resource(avifile); + IBaseFilter *filter = create_avi_splitter(); + ULONG ref, expect_ref; + IFilterGraph2 *graph; + PIN_DIRECTION dir; + PIN_INFO info; + HRESULT hr; + WCHAR *id; + IPin *pin; + BOOL ret; + + graph = connect_input(filter, filename); + + hr = IBaseFilter_FindPin(filter, sink_name, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + expect_ref = get_refcount(filter); + ref = get_refcount(pin); + ok(ref == expect_ref, "Got unexpected refcount %d.\n", ref); + + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, sink_name), "Got name %s.\n", wine_dbgstr_w(info.achName)); + ref = get_refcount(filter); + ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pin); +todo_wine + ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, sink_name), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + IPin_Release(pin); + + hr = IBaseFilter_FindPin(filter, source0_name, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IMediaSeeking, TRUE); + + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, source0_name), "Got name %s.\n", wine_dbgstr_w(info.achName)); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, source0_name), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + IPin_Release(pin); + + IFilterGraph2_Release(graph); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); +} + static void test_filter_graph(void) { IFileSourceFilter *pfile = NULL; @@ -582,6 +657,7 @@ START_TEST(avisplit) test_interfaces(); test_enum_pins(); test_find_pin(); + test_pin_info(); test_filter_graph();
CoUninitialize();