mf/evr: Notify mixer and presenter on clock state changes.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-10-26 17:20:22 +03:00 committed by Alexandre Julliard
parent 21355680e5
commit 8680afcc06
1 changed files with 49 additions and 21 deletions

View File

@ -860,7 +860,6 @@ static HRESULT WINAPI video_renderer_sink_GetStreamSinkById(IMFMediaSink *iface,
*stream = &renderer->streams[i]->IMFStreamSink_iface;
IMFStreamSink_AddRef(*stream);
}
}
LeaveCriticalSection(&renderer->cs);
@ -1382,6 +1381,11 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStart(IMFClockStateSink *
EnterCriticalSection(&renderer->cs);
if (renderer->state == EVR_STATE_STOPPED)
{
IMFTransform_ProcessMessage(renderer->mixer, MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0);
IMFVideoPresenter_ProcessMessage(renderer->presenter, MFVP_MESSAGE_BEGINSTREAMING, 0);
for (i = 0; i < renderer->stream_count; ++i)
{
struct video_stream *stream = renderer->streams[i];
@ -1395,8 +1399,12 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStart(IMFClockStateSink *
stream->flags |= EVR_STREAM_PREROLLED;
LeaveCriticalSection(&stream->cs);
}
}
renderer->state = EVR_STATE_RUNNING;
IMFVideoPresenter_OnClockStart(renderer->presenter, systime, offset);
LeaveCriticalSection(&renderer->cs);
return S_OK;
@ -1411,6 +1419,17 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStop(IMFClockStateSink *i
EnterCriticalSection(&renderer->cs);
IMFVideoPresenter_OnClockStop(renderer->presenter, systime);
IMFTransform_ProcessMessage(renderer->mixer, MFT_MESSAGE_COMMAND_FLUSH, 0);
IMFVideoPresenter_ProcessMessage(renderer->presenter, MFVP_MESSAGE_FLUSH, 0);
if (renderer->state == EVR_STATE_RUNNING ||
renderer->state == EVR_STATE_PAUSED)
{
IMFTransform_ProcessMessage(renderer->mixer, MFT_MESSAGE_NOTIFY_END_STREAMING, 0);
IMFVideoPresenter_ProcessMessage(renderer->presenter, MFVP_MESSAGE_ENDSTREAMING, 0);
for (i = 0; i < renderer->stream_count; ++i)
{
struct video_stream *stream = renderer->streams[i];
@ -1421,6 +1440,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStop(IMFClockStateSink *i
LeaveCriticalSection(&stream->cs);
}
renderer->state = EVR_STATE_STOPPED;
}
LeaveCriticalSection(&renderer->cs);
@ -1436,11 +1456,17 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockPause(IMFClockStateSink *
EnterCriticalSection(&renderer->cs);
IMFVideoPresenter_OnClockPause(renderer->presenter, systime);
if (renderer->state == EVR_STATE_RUNNING)
{
for (i = 0; i < renderer->stream_count; ++i)
{
struct video_stream *stream = renderer->streams[i];
IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkPaused, &GUID_NULL, S_OK, NULL);
}
}
renderer->state = EVR_STATE_PAUSED;
LeaveCriticalSection(&renderer->cs);
@ -1457,6 +1483,8 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockRestart(IMFClockStateSink
EnterCriticalSection(&renderer->cs);
IMFVideoPresenter_OnClockRestart(renderer->presenter, systime);
for (i = 0; i < renderer->stream_count; ++i)
{
struct video_stream *stream = renderer->streams[i];