Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 14 ++++++++++++-- dlls/mfplat/tests/mfplat.c | 11 ++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index b526509ab3..bdc476005a 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -931,9 +931,19 @@ static HRESULT WINAPI mediatype_handler_GetCurrentMediaType(IMFMediaTypeHandler
static HRESULT WINAPI mediatype_handler_GetMajorType(IMFMediaTypeHandler *iface, GUID *type) { - FIXME("%p, %p.\n", iface, type); + struct stream_desc *stream_desc = impl_from_IMFMediaTypeHandler(iface); + HRESULT hr;
- return E_NOTIMPL; + TRACE("%p, %p.\n", iface, type); + + EnterCriticalSection(&stream_desc->cs); + if (stream_desc->current_type) + hr = IMFMediaType_GetGUID(stream_desc->current_type, &MF_MT_MAJOR_TYPE, type); + else + hr = MF_E_ATTRIBUTENOTFOUND; + LeaveCriticalSection(&stream_desc->cs); + + return hr; }
static const IMFMediaTypeHandlerVtbl mediatypehandlervtbl = diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index b3fbc46126..9985f59172 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -2387,7 +2387,6 @@ static void test_stream_descriptor(void) ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IMFMediaTypeHandler_GetMajorType(type_handler, &major_type); -todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(media_types); ++i) @@ -2409,6 +2408,16 @@ todo_wine hr = IMFMediaTypeHandler_SetCurrentMediaType(type_handler, media_type); ok(hr == S_OK, "Failed to set current type, hr %#x.\n", hr);
+ hr = IMFMediaTypeHandler_GetMajorType(type_handler, &major_type); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio); + ok(hr == S_OK, "Failed to set major type, hr %#x.\n", hr); + + hr = IMFMediaTypeHandler_GetMajorType(type_handler, &major_type); + ok(hr == S_OK, "Failed to get major type, hr %#x.\n", hr); + ok(IsEqualGUID(&major_type, &MFMediaType_Audio), "Unexpected major type.\n"); + hr = IMFMediaTypeHandler_GetMediaTypeCount(type_handler, &count); ok(hr == S_OK, "Failed to get type count, hr %#x.\n", hr); ok(count == ARRAY_SIZE(media_types), "Unexpected type count.\n");