Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avico.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 5c60846013..2d2d4c7f2b 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -54,6 +54,8 @@ static ULONG get_refcount(void *iface)
static void test_interfaces(IBaseFilter *filter) { + IPin *pin; + check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IMediaFilter, TRUE); check_interface(filter, &IID_IPersist, TRUE); @@ -71,6 +73,29 @@ static void test_interfaces(IBaseFilter *filter) check_interface(filter, &IID_IQualProp, FALSE); check_interface(filter, &IID_IReferenceClock, FALSE); check_interface(filter, &IID_IVideoWindow, FALSE); + + IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IMediaPosition, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + IBaseFilter_FindPin(filter, source_id, &pin); + + todo_wine check_interface(pin, &IID_IMediaPosition, TRUE); + todo_wine check_interface(pin, &IID_IMediaSeeking, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IAsyncReader, FALSE); + + IPin_Release(pin); }
static void test_enum_pins(IBaseFilter *filter)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avico.c | 88 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-)
diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 2d2d4c7f2b..0ee2e1bcb3 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -330,6 +330,89 @@ static LRESULT CALLBACK driver_proc(DWORD_PTR id, HDRVR driver, UINT msg, return 0; }
+static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out) +{ + ok(0, "Unexpected call (iid %s).\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface) +{ + ok(0, "Unexpected call.\n"); + return 2; +} + +static ULONG WINAPI property_bag_Release(IPropertyBag *iface) +{ + ok(0, "Unexpected call.\n"); + return 1; +} + +static const WCHAR fcchandlerW[] = {'F','c','c','H','a','n','d','l','e','r',0}; +static BSTR ppb_handler; +static unsigned int ppb_got_read; + +static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *log) +{ + ok(!lstrcmpW(name, fcchandlerW), "Got unexpected name %s.\n", wine_dbgstr_w(name)); + todo_wine ok(V_VT(var) == VT_BSTR, "Got unexpected type %u.\n", V_VT(var)); + ok(!log, "Got unexpected error log %p.\n", log); + V_BSTR(var) = SysAllocString(ppb_handler); + ppb_got_read++; + return S_OK; +} + +static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *name, VARIANT *var) +{ + ok(0, "Unexpected call (name %s).\n", wine_dbgstr_w(name)); + return E_FAIL; +} + +static const IPropertyBagVtbl property_bag_vtbl = +{ + property_bag_QueryInterface, + property_bag_AddRef, + property_bag_Release, + property_bag_Read, + property_bag_Write, +}; + +static void test_property_bag(IMoniker *mon) +{ + IPropertyBag property_bag = {&property_bag_vtbl}; + IPropertyBag *devenum_bag; + IPersistPropertyBag *ppb; + VARIANT var; + HRESULT hr; + ULONG ref; + + hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&devenum_bag); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + VariantInit(&var); + hr = IPropertyBag_Read(devenum_bag, fcchandlerW, &var, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ppb_handler = V_BSTR(&var); + + hr = CoCreateInstance(&CLSID_AVICo, NULL, CLSCTX_INPROC_SERVER, + &IID_IPersistPropertyBag, (void **)&ppb); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IPersistPropertyBag_InitNew(ppb); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + ppb_got_read = 0; + hr = IPersistPropertyBag_Load(ppb, &property_bag, NULL); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ppb_got_read == 1, "Got %u calls to Read().\n", ppb_got_read); + + ref = IPersistPropertyBag_Release(ppb); + ok(!ref, "Got unexpected refcount %d.\n", ref); + + VariantClear(&var); + IPropertyBag_Release(devenum_bag); +} + START_TEST(avico) { static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':', @@ -373,8 +456,11 @@ START_TEST(avico) ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); } - CoTaskMemFree(name);
+ if (!memcmp(name, test_display_name, 11 * sizeof(WCHAR))) + test_property_bag(mon); + + CoTaskMemFree(name); IMoniker_Release(mon); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/avico.c | 2 +- dlls/qcap/tests/avico.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index d5020a0945..3351b36167 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -323,7 +323,7 @@ static HRESULT WINAPI AVICompressorPropertyBag_Load(IPersistPropertyBag *iface,
TRACE("(%p)->(%p %p)\n", This, pPropBag, pErrorLog);
- V_VT(&v) = VT_EMPTY; + V_VT(&v) = VT_BSTR; hres = IPropertyBag_Read(pPropBag, fcc_handlerW, &v, NULL); if(FAILED(hres)) { WARN("Could not read FccHandler: %08x\n", hres); diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 0ee2e1bcb3..9ef66b9843 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -355,7 +355,7 @@ static unsigned int ppb_got_read; static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *log) { ok(!lstrcmpW(name, fcchandlerW), "Got unexpected name %s.\n", wine_dbgstr_w(name)); - todo_wine ok(V_VT(var) == VT_BSTR, "Got unexpected type %u.\n", V_VT(var)); + ok(V_VT(var) == VT_BSTR, "Got unexpected type %u.\n", V_VT(var)); ok(!log, "Got unexpected error log %p.\n", log); V_BSTR(var) = SysAllocString(ppb_handler); ppb_got_read++; @@ -403,7 +403,7 @@ static void test_property_bag(IMoniker *mon)
ppb_got_read = 0; hr = IPersistPropertyBag_Load(ppb, &property_bag, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); ok(ppb_got_read == 1, "Got %u calls to Read().\n", ppb_got_read);
ref = IPersistPropertyBag_Release(ppb);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/qcap.c | 137 ----------------------------------------- 1 file changed, 137 deletions(-)
diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c index 20ab2e97fa..a250139940 100644 --- a/dlls/qcap/tests/qcap.c +++ b/dlls/qcap/tests/qcap.c @@ -59,7 +59,6 @@ DEFINE_EXPECT(ReceiveConnection); DEFINE_EXPECT(GetAllocatorRequirements); DEFINE_EXPECT(NotifyAllocator); DEFINE_EXPECT(Reconnect); -DEFINE_EXPECT(Read_FccHandler); DEFINE_EXPECT(MediaSeeking_GetPositions); DEFINE_EXPECT(MemAllocator_GetProperties); DEFINE_EXPECT(MemInputPin_QueryInterface_IStream); @@ -74,28 +73,6 @@ DEFINE_EXPECT(MediaSample_GetActualDataLength); DEFINE_EXPECT(MediaSample_GetSize); DEFINE_EXPECT(MediaSample_GetMediaTime);
-static int strcmp_wa(LPCWSTR strw, const char *stra) -{ - CHAR buf[512]; - WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL); - return lstrcmpA(stra, buf); -} - -static BSTR a2bstr(const char *str) -{ - BSTR ret; - int len; - - if(!str) - return NULL; - - len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - ret = SysAllocStringLen(NULL, len-1); - MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); - - return ret; -} - typedef enum { SOURCE_FILTER, SINK_FILTER, @@ -1737,119 +1714,6 @@ static void test_AviMux(char *arg) ok(ref == 0, "IStream was not destroyed (%d)\n", ref); }
-static HRESULT WINAPI PropertyBag_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv) -{ - if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IPropertyBag, riid)) { - *ppv = iface; - return S_OK; - } - - ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid)); - *ppv = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI PropertyBag_AddRef(IPropertyBag *iface) -{ - return 2; -} - -static ULONG WINAPI PropertyBag_Release(IPropertyBag *iface) -{ - return 1; -} - -static HRESULT WINAPI PropertyBag_Read(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog) -{ - ok(!pErrorLog, "pErrorLog = %p\n", pErrorLog); - - if(!strcmp_wa(pszPropName, "FccHandler")) { - CHECK_EXPECT(Read_FccHandler); - V_VT(pVar) = VT_BSTR; - V_BSTR(pVar) = a2bstr("mrle"); - return S_OK; - } - - ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName)); - return E_NOTIMPL; -} - -static HRESULT WINAPI PropertyBag_Write(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar) -{ - ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName)); - return E_NOTIMPL; -} - -static const IPropertyBagVtbl PropertyBagVtbl = { - PropertyBag_QueryInterface, - PropertyBag_AddRef, - PropertyBag_Release, - PropertyBag_Read, - PropertyBag_Write -}; - -static IPropertyBag PropertyBag = { &PropertyBagVtbl }; - -static void test_AviCo(void) -{ - IPersistPropertyBag *persist_bag; - IPin *pin, *in_pin, *out_pin; - IEnumPins *enum_pins; - IBaseFilter *avico; - PIN_INFO pin_info; - HRESULT hres; - - static const WCHAR inputW[] = {'I','n','p','u','t',0}; - static const WCHAR outputW[] = {'O','u','t','p','u','t',0}; - - hres = CoCreateInstance(&CLSID_AVICo, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void**)&avico); - if(hres == REGDB_E_CLASSNOTREG || hres == CLASS_E_CLASSNOTAVAILABLE) { - win_skip("CLSID_AVICo not registered/available\n"); - return; - } - ok(hres == S_OK, "Could not create CLSID_AVICo class: %08x\n", hres); - - hres = IBaseFilter_QueryInterface(avico, &IID_IPin, (void**)&pin); - ok(hres == E_NOINTERFACE, "QueryInterface(IID_IPin) returned: %08x\n", hres); - - hres = IBaseFilter_QueryInterface(avico, &IID_IPersistPropertyBag, (void**)&persist_bag); - ok(hres == S_OK, "QueryInterface(IID_IPersistPropertyBag) returned: %08x\n", hres); - - SET_EXPECT(Read_FccHandler); - hres = IPersistPropertyBag_Load(persist_bag, &PropertyBag, NULL); - ok(hres == S_OK, "Load failed: %08x\n", hres); - CHECK_CALLED(Read_FccHandler); - - IPersistPropertyBag_Release(persist_bag); - - hres = IBaseFilter_EnumPins(avico, &enum_pins); - ok(hres == S_OK, "EnumPins failed: %08x\n", hres); - - hres = IEnumPins_Next(enum_pins, 1, &in_pin, NULL); - ok(hres == S_OK, "Next failed: %08x\n", hres); - - hres = IPin_QueryPinInfo(in_pin, &pin_info); - ok(hres == S_OK, "QueryPinInfo failed: %08x\n", hres); - ok(pin_info.pFilter == avico, "pin_info.pFilter != avico\n"); - ok(pin_info.dir == PINDIR_INPUT, "pin_info.dir = %d\n", pin_info.dir); - todo_wine ok(!lstrcmpW(pin_info.achName, inputW), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info.achName)); - - hres = IEnumPins_Next(enum_pins, 1, &out_pin, NULL); - ok(hres == S_OK, "Next failed: %08x\n", hres); - - hres = IPin_QueryPinInfo(out_pin, &pin_info); - ok(hres == S_OK, "QueryPinInfo failed: %08x\n", hres); - ok(pin_info.pFilter == avico, "pin_info.pFilter != avico\n"); - ok(pin_info.dir == PINDIR_OUTPUT, "pin_info.dir = %d\n", pin_info.dir); - todo_wine ok(!lstrcmpW(pin_info.achName, outputW), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info.achName)); - - IEnumPins_Release(enum_pins); - - IPin_Release(in_pin); - IPin_Release(out_pin); - IBaseFilter_Release(avico); -} - /* Outer IUnknown for COM aggregation tests */ struct unk_impl { IUnknown IUnknown_iface; @@ -2005,7 +1869,6 @@ START_TEST(qcap)
test_AviMux_QueryInterface(); test_AviMux(arg_c>2 ? arg_v[2] : NULL); - test_AviCo(); test_COM_vfwcapture();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avico.c | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+)
diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 9ef66b9843..4cdfe81d81 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -325,6 +325,11 @@ static LRESULT CALLBACK driver_proc(DWORD_PTR id, HDRVR driver, UINT msg, lstrcpyW(info->szDescription, nameW); return sizeof(ICINFO); } + case ICM_COMPRESS_QUERY: + { + BITMAPINFO *in = (BITMAPINFO *)lparam1; + return in->bmiHeader.biBitCount == 16 ? ICERR_OK : ICERR_BADFORMAT; + } }
return 0; @@ -413,6 +418,78 @@ static void test_property_bag(IMoniker *mon) IPropertyBag_Release(devenum_bag); }
+static void test_media_types(IBaseFilter *filter) +{ + VIDEOINFOHEADER vih = + { + .bmiHeader.biSize = sizeof(BITMAPINFOHEADER), + .bmiHeader.biBitCount = 16, + .bmiHeader.biCompression = BI_RGB, + }; + AM_MEDIA_TYPE mt = {}, *pmt; + IEnumMediaTypes *enummt; + HRESULT hr; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enummt); + + mt.majortype = MEDIATYPE_Video; + mt.formattype = FORMAT_VideoInfo; + mt.cbFormat = sizeof(VIDEOINFOHEADER); + mt.pbFormat = (BYTE *)&vih; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + vih.bmiHeader.biBitCount = 32; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + vih.bmiHeader.biBitCount = 16; + + mt.bFixedSizeSamples = TRUE; + mt.bTemporalCompression = TRUE; + mt.lSampleSize = 123; + mt.subtype = MEDIASUBTYPE_RGB565; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + mt.subtype = MEDIASUBTYPE_WAVE; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + mt.formattype = GUID_NULL; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.formattype = FORMAT_None; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.formattype = FORMAT_VideoInfo; + + mt.majortype = MEDIATYPE_NULL; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.majortype = MEDIATYPE_Video; + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, source_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enummt); + IPin_Release(pin); +} + START_TEST(avico) { static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':', @@ -452,6 +529,7 @@ START_TEST(avico) test_enum_pins(filter); test_find_pin(filter); test_pin_info(filter); + test_media_types(filter);
ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref);