Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filtergraph.c | 9 +++++++ dlls/quartz/tests/filtergraph.c | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 7319345931e..273cd021109 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -4961,6 +4961,15 @@ static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD timeout, F hr = VFW_S_STATE_INTERMEDIATE; else if (filter_hr != S_OK && filter_hr != VFW_S_STATE_INTERMEDIATE) hr = filter_hr; + + if (hr == S_OK && filter_state == State_Paused && graph->state != State_Paused) + { + async_filter = filter->filter; + hr = VFW_S_STATE_INTERMEDIATE; + } + else if (filter_state != graph->state && filter_state != State_Paused) + hr = E_FAIL; + if (filter_state != graph->state) ERR("Filter %p reported incorrect state %u.\n", filter->filter, filter_state); } diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index c0076191a87..99120133bb6 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -3254,6 +3254,21 @@ static void test_filter_state(void) ok(hr == S_OK, "Got hr %#x.\n", hr); check_filter_state(graph, State_Paused);
+ sink.state = State_Stopped; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + + sink.state = State_Running; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + + sink.state = State_Paused; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#x.\n", hr); check_filter_state(graph, State_Stopped); @@ -3262,10 +3277,40 @@ static void test_filter_state(void) ok(hr == S_OK, "Got hr %#x.\n", hr); check_filter_state(graph, State_Running);
+ sink.state = State_Stopped; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + + sink.state = State_Paused; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + + sink.state = State_Running; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#x.\n", hr); check_filter_state(graph, State_Stopped);
+ sink.state = State_Running; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + sink.state = State_Paused; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + sink.state = State_Stopped; + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + hr = IMediaControl_Pause(control); ok(hr == S_OK, "Got hr %#x.\n", hr); check_filter_state(graph, State_Paused);