Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/acmwrapper.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/quartz/tests/acmwrapper.c b/dlls/quartz/tests/acmwrapper.c index 571e78d9df..a543893d79 100644 --- a/dlls/quartz/tests/acmwrapper.c +++ b/dlls/quartz/tests/acmwrapper.c @@ -61,6 +61,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO static void test_interfaces(void) { IBaseFilter *filter = create_acm_wrapper(); + IPin *pin;
check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IMediaFilter, TRUE); @@ -80,6 +81,30 @@ static void test_interfaces(void) 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); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, source_id, &pin); + + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IMediaPosition, TRUE); + check_interface(pin, &IID_IMediaSeeking, TRUE); + check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IAsyncReader, FALSE); + + IPin_Release(pin); + IBaseFilter_Release(filter); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 91 +++++++++++--------------------- 1 file changed, 32 insertions(+), 59 deletions(-)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index c350192727..f6331297c3 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -1,5 +1,5 @@ /* - * Unit tests for DSound Renderer functions + * DirectSound renderer filter unit tests * * Copyright (C) 2010 Maarten Lankhorst for CodeWeavers * Copyright (C) 2007 Google (Lei Zhang) @@ -20,12 +20,11 @@ */
#define COBJMACROS - -#include "wine/test.h" #include "dshow.h" #include "initguid.h" #include "dsound.h" #include "amaudio.h" +#include "wine/test.h"
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \ ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \ @@ -55,64 +54,43 @@ static void release_dsound_renderer(void) ok(hr == 0, "IUnknown_Release failed with %x\n", hr); }
-static HRESULT WINAPI PB_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv) -{ - ok(0, "Should not be called\n"); - *ppv = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI PB_AddRef(IPropertyBag *iface) +static void test_property_bag(void) { - ok(0, "Should not be called\n"); - return 2; -} + IPersistPropertyBag *ppb; + ICreateDevEnum *devenum; + IEnumMoniker *enummon; + IPropertyBag *propbag; + IMoniker *mon; + HRESULT hr;
-static ULONG WINAPI PB_Release(IPropertyBag *iface) -{ - ok(0, "Should not be called\n"); - return 1; -} + CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, + &IID_ICreateDevEnum, (void **)&devenum); + ICreateDevEnum_CreateClassEnumerator(devenum, &CLSID_AudioRendererCategory, &enummon, 0);
-static HRESULT WINAPI PB_Read(IPropertyBag *iface, LPCOLESTR name, VARIANT *var, IErrorLog *log) -{ - static const WCHAR dsguid[] = { 'D','S','G','u','i','d', 0 }; - char temp[50]; - WideCharToMultiByte(CP_ACP, 0, name, -1, temp, sizeof(temp)-1, NULL, NULL); - temp[sizeof(temp)-1] = 0; - trace("Trying to read %s, type %u\n", temp, var->n1.n2.vt); - if (!lstrcmpW(name, dsguid)) + while (IEnumMoniker_Next(enummon, 1, &mon, NULL) == S_OK) { - static const WCHAR defaultplayback[] = - { - '{','D','E','F','0','0','0','0','0','-', - '9','C','6','D','-','4','7','E','D','-', - 'A','A','F','1','-','4','D','D','A','8', - 'F','2','B','5','C','0','3','}',0 - }; - ok(var->n1.n2.vt == VT_BSTR, "Wrong type asked: %u\n", var->n1.n2.vt); - var->n1.n2.n3.bstrVal = SysAllocString(defaultplayback); - return S_OK; + hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, + &IID_IPersistPropertyBag, (void **)&ppb); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) break; + + IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&propbag); + + hr = IPersistPropertyBag_InitNew(ppb); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IPersistPropertyBag_Load(ppb, propbag, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPersistPropertyBag_Release(ppb); + IPropertyBag_Release(propbag); + IMoniker_Release(mon); } - ok(0, "Unknown property '%s' queried\n", temp); - return E_FAIL; -}
-static HRESULT WINAPI PB_Write(IPropertyBag *iface, LPCOLESTR name, VARIANT *var) -{ - ok(0, "Should not be called\n"); - return E_FAIL; + IEnumMoniker_Release(enummon); + ICreateDevEnum_Release(devenum); }
-static IPropertyBagVtbl PB_Vtbl = -{ - PB_QueryInterface, - PB_AddRef, - PB_Release, - PB_Read, - PB_Write -}; - static void test_query_interface(void) { HRESULT hr; @@ -140,12 +118,6 @@ static void test_query_interface(void) QI_SUCCEED(pDSRender, IID_IDirectSound3DBuffer, ds3dbuf); RELEASE_EXPECT(ds3dbuf, 1); QI_SUCCEED(pDSRender, IID_IPersistPropertyBag, ppb); - if (ppb) - { - IPropertyBag bag = { &PB_Vtbl }; - hr = IPersistPropertyBag_Load(ppb, &bag, NULL); - ok(hr == S_OK, "Couldn't load default device: %08x\n", hr); - } RELEASE_EXPECT(ppb, 1); } QI_SUCCEED(pDSRender, IID_IMediaPosition, pMediaPosition); @@ -224,6 +196,7 @@ START_TEST(dsoundrender) if (!create_dsound_renderer()) return;
+ test_property_bag(); test_query_interface(); test_basefilter();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 192 +++++++++++++++++-------------- 1 file changed, 106 insertions(+), 86 deletions(-)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index f6331297c3..f631cd2a62 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -26,104 +26,122 @@ #include "amaudio.h" #include "wine/test.h"
-#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \ - ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \ - ok(ppv != NULL, "Pointer is NULL\n"); - -#define RELEASE_EXPECT(iface, num) if (iface) { \ - hr = IUnknown_Release((IUnknown*)iface); \ - ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \ +static IBaseFilter *create_dsound_render(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + return filter; }
-static IUnknown *pDSRender = NULL; +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 BOOL create_dsound_renderer(void) +static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface) { - HRESULT hr; + ok(0, "Unexpected call.\n"); + return 2; +}
- hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (LPVOID*)&pDSRender); - return (hr == S_OK && pDSRender != NULL); +static ULONG WINAPI property_bag_Release(IPropertyBag *iface) +{ + ok(0, "Unexpected call.\n"); + return 1; }
-static void release_dsound_renderer(void) +static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *log) { - HRESULT hr; + static const WCHAR dsguidW[] = {'D','S','G','u','i','d',0}; + WCHAR guidstr[39]; + + ok(!lstrcmpW(name, dsguidW), "Got unexpected name %s.\n", wine_dbgstr_w(name)); + ok(V_VT(var) == VT_BSTR, "Got unexpected type %u.\n", V_VT(var)); + StringFromGUID2(&DSDEVID_DefaultPlayback, guidstr, ARRAY_SIZE(guidstr)); + V_BSTR(var) = SysAllocString(guidstr); + return S_OK; +}
- hr = IUnknown_Release(pDSRender); - ok(hr == 0, "IUnknown_Release failed with %x\n", hr); +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(void) { + IPropertyBag property_bag = {&property_bag_vtbl}; IPersistPropertyBag *ppb; - ICreateDevEnum *devenum; - IEnumMoniker *enummon; - IPropertyBag *propbag; - IMoniker *mon; HRESULT hr; + ULONG ref;
- CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, - &IID_ICreateDevEnum, (void **)&devenum); - ICreateDevEnum_CreateClassEnumerator(devenum, &CLSID_AudioRendererCategory, &enummon, 0); + hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, + &IID_IPersistPropertyBag, (void **)&ppb); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) return;
- while (IEnumMoniker_Next(enummon, 1, &mon, NULL) == S_OK) - { - hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, - &IID_IPersistPropertyBag, (void **)&ppb); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr != S_OK) break; + hr = IPersistPropertyBag_InitNew(ppb); + ok(hr == S_OK, "Got hr %#x.\n", hr);
- IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&propbag); + hr = IPersistPropertyBag_Load(ppb, &property_bag, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = IPersistPropertyBag_InitNew(ppb); - ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = IPersistPropertyBag_Release(ppb); + ok(!ref, "Got unexpected refcount %d.\n", ref); +}
- hr = IPersistPropertyBag_Load(ppb, propbag, NULL); - ok(hr == S_OK, "Got hr %#x.\n", hr); +#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) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk;
- IPersistPropertyBag_Release(ppb); - IPropertyBag_Release(propbag); - IMoniker_Release(mon); - } + expected_hr = supported ? S_OK : E_NOINTERFACE;
- IEnumMoniker_Release(enummon); - ICreateDevEnum_Release(devenum); + 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; - IBaseFilter *pBaseFilter = NULL; - IBasicAudio *pBasicAudio = NULL; - IMediaPosition *pMediaPosition = NULL; - IMediaSeeking *pMediaSeeking = NULL; - IQualityControl *pQualityControl = NULL; - IPersistPropertyBag *ppb = NULL; - IDirectSound3DBuffer *ds3dbuf = NULL; - IReferenceClock *clock = NULL; - IAMDirectSound *pAMDirectSound = NULL; - - QI_SUCCEED(pDSRender, IID_IBaseFilter, pBaseFilter); - RELEASE_EXPECT(pBaseFilter, 1); - QI_SUCCEED(pDSRender, IID_IBasicAudio, pBasicAudio); - RELEASE_EXPECT(pBasicAudio, 1); - QI_SUCCEED(pDSRender, IID_IMediaSeeking, pMediaSeeking); - RELEASE_EXPECT(pMediaSeeking, 1); - QI_SUCCEED(pDSRender, IID_IReferenceClock, clock); - RELEASE_EXPECT(clock, 1); - QI_SUCCEED(pDSRender, IID_IAMDirectSound, pAMDirectSound); - RELEASE_EXPECT( pAMDirectSound, 1); - todo_wine { - QI_SUCCEED(pDSRender, IID_IDirectSound3DBuffer, ds3dbuf); - RELEASE_EXPECT(ds3dbuf, 1); - QI_SUCCEED(pDSRender, IID_IPersistPropertyBag, ppb); - RELEASE_EXPECT(ppb, 1); - } - QI_SUCCEED(pDSRender, IID_IMediaPosition, pMediaPosition); - RELEASE_EXPECT(pMediaPosition, 1); - QI_SUCCEED(pDSRender, IID_IQualityControl, pQualityControl); - RELEASE_EXPECT(pQualityControl, 1); + IBaseFilter *filter = create_dsound_render(); + + check_interface(filter, &IID_IAMDirectSound, TRUE); + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IBasicAudio, TRUE); + todo_wine check_interface(filter, &IID_IDirectSound3DBuffer, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + check_interface(filter, &IID_IMediaPosition, TRUE); + check_interface(filter, &IID_IMediaSeeking, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + todo_wine check_interface(filter, &IID_IPersistPropertyBag, TRUE); + check_interface(filter, &IID_IQualityControl, TRUE); + check_interface(filter, &IID_IReferenceClock, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); + check_interface(filter, &IID_IBasicVideo, FALSE); + check_interface(filter, &IID_IKsPropertySet, FALSE); + check_interface(filter, &IID_IPin, FALSE); + check_interface(filter, &IID_IQualProp, FALSE); + check_interface(filter, &IID_IVideoWindow, FALSE); + + IBaseFilter_Release(filter); }
static void test_pin(IPin *pin) @@ -145,19 +163,11 @@ static void test_pin(IPin *pin) static void test_basefilter(void) { IEnumPins *pin_enum = NULL; - IBaseFilter *base = NULL; + IBaseFilter *base = create_dsound_render(); IPin *pins[2]; ULONG ref; HRESULT hr;
- IUnknown_QueryInterface(pDSRender, &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);
@@ -192,15 +202,25 @@ static void test_basefilter(void)
START_TEST(dsoundrender) { + IBaseFilter *filter; + HRESULT hr; + CoInitialize(NULL); - if (!create_dsound_renderer()) + + hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + if (hr == VFW_E_NO_AUDIO_HARDWARE) + { + skip("No audio hardware.\n"); + CoUninitialize(); return; + } + ok(hr == S_OK, "Got hr %#x.\n", hr); + IBaseFilter_Release(filter);
test_property_bag(); - test_query_interface(); + test_interfaces(); test_basefilter();
- release_dsound_renderer(); - CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 100 +++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index f631cd2a62..aa24d330ca 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -35,6 +35,13 @@ static IBaseFilter *create_dsound_render(void) return filter; }
+static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out) { ok(0, "Unexpected call (iid %s).\n", wine_dbgstr_guid(iid)); @@ -144,6 +151,98 @@ static void test_interfaces(void) IBaseFilter_Release(filter); }
+static void test_enum_pins(void) +{ + IBaseFilter *filter = create_dsound_render(); + IEnumPins *enum1, *enum2; + ULONG count, ref; + IPin *pins[2]; + HRESULT hr; + + ref = get_refcount(filter); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + hr = IBaseFilter_EnumPins(filter, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", 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 = IEnumPins_Next(enum1, 1, NULL, NULL); + ok(hr == E_POINTER, "Got hr %#x.\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(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(enum1, 1, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, NULL); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + 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]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 2); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum2, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + IEnumPins_Release(enum2); + IEnumPins_Release(enum1); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_pin(IPin *pin) { IMemInputPin *mpin = NULL; @@ -220,6 +319,7 @@ START_TEST(dsoundrender)
test_property_bag(); test_interfaces(); + test_enum_pins(); test_basefilter();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/evr/evr.c | 2 +- dlls/quartz/dsoundrender.c | 9 +++++++-- dlls/quartz/nullrenderer.c | 10 ++++++---- dlls/quartz/videorenderer.c | 9 +++++---- dlls/quartz/vmr9.c | 14 +++++++++----- dlls/strmbase/renderer.c | 29 ++++------------------------- include/wine/strmbase.h | 5 +++-- 7 files changed, 35 insertions(+), 43 deletions(-)
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index c2d2933211..ba5b5442bd 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -182,7 +182,7 @@ static const IBaseFilterVtbl basefilter_vtbl = BaseRendererImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, BaseFilterImpl_EnumPins, - BaseRendererImpl_FindPin, + BaseFilterImpl_FindPin, BaseFilterImpl_QueryFilterInfo, BaseFilterImpl_JoinFilterGraph, BaseFilterImpl_QueryVendorInfo diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 086352edba..f92ab41880 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -617,6 +617,8 @@ static const BaseRendererFuncTable BaseFuncTable = {
HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) { + static const WCHAR sink_name[] = {'A','u','d','i','o',' ','I','n','p','u','t',' ','p','i','n',' ','(','r','e','n','d','e','r','e','d',')',0}; + HRESULT hr; DSoundRenderImpl * pDSoundRender;
@@ -632,7 +634,10 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) return E_OUTOFMEMORY; ZeroMemory(pDSoundRender, sizeof(DSoundRenderImpl));
- hr = BaseRenderer_Init(&pDSoundRender->renderer, &DSoundRender_Vtbl, (IUnknown*)pDSoundRender, &CLSID_DSoundRender, (DWORD_PTR)(__FILE__ ": DSoundRenderImpl.csFilter"), &BaseFuncTable); + hr = strmbase_renderer_init(&pDSoundRender->renderer, &DSoundRender_Vtbl, + (IUnknown *)&pDSoundRender->renderer. filter.IBaseFilter_iface, + &CLSID_DSoundRender, sink_name, + (DWORD_PTR)(__FILE__ ": DSoundRenderImpl.csFilter"), &BaseFuncTable);
BasicAudio_Init(&pDSoundRender->basicAudio,&IBasicAudio_Vtbl); pDSoundRender->IReferenceClock_iface.lpVtbl = &IReferenceClock_Vtbl; @@ -794,7 +799,7 @@ static const IBaseFilterVtbl DSoundRender_Vtbl = BaseRendererImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, BaseFilterImpl_EnumPins, - BaseRendererImpl_FindPin, + BaseFilterImpl_FindPin, BaseFilterImpl_QueryFilterInfo, BaseFilterImpl_JoinFilterGraph, BaseFilterImpl_QueryVendorInfo diff --git a/dlls/quartz/nullrenderer.c b/dlls/quartz/nullrenderer.c index eccdfc6757..e17d19e3ca 100644 --- a/dlls/quartz/nullrenderer.c +++ b/dlls/quartz/nullrenderer.c @@ -180,7 +180,7 @@ static const IBaseFilterVtbl NullRenderer_Vtbl = BaseRendererImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, BaseFilterImpl_EnumPins, - BaseRendererImpl_FindPin, + BaseFilterImpl_FindPin, BaseFilterImpl_QueryFilterInfo, BaseFilterImpl_JoinFilterGraph, BaseFilterImpl_QueryVendorInfo @@ -224,6 +224,8 @@ static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
HRESULT NullRenderer_create(IUnknown *pUnkOuter, void **ppv) { + static const WCHAR sink_name[] = {'I','n',0}; + HRESULT hr; NullRendererImpl *pNullRenderer;
@@ -240,9 +242,9 @@ HRESULT NullRenderer_create(IUnknown *pUnkOuter, void **ppv) else pNullRenderer->outer_unk = &pNullRenderer->IUnknown_inner;
- hr = BaseRenderer_Init(&pNullRenderer->renderer, &NullRenderer_Vtbl, pUnkOuter, - &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), - &RendererFuncTable); + hr = strmbase_renderer_init(&pNullRenderer->renderer, &NullRenderer_Vtbl, pUnkOuter, + &CLSID_NullRenderer, sink_name, + (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), &RendererFuncTable);
if (FAILED(hr)) { diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 61f08f5156..1646e3fe0c 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -780,7 +780,7 @@ static const IBaseFilterVtbl VideoRenderer_Vtbl = BaseRendererImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, BaseFilterImpl_EnumPins, - BaseRendererImpl_FindPin, + BaseFilterImpl_FindPin, BaseFilterImpl_QueryFilterInfo, BaseFilterImpl_JoinFilterGraph, BaseFilterImpl_QueryVendorInfo @@ -1017,6 +1017,7 @@ static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
HRESULT VideoRenderer_create(IUnknown *pUnkOuter, void **ppv) { + static const WCHAR sink_name[] = {'I','n',0}; HRESULT hr; VideoRendererImpl * pVideoRenderer;
@@ -1039,9 +1040,9 @@ HRESULT VideoRenderer_create(IUnknown *pUnkOuter, void **ppv) else pVideoRenderer->outer_unk = &pVideoRenderer->IUnknown_inner;
- hr = BaseRenderer_Init(&pVideoRenderer->renderer, &VideoRenderer_Vtbl, pUnkOuter, - &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), - &BaseFuncTable); + hr = strmbase_renderer_init(&pVideoRenderer->renderer, &VideoRenderer_Vtbl, + pUnkOuter, &CLSID_VideoRenderer, sink_name, + (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
if (FAILED(hr)) goto fail; diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 5aa9799c71..de30049fdc 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -935,7 +935,7 @@ static const IBaseFilterVtbl VMR_Vtbl = BaseRendererImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, BaseFilterImpl_EnumPins, - BaseRendererImpl_FindPin, + BaseFilterImpl_FindPin, BaseFilterImpl_QueryFilterInfo, BaseFilterImpl_JoinFilterGraph, BaseFilterImpl_QueryVendorInfo @@ -2368,6 +2368,8 @@ static const IVMRSurfaceAllocatorNotify9Vtbl VMR9_SurfaceAllocatorNotify_Vtbl =
static HRESULT vmr_create(IUnknown *outer_unk, LPVOID *ppv, const CLSID *clsid) { + static const WCHAR sink_name[] = {'V','M','R',' ','I','n','p','u','t','0',0}; + HRESULT hr; struct quartz_vmr* pVMR;
@@ -2409,11 +2411,13 @@ static HRESULT vmr_create(IUnknown *outer_unk, LPVOID *ppv, const CLSID *clsid) pVMR->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl;
if (IsEqualGUID(clsid, &CLSID_VideoMixingRenderer)) - hr = BaseRenderer_Init(&pVMR->renderer, &VMR_Vtbl, outer_unk, &CLSID_VideoMixingRenderer, - (DWORD_PTR)(__FILE__ ": VMR7Impl.csFilter"), &BaseFuncTable); + hr = strmbase_renderer_init(&pVMR->renderer, &VMR_Vtbl, outer_unk, + &CLSID_VideoMixingRenderer, sink_name, + (DWORD_PTR)(__FILE__ ": VMR7Impl.csFilter"), &BaseFuncTable); else - hr = BaseRenderer_Init(&pVMR->renderer, &VMR_Vtbl, outer_unk, &CLSID_VideoMixingRenderer9, - (DWORD_PTR)(__FILE__ ": VMR9Impl.csFilter"), &BaseFuncTable); + hr = strmbase_renderer_init(&pVMR->renderer, &VMR_Vtbl, outer_unk, + &CLSID_VideoMixingRenderer9, sink_name, + (DWORD_PTR)(__FILE__ ": VMR9Impl.csFilter"), &BaseFuncTable);
if (FAILED(hr)) goto fail; diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 3d5e4b5e7d..499bc2bad4 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -30,9 +30,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
-static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0}; -static const WCHAR wcsAltInputPinName[] = {'I','n',0}; - static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface ) { return CONTAINING_RECORD(iface, BaseInputPin, pin.IPin_iface); @@ -238,8 +235,9 @@ static const BaseInputPinFuncTable input_BaseInputFuncTable = { };
-HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtbl, IUnknown *pUnkOuter, const CLSID *pClsid, - DWORD_PTR DebugInfo, const BaseRendererFuncTable* pBaseFuncsTable) +HRESULT WINAPI strmbase_renderer_init(BaseRenderer *This, const IBaseFilterVtbl *Vtbl, + IUnknown *pUnkOuter, const CLSID *pClsid, const WCHAR *sink_name, DWORD_PTR DebugInfo, + const BaseRendererFuncTable *pBaseFuncsTable) { PIN_INFO piInput; HRESULT hr; @@ -251,7 +249,7 @@ HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtb /* construct input pin */ piInput.dir = PINDIR_INPUT; piInput.pFilter = &This->filter.IBaseFilter_iface; - lstrcpynW(piInput.achName, wcsInputPinName, ARRAY_SIZE(piInput.achName)); + lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName));
hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin); @@ -419,25 +417,6 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp return hr; }
-HRESULT WINAPI BaseRendererImpl_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin) -{ - BaseRenderer *This = impl_from_IBaseFilter(iface); - - TRACE("(%p)->(%s,%p)\n", This, debugstr_w(Id), ppPin); - - if (!Id || !ppPin) - return E_POINTER; - - if (!lstrcmpiW(Id,wcsInputPinName) || !lstrcmpiW(Id,wcsAltInputPinName)) - { - *ppPin = &This->pInputPin->pin.IPin_iface; - IPin_AddRef(*ppPin); - return S_OK; - } - *ppPin = NULL; - return VFW_E_NOT_FOUND; -} - HRESULT WINAPI BaseRendererImpl_Stop(IBaseFilter * iface) { BaseRenderer *This = impl_from_IBaseFilter(iface); diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index a3890ae8e7..afe06df01b 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -634,7 +634,6 @@ typedef struct BaseRendererFuncTable { HRESULT WINAPI BaseRendererImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv); ULONG WINAPI BaseRendererImpl_Release(IBaseFilter * iface); HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSample); -HRESULT WINAPI BaseRendererImpl_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin); HRESULT WINAPI BaseRendererImpl_Stop(IBaseFilter * iface); HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart); HRESULT WINAPI BaseRendererImpl_Pause(IBaseFilter * iface); @@ -645,7 +644,9 @@ HRESULT WINAPI BaseRendererImpl_BeginFlush(BaseRenderer* iface); HRESULT WINAPI BaseRendererImpl_EndFlush(BaseRenderer* iface); HRESULT WINAPI BaseRendererImpl_ClearPendingSample(BaseRenderer *iface);
-HRESULT WINAPI BaseRenderer_Init(BaseRenderer *This, const IBaseFilterVtbl *Vtbl, IUnknown *pUnkOuter, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseRendererFuncTable* pBaseFuncsTable); +HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtbl *vtbl, + IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, DWORD_PTR debug_info, + const BaseRendererFuncTable *func_table);
#ifdef __IBasicAudio_FWD_DEFINED__ typedef struct tagBasicAudio
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index aa24d330ca..37b9dfa219 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -26,6 +26,8 @@ #include "amaudio.h" #include "wine/test.h"
+static const WCHAR sink_id[] = {'A','u','d','i','o',' ','I','n','p','u','t',' ','p','i','n',' ','(','r','e','n','d','e','r','e','d',')',0}; + static IBaseFilter *create_dsound_render(void) { IBaseFilter *filter = NULL; @@ -243,6 +245,39 @@ todo_wine ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_find_pin(void) +{ + static const WCHAR inW[] = {'I','n',0}; + static const WCHAR input_pinW[] = {'i','n','p','u','t',' ','p','i','n',0}; + IBaseFilter *filter = create_dsound_render(); + IEnumPins *enum_pins; + IPin *pin, *pin2; + HRESULT hr; + ULONG ref; + + hr = IBaseFilter_FindPin(filter, inW, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, input_pinW, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, sink_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + 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); + ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin); + IPin_Release(pin); + IPin_Release(pin2); + + IEnumPins_Release(enum_pins); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_pin(IPin *pin) { IMemInputPin *mpin = NULL; @@ -320,6 +355,7 @@ START_TEST(dsoundrender) test_property_bag(); test_interfaces(); test_enum_pins(); + test_find_pin(); test_basefilter();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index 37b9dfa219..28166e56a3 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -278,6 +278,51 @@ static void test_find_pin(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_pin_info(void) +{ + IBaseFilter *filter = create_dsound_render(); + PIN_DIRECTION dir; + PIN_INFO info; + HRESULT hr; + WCHAR *id; + ULONG ref; + IPin *pin; + + hr = IBaseFilter_FindPin(filter, sink_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + todo_wine ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pin); + ok(ref == 2, "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_id), "Got name %s.\n", wine_dbgstr_w(info.achName)); + ref = get_refcount(filter); + todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pin); + todo_wine ok(ref == 3, "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_id), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, NULL); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IPin_Release(pin); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_pin(IPin *pin) { IMemInputPin *mpin = NULL; @@ -356,6 +401,7 @@ START_TEST(dsoundrender) test_interfaces(); test_enum_pins(); test_find_pin(); + test_pin_info(); test_basefilter();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index 28166e56a3..0d48bec879 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -129,6 +129,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO static void test_interfaces(void) { IBaseFilter *filter = create_dsound_render(); + IPin *pin;
check_interface(filter, &IID_IAMDirectSound, TRUE); check_interface(filter, &IID_IBaseFilter, TRUE); @@ -150,6 +151,18 @@ static void test_interfaces(void) check_interface(filter, &IID_IQualProp, FALSE); check_interface(filter, &IID_IVideoWindow, FALSE);
+ IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IAsyncReader, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); IBaseFilter_Release(filter); }