Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avimux.c | 122 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+)
diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index 8292067f533..e51c6af8b22 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -179,6 +179,127 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); }
+static void test_enum_pins(void) +{ + IBaseFilter *filter = create_avi_mux(); + IEnumPins *enum1, *enum2; + ULONG count, ref; + IPin *pins[3]; + HRESULT hr; + + ref = get_refcount(filter); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + hr = IBaseFilter_EnumPins(filter, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IBaseFilter_EnumPins(filter, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + hr = IEnumPins_Next(enum1, 1, NULL, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pins[0]); + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + IPin_Release(pins[0]); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pins[0]); + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + IPin_Release(pins[0]); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, NULL); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 3, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 3); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum2, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + IEnumPins_Release(enum2); + IEnumPins_Release(enum1); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_seeking(void) { IBaseFilter *filter = create_avi_mux(); @@ -319,6 +440,7 @@ START_TEST(avimux)
test_interfaces(); test_aggregation(); + test_enum_pins(); test_seeking();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avimux.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index e51c6af8b22..f303783d570 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -23,6 +23,9 @@ #include "vfw.h" #include "wine/test.h"
+static const WCHAR source_id[] = {'A','V','I',' ','O','u','t',0}; +static const WCHAR sink0_id[] = {'I','n','p','u','t',' ','0','1',0}; + static const GUID testguid = {0xfacade};
static IBaseFilter *create_avi_mux(void) @@ -300,6 +303,38 @@ static void test_enum_pins(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_find_pin(void) +{ + IBaseFilter *filter = create_avi_mux(); + IEnumPins *enum_pins; + IPin *pin, *pin2; + HRESULT hr; + ULONG ref; + + hr = IBaseFilter_EnumPins(filter, &enum_pins); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, source_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(pin == pin2, "Pins didn't match.\n"); + IPin_Release(pin); + IPin_Release(pin2); + + hr = IBaseFilter_FindPin(filter, sink0_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(pin == pin2, "Pins didn't match.\n"); + IPin_Release(pin); + IPin_Release(pin2); + + IEnumPins_Release(enum_pins); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_seeking(void) { IBaseFilter *filter = create_avi_mux(); @@ -441,6 +476,7 @@ START_TEST(avimux) test_interfaces(); test_aggregation(); test_enum_pins(); + test_find_pin(); test_seeking();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avimux.c | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index f303783d570..e5ec947b7ba 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -335,6 +335,76 @@ static void test_find_pin(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_pin_info(void) +{ + IBaseFilter *filter = create_avi_mux(); + PIN_DIRECTION dir; + PIN_INFO info; + HRESULT hr; + WCHAR *id; + ULONG ref; + IPin *pin; + + hr = IBaseFilter_FindPin(filter, source_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pin); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, source_id), "Got name %s.\n", wine_dbgstr_w(info.achName)); + ref = get_refcount(filter); + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pin); + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, source_id), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, NULL); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + hr = IBaseFilter_FindPin(filter, sink0_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, sink0_id), "Got name %s.\n", wine_dbgstr_w(info.achName)); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, sink0_id), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, NULL); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_seeking(void) { IBaseFilter *filter = create_avi_mux(); @@ -477,6 +547,7 @@ START_TEST(avimux) test_aggregation(); test_enum_pins(); test_find_pin(); + test_pin_info(); test_seeking();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avimux.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index e5ec947b7ba..ea617b411e1 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -62,6 +62,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO static void test_interfaces(void) { IBaseFilter *filter = create_avi_mux(); + IPin *pin;
check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IConfigAviMux, TRUE); @@ -85,6 +86,34 @@ static void test_interfaces(void) check_interface(filter, &IID_IReferenceClock, FALSE); check_interface(filter, &IID_IVideoWindow, FALSE);
+ IBaseFilter_FindPin(filter, source_id, &pin); + + check_interface(pin, &IID_IPin, TRUE); + 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_IMediaSeeking, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, sink0_id, &pin); + + check_interface(pin, &IID_IAMStreamControl, TRUE); + check_interface(pin, &IID_IMemInputPin, TRUE); + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IPropertyBag, TRUE); + check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + + IPin_Release(pin); + IBaseFilter_Release(filter); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avimux.c | 123 +++++++++++++++++++++++++++++++++++++++ dlls/qcap/tests/qcap.c | 31 ---------- 2 files changed, 123 insertions(+), 31 deletions(-)
diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index ea617b411e1..8218d0e5eb2 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -434,6 +434,128 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_media_types(void) +{ + IBaseFilter *filter = create_avi_mux(); + AM_MEDIA_TYPE mt = {}, *pmt; + VIDEOINFOHEADER vih = {}; + IEnumMediaTypes *enummt; + WAVEFORMATEX wfx = {}; + HRESULT hr; + ULONG ref; + IPin *pin; + + IBaseFilter_FindPin(filter, source_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s\n", + wine_dbgstr_guid(&pmt->majortype)); + ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_Avi), "Got subtype %s\n", + wine_dbgstr_guid(&pmt->subtype)); + ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples); + ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression); + ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize); + ok(IsEqualGUID(&pmt->formattype, &GUID_NULL), "Got format type %s.\n", + wine_dbgstr_guid(&pmt->formattype)); + ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk); + ok(!pmt->cbFormat, "Got format size %u.\n", pmt->cbFormat); + ok(!pmt->pbFormat, "Got format block %u.\n", pmt->cbFormat); + + hr = IPin_QueryAccept(pin, pmt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + pmt->bFixedSizeSamples = FALSE; + pmt->bTemporalCompression = TRUE; + pmt->lSampleSize = 123; + hr = IPin_QueryAccept(pin, pmt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + pmt->majortype = GUID_NULL; + hr = IPin_QueryAccept(pin, pmt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + pmt->majortype = MEDIATYPE_Video; + hr = IPin_QueryAccept(pin, pmt); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + pmt->majortype = MEDIATYPE_Stream; + + pmt->subtype = GUID_NULL; + hr = IPin_QueryAccept(pin, pmt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + pmt->subtype = MEDIASUBTYPE_RGB8; + hr = IPin_QueryAccept(pin, pmt); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + pmt->subtype = MEDIASUBTYPE_Avi; + + CoTaskMemFree(pmt); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enummt); + IPin_Release(pin); + + IBaseFilter_FindPin(filter, sink0_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enummt); + + mt.majortype = MEDIATYPE_Audio; + mt.formattype = FORMAT_WaveFormatEx; + mt.cbFormat = sizeof(wfx); + mt.pbFormat = (BYTE *)&wfx; + wfx.nBlockAlign = 1; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + mt.subtype = MEDIASUBTYPE_RGB8; + mt.bFixedSizeSamples = TRUE; + mt.bTemporalCompression = TRUE; + mt.lSampleSize = 123; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + mt.majortype = MEDIATYPE_Video; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.majortype = GUID_NULL; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.majortype = MEDIATYPE_Interleaved; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + mt.majortype = MEDIATYPE_Video; + mt.formattype = FORMAT_VideoInfo; + mt.cbFormat = sizeof(vih); + mt.pbFormat = (BYTE *)&vih; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + mt.majortype = MEDIATYPE_Audio; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.majortype = GUID_NULL; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + mt.majortype = MEDIATYPE_Interleaved; + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_seeking(void) { IBaseFilter *filter = create_avi_mux(); @@ -577,6 +699,7 @@ START_TEST(avimux) test_enum_pins(); test_find_pin(); test_pin_info(); + test_media_types(); test_seeking();
CoUninitialize(); diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c index df26b5469dc..45fd98b7f93 100644 --- a/dlls/qcap/tests/qcap.c +++ b/dlls/qcap/tests/qcap.c @@ -1365,11 +1365,9 @@ static void test_AviMux(char *arg) VIDEOINFO videoinfo; IPin *avimux_in, *avimux_out, *pin; AM_MEDIA_TYPE source_media_type; - AM_MEDIA_TYPE *media_type; PIN_DIRECTION dir; IBaseFilter *avimux; IEnumPins *ep; - IEnumMediaTypes *emt; IMemInputPin *memin; ALLOCATOR_PROPERTIES props; IMemAllocator *memalloc; @@ -1405,35 +1403,6 @@ static void test_AviMux(char *arg) ok(dir == PINDIR_INPUT, "dir = %d\n", dir); IEnumPins_Release(ep);
- hr = IPin_EnumMediaTypes(avimux_out, &emt); - ok(hr == S_OK, "EnumMediaTypes returned %x\n", hr); - hr = IEnumMediaTypes_Next(emt, 1, &media_type, NULL); - ok(hr == S_OK, "Next returned %x\n", hr); - ok(IsEqualIID(&media_type->majortype, &MEDIATYPE_Stream), "majortype = %s\n", - wine_dbgstr_guid(&media_type->majortype)); - ok(IsEqualIID(&media_type->subtype, &MEDIASUBTYPE_Avi), "subtype = %s\n", - wine_dbgstr_guid(&media_type->subtype)); - ok(media_type->bFixedSizeSamples, "bFixedSizeSamples = %x\n", media_type->bFixedSizeSamples); - ok(!media_type->bTemporalCompression, "bTemporalCompression = %x\n", media_type->bTemporalCompression); - ok(media_type->lSampleSize == 1, "lSampleSize = %d\n", media_type->lSampleSize); - ok(IsEqualIID(&media_type->formattype, &GUID_NULL), "formattype = %s\n", - wine_dbgstr_guid(&media_type->formattype)); - ok(!media_type->pUnk, "pUnk = %p\n", media_type->pUnk); - ok(!media_type->cbFormat, "cbFormat = %d\n", media_type->cbFormat); - ok(!media_type->pbFormat, "pbFormat = %p\n", media_type->pbFormat); - CoTaskMemFree(media_type); - hr = IEnumMediaTypes_Next(emt, 1, &media_type, NULL); - ok(hr == S_FALSE, "Next returned %x\n", hr); - IEnumMediaTypes_Release(emt); - - hr = IPin_EnumMediaTypes(avimux_in, &emt); - ok(hr == S_OK, "EnumMediaTypes returned %x\n", hr); - hr = IEnumMediaTypes_Reset(emt); - ok(hr == S_OK, "Reset returned %x\n", hr); - hr = IEnumMediaTypes_Next(emt, 1, &media_type, NULL); - ok(hr == S_FALSE, "Next returned %x\n", hr); - IEnumMediaTypes_Release(emt); - hr = IPin_ReceiveConnection(avimux_in, &source_filter.IPin_iface, NULL); ok(hr == E_POINTER, "ReceiveConnection returned %x\n", hr);