Nikolay Sivov : mf: Add internal placeholder command for end-of-presentation.
Alexandre Julliard
julliard at winehq.org
Mon May 11 16:08:36 CDT 2020
Module: wine
Branch: master
Commit: fafe82c6cc0baad4dec14f401da36a3e35553cee
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fafe82c6cc0baad4dec14f401da36a3e35553cee
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon May 11 17:53:15 2020 +0300
mf: Add internal placeholder command for end-of-presentation.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mf/session.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index bf6e29471d..ba30733fe5 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -43,6 +43,7 @@ enum session_command
SESSION_CMD_START,
SESSION_CMD_PAUSE,
SESSION_CMD_STOP,
+ SESSION_CMD_END, /* Internal use only. */
};
struct session_op
@@ -526,6 +527,14 @@ static HRESULT session_is_shut_down(struct media_session *session)
return session->state == SESSION_STATE_SHUT_DOWN ? MF_E_SHUTDOWN : S_OK;
}
+static void session_push_back_command(struct media_session *session, enum session_command command)
+{
+ struct session_op *op;
+
+ if (SUCCEEDED(create_session_op(command, &op)))
+ list_add_head(&session->commands, &op->entry);
+}
+
static HRESULT session_submit_command(struct media_session *session, struct session_op *op)
{
HRESULT hr;
@@ -933,7 +942,7 @@ static void session_set_stopped(struct media_session *session, HRESULT status)
static void session_stop(struct media_session *session)
{
- HRESULT hr;
+ HRESULT hr = MF_E_INVALIDREQUEST;
switch (session->state)
{
@@ -949,10 +958,12 @@ static void session_stop(struct media_session *session)
break;
case SESSION_STATE_STOPPED:
- IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionStopped, &GUID_NULL, S_OK, NULL);
- break;
+ hr = S_OK;
+ /* fallthrough */
default:
- ;
+ IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionStopped, &GUID_NULL, hr, NULL);
+ session_command_complete(session);
+ break;
}
}
@@ -1002,11 +1013,9 @@ static void session_close(struct media_session *session)
if (SUCCEEDED(hr = IMFPresentationClock_Stop(session->clock)))
session->state = SESSION_STATE_STOPPING_SINKS;
break;
- case SESSION_STATE_CLOSED:
+ default:
hr = MF_E_INVALIDREQUEST;
break;
- default:
- ;
}
if (FAILED(hr))
@@ -2749,8 +2758,9 @@ static void session_raise_end_of_presentation(struct media_session *session)
{
if (session_nodes_is_mask_set(session, MF_TOPOLOGY_MAX, SOURCE_FLAG_END_OF_PRESENTATION))
{
- IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MEEndOfPresentation, &GUID_NULL, S_OK, NULL);
session->presentation.flags |= SESSION_FLAG_END_OF_PRESENTATION;
+ session_push_back_command(session, SESSION_CMD_END);
+ IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MEEndOfPresentation, &GUID_NULL, S_OK, NULL);
}
}
}
More information about the wine-cvs
mailing list