Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/dsdmo/main.c | 25 +++++++++++++++++++++++-- dlls/dsdmo/tests/dsdmo.c | 10 +++++----- 2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/dlls/dsdmo/main.c b/dlls/dsdmo/main.c index 9d4fbc5b785..1e992fe5419 100644 --- a/dlls/dsdmo/main.c +++ b/dlls/dsdmo/main.c @@ -226,8 +226,29 @@ static HRESULT WINAPI effect_SetInputType(IMediaObject *iface, DWORD index, cons
static HRESULT WINAPI effect_SetOutputType(IMediaObject *iface, DWORD index, const DMO_MEDIA_TYPE *type, DWORD flags) { - FIXME("iface %p, index %u, type %p, flags %#x, stub!\n", iface, index, type, flags); - return E_NOTIMPL; + struct effect *effect = impl_from_IMediaObject(iface); + HRESULT hr; + + TRACE("iface %p, index %u, type %p, flags %#x.\n", iface, index, type, flags); + + if (flags & DMO_SET_TYPEF_CLEAR) + return S_OK; + + if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Audio)) + return DMO_E_TYPE_NOT_ACCEPTED; + + if (!IsEqualGUID(&type->subtype, &MEDIASUBTYPE_PCM) + && !IsEqualGUID(&type->subtype, &MEDIASUBTYPE_IEEE_FLOAT)) + return DMO_E_TYPE_NOT_ACCEPTED; + + if (!IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx)) + return DMO_E_TYPE_NOT_ACCEPTED; + + EnterCriticalSection(&effect->cs); + hr = memcmp(type->pbFormat, &effect->format, sizeof(WAVEFORMATEX)) ? DMO_E_TYPE_NOT_ACCEPTED : S_OK; + LeaveCriticalSection(&effect->cs); + + return hr; }
static HRESULT WINAPI effect_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c index d1cf2575de2..9026728f6c6 100644 --- a/dlls/dsdmo/tests/dsdmo.c +++ b/dlls/dsdmo/tests/dsdmo.c @@ -254,22 +254,22 @@ static void test_media_types(const GUID *clsid)
build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], 3 - channels); hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", hr, sample_rates[i], channels, depths[j].format, depths[j].depth);
build_pcm_format(&wfx, depths[j].format, depths[j].depth, 2 * sample_rates[i], channels); hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", hr, sample_rates[i], channels, depths[j].format, depths[j].depth);
build_pcm_format(&wfx, depths[j].format, 24 - depths[j].depth, sample_rates[i], channels); hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", hr, sample_rates[i], channels, depths[j].format, depths[j].depth);
build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], channels); hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); - todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", hr, sample_rates[i], channels, depths[j].format, depths[j].depth);
hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); @@ -277,7 +277,7 @@ static void test_media_types(const GUID *clsid) hr, sample_rates[i], channels, depths[j].format, depths[j].depth);
hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); - todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", hr, sample_rates[i], channels, depths[j].format, depths[j].depth);
hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR);