Nikolay Sivov : mfreadwrite/reader: Use current stream type to set up sample allocator.
Alexandre Julliard
julliard at winehq.org
Tue Mar 23 16:54:32 CDT 2021
Module: wine
Branch: master
Commit: 482f977b343e51d220025400b9b0f0f6f1722f88
URL: https://source.winehq.org/git/wine.git/?a=commit;h=482f977b343e51d220025400b9b0f0f6f1722f88
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Mar 23 19:04:47 2021 +0300
mfreadwrite/reader: Use current stream type to set up sample allocator.
It's normal to have incomplete type description for SetCurrentMediaType(),
with just major/subtype attributes. Allocator will need at least frame size.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfreadwrite/reader.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c
index f1fbba94e51..7cb7e1e40eb 100644
--- a/dlls/mfreadwrite/reader.c
+++ b/dlls/mfreadwrite/reader.c
@@ -1629,15 +1629,14 @@ static HRESULT source_reader_set_compatible_media_type(struct source_reader *rea
return type_set ? S_OK : S_FALSE;
}
-static HRESULT source_reader_setup_sample_allocator(struct source_reader *reader, unsigned int index,
- IMFMediaType *media_type)
+static HRESULT source_reader_setup_sample_allocator(struct source_reader *reader, unsigned int index)
{
struct media_stream *stream = &reader->streams[index];
IMFVideoSampleAllocatorCallback *callback;
GUID major = { 0 };
HRESULT hr;
- IMFMediaType_GetMajorType(media_type, &major);
+ IMFMediaType_GetMajorType(stream->current, &major);
if (!IsEqualGUID(&major, &MFMediaType_Video))
return S_OK;
@@ -1666,7 +1665,7 @@ static HRESULT source_reader_setup_sample_allocator(struct source_reader *reader
return hr;
}
- if (FAILED(hr = IMFVideoSampleAllocatorEx_InitializeSampleAllocatorEx(stream->allocator, 2, 8, NULL, media_type)))
+ if (FAILED(hr = IMFVideoSampleAllocatorEx_InitializeSampleAllocatorEx(stream->allocator, 2, 8, NULL, stream->current)))
WARN("Failed to initialize sample allocator, hr %#x.\n", hr);
if (SUCCEEDED(IMFVideoSampleAllocatorEx_QueryInterface(stream->allocator, &IID_IMFVideoSampleAllocatorCallback, (void **)&callback)))
@@ -1837,7 +1836,7 @@ static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReader *iface, DWO
if (hr == S_FALSE)
hr = source_reader_create_decoder_for_stream(reader, index, type);
if (SUCCEEDED(hr))
- hr = source_reader_setup_sample_allocator(reader, index, type);
+ hr = source_reader_setup_sample_allocator(reader, index);
LeaveCriticalSection(&reader->cs);
More information about the wine-cvs
mailing list