Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfreadwrite/main.c | 10 ++++++++-- dlls/mfreadwrite/tests/mfplat.c | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index 7625669ddb..d80e450c85 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -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; }
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 074c403e49..188e6889fe 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -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+ */