Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 13 +++++++++++-- dlls/mf/tests/mf.c | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index b27610e073a..31bc110ea48 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -385,9 +385,18 @@ static HRESULT WINAPI video_stream_typehandler_GetCurrentMediaType(IMFMediaTypeH
static HRESULT WINAPI video_stream_typehandler_GetMajorType(IMFMediaTypeHandler *iface, GUID *type) { - FIXME("%p, %p.\n", iface, type); + struct video_stream *stream = impl_from_IMFMediaTypeHandler(iface);
- return E_NOTIMPL; + TRACE("%p, %p.\n", iface, type); + + if (!stream->parent) + return MF_E_STREAMSINK_REMOVED; + + if (!type) + return E_POINTER; + + memcpy(type, &MFMediaType_Video, sizeof(*type)); + return S_OK; }
static const IMFMediaTypeHandlerVtbl video_stream_type_handler_vtbl = diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 7013939ab0b..2c02b1d8e54 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3236,16 +3236,19 @@ todo_wine static void test_evr(void) { IMFMediaEventGenerator *ev_generator; + IMFMediaTypeHandler *type_handler; IMFVideoRenderer *video_renderer; IMFClockStateSink *clock_sink; IMFMediaSinkPreroll *preroll; IMFMediaSink *sink, *sink2; + IMFStreamSink *stream_sink; IMFActivate *activate; DWORD flags, count; IMFGetService *gs; IUnknown *unk; UINT64 value; HRESULT hr; + GUID guid;
hr = CoInitialize(NULL); ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr); @@ -3267,6 +3270,23 @@ static void test_evr(void) hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink); ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr);
+ /* Primary stream type handler. */ + hr = IMFMediaSink_GetStreamSinkById(sink, 0, &stream_sink); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFStreamSink_GetMediaTypeHandler(stream_sink, &type_handler); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaTypeHandler_GetMajorType(type_handler, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaTypeHandler_GetMajorType(type_handler, &guid); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(IsEqualGUID(&guid, &MFMediaType_Video), "Unexpected type %s.\n", wine_dbgstr_guid(&guid)); + + IMFStreamSink_Release(stream_sink); + IMFMediaTypeHandler_Release(type_handler); + hr = IMFMediaSink_GetCharacteristics(sink, &flags); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(flags == (MEDIASINK_CAN_PREROLL | MEDIASINK_CLOCK_REQUIRED), "Unexpected flags %#x.\n", flags);