Commit 5b3fdc26 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfreadwrite: Duplicate media type returned with GetNativeMediaType().

parent 89bfcfc6
......@@ -463,6 +463,7 @@ static HRESULT WINAPI src_reader_GetNativeMediaType(IMFSourceReader *iface, DWOR
struct source_reader *reader = impl_from_IMFSourceReader(iface);
IMFMediaTypeHandler *handler;
IMFStreamDescriptor *sd;
IMFMediaType *src_type;
BOOL selected;
HRESULT hr;
......@@ -489,11 +490,16 @@ static HRESULT WINAPI src_reader_GetNativeMediaType(IMFSourceReader *iface, DWOR
return hr;
if (type_index == MF_SOURCE_READER_CURRENT_TYPE_INDEX)
hr = IMFMediaTypeHandler_GetCurrentMediaType(handler, type);
hr = IMFMediaTypeHandler_GetCurrentMediaType(handler, &src_type);
else
hr = IMFMediaTypeHandler_GetMediaTypeByIndex(handler, type_index, type);
hr = IMFMediaTypeHandler_GetMediaTypeByIndex(handler, type_index, &src_type);
IMFMediaTypeHandler_Release(handler);
if (SUCCEEDED(hr = MFCreateMediaType(type)))
hr = IMFMediaType_CopyAllItems(src_type, (IMFAttributes *)*type);
IMFMediaType_Release(src_type);
return hr;
}
......
......@@ -186,9 +186,9 @@ static struct async_callback *create_async_callback(void)
static void test_source_reader(void)
{
IMFMediaType *mediatype, *mediatype2;
struct async_callback *callback;
IMFAttributes *attributes;
IMFMediaType *mediatype;
IMFSourceReader *reader;
IMFMediaSource *source;
IMFByteStream *stream;
......@@ -267,6 +267,10 @@ todo_wine
hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &mediatype);
ok(hr == S_OK, "Failed to get native mediatype, hr %#x.\n", hr);
hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &mediatype2);
ok(hr == S_OK, "Failed to get native mediatype, hr %#x.\n", hr);
ok(mediatype != mediatype2, "Unexpected media type instance.\n");
IMFMediaType_Release(mediatype2);
IMFMediaType_Release(mediatype);
/* MF_SOURCE_READER_CURRENT_TYPE_INDEX is Win8+ */
......
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