mfreadwrite: Duplicate media type returned with GetNativeMediaType().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
89bfcfc645
commit
5b3fdc26b7
|
@ -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+ */
|
||||
|
|
Loading…
Reference in New Issue