Commit c752b561 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap/audiorecord: Implement IAMStreamConfig::GetStreamCaps().

Needed by the Microsoft Silverlight configuration tool. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36230
parent fa323802
......@@ -174,15 +174,51 @@ static HRESULT WINAPI stream_config_GetFormat(IAMStreamConfig *iface, AM_MEDIA_T
static HRESULT WINAPI stream_config_GetNumberOfCapabilities(IAMStreamConfig *iface,
int *count, int *size)
{
FIXME("iface %p, count %p, size %p, stub!\n", iface, count, size);
return E_NOTIMPL;
struct audio_record *filter = impl_from_IAMStreamConfig(iface);
TRACE("filter %p, count %p, size %p.\n", filter, count, size);
*count = ARRAY_SIZE(audio_formats);
*size = sizeof(AUDIO_STREAM_CONFIG_CAPS);
return S_OK;
}
static HRESULT WINAPI stream_config_GetStreamCaps(IAMStreamConfig *iface,
int index, AM_MEDIA_TYPE **mt, BYTE *caps)
int index, AM_MEDIA_TYPE **ret_mt, BYTE *caps)
{
FIXME("iface %p, index %d, mt %p, caps %p, stub!\n", iface, index, mt, caps);
return E_NOTIMPL;
struct audio_record *filter = impl_from_IAMStreamConfig(iface);
AUDIO_STREAM_CONFIG_CAPS *audio_caps = (void *)caps;
AM_MEDIA_TYPE *mt;
HRESULT hr;
TRACE("filter %p, index %d, ret_mt %p, caps %p.\n", filter, index, ret_mt, caps);
if (index >= 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)
{
CoTaskMemFree(mt);
return hr;
}
*ret_mt = mt;
audio_caps->guid = MEDIATYPE_Audio;
audio_caps->MinimumChannels = 1;
audio_caps->MaximumChannels = 2;
audio_caps->ChannelsGranularity = 1;
audio_caps->MinimumBitsPerSample = 8;
audio_caps->MaximumBitsPerSample = 16;
audio_caps->BitsPerSampleGranularity = 8;
audio_caps->MinimumSampleFrequency = 11025;
audio_caps->MaximumSampleFrequency = 44100;
audio_caps->SampleFrequencyGranularity = 11025;
return S_OK;
}
static const IAMStreamConfigVtbl stream_config_vtbl =
......
......@@ -482,9 +482,9 @@ static void test_stream_config(IBaseFilter *filter)
count = size = 0xdeadbeef;
hr = IAMStreamConfig_GetNumberOfCapabilities(config, &count, &size);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine ok(count && count != 0xdeadbeef, "Got count %d.\n", count);
todo_wine ok(size == sizeof(AUDIO_STREAM_CONFIG_CAPS), "Got size %d.\n", size);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(count && count != 0xdeadbeef, "Got count %d.\n", count);
ok(size == sizeof(AUDIO_STREAM_CONFIG_CAPS), "Got size %d.\n", size);
hr = IPin_EnumMediaTypes(source, &enummt);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
......@@ -518,9 +518,9 @@ static void test_stream_config(IBaseFilter *filter)
}
hr = IAMStreamConfig_GetStreamCaps(config, count, &mt, (BYTE *)&caps);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IEnumMediaTypes_Next(enummt, 1, &mt2, NULL);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
IEnumMediaTypes_Release(enummt);
......@@ -551,19 +551,21 @@ static void test_stream_config(IBaseFilter *filter)
winetest_push_context("Caps %u", i);
hr = IAMStreamConfig_GetStreamCaps(config, i, &mt, (BYTE *)&caps);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IAMStreamConfig_SetFormat(config, mt);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IAMStreamConfig_GetFormat(config, &mt2);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
if (hr == S_OK)
{
hr = IAMStreamConfig_SetFormat(config, mt);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IAMStreamConfig_GetFormat(config, &mt2);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(compare_media_types(mt, mt2), "Media types didn't match.\n");
DeleteMediaType(mt2);
DeleteMediaType(mt);
}
DeleteMediaType(mt);
winetest_pop_context();
}
......
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