Nikolay Sivov : mf/evr: Add slowest/fastest rate support methods.
Alexandre Julliard
julliard at winehq.org
Mon Apr 26 15:51:31 CDT 2021
Module: wine
Branch: master
Commit: 51a0cdf52d6f9796ba5e3ca8bb8abb205703f54b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=51a0cdf52d6f9796ba5e3ca8bb8abb205703f54b
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Apr 26 11:23:35 2021 +0300
mf/evr: Add slowest/fastest rate support methods.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mf/evr.c | 17 +++++++++++++----
dlls/mf/tests/mf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c
index 2a529895237..292e84ddd6b 100644
--- a/dlls/mf/evr.c
+++ b/dlls/mf/evr.c
@@ -2677,17 +2677,26 @@ static ULONG WINAPI video_renderer_rate_support_Release(IMFRateSupport *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);
+ struct video_renderer *renderer = impl_from_IMFRateSupport(iface);
- return E_NOTIMPL;
+ TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
+
+ if (renderer->flags & EVR_SHUT_DOWN)
+ return MF_E_SHUTDOWN;
+
+ *rate = 0.0f;
+
+ return S_OK;
}
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);
+ struct video_renderer *renderer = impl_from_IMFRateSupport(iface);
- return E_NOTIMPL;
+ TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
+
+ return renderer->flags & EVR_SHUT_DOWN ? MF_E_SHUTDOWN : MF_E_INVALIDREQUEST;
}
static HRESULT WINAPI video_renderer_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate,
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 89da5d0ab64..c8c7e0569cc 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -4224,10 +4224,12 @@ static void test_evr(void)
DWORD flags, count, value;
IMFActivate *activate;
HWND window, window2;
+ IMFRateSupport *rs;
LONG sample_count;
IMFSample *sample;
IUnknown *unk;
UINT64 window3;
+ float rate;
HRESULT hr;
GUID guid;
@@ -4510,6 +4512,50 @@ todo_wine
hr = IMFMediaSink_SetPresentationClock(sink, clock);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaSink_QueryInterface(sink, &IID_IMFRateSupport, (void **)&rs);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ rate = 1.0f;
+ hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_FORWARD, FALSE, &rate);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(rate == 0.0f, "Unexpected rate %f.\n", rate);
+
+ rate = 1.0f;
+ hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_REVERSE, FALSE, &rate);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(rate == 0.0f, "Unexpected rate %f.\n", rate);
+
+ rate = 1.0f;
+ hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_FORWARD, TRUE, &rate);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(rate == 0.0f, "Unexpected rate %f.\n", rate);
+
+ rate = 1.0f;
+ hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_REVERSE, TRUE, &rate);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(rate == 0.0f, "Unexpected rate %f.\n", rate);
+
+ hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, &rate);
+ ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, FALSE, &rate);
+ ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, TRUE, &rate);
+ ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate);
+ ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFMediaSink_Shutdown(sink);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_FORWARD, FALSE, &rate);
+ ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, &rate);
+ ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+
IMFPresentationClock_Release(clock);
IMFActivate_Release(activate);
More information about the wine-cvs
mailing list