Commit 5009e5da authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Set shutdown state flag for presentation clock.

parent 15657f68
...@@ -239,6 +239,7 @@ struct presentation_clock ...@@ -239,6 +239,7 @@ struct presentation_clock
float rate; float rate;
LONGLONG frequency; LONGLONG frequency;
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
BOOL is_shut_down;
}; };
struct quality_manager struct quality_manager
...@@ -3332,16 +3333,35 @@ static ULONG WINAPI present_clock_shutdown_Release(IMFShutdown *iface) ...@@ -3332,16 +3333,35 @@ static ULONG WINAPI present_clock_shutdown_Release(IMFShutdown *iface)
static HRESULT WINAPI present_clock_shutdown_Shutdown(IMFShutdown *iface) static HRESULT WINAPI present_clock_shutdown_Shutdown(IMFShutdown *iface)
{ {
FIXME("%p.\n", iface); struct presentation_clock *clock = impl_from_IMFShutdown(iface);
return E_NOTIMPL; TRACE("%p.\n", iface);
EnterCriticalSection(&clock->cs);
clock->is_shut_down = TRUE;
LeaveCriticalSection(&clock->cs);
return S_OK;
} }
static HRESULT WINAPI present_clock_shutdown_GetShutdownStatus(IMFShutdown *iface, MFSHUTDOWN_STATUS *status) static HRESULT WINAPI present_clock_shutdown_GetShutdownStatus(IMFShutdown *iface, MFSHUTDOWN_STATUS *status)
{ {
FIXME("%p, %p.\n", iface, status); struct presentation_clock *clock = impl_from_IMFShutdown(iface);
HRESULT hr = S_OK;
return E_NOTIMPL; TRACE("%p, %p.\n", iface, status);
if (!status)
return E_INVALIDARG;
EnterCriticalSection(&clock->cs);
if (clock->is_shut_down)
*status = MFSHUTDOWN_COMPLETED;
else
hr = MF_E_INVALIDREQUEST;
LeaveCriticalSection(&clock->cs);
return hr;
} }
static const IMFShutdownVtbl presentclockshutdownvtbl = static const IMFShutdownVtbl presentclockshutdownvtbl =
......
...@@ -1776,6 +1776,10 @@ static void test_presentation_clock(void) ...@@ -1776,6 +1776,10 @@ static void test_presentation_clock(void)
ok(rate == 1.0f, "Unexpected rate.\n"); ok(rate == 1.0f, "Unexpected rate.\n");
ok(!thin, "Unexpected thinning.\n"); ok(!thin, "Unexpected thinning.\n");
hr = IMFPresentationClock_GetState(clock, 0, &state);
ok(hr == S_OK, "Failed to get clock state, hr %#x.\n", hr);
ok(state == MFCLOCK_STATE_PAUSED, "Unexpected state %d.\n", state);
hr = IMFPresentationClock_Start(clock, 0); hr = IMFPresentationClock_Start(clock, 0);
ok(hr == S_OK, "Failed to stop, hr %#x.\n", hr); ok(hr == S_OK, "Failed to stop, hr %#x.\n", hr);
...@@ -1809,18 +1813,37 @@ static void test_presentation_clock(void) ...@@ -1809,18 +1813,37 @@ static void test_presentation_clock(void)
/* Shutdown behavior. */ /* Shutdown behavior. */
hr = IMFShutdown_GetShutdownStatus(shutdown, NULL); hr = IMFShutdown_GetShutdownStatus(shutdown, NULL);
todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFShutdown_Shutdown(shutdown); hr = IMFShutdown_Shutdown(shutdown);
todo_wine
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
time_source = NULL;
hr = IMFPresentationClock_GetTimeSource(clock, &time_source);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!time_source, "Unexpected instance %p.\n", time_source);
IMFPresentationTimeSource_Release(time_source);
hr = IMFPresentationClock_GetTime(clock, &time);
ok(hr == S_OK, "Failed to get time, hr %#x.\n", hr);
hr = IMFShutdown_GetShutdownStatus(shutdown, &status); hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
todo_wine {
ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr);
ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n"); ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n");
}
hr = IMFPresentationClock_Start(clock, 0);
ok(hr == S_OK, "Failed to start the clock, hr %#x.\n", hr);
hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr);
ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n");
hr = IMFShutdown_Shutdown(shutdown);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IMFShutdown_Release(shutdown); IMFShutdown_Release(shutdown);
IMFPresentationClock_Release(clock); IMFPresentationClock_Release(clock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment