Commit 5a461804 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/tests: Test that sink pins are enumerated first.

parent ecb7c901
...@@ -854,14 +854,6 @@ static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, ...@@ -854,14 +854,6 @@ static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid,
return S_OK; return S_OK;
} }
static HRESULT testsink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
{
struct testfilter *filter = impl_from_strmbase_filter(iface->filter);
if (filter->mt && !compare_media_types(mt, filter->mt))
return S_FALSE;
return S_OK;
}
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
{ {
struct testfilter *filter = impl_from_strmbase_filter(iface->filter); struct testfilter *filter = impl_from_strmbase_filter(iface->filter);
...@@ -873,6 +865,14 @@ static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int ...@@ -873,6 +865,14 @@ static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int
return VFW_S_NO_MORE_ITEMS; return VFW_S_NO_MORE_ITEMS;
} }
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
{
struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
return VFW_E_TYPE_NOT_ACCEPTED;
return S_OK;
}
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample) static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
{ {
struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
...@@ -958,8 +958,8 @@ static HRESULT testsink_end_flush(struct strmbase_sink *iface) ...@@ -958,8 +958,8 @@ static HRESULT testsink_end_flush(struct strmbase_sink *iface)
static const struct strmbase_sink_ops testsink_ops = static const struct strmbase_sink_ops testsink_ops =
{ {
.base.pin_query_interface = testsink_query_interface, .base.pin_query_interface = testsink_query_interface,
.base.pin_query_accept = testsink_query_accept,
.base.pin_get_media_type = testsink_get_media_type, .base.pin_get_media_type = testsink_get_media_type,
.sink_connect = testsink_connect,
.pfnReceive = testsink_Receive, .pfnReceive = testsink_Receive,
.sink_new_segment = testsink_new_segment, .sink_new_segment = testsink_new_segment,
.sink_eos = testsink_eos, .sink_eos = testsink_eos,
...@@ -1501,6 +1501,8 @@ static void test_connect_pin(void) ...@@ -1501,6 +1501,8 @@ static void test_connect_pin(void)
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
/* Test enumeration of sink media types. */
/* Our sink's proposed media type is sort of broken, but Windows 8+ returns /* Our sink's proposed media type is sort of broken, but Windows 8+ returns
* VFW_E_INVALIDMEDIATYPE for even perfectly reasonable ones. */ * VFW_E_INVALIDMEDIATYPE for even perfectly reasonable ones. */
testsink.mt = &req_mt; testsink.mt = &req_mt;
...@@ -1511,8 +1513,10 @@ static void test_connect_pin(void) ...@@ -1511,8 +1513,10 @@ static void test_connect_pin(void)
req_mt.majortype = MEDIATYPE_Video; req_mt.majortype = MEDIATYPE_Video;
req_mt.subtype = MEDIASUBTYPE_I420; req_mt.subtype = MEDIASUBTYPE_I420;
req_mt.formattype = FORMAT_VideoInfo; req_mt.formattype = FORMAT_VideoInfo;
req_mt.lSampleSize = 444;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
hr = IFilterGraph2_Disconnect(graph, sink); hr = IFilterGraph2_Disconnect(graph, sink);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
......
...@@ -894,14 +894,6 @@ static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, ...@@ -894,14 +894,6 @@ static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid,
return S_OK; return S_OK;
} }
static HRESULT testsink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
{
struct testfilter *filter = impl_from_strmbase_filter(iface->filter);
if (filter->mt && !compare_media_types(mt, filter->mt))
return S_FALSE;
return S_OK;
}
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
{ {
struct testfilter *filter = impl_from_strmbase_filter(iface->filter); struct testfilter *filter = impl_from_strmbase_filter(iface->filter);
...@@ -915,6 +907,7 @@ static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int ...@@ -915,6 +907,7 @@ static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt) static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
{ {
struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
AM_MEDIA_TYPE mt2; AM_MEDIA_TYPE mt2;
IPin *peer2; IPin *peer2;
HRESULT hr; HRESULT hr;
...@@ -929,6 +922,8 @@ static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const A ...@@ -929,6 +922,8 @@ static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const A
ok(compare_media_types(mt, &mt2), "Media types didn't match.\n"); ok(compare_media_types(mt, &mt2), "Media types didn't match.\n");
FreeMediaType(&mt2); FreeMediaType(&mt2);
if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
return VFW_E_TYPE_NOT_ACCEPTED;
return S_OK; return S_OK;
} }
...@@ -993,7 +988,6 @@ static HRESULT testsink_new_segment(struct strmbase_sink *iface, ...@@ -993,7 +988,6 @@ static HRESULT testsink_new_segment(struct strmbase_sink *iface,
static const struct strmbase_sink_ops testsink_ops = static const struct strmbase_sink_ops testsink_ops =
{ {
.base.pin_query_interface = testsink_query_interface, .base.pin_query_interface = testsink_query_interface,
.base.pin_query_accept = testsink_query_accept,
.base.pin_get_media_type = testsink_get_media_type, .base.pin_get_media_type = testsink_get_media_type,
.sink_connect = testsink_connect, .sink_connect = testsink_connect,
.pfnReceive = testsink_Receive, .pfnReceive = testsink_Receive,
...@@ -1359,6 +1353,8 @@ static void test_connect_pin(void) ...@@ -1359,6 +1353,8 @@ static void test_connect_pin(void)
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
/* Test enumeration of sink media types. */
testsink.mt = &req_mt; testsink.mt = &req_mt;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
...@@ -1366,8 +1362,10 @@ static void test_connect_pin(void) ...@@ -1366,8 +1362,10 @@ static void test_connect_pin(void)
req_mt.majortype = MEDIATYPE_Video; req_mt.majortype = MEDIATYPE_Video;
req_mt.subtype = MEDIASUBTYPE_I420; req_mt.subtype = MEDIASUBTYPE_I420;
req_mt.formattype = FORMAT_VideoInfo; req_mt.formattype = FORMAT_VideoInfo;
req_mt.lSampleSize = 444;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
IPin_Release(source); IPin_Release(source);
hr = IFilterGraph2_Disconnect(graph, sink); hr = IFilterGraph2_Disconnect(graph, sink);
......
...@@ -1183,14 +1183,6 @@ static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, ...@@ -1183,14 +1183,6 @@ static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid,
return S_OK; return S_OK;
} }
static HRESULT testsink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
{
struct testfilter *filter = impl_from_strmbase_filter(iface->filter);
if (filter->mt && !compare_media_types(mt, filter->mt))
return S_FALSE;
return S_OK;
}
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
{ {
struct testfilter *filter = impl_from_strmbase_filter(iface->filter); struct testfilter *filter = impl_from_strmbase_filter(iface->filter);
...@@ -1202,6 +1194,14 @@ static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int ...@@ -1202,6 +1194,14 @@ static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int
return VFW_S_NO_MORE_ITEMS; return VFW_S_NO_MORE_ITEMS;
} }
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
{
struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
return VFW_E_TYPE_NOT_ACCEPTED;
return S_OK;
}
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample) static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
{ {
struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
...@@ -1263,8 +1263,8 @@ static HRESULT testsink_new_segment(struct strmbase_sink *iface, ...@@ -1263,8 +1263,8 @@ static HRESULT testsink_new_segment(struct strmbase_sink *iface,
static const struct strmbase_sink_ops testsink_ops = static const struct strmbase_sink_ops testsink_ops =
{ {
.base.pin_query_interface = testsink_query_interface, .base.pin_query_interface = testsink_query_interface,
.base.pin_query_accept = testsink_query_accept,
.base.pin_get_media_type = testsink_get_media_type, .base.pin_get_media_type = testsink_get_media_type,
.sink_connect = testsink_connect,
.pfnReceive = testsink_Receive, .pfnReceive = testsink_Receive,
.sink_eos = testsink_eos, .sink_eos = testsink_eos,
.sink_new_segment = testsink_new_segment, .sink_new_segment = testsink_new_segment,
...@@ -1576,6 +1576,8 @@ static void test_connect_pin(void) ...@@ -1576,6 +1576,8 @@ static void test_connect_pin(void)
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
/* Test enumeration of sink media types. */
testsink.mt = &req_mt; testsink.mt = &req_mt;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
...@@ -1583,8 +1585,10 @@ static void test_connect_pin(void) ...@@ -1583,8 +1585,10 @@ static void test_connect_pin(void)
req_mt.majortype = MEDIATYPE_Audio; req_mt.majortype = MEDIATYPE_Audio;
req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload; req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
req_mt.formattype = FORMAT_WaveFormatEx; req_mt.formattype = FORMAT_WaveFormatEx;
req_mt.lSampleSize = 444;
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL); hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
IPin_Release(source); IPin_Release(source);
hr = IFilterGraph2_Disconnect(graph, sink); hr = IFilterGraph2_Disconnect(graph, sink);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment