strmbase: Also match a GUID_NULL formattype as a wildcard in source_Connect().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-02-16 23:31:49 -06:00 committed by Alexandre Julliard
parent 283b587b94
commit 4f1df5246c
9 changed files with 27 additions and 56 deletions

View File

@ -2831,29 +2831,19 @@ static void test_source_connection(AM_MEDIA_TYPE req_mt, IFilterGraph2 *graph,
req_mt.formattype = FORMAT_WaveFormatEx;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.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->sink.pin.IPin_iface);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt = sink_mt;
req_mt.formattype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(compare_media_types(&testsink->sink.pin.mt, &sink_mt), "Media types didn't match.\n");
ok(compare_media_types(&testsink->sink.pin.mt, &sink_mt), "Media types didn't match.\n");
IFilterGraph2_Disconnect(graph, source);
IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
req_mt.subtype = MEDIASUBTYPE_RGB32;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.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->sink.pin.IPin_iface);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt);

View File

@ -939,29 +939,21 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.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.sink.pin.IPin_iface);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Video;
req_mt.subtype = MEDIASUBTYPE_RGB8;
req_mt.formattype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
IFilterGraph2_Disconnect(graph, source);
IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
}
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
IFilterGraph2_Disconnect(graph, source);
IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
req_mt.subtype = MEDIASUBTYPE_RGB32;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);

View File

@ -1073,6 +1073,7 @@ static void test_connect_pin(void)
{
.majortype = MEDIATYPE_Stream,
.subtype = MEDIASUBTYPE_Avi,
.formattype = FORMAT_None,
.lSampleSize = 888,
};
IBaseFilter *filter = create_avi_splitter(), *reader;
@ -1235,26 +1236,20 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.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.sink.pin.IPin_iface);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Video;
req_mt.subtype = MEDIASUBTYPE_I420;
req_mt.formattype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
IFilterGraph2_Disconnect(graph, source);
IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
req_mt.subtype = MEDIASUBTYPE_RGB32;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);

View File

@ -1398,7 +1398,7 @@ static void test_connect_pin(void)
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");
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);

View File

@ -1310,6 +1310,7 @@ static void test_connect_pin(void)
{
.majortype = MEDIATYPE_Stream,
.subtype = MEDIASUBTYPE_MPEG1Audio,
.formattype = FORMAT_WaveFormatEx,
.lSampleSize = 888,
};
IBaseFilter *filter = create_mpeg_splitter(), *reader;
@ -1471,12 +1472,7 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.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.sink.pin.IPin_iface);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Audio;
req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
@ -1490,7 +1486,7 @@ static void test_connect_pin(void)
req_mt.subtype = MEDIASUBTYPE_PCM;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);

View File

@ -1206,9 +1206,6 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None;
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.formattype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.formattype = FORMAT_VideoInfo;
peer = (IPin *)0xdeadbeef;

View File

@ -1411,9 +1411,6 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None;
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.formattype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.formattype = FORMAT_VideoInfo;
req_mt.subtype = MEDIASUBTYPE_RGB8;

View File

@ -1405,9 +1405,6 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None;
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.formattype = GUID_NULL;
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.formattype = FORMAT_VideoInfo;
req_mt.subtype = MEDIASUBTYPE_RGB8;

View File

@ -437,6 +437,11 @@ static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
&& !IsEqualGUID(&b->subtype, &GUID_NULL))
return FALSE;
if (!IsEqualGUID(&a->formattype, &b->formattype)
&& !IsEqualGUID(&a->formattype, &GUID_NULL)
&& !IsEqualGUID(&b->formattype, &GUID_NULL))
return FALSE;
return TRUE;
}
@ -477,7 +482,9 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP
return VFW_E_NOT_STOPPED;
}
if (mt && !IsEqualGUID(&mt->majortype, &GUID_NULL) && !IsEqualGUID(&mt->subtype, &GUID_NULL))
if (mt && !IsEqualGUID(&mt->majortype, &GUID_NULL)
&& !IsEqualGUID(&mt->subtype, &GUID_NULL)
&& !IsEqualGUID(&mt->formattype, &GUID_NULL))
{
hr = pin->pFuncsTable->pfnAttemptConnection(pin, peer, mt);
LeaveCriticalSection(&pin->pin.filter->csFilter);