Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 110693185fd..decea5d94cb 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -2915,6 +2915,37 @@ todo_wine ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer); ok(source_pin.mt == &mt, "Got mt %p.\n", source_pin.mt); ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer); + hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Test Reconnect[Ex](). */ + + hr = IFilterGraph2_Reconnect(graph, &source_pin.IPin_iface); + ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + hr = IFilterGraph2_Reconnect(graph, &sink_pin.IPin_iface); + ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_Reconnect(graph, &source_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer); + ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt); + ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer); + hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + sink_pin.peer = &source_pin.IPin_iface; + IPin_AddRef(sink_pin.peer); + hr = IFilterGraph2_Reconnect(graph, &sink_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer); + ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt); + ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer); + hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr);
/* ConnectDirect() protects against cyclical connections. */ hr = IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL); @@ -2953,6 +2984,8 @@ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
/* Both pins are disconnected when a filter is removed. */ + hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); sink_pin.peer = &source_pin.IPin_iface; IPin_AddRef(sink_pin.peer); hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filtergraph.c | 54 +++++++++++++++------------------ dlls/quartz/tests/filtergraph.c | 25 +++++++++++++++ 2 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 21c60267311..fde793e6dcb 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -996,33 +996,13 @@ static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface, IPin *ppi return hr; }
-static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface, IPin *ppin) +static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface, IPin *pin) { - IFilterGraphImpl *This = impl_from_IFilterGraph2(iface); - IPin *pConnectedTo = NULL; - HRESULT hr; - PIN_DIRECTION pindir; - - IPin_QueryDirection(ppin, &pindir); - hr = IPin_ConnectedTo(ppin, &pConnectedTo); + IFilterGraphImpl *graph = impl_from_IFilterGraph2(iface);
- TRACE("(%p/%p)->(%p) -- %p\n", This, iface, ppin, pConnectedTo); + TRACE("graph %p, pin %p.\n", graph, pin);
- if (FAILED(hr)) { - TRACE("Querying connected to failed: %x\n", hr); - return hr; - } - IPin_Disconnect(ppin); - IPin_Disconnect(pConnectedTo); - if (pindir == PINDIR_INPUT) - hr = IFilterGraph2_ConnectDirect(iface, pConnectedTo, ppin, NULL); - else - hr = IFilterGraph2_ConnectDirect(iface, ppin, pConnectedTo, NULL); - IPin_Release(pConnectedTo); - if (FAILED(hr)) - WARN("Reconnecting pins failed, pins are not connected now..\n"); - TRACE("-> %08x\n", hr); - return hr; + return IFilterGraph2_ReconnectEx(iface, pin, NULL); }
static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface, IPin *ppin) @@ -1950,15 +1930,29 @@ static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *ifac return S_OK; }
-static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface, IPin *ppin, - const AM_MEDIA_TYPE *pmt) +static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface, IPin *pin, const AM_MEDIA_TYPE *mt) { - IFilterGraphImpl *This = impl_from_IFilterGraph2(iface); + IFilterGraphImpl *graph = impl_from_IFilterGraph2(iface); + PIN_DIRECTION dir; + HRESULT hr; + IPin *peer;
- TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt); - strmbase_dump_media_type(pmt); + TRACE("graph %p, pin %p, mt %p.\n", graph, pin, mt);
- return S_OK; + if (FAILED(hr = IPin_ConnectedTo(pin, &peer))) + return hr; + + IPin_QueryDirection(pin, &dir); + IFilterGraph2_Disconnect(iface, peer); + IFilterGraph2_Disconnect(iface, pin); + + if (dir == PINDIR_INPUT) + hr = IFilterGraph2_ConnectDirect(iface, peer, pin, mt); + else + hr = IFilterGraph2_ConnectDirect(iface, pin, peer, mt); + + IPin_Release(peer); + return hr; }
static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface, IPin *pPinOut, DWORD dwFlags, diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index decea5d94cb..5b913d828da 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -2947,6 +2947,31 @@ todo_wine hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, NULL); + ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + hr = IFilterGraph2_ReconnectEx(graph, &sink_pin.IPin_iface, NULL); + ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer); + ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt); + ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer); + hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer); + ok(source_pin.mt == &mt, "Got mt %p.\n", source_pin.mt); + ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer); + hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + /* ConnectDirect() protects against cyclical connections. */ hr = IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr);
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=64332
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/videorenderer.c | 21 ++++----------------- dlls/quartz/tests/vmr7.c | 21 ++++----------------- dlls/quartz/tests/vmr9.c | 22 ++++------------------ 3 files changed, 12 insertions(+), 52 deletions(-)
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 55a704f82ba..ce02977ff61 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -522,31 +522,18 @@ static HRESULT testsource_query_accept(struct strmbase_pin *iface, const AM_MEDI return S_OK; }
-static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface, +static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IPin *peer, const AM_MEDIA_TYPE *mt) { - HRESULT hr; - - iface->pin.peer = peer; - IPin_AddRef(peer); - CopyMediaType(&iface->pin.mt, mt); - - if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt))) - { - ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); - IPin_Release(peer); - iface->pin.peer = NULL; - FreeMediaType(&iface->pin.mt); - } - - return hr; + return S_OK; }
static const struct strmbase_source_ops testsource_ops = { .base.pin_query_accept = testsource_query_accept, .base.pin_get_media_type = strmbase_pin_get_media_type, - .pfnAttemptConnection = testsource_AttemptConnection, + .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, + .pfnDecideAllocator = testsource_DecideAllocator, };
static void testfilter_init(struct testfilter *filter) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 8a17bdcd19f..c4190b17712 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -872,31 +872,18 @@ static HRESULT testsource_query_accept(struct strmbase_pin *iface, const AM_MEDI return S_OK; }
-static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface, +static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IPin *peer, const AM_MEDIA_TYPE *mt) { - HRESULT hr; - - iface->pin.peer = peer; - IPin_AddRef(peer); - CopyMediaType(&iface->pin.mt, mt); - - if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt))) - { - ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); - IPin_Release(peer); - iface->pin.peer = NULL; - FreeMediaType(&iface->pin.mt); - } - - return hr; + return S_OK; }
static const struct strmbase_source_ops testsource_ops = { .base.pin_query_accept = testsource_query_accept, .base.pin_get_media_type = strmbase_pin_get_media_type, - .pfnAttemptConnection = testsource_AttemptConnection, + .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, + .pfnDecideAllocator = testsource_DecideAllocator, };
static void testfilter_init(struct testfilter *filter) diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index ed3f7cd38bb..3a3c8bf6554 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -876,32 +876,18 @@ static HRESULT testsource_query_accept(struct strmbase_pin *iface, const AM_MEDI return S_OK; }
-static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface, +static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IPin *peer, const AM_MEDIA_TYPE *mt) { - HRESULT hr; - - iface->pin.peer = peer; - IPin_AddRef(peer); - CopyMediaType(&iface->pin.mt, mt); - - if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt))) - { - todo_wine_if (((VIDEOINFOHEADER *)mt->pbFormat)->bmiHeader.biBitCount == 24) - ok(hr == VFW_E_TYPE_NOT_ACCEPTED || hr == E_FAIL, "Got hr %#x.\n", hr); - IPin_Release(peer); - iface->pin.peer = NULL; - FreeMediaType(&iface->pin.mt); - } - - return hr; + return S_OK; }
static const struct strmbase_source_ops testsource_ops = { .base.pin_query_accept = testsource_query_accept, .base.pin_get_media_type = strmbase_pin_get_media_type, - .pfnAttemptConnection = testsource_AttemptConnection, + .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, + .pfnDecideAllocator = testsource_DecideAllocator, };
static void testfilter_init(struct testfilter *filter)
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=64333
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filesource.c | 306 ++++++++++++++++++++++++++++++++- 1 file changed, 305 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index df0db1b3b53..3c8626b7399 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -21,6 +21,7 @@
#define COBJMACROS #include "dshow.h" +#include "wine/strmbase.h" #include "wine/test.h"
static IBaseFilter *create_file_source(void) @@ -32,6 +33,12 @@ static IBaseFilter *create_file_source(void) return filter; }
+static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b) +{ + return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat)) + && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat); +} + static WCHAR *load_resource(const WCHAR *name) { static WCHAR pathW[MAX_PATH]; @@ -380,8 +387,9 @@ static void test_file_source_filter(void) mt.bTemporalCompression = TRUE; mt.lSampleSize = 123; mt.formattype = FORMAT_VideoInfo; + mt.subtype = MEDIASUBTYPE_RGB32; hr = IPin_QueryAccept(pin, &mt); - ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
mt.majortype = MEDIATYPE_Video; hr = IPin_QueryAccept(pin, &mt); @@ -1197,6 +1205,301 @@ static void test_enum_media_types(void) ok(ret, "Failed to delete file, error %u.\n", GetLastError()); }
+struct testsink +{ + struct strmbase_filter filter; + struct strmbase_sink pin; + IAsyncReader *reader; + BOOL reject_avi; + const AM_MEDIA_TYPE *mt; +}; + +static inline struct testsink *impl_sink_from_strmbase_filter(struct strmbase_filter *iface) +{ + return CONTAINING_RECORD(iface, struct testsink, filter); +} + +static struct strmbase_pin *testsink_get_pin(struct strmbase_filter *iface, unsigned int index) +{ + struct testsink *filter = impl_sink_from_strmbase_filter(iface); + if (!index) + return &filter->pin.pin; + return NULL; +} + +static void testsink_destroy(struct strmbase_filter *iface) +{ + struct testsink *filter = impl_sink_from_strmbase_filter(iface); + strmbase_sink_cleanup(&filter->pin); + strmbase_filter_cleanup(&filter->filter); +} + +static const struct strmbase_filter_ops testsink_ops = +{ + .filter_get_pin = testsink_get_pin, + .filter_destroy = testsink_destroy, +}; + +static HRESULT testsink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt) +{ + return S_OK; +} + +static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) +{ + struct testsink *filter = impl_sink_from_strmbase_filter(iface->filter); + if (!index && filter->mt) + { + CopyMediaType(mt, filter->mt); + return S_OK; + } + return VFW_S_NO_MORE_ITEMS; +} + +static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt) +{ + struct testsink *filter = impl_sink_from_strmbase_filter(iface->pin.filter); + if (filter->reject_avi && IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_Avi)) + return VFW_E_TYPE_NOT_ACCEPTED; + IPin_QueryInterface(peer, &IID_IAsyncReader, (void **)&filter->reader); + return S_OK; +} + +static void testsink_disconnect(struct strmbase_sink *iface) +{ + struct testsink *filter = impl_sink_from_strmbase_filter(iface->pin.filter); + IAsyncReader_Release(filter->reader); + filter->reader = NULL; +} + +static const struct strmbase_sink_ops testsink_pin_ops = +{ + .base.pin_query_accept = testsink_query_accept, + .base.pin_get_media_type = testsink_get_media_type, + .sink_connect = testsink_connect, + .sink_disconnect = testsink_disconnect, +}; + +static void testsink_init(struct testsink *filter) +{ + static const GUID clsid = {0xabacab}; + memset(filter, 0, sizeof(*filter)); + strmbase_filter_init(&filter->filter, NULL, &clsid, &testsink_ops); + strmbase_sink_init(&filter->pin, &filter->filter, L"", &testsink_pin_ops, NULL); +} + +static void test_connect_pin(void) +{ + AM_MEDIA_TYPE req_mt = + { + .majortype = MEDIATYPE_Stream, + .subtype = MEDIASUBTYPE_Avi, + .formattype = FORMAT_None, + .lSampleSize = 888, + }; + const WCHAR *filename = load_resource(L"test.avi"); + IBaseFilter *filter = create_file_source(); + AM_MEDIA_TYPE mt, *source_mt; + struct testsink testsink; + IEnumMediaTypes *enummt; + IFilterGraph2 *graph; + IPin *source, *peer; + BYTE my_format = 1; + HRESULT hr; + ULONG ref; + BOOL ret; + + testsink_init(&testsink); + CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterGraph2, (void **)&graph); + IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink"); + IFilterGraph2_AddFilter(graph, filter, "file source"); + load_file(filter, filename); + IBaseFilter_FindPin(filter, L"Output", &source); + + IPin_EnumMediaTypes(source, &enummt); + IEnumMediaTypes_Next(enummt, 1, &source_mt, NULL); + IEnumMediaTypes_Release(enummt); + + peer = (IPin *)0xdeadbeef; + hr = IPin_ConnectedTo(source, &peer); + ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + ok(!peer, "Got peer %p.\n", peer); + + hr = IPin_ConnectionMediaType(source, &mt); + ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + /* Test exact connection. */ + + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IPin_ConnectedTo(source, &peer); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(peer == &testsink.pin.pin.IPin_iface, "Got peer %p.\n", peer); + IPin_Release(peer); + + hr = IPin_ConnectionMediaType(source, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n"); + ok(compare_media_types(&testsink.pin.pin.mt, &req_mt), "Media types didn't match.\n"); + + hr = IFilterGraph2_Disconnect(graph, source); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_Disconnect(graph, source); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(testsink.pin.pin.peer == source, "Got peer %p.\n", testsink.pin.pin.peer); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + req_mt.pbFormat = &my_format; + req_mt.cbFormat = sizeof(my_format); + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.pin.pin.mt, &req_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + req_mt.pbFormat = NULL; + req_mt.cbFormat = 0; + + req_mt.majortype = MEDIATYPE_Video; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + req_mt.majortype = MEDIATYPE_Stream; + + req_mt.subtype = MEDIASUBTYPE_RGB8; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.pin.pin.mt, &req_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + req_mt.subtype = GUID_NULL; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + req_mt.subtype = MEDIASUBTYPE_Avi; + + /* Test connection with wildcards. */ + + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + req_mt.formattype = GUID_NULL; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + req_mt.formattype = FORMAT_None; + req_mt.majortype = GUID_NULL; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + + req_mt.formattype = GUID_NULL; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + req_mt.subtype = MEDIASUBTYPE_RGB8; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + + req_mt.subtype = GUID_NULL; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + req_mt.majortype = MEDIATYPE_Stream; + req_mt.subtype = MEDIASUBTYPE_RGB8; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + + req_mt.subtype = GUID_NULL; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + req_mt.majortype = MEDIATYPE_Video; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + + /* The second type (i.e. whose subtype is GUID_NULL) is not tried. This is + * consistent with its being rejected by IPin::QueryAccept(). */ + testsink.reject_avi = TRUE; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL); + todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + + /* But any types we expose are tried. */ + testsink.mt = &mt; + memset(&mt, 0, sizeof(mt)); + mt.majortype = MEDIATYPE_Video; + mt.subtype = MEDIASUBTYPE_RGB8; + mt.formattype = FORMAT_None; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL); + todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + } + + mt.majortype = MEDIATYPE_Stream; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(compare_media_types(&testsink.pin.pin.mt, &mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); + + CoTaskMemFree(source_mt); + IPin_Release(source); + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); +} + START_TEST(filesource) { CoInitialize(NULL); @@ -1210,6 +1513,7 @@ START_TEST(filesource) test_file_source_filter(); test_async_reader(); test_enum_media_types(); + test_connect_pin();
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=64334
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filesource.c | 3 ++- dlls/quartz/tests/filesource.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 2b7e9d58b1f..4855f9834c7 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -591,7 +591,8 @@ static HRESULT source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TY AsyncReader *filter = impl_from_strmbase_pin(iface);
if (IsEqualGUID(&mt->majortype, &filter->mt.majortype) - && IsEqualGUID(&mt->subtype, &filter->mt.subtype)) + && (!IsEqualGUID(&mt->subtype, &GUID_NULL) + || IsEqualGUID(&filter->mt.subtype, &GUID_NULL))) return S_OK;
return S_FALSE; diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 3c8626b7399..8f61816c4bd 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -389,7 +389,7 @@ static void test_file_source_filter(void) mt.formattype = FORMAT_VideoInfo; mt.subtype = MEDIASUBTYPE_RGB32; hr = IPin_QueryAccept(pin, &mt); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
mt.majortype = MEDIATYPE_Video; hr = IPin_QueryAccept(pin, &mt);
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=64335
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 error: patch failed: dlls/quartz/filtergraph.c:996 error: patch failed: dlls/quartz/tests/filtergraph.c:2947 Task: Patch failed to apply
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=64331
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/quartz/tests/filtergraph.c:2915 Task: Patch failed to apply