Commit 762a9ae4 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Implement GetMajorType() for stream descriptor.

parent d3e819a5
......@@ -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 =
......
......@@ -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");
......
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