Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfreadwrite/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index fd9062f648..7625669ddb 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -727,7 +727,13 @@ static DWORD reader_get_first_stream_index(IMFPresentationDescriptor *descriptor { hr = IMFMediaTypeHandler_GetMajorType(handler, &guid); IMFMediaTypeHandler_Release(handler); - if (SUCCEEDED(hr) && IsEqualGUID(&guid, major)) + if (FAILED(hr)) + { + WARN("Failed to get stream major type, hr %#x.\n", hr); + continue; + } + + if (IsEqualGUID(&guid, major)) { return i; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 176f339022..571d57a220 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -216,9 +216,13 @@ static void test_source_resolver(void) IMFAttributes *attributes; IMFMediaSource *mediasource; IMFPresentationDescriptor *descriptor; + IMFMediaTypeHandler *handler; MF_OBJECT_TYPE obj_type; + IMFStreamDescriptor *sd; HRESULT hr; WCHAR *filename; + BOOL selected; + GUID guid;
static const WCHAR file_type[] = {'v','i','d','e','o','/','m','p','4',0};
@@ -297,11 +301,23 @@ static void test_source_resolver(void) ok(mediasource != NULL, "got %p\n", mediasource); ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type);
- hr = IMFMediaSource_CreatePresentationDescriptor( - mediasource, &descriptor); - ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IMFMediaSource_CreatePresentationDescriptor(mediasource, &descriptor); + ok(hr == S_OK, "Failed to get presentation descriptor, hr %#x.\n", hr); ok(descriptor != NULL, "got %p\n", descriptor);
+ hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(descriptor, 0, &selected, &sd); + ok(hr == S_OK, "Failed to get stream descriptor, hr %#x.\n", hr); + + hr = IMFStreamDescriptor_GetMediaTypeHandler(sd, &handler); + ok(hr == S_OK, "Failed to get type handler, hr %#x.\n", hr); + + hr = IMFMediaTypeHandler_GetMajorType(handler, &guid); +todo_wine + ok(hr == S_OK, "Failed to get stream major type, hr %#x.\n", hr); + + IMFMediaTypeHandler_Release(handler); + IMFStreamDescriptor_Release(sd); + IMFPresentationDescriptor_Release(descriptor); IMFMediaSource_Release(mediasource); IMFByteStream_Release(bytestream);