From: Zebediah Figura zfigura@codeweavers.com
--- dlls/qcap/tests/audiorecord.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index e0a130fefb3..ddf54e68e21 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -1118,6 +1118,19 @@ static void test_stream_config(IBaseFilter *filter) ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); DeleteMediaType(mt2);
+ /* The first entry in the list is always the same as the format set. */ + IPin_EnumMediaTypes(source, &enummt); + hr = IEnumMediaTypes_Next(enummt, 1, &mt2, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (i > 0) ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); + DeleteMediaType(mt2); + IEnumMediaTypes_Release(enummt); + + hr = IAMStreamConfig_GetStreamCaps(config, 0, &mt2, (BYTE *)&caps); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (i > 0) ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); + DeleteMediaType(mt2); + DeleteMediaType(mt);
winetest_pop_context(); @@ -1135,6 +1148,9 @@ static void test_stream_config(IBaseFilter *filter) ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(compare_media_types(mt, mt2), "Media types didn't match.\n");
+ hr = IPin_QueryAccept(source, mt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + DeleteMediaType(mt2); DeleteMediaType(mt); }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/qcap/audiorecord.c | 20 +++++++++++++------- dlls/qcap/tests/audiorecord.c | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 5ece56e97ec..eefac79b409 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -114,13 +114,17 @@ audio_formats[] = {96000, 16, 1}, };
-static HRESULT fill_media_type(unsigned int index, AM_MEDIA_TYPE *mt) +static HRESULT fill_media_type(struct audio_record *filter, unsigned int index, AM_MEDIA_TYPE *mt) { WAVEFORMATEX *format;
- if (index >= ARRAY_SIZE(audio_formats)) + if (index >= 1 + ARRAY_SIZE(audio_formats)) return VFW_S_NO_MORE_ITEMS;
+ if (!index) + return CopyMediaType(mt, &filter->format); + --index; + if (!(format = CoTaskMemAlloc(sizeof(*format)))) return E_OUTOFMEMORY;
@@ -147,7 +151,9 @@ static HRESULT fill_media_type(unsigned int index, AM_MEDIA_TYPE *mt) static HRESULT audio_record_source_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) { - return fill_media_type(index, mt); + struct audio_record *filter = impl_from_strmbase_filter(iface->filter); + + return fill_media_type(filter, index, mt); }
static HRESULT WINAPI audio_record_source_DecideBufferSize(struct strmbase_source *iface, @@ -283,7 +289,7 @@ static HRESULT WINAPI stream_config_GetNumberOfCapabilities(IAMStreamConfig *ifa
TRACE("filter %p, count %p, size %p.\n", filter, count, size);
- *count = ARRAY_SIZE(audio_formats); + *count = 1 + ARRAY_SIZE(audio_formats); *size = sizeof(AUDIO_STREAM_CONFIG_CAPS); return S_OK; } @@ -298,13 +304,13 @@ static HRESULT WINAPI stream_config_GetStreamCaps(IAMStreamConfig *iface,
TRACE("filter %p, index %d, ret_mt %p, caps %p.\n", filter, index, ret_mt, caps);
- if (index >= ARRAY_SIZE(audio_formats)) + if (index >= 1 + ARRAY_SIZE(audio_formats)) return S_FALSE;
if (!(mt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)))) return E_OUTOFMEMORY;
- if ((hr = fill_media_type(index, mt)) != S_OK) + if ((hr = fill_media_type(filter, index, mt)) != S_OK) { CoTaskMemFree(mt); return hr; @@ -795,7 +801,7 @@ HRESULT audio_record_create(IUnknown *outer, IUnknown **out) return E_OUTOFMEMORY; }
- if ((hr = fill_media_type(0, &object->format))) + if ((hr = fill_media_type(object, 1, &object->format))) { CloseHandle(object->event); free(object); diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index ddf54e68e21..11397531064 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -1122,13 +1122,13 @@ static void test_stream_config(IBaseFilter *filter) IPin_EnumMediaTypes(source, &enummt); hr = IEnumMediaTypes_Next(enummt, 1, &mt2, NULL); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine_if (i > 0) ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); + ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); DeleteMediaType(mt2); IEnumMediaTypes_Release(enummt);
hr = IAMStreamConfig_GetStreamCaps(config, 0, &mt2, (BYTE *)&caps); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine_if (i > 0) ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); + ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); DeleteMediaType(mt2);
DeleteMediaType(mt);