Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 48 +++++++++++++++++++++++++++++++++++++++++++++- dlls/mf/tests/mf.c | 9 ++++++++- 2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 27238339031..2ac85fab795 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); struct video_renderer { IMFMediaSink IMFMediaSink_iface; + IMFMediaSinkPreroll IMFMediaSinkPreroll_iface; LONG refcount; };
@@ -33,14 +34,25 @@ static struct video_renderer *impl_from_IMFMediaSink(IMFMediaSink *iface) return CONTAINING_RECORD(iface, struct video_renderer, IMFMediaSink_iface); }
+static struct video_renderer *impl_from_IMFMediaSinkPreroll(IMFMediaSinkPreroll *iface) +{ + return CONTAINING_RECORD(iface, struct video_renderer, IMFMediaSinkPreroll_iface); +} + static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, REFIID riid, void **obj) { + struct video_renderer *renderer = impl_from_IMFMediaSink(iface); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
if (IsEqualIID(riid, &IID_IMFMediaSink) || IsEqualIID(riid, &IID_IUnknown)) { - *obj = iface; + *obj = &renderer->IMFMediaSink_iface; + } + else if (IsEqualIID(riid, &IID_IMFMediaSinkPreroll)) + { + *obj = &renderer->IMFMediaSinkPreroll_iface; } else { @@ -159,6 +171,39 @@ static const IMFMediaSinkVtbl video_renderer_sink_vtbl = video_renderer_sink_Shutdown, };
+static HRESULT WINAPI video_renderer_preroll_QueryInterface(IMFMediaSinkPreroll *iface, REFIID riid, void **obj) +{ + struct video_renderer *renderer = impl_from_IMFMediaSinkPreroll(iface); + return IMFMediaSink_QueryInterface(&renderer->IMFMediaSink_iface, riid, obj); +} + +static ULONG WINAPI video_renderer_preroll_AddRef(IMFMediaSinkPreroll *iface) +{ + struct video_renderer *renderer = impl_from_IMFMediaSinkPreroll(iface); + return IMFMediaSink_AddRef(&renderer->IMFMediaSink_iface); +} + +static ULONG WINAPI video_renderer_preroll_Release(IMFMediaSinkPreroll *iface) +{ + struct video_renderer *renderer = impl_from_IMFMediaSinkPreroll(iface); + return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); +} + +static HRESULT WINAPI video_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll *iface, MFTIME start_time) +{ + FIXME("%p, %s.\n", iface, debugstr_time(start_time)); + + return E_NOTIMPL; +} + +static const IMFMediaSinkPrerollVtbl video_renderer_preroll_vtbl = +{ + video_renderer_preroll_QueryInterface, + video_renderer_preroll_AddRef, + video_renderer_preroll_Release, + video_renderer_preroll_NotifyPreroll, +}; + static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, IUnknown **obj) { struct video_renderer *object; @@ -169,6 +214,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, return E_OUTOFMEMORY;
object->IMFMediaSink_iface.lpVtbl = &video_renderer_sink_vtbl; + object->IMFMediaSinkPreroll_iface.lpVtbl = &video_renderer_preroll_vtbl; object->refcount = 1;
*obj = (IUnknown *)&object->IMFMediaSink_iface; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 72444dd2482..44d69a7a8cc 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3226,6 +3226,7 @@ todo_wine
static void test_evr(void) { + IMFMediaSinkPreroll *preroll; IMFMediaSink *sink, *sink2; IMFActivate *activate; DWORD flags, count; @@ -3252,9 +3253,15 @@ static void test_evr(void) hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink); ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr);
+ flags = 0; hr = IMFMediaSink_GetCharacteristics(sink, &flags); -todo_wine +todo_wine { + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(flags == (MEDIASINK_CAN_PREROLL | MEDIASINK_CLOCK_REQUIRED), "Unexpected flags %#x.\n", flags); +} + hr = IMFMediaSink_QueryInterface(sink, &IID_IMFMediaSinkPreroll, (void **)&preroll); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFMediaSinkPreroll_Release(preroll);
hr = IMFActivate_ShutdownObject(activate); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);