quartz/filesource: Check if the media type is acceptable.

PowerPoint 2016 tries to build a graph by autoplugging the file source to the
sample grabber; direct connection should fail here.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-05 20:04:35 -06:00 committed by Alexandre Julliard
parent fc7477d83e
commit 8e80f68dce
2 changed files with 7 additions and 26 deletions

View File

@ -611,7 +611,8 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(struct strmbase_sourc
TRACE("%p->(%p, %p)\n", This, pReceivePin, pmt);
/* FIXME: call queryacceptproc */
if (This->pin.ops->pin_query_accept(&This->pin, pmt) != S_OK)
return VFW_E_TYPE_NOT_ACCEPTED;
This->pin.peer = pReceivePin;
IPin_AddRef(pReceivePin);

View File

@ -1363,12 +1363,7 @@ static void test_connect_pin(void)
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);
}
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Stream;
req_mt.subtype = MEDIASUBTYPE_RGB8;
@ -1379,12 +1374,7 @@ static void test_connect_pin(void)
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);
}
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
req_mt.subtype = MEDIASUBTYPE_Avi;
/* Test connection with wildcards. */
@ -1445,12 +1435,7 @@ static void test_connect_pin(void)
* 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);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
/* But any types we expose are tried. */
testsink.mt = &mt;
@ -1459,17 +1444,12 @@ static void test_connect_pin(void)
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);
}
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
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");
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);