Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/samplegrabber.c | 78 ++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 28 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index c788fb20fb..e66a000af4 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -794,8 +794,30 @@ SampleGrabber_IMemInputPin_ReceiveCanBlock(IMemInputPin *iface) return This->memOutput ? IMemInputPin_ReceiveCanBlock(This->memOutput) : S_OK; }
+static HRESULT WINAPI sample_grabber_sink_QueryInterface(IPin *iface, REFIID iid, void **out) +{ + SG_Pin *pin = impl_from_IPin(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IPin)) + { + *out = iface; + } + else if (IsEqualGUID(iid, &IID_IMemInputPin)) + { + *out = &pin->sg->IMemInputPin_iface; + } + else + { + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; + }
-/* SampleGrabber member pin implementation */ + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +}
/* IUnknown */ static ULONG WINAPI @@ -813,31 +835,6 @@ SampleGrabber_IPin_Release(IPin *iface) return ISampleGrabber_Release(&This->sg->ISampleGrabber_iface); }
-/* IUnknown */ -static HRESULT WINAPI -SampleGrabber_IPin_QueryInterface(IPin *iface, REFIID riid, void **ppv) -{ - SG_Pin *This = impl_from_IPin(iface); - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); - - *ppv = NULL; - if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) - *ppv = iface; - else if (IsEqualIID(riid, &IID_IMemInputPin)) - *ppv = &This->sg->IMemInputPin_iface; - else if (IsEqualIID(riid, &IID_IMediaSeeking)) - return IUnknown_QueryInterface(This->sg->seekthru_unk, riid, ppv); - else if (IsEqualIID(riid, &IID_IMediaPosition)) - return IUnknown_QueryInterface(This->sg->seekthru_unk, riid, ppv); - else { - WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv); - return E_NOINTERFACE; - } - - IUnknown_AddRef((IUnknown*)*ppv); - return S_OK; -} - /* IPin - input pin */ static HRESULT WINAPI SampleGrabber_In_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE *mtype) @@ -1202,7 +1199,7 @@ static const IMemInputPinVtbl IMemInputPin_VTable =
static const IPinVtbl IPin_In_VTable = { - SampleGrabber_IPin_QueryInterface, + sample_grabber_sink_QueryInterface, SampleGrabber_IPin_AddRef, SampleGrabber_IPin_Release, SampleGrabber_In_IPin_Connect, @@ -1222,9 +1219,34 @@ static const IPinVtbl IPin_In_VTable = SampleGrabber_IPin_NewSegment, };
+static HRESULT WINAPI sample_grabber_source_QueryInterface(IPin *iface, REFIID iid, void **out) +{ + SG_Pin *pin = impl_from_IPin(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IPin)) + { + *out = iface; + } + else if (IsEqualGUID(iid, &IID_IMediaPosition) || IsEqualGUID(iid, &IID_IMediaSeeking)) + { + return IUnknown_QueryInterface(pin->sg->seekthru_unk, iid, out); + } + else + { + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + static const IPinVtbl IPin_Out_VTable = { - SampleGrabber_IPin_QueryInterface, + sample_grabber_source_QueryInterface, SampleGrabber_IPin_AddRef, SampleGrabber_IPin_Release, SampleGrabber_Out_IPin_Connect,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/tests/samplegrabber.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index 5e4ee6e75b..04b63d3b9e 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -71,7 +71,10 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO static void test_interfaces(void) { IBaseFilter *filter = create_sample_grabber(); + IUnknown *unk; + HRESULT hr; ULONG ref; + IPin *pin;
check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IMediaFilter, TRUE); @@ -94,6 +97,39 @@ static void test_interfaces(void) check_interface(filter, &IID_ISeekingPassThru, 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_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, source_id, &pin); + + /* Queries for IMediaPosition or IMediaSeeking do not seem to increase the + * reference count. */ + hr = IPin_QueryInterface(pin, &IID_IMediaPosition, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IUnknown_Release(unk); + hr = IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IUnknown_Release(unk); + 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); + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMemInputPin, FALSE); + + IPin_Release(pin); + ref = IBaseFilter_Release(filter); ok(!ref, "Got unexpected refcount %d.\n", ref); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50980
Your paranoid android.
=== w2008s64 (32 bit report) ===
qedit: samplegrabber.c:36: Test failed: Got hr 0x80040154. 0b40:samplegrabber: unhandled exception c0000005 at 00403471
=== w2008s64 (64 bit report) ===
qedit: samplegrabber.c:36: Test failed: Got hr 0x80040154. 052c:samplegrabber: unhandled exception c0000005 at 0000000000402F2A
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/tests/mediadet.c | 148 ++++++++++++++++++------------- dlls/qedit/tests/samplegrabber.c | 95 ++++++++++++++++++++ dlls/qedit/tests/timeline.c | 108 +++++++++++++++++++++- 3 files changed, 288 insertions(+), 63 deletions(-)
diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index fd6004ecdb..62685af2c9 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -30,46 +30,106 @@ #include "control.h" #include "rc.h"
-/* Outer IUnknown for COM aggregation tests */ -struct unk_impl { - IUnknown IUnknown_iface; - LONG ref; - IUnknown *inner_unk; -}; - -static inline struct unk_impl *impl_from_IUnknown(IUnknown *iface) +static ULONG get_refcount(void *iface) { - return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface); + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); }
-static HRESULT WINAPI unk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) -{ - struct unk_impl *This = impl_from_IUnknown(iface); +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1;
- return IUnknown_QueryInterface(This->inner_unk, riid, ppv); +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IMediaDet) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; }
-static ULONG WINAPI unk_AddRef(IUnknown *iface) +static ULONG WINAPI outer_AddRef(IUnknown *iface) { - struct unk_impl *This = impl_from_IUnknown(iface); - - return InterlockedIncrement(&This->ref); + return InterlockedIncrement(&outer_ref); }
-static ULONG WINAPI unk_Release(IUnknown *iface) +static ULONG WINAPI outer_Release(IUnknown *iface) { - struct unk_impl *This = impl_from_IUnknown(iface); - - return InterlockedDecrement(&This->ref); + return InterlockedDecrement(&outer_ref); }
-static const IUnknownVtbl unk_vtbl = +static const IUnknownVtbl outer_vtbl = { - unk_QueryInterface, - unk_AddRef, - unk_Release + outer_QueryInterface, + outer_AddRef, + outer_Release, };
+static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IMediaDet *detector, *detector2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + detector = (IMediaDet *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_MediaDet, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IMediaDet, (void **)&detector); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!detector, "Got interface %p.\n", detector); + + hr = CoCreateInstance(&CLSID_MediaDet, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IMediaDet, (void **)&detector); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaDet_QueryInterface(detector, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IMediaDet_QueryInterface(detector, &IID_IMediaDet, (void **)&detector2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(detector2 == (IMediaDet *)0xdeadbeef, "Got unexpected IMediaDet %p.\n", detector2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IMediaDet_QueryInterface(detector, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IMediaDet_Release(detector); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +}
static WCHAR test_avi_filename[MAX_PATH]; static WCHAR test_sound_avi_filename[MAX_PATH]; @@ -131,9 +191,7 @@ static BOOL init_tests(void) static void test_mediadet(void) { HRESULT hr; - struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL}; IMediaDet *pM = NULL; - ULONG refcount; BSTR filename = NULL; LONG nstrms = 0; LONG strm; @@ -142,22 +200,6 @@ static void test_mediadet(void) int flags; int i;
- /* COM aggregation */ - hr = CoCreateInstance(&CLSID_MediaDet, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (void**)&unk_obj.inner_unk); - ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr); - - hr = IUnknown_QueryInterface(unk_obj.inner_unk, &IID_IMediaDet, (void**)&pM); - ok(hr == S_OK, "QueryInterface for IID_IMediaDet failed: %08x\n", hr); - refcount = IMediaDet_AddRef(pM); - ok(refcount == unk_obj.ref, "MediaDet just pretends to support COM aggregation\n"); - refcount = IMediaDet_Release(pM); - ok(refcount == unk_obj.ref, "MediaDet just pretends to support COM aggregation\n"); - refcount = IMediaDet_Release(pM); - ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount); - - IUnknown_Release(unk_obj.inner_unk); - /* test.avi has one video stream. */ hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaDet, (LPVOID*)&pM); @@ -523,31 +565,14 @@ static ISampleGrabberCB my_sg_cb = { &sgcb_vt };
static void test_samplegrabber(void) { - struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL}; ISampleGrabber *sg; IBaseFilter *bf; IPin *pin; IMemInputPin *inpin; IEnumPins *pins; - ULONG refcount; HRESULT hr; FILTER_STATE fstate;
- /* COM aggregation */ - hr = CoCreateInstance(&CLSID_SampleGrabber, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (void**)&unk_obj.inner_unk); - ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr); - - hr = IUnknown_QueryInterface(unk_obj.inner_unk, &IID_ISampleGrabber, (void**)&sg); - ok(hr == S_OK, "QueryInterface for IID_ISampleGrabber failed: %08x\n", hr); - refcount = ISampleGrabber_AddRef(sg); - ok(refcount == unk_obj.ref, "SampleGrabber just pretends to support COM aggregation\n"); - refcount = ISampleGrabber_Release(sg); - ok(refcount == unk_obj.ref, "SampleGrabber just pretends to support COM aggregation\n"); - refcount = ISampleGrabber_Release(sg); - ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount); - IUnknown_Release(unk_obj.inner_unk); - /* Invalid RIID */ hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory, (void**)&sg); @@ -629,8 +654,11 @@ START_TEST(mediadet) }
CoInitialize(NULL); + + test_aggregation(); test_mediadet(); test_samplegrabber(); test_COM_sg_enumpins(); + CoUninitialize(); } diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index 04b63d3b9e..76fdfbb8f8 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -355,6 +355,100 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IBaseFilter) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IBaseFilter *filter, *filter2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + filter = (IBaseFilter *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_SampleGrabber, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!filter, "Got interface %p.\n", filter); + + hr = CoCreateInstance(&CLSID_SampleGrabber, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IBaseFilter_Release(filter); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +} + START_TEST(samplegrabber) { CoInitialize(NULL); @@ -363,6 +457,7 @@ START_TEST(samplegrabber) test_enum_pins(); test_find_pin(); test_pin_info(); + test_aggregation();
CoUninitialize(); } diff --git a/dlls/qedit/tests/timeline.c b/dlls/qedit/tests/timeline.c index 94c018e0fb..a1e38e058f 100644 --- a/dlls/qedit/tests/timeline.c +++ b/dlls/qedit/tests/timeline.c @@ -19,10 +19,109 @@ */
#define COBJMACROS -#define CONST_VTABLE - -#include "wine/test.h" #include "qedit.h" +#include "wine/test.h" + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IAMTimeline) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IAMTimeline *timeline, *timeline2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + timeline = (IAMTimeline *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_AMTimeline, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IAMTimeline, (void **)&timeline); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!timeline, "Got interface %p.\n", timeline); + + hr = CoCreateInstance(&CLSID_AMTimeline, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IAMTimeline, (void **)&timeline); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMTimeline_QueryInterface(timeline, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IAMTimeline_QueryInterface(timeline, &IID_IAMTimeline, (void **)&timeline2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(timeline2 == (IAMTimeline *)0xdeadbeef, "Got unexpected IAMTimeline %p.\n", timeline2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IAMTimeline_QueryInterface(timeline, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IAMTimeline_Release(timeline); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +}
static void test_timeline(void) { @@ -148,7 +247,10 @@ static void test_timelineobj_interfaces(void) START_TEST(timeline) { CoInitialize(NULL); + + test_aggregation(); test_timeline(); test_timelineobj_interfaces(); + CoUninitialize(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50981
Your paranoid android.
=== w2008s64 (32 bit report) ===
qedit: mediadet.c:85: Test failed: Got hr 0x80040154. mediadet.c:90: Test failed: Got hr 0x80040154. 052c:mediadet: unhandled exception c0000005 at 00401C22
=== w2008s64 (64 bit report) ===
qedit: mediadet.c:85: Test failed: Got hr 0x80040154. mediadet.c:90: Test failed: Got hr 0x80040154. 052c:mediadet: unhandled exception c0000005 at 0000000000401BFC
=== w2008s64 (32 bit report) ===
qedit: samplegrabber.c:36: Test failed: Got hr 0x80040154. 052c:samplegrabber: unhandled exception c0000005 at 00403781
=== w2008s64 (64 bit report) ===
qedit: samplegrabber.c:36: Test failed: Got hr 0x80040154. 052c:samplegrabber: unhandled exception c0000005 at 000000000040323A
=== w2008s64 (32 bit report) ===
qedit: timeline.c:77: Test failed: Got hr 0x80040154. timeline.c:82: Test failed: Got hr 0x80040154. 01a8:timeline: unhandled exception c0000005 at 00405E2D
=== w2008s64 (64 bit report) ===
qedit: timeline.c:77: Test failed: Got hr 0x80040154. timeline.c:82: Test failed: Got hr 0x80040154. 052c:timeline: unhandled exception c0000005 at 0000000000405343
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/main.c | 2 +- dlls/qedit/tests/mediadet.c | 2 +- dlls/qedit/tests/samplegrabber.c | 2 +- dlls/qedit/tests/timeline.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/qedit/main.c b/dlls/qedit/main.c index a46f3f02e5..578e9df2e7 100644 --- a/dlls/qedit/main.c +++ b/dlls/qedit/main.c @@ -106,7 +106,7 @@ static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter
*ppobj = NULL; if (pOuter && !IsEqualGUID(&IID_IUnknown, riid)) - return E_INVALIDARG; + return E_NOINTERFACE;
hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk); if (SUCCEEDED(hres)) { diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index 62685af2c9..34c43fd295 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -82,7 +82,7 @@ static void test_aggregation(void) detector = (IMediaDet *)0xdeadbeef; hr = CoCreateInstance(&CLSID_MediaDet, &test_outer, CLSCTX_INPROC_SERVER, &IID_IMediaDet, (void **)&detector); - todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); ok(!detector, "Got interface %p.\n", detector);
hr = CoCreateInstance(&CLSID_MediaDet, &test_outer, CLSCTX_INPROC_SERVER, diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index 76fdfbb8f8..22f6ddb673 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -400,7 +400,7 @@ static void test_aggregation(void) filter = (IBaseFilter *)0xdeadbeef; hr = CoCreateInstance(&CLSID_SampleGrabber, &test_outer, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter); - todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); ok(!filter, "Got interface %p.\n", filter);
hr = CoCreateInstance(&CLSID_SampleGrabber, &test_outer, CLSCTX_INPROC_SERVER, diff --git a/dlls/qedit/tests/timeline.c b/dlls/qedit/tests/timeline.c index a1e38e058f..9e24062a9d 100644 --- a/dlls/qedit/tests/timeline.c +++ b/dlls/qedit/tests/timeline.c @@ -74,7 +74,7 @@ static void test_aggregation(void) timeline = (IAMTimeline *)0xdeadbeef; hr = CoCreateInstance(&CLSID_AMTimeline, &test_outer, CLSCTX_INPROC_SERVER, &IID_IAMTimeline, (void **)&timeline); - todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); ok(!timeline, "Got interface %p.\n", timeline);
hr = CoCreateInstance(&CLSID_AMTimeline, &test_outer, CLSCTX_INPROC_SERVER,
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50982
Your paranoid android.
=== w2008s64 (32 bit report) ===
qedit: mediadet.c:85: Test failed: Got hr 0x80040154. mediadet.c:90: Test failed: Got hr 0x80040154. 01a8:mediadet: unhandled exception c0000005 at 00401BEA
=== w2008s64 (64 bit report) ===
qedit: mediadet.c:85: Test failed: Got hr 0x80040154. mediadet.c:90: Test failed: Got hr 0x80040154. 0460:mediadet: unhandled exception c0000005 at 0000000000401BB4
=== w2008s64 (32 bit report) ===
qedit: samplegrabber.c:36: Test failed: Got hr 0x80040154. 01a8:samplegrabber: unhandled exception c0000005 at 00403751
=== w2008s64 (64 bit report) ===
qedit: samplegrabber.c:36: Test failed: Got hr 0x80040154. 052c:samplegrabber: unhandled exception c0000005 at 00000000004031FA
=== w2008s64 (32 bit report) ===
qedit: timeline.c:77: Test failed: Got hr 0x80040154. timeline.c:82: Test failed: Got hr 0x80040154. 01a8:timeline: unhandled exception c0000005 at 00405D8D
=== w2008s64 (64 bit report) ===
qedit: timeline.c:77: Test failed: Got hr 0x80040154. timeline.c:82: Test failed: Got hr 0x80040154. 052c:timeline: unhandled exception c0000005 at 000000000040529A
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/Makefile.in | 1 + dlls/qedit/main.c | 1 + dlls/{quartz => qedit}/nullrenderer.c | 25 ++++++------------------- dlls/qedit/qedit_classes.idl | 7 +++++++ dlls/qedit/qedit_private.h | 1 + dlls/quartz/Makefile.in | 1 - dlls/quartz/main.c | 1 - dlls/quartz/quartz_private.h | 1 - dlls/quartz/quartz_strmif.idl | 7 ------- 9 files changed, 16 insertions(+), 29 deletions(-) rename dlls/{quartz => qedit}/nullrenderer.c (93%)
diff --git a/dlls/qedit/Makefile.in b/dlls/qedit/Makefile.in index 35ec0e35be..b47ee260ab 100644 --- a/dlls/qedit/Makefile.in +++ b/dlls/qedit/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = strmiids strmbase uuid oleaut32 ole32 advapi32 C_SRCS = \ main.c \ mediadet.c \ + nullrenderer.c \ samplegrabber.c \ timeline.c
diff --git a/dlls/qedit/main.c b/dlls/qedit/main.c index 578e9df2e7..a271f9adb7 100644 --- a/dlls/qedit/main.c +++ b/dlls/qedit/main.c @@ -60,6 +60,7 @@ static const struct object_creation_info object_creation[] = { { &CLSID_AMTimeline, AMTimeline_create }, { &CLSID_MediaDet, MediaDet_create }, + { &CLSID_NullRenderer, NullRenderer_create }, { &CLSID_SampleGrabber, SampleGrabber_create }, };
diff --git a/dlls/quartz/nullrenderer.c b/dlls/qedit/nullrenderer.c similarity index 93% rename from dlls/quartz/nullrenderer.c rename to dlls/qedit/nullrenderer.c index b78619c0b2..7ab28676bb 100644 --- a/dlls/quartz/nullrenderer.c +++ b/dlls/qedit/nullrenderer.c @@ -1,5 +1,5 @@ /* - * Null Renderer (Promiscuous, not rendering anything at all!) + * Null renderer filter * * Copyright 2004 Christian Costa * Copyright 2008 Maarten Lankhorst @@ -19,25 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" - -#include "quartz_private.h" -#include "pin.h" - -#include "uuids.h" -#include "vfwmsgs.h" -#include "amvideo.h" -#include "windef.h" -#include "winbase.h" +#define COBJMACROS #include "dshow.h" -#include "evcode.h" -#include "strmif.h" -#include "ddraw.h" - -#include "wine/unicode.h" #include "wine/debug.h" +#include "wine/strmbase.h"
-WINE_DEFAULT_DEBUG_CHANNEL(quartz); +WINE_DEFAULT_DEBUG_CHANNEL(qedit);
typedef struct NullRendererImpl { @@ -89,7 +76,7 @@ static HRESULT WINAPI NullRendererInner_QueryInterface(IUnknown *iface, REFIID r { NullRendererImpl *This = impl_from_IUnknown(iface);
- TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv); + TRACE("filter %p, iid %s, out %p.\n", This, debugstr_guid(riid), ppv);
*ppv = NULL;
@@ -112,7 +99,7 @@ static HRESULT WINAPI NullRendererInner_QueryInterface(IUnknown *iface, REFIID r }
if (!IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow)) - FIXME("No interface for %s!\n", qzdebugstr_guid(riid)); + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
return E_NOINTERFACE; } diff --git a/dlls/qedit/qedit_classes.idl b/dlls/qedit/qedit_classes.idl index 7dca0f125b..35a5abd3f5 100644 --- a/dlls/qedit/qedit_classes.idl +++ b/dlls/qedit/qedit_classes.idl @@ -32,6 +32,13 @@ coclass AMTimeline { interface IAMTimeline; interface IPersistStream; interface ] coclass MediaDet { interface IMediaDet; }
+[ + helpstring("Null Renderer"), + threading(both), + uuid(c1f400a4-3f08-11d3-9f0b-006008039e37) +] +coclass NullRenderer { interface IBaseFilter; } + [ helpstring("Sample Grabber"), threading(both), diff --git a/dlls/qedit/qedit_private.h b/dlls/qedit/qedit_private.h index 708c53d7de..344656d7d8 100644 --- a/dlls/qedit/qedit_private.h +++ b/dlls/qedit/qedit_private.h @@ -34,6 +34,7 @@
HRESULT AMTimeline_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; +HRESULT NullRenderer_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
#endif /* __QEDIT_PRIVATE_INCLUDED__ */ diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index 147d395ab9..efd96dbb1c 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -16,7 +16,6 @@ C_SRCS = \ main.c \ memallocator.c \ mpegsplit.c \ - nullrenderer.c \ parser.c \ pin.c \ regsvr.c \ diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 4575c6ee54..08287a75eb 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -74,7 +74,6 @@ static const struct object_creation_info object_creation[] = { &CLSID_AviSplitter, AVISplitter_create }, { &CLSID_MPEG1Splitter, MPEGSplitter_create }, { &CLSID_VideoRenderer, VideoRenderer_create }, - { &CLSID_NullRenderer, NullRenderer_create }, { &CLSID_VideoMixingRenderer, VMR7Impl_create }, { &CLSID_VideoMixingRenderer9, VMR9Impl_create }, { &CLSID_VideoRendererDefault, VideoRendererDefault_create }, diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 2104f806f7..8d4b6a3c87 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -59,7 +59,6 @@ HRESULT MPEGSplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; -HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; diff --git a/dlls/quartz/quartz_strmif.idl b/dlls/quartz/quartz_strmif.idl index 44dc668ae5..ab1af89ac4 100644 --- a/dlls/quartz/quartz_strmif.idl +++ b/dlls/quartz/quartz_strmif.idl @@ -119,13 +119,6 @@ coclass DSoundRender { interface IBaseFilter; } ] coclass AudioRender { interface IBaseFilter; }
-[ - helpstring("Null Renderer"), - threading(both), - uuid(c1f400a4-3f08-11d3-9f0b-006008039e37) -] -coclass NullRenderer { interface IBaseFilter; } - [ helpstring("Video Renderer"), threading(both),
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50983
Your paranoid android.
=== debian9 (32 bit report) ===
quartz: avisplit.c:683: Test failed: Could not create null renderer: 80040111 Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004069ef). misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL
Report errors: quartz:avisplit crashed (c0000005)
=== debian9 (32 bit Chinese:China report) ===
quartz: avisplit.c:683: Test failed: Could not create null renderer: 80040111 Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004069ef). misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL
Report errors: quartz:avisplit crashed (c0000005)
=== debian9 (32 bit WoW report) ===
quartz: avisplit.c:683: Test failed: Could not create null renderer: 80040111 Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004069ef). misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL
Report errors: quartz:avisplit crashed (c0000005)
=== debian9 (64 bit WoW report) ===
quartz: avisplit.c:683: Test failed: Could not create null renderer: 80040111 Unhandled exception: page fault on read access to 0x00000000 in 64-bit code (0x0000000000405c08). misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL misc.c:77: Test failed: CoCreateInstance returned 80040111 misc.c:83: Test failed: CoCreateInstance returned 80040111 misc.c:84: Test failed: pUnkInner is NULL
Report errors: quartz:avisplit crashed (c0000005)