Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ddfb56c0
Commit
ddfb56c0
authored
Feb 28, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Implement Stop() command for media session.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d4cc70e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
session.c
dlls/mf/session.c
+71
-0
No files found.
dlls/mf/session.c
View file @
ddfb56c0
...
...
@@ -79,6 +79,8 @@ enum session_state
SESSION_STATE_PAUSING_SINKS
,
SESSION_STATE_PAUSING_SOURCES
,
SESSION_STATE_PAUSED
,
SESSION_STATE_STOPPING_SINKS
,
SESSION_STATE_STOPPING_SOURCES
,
SESSION_STATE_CLOSED
,
SESSION_STATE_SHUT_DOWN
,
};
...
...
@@ -676,6 +678,36 @@ static void session_pause(struct media_session *session)
LeaveCriticalSection
(
&
session
->
cs
);
}
static
void
session_stop
(
struct
media_session
*
session
)
{
HRESULT
hr
=
S_OK
;
EnterCriticalSection
(
&
session
->
cs
);
switch
(
session
->
state
)
{
case
SESSION_STATE_RUNNING
:
case
SESSION_STATE_PAUSED
:
/* Transition in two steps - pause clock, wait for sinks and pause sources. */
if
(
SUCCEEDED
(
hr
=
IMFPresentationClock_Stop
(
session
->
clock
)))
session
->
state
=
SESSION_STATE_STOPPING_SINKS
;
break
;
default:
;
}
if
(
FAILED
(
hr
))
{
session
->
state
=
SESSION_STATE_STOPPED
;
IMFMediaEventQueue_QueueEventParamVar
(
session
->
event_queue
,
MESessionStopped
,
&
GUID_NULL
,
hr
,
NULL
);
}
LeaveCriticalSection
(
&
session
->
cs
);
}
static
struct
media_source
*
session_get_media_source
(
struct
media_session
*
session
,
IMFMediaSource
*
source
)
{
struct
media_source
*
cur
;
...
...
@@ -1503,6 +1535,9 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface,
case
SESSION_CMD_PAUSE
:
session_pause
(
session
);
break
;
case
SESSION_CMD_STOP
:
session_stop
(
session
);
break
;
case
SESSION_CMD_CLOSE
:
EnterCriticalSection
(
&
session
->
cs
);
if
(
session
->
state
!=
SESSION_STATE_CLOSED
)
...
...
@@ -1724,6 +1759,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn
MediaEventType
event_type
)
{
struct
source_node
*
src_node
;
struct
output_node
*
out_node
;
struct
media_source
*
src
;
enum
object_state
state
;
BOOL
changed
=
FALSE
;
...
...
@@ -1789,6 +1825,22 @@ static void session_set_source_object_state(struct media_session *session, IUnkn
IMFMediaEventQueue_QueueEventParamVar
(
session
->
event_queue
,
MESessionPaused
,
&
GUID_NULL
,
S_OK
,
NULL
);
break
;
case
SESSION_STATE_STOPPING_SOURCES
:
if
(
!
session_is_source_nodes_state
(
session
,
OBJ_STATE_STOPPED
))
break
;
session
->
state
=
SESSION_STATE_STOPPED
;
LIST_FOR_EACH_ENTRY
(
out_node
,
&
session
->
presentation
.
output_nodes
,
struct
output_node
,
entry
)
{
IMFStreamSink_Flush
(
out_node
->
stream
);
}
session_set_caps
(
session
,
session
->
caps
&
~
MFSESSIONCAP_PAUSE
);
IMFMediaEventQueue_QueueEventParamVar
(
session
->
event_queue
,
MESessionStopped
,
&
GUID_NULL
,
S_OK
,
NULL
);
break
;
default:
;
}
...
...
@@ -1871,6 +1923,25 @@ static void session_set_sink_stream_state(struct media_session *session, IMFStre
}
break
;
case
SESSION_STATE_STOPPING_SINKS
:
if
(
!
session_is_output_nodes_state
(
session
,
OBJ_STATE_STOPPED
))
break
;
session
->
state
=
SESSION_STATE_STOPPING_SOURCES
;
LIST_FOR_EACH_ENTRY
(
source
,
&
session
->
presentation
.
sources
,
struct
media_source
,
entry
)
{
if
(
FAILED
(
hr
=
IMFMediaSource_Stop
(
source
->
source
)))
break
;
}
if
(
FAILED
(
hr
))
{
session
->
state
=
SESSION_STATE_STOPPED
;
IMFMediaEventQueue_QueueEventParamVar
(
session
->
event_queue
,
MESessionStopped
,
&
GUID_NULL
,
hr
,
NULL
);
}
break
;
default:
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment