Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 3 +++ 2 files changed, 70 insertions(+)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index baa6665853e..2a529895237 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -80,6 +80,7 @@ struct video_renderer IMediaEventSink IMediaEventSink_iface; IMFAttributes IMFAttributes_iface; IMFQualityAdvise IMFQualityAdvise_iface; + IMFRateSupport IMFRateSupport_iface; LONG refcount;
IMFMediaEventQueue *event_queue; @@ -150,6 +151,11 @@ static struct video_renderer *impl_from_IMFQualityAdvise(IMFQualityAdvise *iface return CONTAINING_RECORD(iface, struct video_renderer, IMFQualityAdvise_iface); }
+static struct video_renderer *impl_from_IMFRateSupport(IMFRateSupport *iface) +{ + return CONTAINING_RECORD(iface, struct video_renderer, IMFRateSupport_iface); +} + static struct video_stream *impl_from_IMFStreamSink(IMFStreamSink *iface) { return CONTAINING_RECORD(iface, struct video_stream, IMFStreamSink_iface); @@ -1087,6 +1093,10 @@ static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, RE { *obj = &renderer->IMFQualityAdvise_iface; } + else if (IsEqualIID(riid, &IID_IMFRateSupport)) + { + *obj = &renderer->IMFRateSupport_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -2028,6 +2038,10 @@ static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface if (renderer->device_manager) hr = IUnknown_QueryInterface(renderer->device_manager, riid, obj); } + else if (IsEqualGUID(service, &MF_RATE_CONTROL_SERVICE) && IsEqualIID(riid, &IID_IMFRateSupport)) + { + hr = IMFVideoRenderer_QueryInterface(&renderer->IMFVideoRenderer_iface, riid, obj); + } else { FIXME("Unsupported service %s.\n", debugstr_guid(service)); @@ -2642,6 +2656,58 @@ static const IMFQualityAdviseVtbl video_renderer_quality_advise_vtbl = video_renderer_quality_advise_DropTime, };
+static HRESULT WINAPI video_renderer_rate_support_QueryInterface(IMFRateSupport *iface, REFIID riid, void **out) +{ + struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + return IMFMediaSink_QueryInterface(&renderer->IMFMediaSink_iface, riid, out); +} + +static ULONG WINAPI video_renderer_rate_support_AddRef(IMFRateSupport *iface) +{ + struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + return IMFMediaSink_AddRef(&renderer->IMFMediaSink_iface); +} + +static ULONG WINAPI video_renderer_rate_support_Release(IMFRateSupport *iface) +{ + struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); +} + +static HRESULT WINAPI video_renderer_rate_support_GetSlowestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, + BOOL thin, float *rate) +{ + FIXME("%p, %d, %d, %p.\n", iface, direction, thin, rate); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_renderer_rate_support_GetFastestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, + BOOL thin, float *rate) +{ + FIXME("%p, %d, %d, %p.\n", iface, direction, thin, rate); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_renderer_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, + float *nearest_supported_rate) +{ + FIXME("%p, %d, %f, %p.\n", iface, thin, rate, nearest_supported_rate); + + return E_NOTIMPL; +} + +static const IMFRateSupportVtbl video_renderer_rate_support_vtbl = +{ + video_renderer_rate_support_QueryInterface, + video_renderer_rate_support_AddRef, + video_renderer_rate_support_Release, + video_renderer_rate_support_GetSlowestRate, + video_renderer_rate_support_GetFastestRate, + video_renderer_rate_support_IsRateSupported, +}; + static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, IUnknown **obj) { struct video_renderer *object; @@ -2664,6 +2730,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, object->IMediaEventSink_iface.lpVtbl = &media_event_sink_vtbl; object->IMFAttributes_iface.lpVtbl = &video_renderer_attributes_vtbl; object->IMFQualityAdvise_iface.lpVtbl = &video_renderer_quality_advise_vtbl; + object->IMFRateSupport_iface.lpVtbl = &video_renderer_rate_support_vtbl; object->refcount = 1; InitializeCriticalSection(&object->cs);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 39b9d64e729..89da5d0ab64 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4263,6 +4263,8 @@ static void test_evr(void) check_interface(sink, &IID_IMFClockStateSink, TRUE); check_interface(sink, &IID_IMFGetService, TRUE); check_interface(sink, &IID_IMFQualityAdvise, TRUE); + check_interface(sink, &IID_IMFRateSupport, TRUE); + check_interface(sink, &IID_IMFRateControl, FALSE); check_service_interface(sink, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, TRUE); check_service_interface(sink, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerBitmap, TRUE); check_service_interface(sink, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, TRUE); @@ -4270,6 +4272,7 @@ static void test_evr(void) check_service_interface(sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE); check_service_interface(sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE); check_service_interface(sink, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE); + check_service_interface(sink, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, TRUE);
hr = MFGetService((IUnknown *)sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, (void **)&display_control);