Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 5 +++ 2 files changed, 81 insertions(+)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index bb21ccdd25a..aa4d3850c6f 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -34,6 +34,7 @@ struct video_renderer IMFMediaSink IMFMediaSink_iface; IMFMediaSinkPreroll IMFMediaSinkPreroll_iface; IMFVideoRenderer IMFVideoRenderer_iface; + IMFClockStateSink IMFClockStateSink_iface; IMFMediaEventGenerator IMFMediaEventGenerator_iface; LONG refcount;
@@ -64,6 +65,11 @@ static struct video_renderer *impl_from_IMFMediaEventGenerator(IMFMediaEventGene return CONTAINING_RECORD(iface, struct video_renderer, IMFMediaEventGenerator_iface); }
+static struct video_renderer *impl_from_IMFClockStateSink(IMFClockStateSink *iface) +{ + return CONTAINING_RECORD(iface, struct video_renderer, IMFClockStateSink_iface); +} + static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, REFIID riid, void **obj) { struct video_renderer *renderer = impl_from_IMFMediaSink(iface); @@ -87,6 +93,10 @@ static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, RE { *obj = &renderer->IMFMediaEventGenerator_iface; } + else if (IsEqualIID(riid, &IID_IMFClockStateSink)) + { + *obj = &renderer->IMFClockStateSink_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -363,6 +373,71 @@ static const IMFMediaEventGeneratorVtbl video_renderer_events_vtbl = video_renderer_events_QueueEvent, };
+static HRESULT WINAPI video_renderer_clock_sink_QueryInterface(IMFClockStateSink *iface, REFIID riid, void **obj) +{ + struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); + return IMFMediaSink_QueryInterface(&renderer->IMFMediaSink_iface, riid, obj); +} + +static ULONG WINAPI video_renderer_clock_sink_AddRef(IMFClockStateSink *iface) +{ + struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); + return IMFMediaSink_AddRef(&renderer->IMFMediaSink_iface); +} + +static ULONG WINAPI video_renderer_clock_sink_Release(IMFClockStateSink *iface) +{ + struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); + return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); +} + +static HRESULT WINAPI video_renderer_clock_sink_OnClockStart(IMFClockStateSink *iface, MFTIME systime, LONGLONG offset) +{ + FIXME("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_renderer_clock_sink_OnClockStop(IMFClockStateSink *iface, MFTIME systime) +{ + FIXME("%p, %s.\n", iface, debugstr_time(systime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_renderer_clock_sink_OnClockPause(IMFClockStateSink *iface, MFTIME systime) +{ + FIXME("%p, %s.\n", iface, debugstr_time(systime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_renderer_clock_sink_OnClockRestart(IMFClockStateSink *iface, MFTIME systime) +{ + FIXME("%p, %s.\n", iface, debugstr_time(systime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_renderer_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME systime, float rate) +{ + FIXME("%p, %s, %f.\n", iface, debugstr_time(systime), rate); + + return E_NOTIMPL; +} + +static const IMFClockStateSinkVtbl video_renderer_clock_sink_vtbl = +{ + video_renderer_clock_sink_QueryInterface, + video_renderer_clock_sink_AddRef, + video_renderer_clock_sink_Release, + video_renderer_clock_sink_OnClockStart, + video_renderer_clock_sink_OnClockStop, + video_renderer_clock_sink_OnClockPause, + video_renderer_clock_sink_OnClockRestart, + video_renderer_clock_sink_OnClockSetRate, +}; + static HRESULT video_renderer_create_mixer(IMFAttributes *attributes, IMFTransform **out) { unsigned int flags = 0; @@ -423,6 +498,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, object->IMFMediaSinkPreroll_iface.lpVtbl = &video_renderer_preroll_vtbl; object->IMFVideoRenderer_iface.lpVtbl = &video_renderer_vtbl; object->IMFMediaEventGenerator_iface.lpVtbl = &video_renderer_events_vtbl; + object->IMFClockStateSink_iface.lpVtbl = &video_renderer_clock_sink_vtbl; object->refcount = 1; InitializeCriticalSection(&object->cs);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 5d9ccc5408d..077466b7e8e 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3229,6 +3229,7 @@ static void test_evr(void) { IMFMediaEventGenerator *ev_generator; IMFVideoRenderer *video_renderer; + IMFClockStateSink *clock_sink; IMFMediaSinkPreroll *preroll; IMFMediaSink *sink, *sink2; IMFActivate *activate; @@ -3272,6 +3273,10 @@ static void test_evr(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IMFMediaEventGenerator_Release(ev_generator);
+ hr = IMFMediaSink_QueryInterface(sink, &IID_IMFClockStateSink, (void **)&clock_sink); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFClockStateSink_Release(clock_sink); + hr = IMFActivate_ShutdownObject(activate); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 5 +++++ 2 files changed, 49 insertions(+)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index aa4d3850c6f..ebb3fd4c2c8 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -36,6 +36,7 @@ struct video_renderer IMFVideoRenderer IMFVideoRenderer_iface; IMFClockStateSink IMFClockStateSink_iface; IMFMediaEventGenerator IMFMediaEventGenerator_iface; + IMFGetService IMFGetService_iface; LONG refcount;
IMFMediaEventQueue *event_queue; @@ -70,6 +71,11 @@ static struct video_renderer *impl_from_IMFClockStateSink(IMFClockStateSink *ifa return CONTAINING_RECORD(iface, struct video_renderer, IMFClockStateSink_iface); }
+static struct video_renderer *impl_from_IMFGetService(IMFGetService *iface) +{ + return CONTAINING_RECORD(iface, struct video_renderer, IMFGetService_iface); +} + static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, REFIID riid, void **obj) { struct video_renderer *renderer = impl_from_IMFMediaSink(iface); @@ -97,6 +103,10 @@ static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, RE { *obj = &renderer->IMFClockStateSink_iface; } + else if (IsEqualIID(riid, &IID_IMFGetService)) + { + *obj = &renderer->IMFGetService_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -438,6 +448,39 @@ static const IMFClockStateSinkVtbl video_renderer_clock_sink_vtbl = video_renderer_clock_sink_OnClockSetRate, };
+static HRESULT WINAPI video_renderer_get_service_QueryInterface(IMFGetService *iface, REFIID riid, void **obj) +{ + struct video_renderer *renderer = impl_from_IMFGetService(iface); + return IMFMediaSink_QueryInterface(&renderer->IMFMediaSink_iface, riid, obj); +} + +static ULONG WINAPI video_renderer_get_service_AddRef(IMFGetService *iface) +{ + struct video_renderer *renderer = impl_from_IMFGetService(iface); + return IMFMediaSink_AddRef(&renderer->IMFMediaSink_iface); +} + +static ULONG WINAPI video_renderer_get_service_Release(IMFGetService *iface) +{ + struct video_renderer *renderer = impl_from_IMFGetService(iface); + return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); +} + +static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) +{ + FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + + return E_NOTIMPL; +} + +static const IMFGetServiceVtbl video_renderer_get_service_vtbl = +{ + video_renderer_get_service_QueryInterface, + video_renderer_get_service_AddRef, + video_renderer_get_service_Release, + video_renderer_get_service_GetService, +}; + static HRESULT video_renderer_create_mixer(IMFAttributes *attributes, IMFTransform **out) { unsigned int flags = 0; @@ -499,6 +542,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, object->IMFVideoRenderer_iface.lpVtbl = &video_renderer_vtbl; object->IMFMediaEventGenerator_iface.lpVtbl = &video_renderer_events_vtbl; object->IMFClockStateSink_iface.lpVtbl = &video_renderer_clock_sink_vtbl; + object->IMFGetService_iface.lpVtbl = &video_renderer_get_service_vtbl; object->refcount = 1; InitializeCriticalSection(&object->cs);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 077466b7e8e..3fad309bcf6 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3234,6 +3234,7 @@ static void test_evr(void) IMFMediaSink *sink, *sink2; IMFActivate *activate; DWORD flags, count; + IMFGetService *gs; UINT64 value; HRESULT hr;
@@ -3277,6 +3278,10 @@ static void test_evr(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IMFClockStateSink_Release(clock_sink);
+ hr = IMFMediaSink_QueryInterface(sink, &IID_IMFGetService, (void **)&gs); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFGetService_Release(gs); + hr = IMFActivate_ShutdownObject(activate); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 4 +++- dlls/evr/tests/evr.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index c8bd300b0d3..f274a2a447f 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -1021,7 +1021,9 @@ static HRESULT WINAPI video_mixer_getservice_GetService(IMFGetService *iface, RE { if (IsEqualIID(riid, &IID_IMFVideoMixerBitmap) || IsEqualIID(riid, &IID_IMFVideoProcessor) || - IsEqualIID(riid, &IID_IMFVideoPositionMapper)) + IsEqualIID(riid, &IID_IMFVideoPositionMapper) || + IsEqualIID(riid, &IID_IMFVideoMixerControl) || + IsEqualIID(riid, &IID_IMFVideoMixerControl2)) { return IMFGetService_QueryInterface(iface, riid, obj); } diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index db9b3a80e04..5e184947188 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -450,6 +450,10 @@ static void test_default_mixer(void) hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, (void **)&processor); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk); + hr = IMFVideoProcessor_GetBackgroundColor(processor, NULL); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 23 +++++++++++++++++++++-- dlls/mf/tests/mf.c | 6 ++++++ 2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index ebb3fd4c2c8..8b7de5c76bb 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -468,9 +468,28 @@ static ULONG WINAPI video_renderer_get_service_Release(IMFGetService *iface)
static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) { - FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + struct video_renderer *renderer = impl_from_IMFGetService(iface); + HRESULT hr = E_NOINTERFACE; + IMFGetService *gs = NULL;
- return E_NOTIMPL; + TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + + if (IsEqualGUID(service, &MR_VIDEO_MIXER_SERVICE)) + { + hr = IMFTransform_QueryInterface(renderer->mixer, &IID_IMFGetService, (void **)&gs); + } + else + { + FIXME("Unsupported service %s.\n", debugstr_guid(service)); + } + + if (gs) + { + hr = IMFGetService_GetService(gs, service, riid, obj); + IMFGetService_Release(gs); + } + + return hr; }
static const IMFGetServiceVtbl video_renderer_get_service_vtbl = diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 3fad309bcf6..aa2c5199b95 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3235,6 +3235,7 @@ static void test_evr(void) IMFActivate *activate; DWORD flags, count; IMFGetService *gs; + IUnknown *unk; UINT64 value; HRESULT hr;
@@ -3280,6 +3281,11 @@ static void test_evr(void)
hr = IMFMediaSink_QueryInterface(sink, &IID_IMFGetService, (void **)&gs); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk); + IMFGetService_Release(gs);
hr = IMFActivate_ShutdownObject(activate);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=75049
Your paranoid android.
=== w8 (testbot log) ===
The task timed out
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 8b7de5c76bb..d20fb1a395d 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -478,6 +478,10 @@ static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface { hr = IMFTransform_QueryInterface(renderer->mixer, &IID_IMFGetService, (void **)&gs); } + else if (IsEqualGUID(service, &MR_VIDEO_RENDER_SERVICE)) + { + hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFGetService, (void **)&gs); + } else { FIXME("Unsupported service %s.\n", debugstr_guid(service));