[PATCH v2 0/2] MR9571: winegstreamer: Implement media_object_Get{Input,Output}CurrentType.
-- v2: winegstreamer: Implement media_object_Get{Input,Output}CurrentType. mf/tests: Test Get{Input,Output}CurrentType. https://gitlab.winehq.org/wine/wine/-/merge_requests/9571
From: Yuxuan Shui <yshui(a)codeweavers.com> --- dlls/mf/tests/transform.c | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index e5c65ace228..7e8dae901b3 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -7857,6 +7857,33 @@ static void test_wmv_decoder_dmo_input_type(void) winetest_pop_context(); } + /* Test GetInputCurrentType. */ + hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 1, NULL); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 0, NULL); + todo_wine ok(hr == E_POINTER, "GetInputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 1, &type); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 0, &type); + todo_wine ok(hr == DMO_E_TYPE_NOT_SET, "GetInputCurrentType returned %#lx.\n", hr); + + init_dmo_media_type_video(good_input_type, input_subtypes[0], width, height, 0); + good_input_type->cbFormat = sizeof(VIDEOINFOHEADER); + hr = IMediaObject_SetInputType(dmo, 0, good_input_type, 0); + ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 1, NULL); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 0, NULL); + todo_wine ok(hr == E_POINTER, "GetInputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 1, &type); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetInputCurrentType(dmo, 0, &type); + todo_wine ok(hr == S_OK, "GetInputCurrentType returned %#lx.\n", hr); + if (hr == S_OK) check_dmo_media_type(&type, good_input_type); + MoFreeMediaType(&type); + init_dmo_media_type_video(good_input_type, input_subtype, width, height, 0); header->dwBitRate = 0xdeadbeef; header->dwBitErrorRate = 0xdeadbeef; @@ -8119,8 +8146,31 @@ static void test_wmv_decoder_dmo_output_type(void) hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0x4); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + /* Test GetOutputCurrentType. */ + hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 1, NULL); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 0, NULL); + todo_wine ok(hr == E_POINTER, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 1, &type); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 0, &type); + todo_wine ok(hr == DMO_E_TYPE_NOT_SET, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 1, NULL); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 0, NULL); + todo_wine ok(hr == E_POINTER, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 1, &type); + todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + hr = IMediaObject_GetOutputCurrentType(dmo, 0, &type); + todo_wine ok(hr == S_OK, "GetOutputCurrentType returned %#lx.\n", hr); + if (hr == S_OK) check_dmo_media_type(&type, good_output_type); + MoFreeMediaType(&type); + hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, DMO_SET_TYPEF_CLEAR); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, DMO_SET_TYPEF_TEST_ONLY); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9571
From: Yuxuan Shui <yshui(a)codeweavers.com> --- dlls/mf/tests/transform.c | 32 +++++++++++++++--------------- dlls/winegstreamer/video_decoder.c | 20 +++++++++++++++---- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 7e8dae901b3..c680781cd91 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -7861,26 +7861,26 @@ static void test_wmv_decoder_dmo_input_type(void) hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 1, NULL); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 0, NULL); - todo_wine ok(hr == E_POINTER, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == E_POINTER, "GetInputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 1, &type); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 0, &type); - todo_wine ok(hr == DMO_E_TYPE_NOT_SET, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_TYPE_NOT_SET, "GetInputCurrentType returned %#lx.\n", hr); init_dmo_media_type_video(good_input_type, input_subtypes[0], width, height, 0); good_input_type->cbFormat = sizeof(VIDEOINFOHEADER); hr = IMediaObject_SetInputType(dmo, 0, good_input_type, 0); ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 1, NULL); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 0, NULL); - todo_wine ok(hr == E_POINTER, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == E_POINTER, "GetInputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 1, &type); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetInputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetInputCurrentType(dmo, 0, &type); - todo_wine ok(hr == S_OK, "GetInputCurrentType returned %#lx.\n", hr); + ok(hr == S_OK, "GetInputCurrentType returned %#lx.\n", hr); if (hr == S_OK) check_dmo_media_type(&type, good_input_type); MoFreeMediaType(&type); @@ -8150,24 +8150,24 @@ static void test_wmv_decoder_dmo_output_type(void) hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 1, NULL); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 0, NULL); - todo_wine ok(hr == E_POINTER, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == E_POINTER, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 1, &type); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 0, &type); - todo_wine ok(hr == DMO_E_TYPE_NOT_SET, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_TYPE_NOT_SET, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 1, NULL); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 0, NULL); - todo_wine ok(hr == E_POINTER, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == E_POINTER, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 1, &type); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == DMO_E_INVALIDSTREAMINDEX, "GetOutputCurrentType returned %#lx.\n", hr); hr = IMediaObject_GetOutputCurrentType(dmo, 0, &type); - todo_wine ok(hr == S_OK, "GetOutputCurrentType returned %#lx.\n", hr); + ok(hr == S_OK, "GetOutputCurrentType returned %#lx.\n", hr); if (hr == S_OK) check_dmo_media_type(&type, good_output_type); MoFreeMediaType(&type); diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index f2bef5ee959..a0b738b49d6 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -1334,14 +1334,26 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde static HRESULT WINAPI media_object_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) { - FIXME("iface %p, index %lu, type %p stub!\n", iface, index, type); - return E_NOTIMPL; + struct video_decoder *decoder = impl_from_IMediaObject(iface); + TRACE("iface %p, index %lu, type %p stub!\n", iface, index, type); + + if (index != 0) return DMO_E_INVALIDSTREAMINDEX; + if (!type) return E_POINTER; + if (IsEqualGUID(&decoder->dmo_input_type.majortype, &GUID_NULL)) return DMO_E_TYPE_NOT_SET; + + return CopyMediaType(type, &decoder->dmo_input_type); } static HRESULT WINAPI media_object_GetOutputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) { - FIXME("iface %p, index %lu, type %p stub!\n", iface, index, type); - return E_NOTIMPL; + struct video_decoder *decoder = impl_from_IMediaObject(iface); + TRACE("iface %p, index %lu, type %p stub!\n", iface, index, type); + + if (index != 0) return DMO_E_INVALIDSTREAMINDEX; + if (!type) return E_POINTER; + if (IsEqualGUID(&decoder->dmo_output_type.majortype, &GUID_NULL)) return DMO_E_TYPE_NOT_SET; + + return CopyMediaType(type, &decoder->dmo_output_type); } static HRESULT WINAPI media_object_GetInputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9571
tests are added. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571#note_123838
The wma decoder probably needs it too? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571#note_123932
On Thu Nov 27 11:19:33 2025 +0000, Rémi Bernon wrote:
The wma decoder probably needs it too? Nvm it's already implemented.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571#note_123933
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571
Rémi Bernon (@rbernon) commented about dlls/winegstreamer/video_decoder.c:
static HRESULT WINAPI media_object_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) { - FIXME("iface %p, index %lu, type %p stub!\n", iface, index, type); - return E_NOTIMPL; + struct video_decoder *decoder = impl_from_IMediaObject(iface); + TRACE("iface %p, index %lu, type %p stub!\n", iface, index, type);
```suggestion:-0+0 TRACE("iface %p, index %lu, type %p\n", iface, index, type); ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571#note_123937
Rémi Bernon (@rbernon) commented about dlls/winegstreamer/video_decoder.c:
+ struct video_decoder *decoder = impl_from_IMediaObject(iface); + TRACE("iface %p, index %lu, type %p stub!\n", iface, index, type); + + if (index != 0) return DMO_E_INVALIDSTREAMINDEX; + if (!type) return E_POINTER; + if (IsEqualGUID(&decoder->dmo_input_type.majortype, &GUID_NULL)) return DMO_E_TYPE_NOT_SET; + + return CopyMediaType(type, &decoder->dmo_input_type); }
static HRESULT WINAPI media_object_GetOutputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) { - FIXME("iface %p, index %lu, type %p stub!\n", iface, index, type); - return E_NOTIMPL; + struct video_decoder *decoder = impl_from_IMediaObject(iface); + TRACE("iface %p, index %lu, type %p stub!\n", iface, index, type);
TRACE("iface %p, index %lu, type %p\n", iface, index, type);
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571#note_123938
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9571
participants (4)
-
Elizabeth Figura (@zfigura) -
Rémi Bernon -
Yuxuan Shui -
Yuxuan Shui (@yshui)