From e6c488de36a968e6338579fa9691169f301969d2 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 20 May 2019 15:22:30 +0300 Subject: [PATCH] mf: Add clock state sink stub for grabber. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/samplegrabber.c | 76 +++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 4 +-- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c index a6a18dd96fb..f0b23241e02 100644 --- a/dlls/mf/samplegrabber.c +++ b/dlls/mf/samplegrabber.c @@ -38,6 +38,7 @@ struct sample_grabber_stream struct sample_grabber { IMFMediaSink IMFMediaSink_iface; + IMFClockStateSink IMFClockStateSink_iface; LONG refcount; IMFSampleGrabberSinkCallback *callback; IMFMediaType *media_type; @@ -65,6 +66,11 @@ static struct sample_grabber *impl_from_IMFMediaSink(IMFMediaSink *iface) return CONTAINING_RECORD(iface, struct sample_grabber, IMFMediaSink_iface); } +static struct sample_grabber *impl_from_IMFClockStateSink(IMFClockStateSink *iface) +{ + return CONTAINING_RECORD(iface, struct sample_grabber, IMFClockStateSink_iface); +} + static struct sample_grabber_stream *impl_from_IMFStreamSink(IMFStreamSink *iface) { return CONTAINING_RECORD(iface, struct sample_grabber_stream, IMFStreamSink_iface); @@ -320,6 +326,10 @@ static HRESULT WINAPI sample_grabber_sink_QueryInterface(IMFMediaSink *iface, RE { *obj = &grabber->IMFMediaSink_iface; } + else if (IsEqualIID(riid, &IID_IMFClockStateSink)) + { + *obj = &grabber->IMFClockStateSink_iface; + } else { WARN("Unsupported %s.\n", debugstr_guid(riid)); @@ -508,6 +518,71 @@ static const IMFMediaSinkVtbl sample_grabber_sink_vtbl = sample_grabber_sink_Shutdown, }; +static HRESULT WINAPI sample_grabber_clock_sink_QueryInterface(IMFClockStateSink *iface, REFIID riid, void **obj) +{ + struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); + return IMFMediaSink_QueryInterface(&grabber->IMFMediaSink_iface, riid, obj); +} + +static ULONG WINAPI sample_grabber_clock_sink_AddRef(IMFClockStateSink *iface) +{ + struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); + return IMFMediaSink_AddRef(&grabber->IMFMediaSink_iface); +} + +static ULONG WINAPI sample_grabber_clock_sink_Release(IMFClockStateSink *iface) +{ + struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); + return IMFMediaSink_Release(&grabber->IMFMediaSink_iface); +} + +static HRESULT WINAPI sample_grabber_clock_sink_OnClockStart(IMFClockStateSink *iface, MFTIME systime, LONGLONG offset) +{ + FIXME("%p, %s, %s.\n", iface, wine_dbgstr_longlong(systime), wine_dbgstr_longlong(offset)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI sample_grabber_clock_sink_OnClockStop(IMFClockStateSink *iface, MFTIME systime) +{ + FIXME("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI sample_grabber_clock_sink_OnClockPause(IMFClockStateSink *iface, MFTIME systime) +{ + FIXME("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI sample_grabber_clock_sink_OnClockRestart(IMFClockStateSink *iface, MFTIME systime) +{ + FIXME("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME systime, float rate) +{ + FIXME("%p, %s, %f.\n", iface, wine_dbgstr_longlong(systime), rate); + + return E_NOTIMPL; +} + +static const IMFClockStateSinkVtbl sample_grabber_clock_sink_vtbl = +{ + sample_grabber_clock_sink_QueryInterface, + sample_grabber_clock_sink_AddRef, + sample_grabber_clock_sink_Release, + sample_grabber_clock_sink_OnClockStart, + sample_grabber_clock_sink_OnClockStop, + sample_grabber_clock_sink_OnClockPause, + sample_grabber_clock_sink_OnClockRestart, + sample_grabber_clock_sink_OnClockSetRate, +}; + static HRESULT sample_grabber_create_stream(IMFMediaSink *sink, IMFStreamSink **stream) { struct sample_grabber_stream *object; @@ -540,6 +615,7 @@ static HRESULT sample_grabber_create_object(IMFAttributes *attributes, void *use return E_OUTOFMEMORY; object->IMFMediaSink_iface.lpVtbl = &sample_grabber_sink_vtbl; + object->IMFClockStateSink_iface.lpVtbl = &sample_grabber_clock_sink_vtbl; object->refcount = 1; object->callback = context->callback; IMFSampleGrabberSinkCallback_AddRef(object->callback); diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index b37fdbaeeb0..43d26906b24 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1709,10 +1709,8 @@ static void test_sample_grabber(void) ok(hr == MF_E_STREAMSINKS_FIXED, "Unexpected hr %#x.\n", hr); hr = IMFMediaSink_QueryInterface(sink, &IID_IMFClockStateSink, (void **)&clocksink); -todo_wine ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr); - if (SUCCEEDED(hr)) - IMFClockStateSink_Release(clocksink); + IMFClockStateSink_Release(clocksink); hr = IMFMediaSink_QueryInterface(sink, &IID_IMFMediaEventGenerator, (void **)&eg); todo_wine