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);