diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 71ab00c2944..79da3d2fd1d 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -5077,14 +5077,12 @@ static void test_wmv_decoder_media_object(void) hr = IMediaObject_SetInputType(media_object, 0, NULL, DMO_SET_TYPEF_CLEAR); ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(media_object, 0, &media_type, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_SET, "SetOutputType returned %#lx.\n", hr); /* Test SetOutputType after setting input type. */ init_dmo_media_type_video(input_type, &expected_input_types[0].subtype, 16, 16); hr = IMediaObject_SetInputType(media_object, 0, input_type, 0); ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); - todo_wine check_dmo_set_output_type(media_object, &MEDIASUBTYPE_RGB24); ret = IMediaObject_Release(media_object); diff --git a/dlls/winegstreamer/wmv_decoder.c b/dlls/winegstreamer/wmv_decoder.c index 3aacede1345..4be36d803ba 100644 --- a/dlls/winegstreamer/wmv_decoder.c +++ b/dlls/winegstreamer/wmv_decoder.c @@ -81,6 +81,7 @@ struct wmv_decoder LONG refcount; struct wg_format input_format; + struct wg_format output_format; }; static bool wg_format_is_set(struct wg_format *format) @@ -513,8 +514,44 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD index, const DMO_MEDIA_TYPE *type, DWORD flags) { - FIXME("iface %p, index %lu, type %p, flags %#lx stub!\n", iface, index, type, flags); - return E_NOTIMPL; + struct wmv_decoder *decoder = impl_from_IMediaObject(iface); + struct wg_format wg_format; + unsigned int i; + + TRACE("iface %p, index %lu, type %p, flags %#lx,\n", iface, index, type, flags); + + if (index > 0) + return DMO_E_INVALIDSTREAMINDEX; + + if (!type) + { + if (flags & DMO_SET_TYPEF_CLEAR) + { + memset(&decoder->output_format, 0, sizeof(decoder->output_format)); + return S_OK; + } + return E_POINTER; + } + + if (!wg_format_is_set(&decoder->input_format)) + return DMO_E_TYPE_NOT_SET; + + if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Video)) + return DMO_E_TYPE_NOT_ACCEPTED; + + for (i = 0; i < ARRAY_SIZE(wmv_decoder_output_types); ++i) + if (IsEqualGUID(&type->subtype, wmv_decoder_output_types[i].subtype)) + break; + if (i == ARRAY_SIZE(wmv_decoder_output_types)) + return DMO_E_TYPE_NOT_ACCEPTED; + + if (!amt_to_wg_format((const AM_MEDIA_TYPE *)type, &wg_format)) + return DMO_E_TYPE_NOT_ACCEPTED; + + if (!(flags & DMO_SET_TYPEF_TEST_ONLY)) + decoder->output_format = wg_format; + + return S_OK; } static HRESULT WINAPI media_object_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type)