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
7e9d2947
Commit
7e9d2947
authored
Apr 07, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplay: Create per-player session instance.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0f18e5f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
player.c
dlls/mfplay/player.c
+51
-0
No files found.
dlls/mfplay/player.c
View file @
7e9d2947
...
...
@@ -63,10 +63,12 @@ struct media_player
IPropertyStore
IPropertyStore_iface
;
IMFAsyncCallback
resolver_callback
;
IMFAsyncCallback
events_callback
;
IMFAsyncCallback
session_events_callback
;
LONG
refcount
;
IMFPMediaPlayerCallback
*
callback
;
IPropertyStore
*
propstore
;
IMFSourceResolver
*
resolver
;
IMFMediaSession
*
session
;
MFP_CREATION_OPTIONS
options
;
HWND
event_window
;
HWND
output_window
;
...
...
@@ -121,6 +123,11 @@ static struct media_player *impl_from_events_IMFAsyncCallback(IMFAsyncCallback *
return
CONTAINING_RECORD
(
iface
,
struct
media_player
,
events_callback
);
}
static
struct
media_player
*
impl_from_session_events_IMFAsyncCallback
(
IMFAsyncCallback
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
media_player
,
session_events_callback
);
}
static
struct
media_item
*
impl_from_IMFPMediaItem
(
IMFPMediaItem
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
media_item
,
IMFPMediaItem_iface
);
...
...
@@ -618,6 +625,8 @@ static ULONG WINAPI media_player_Release(IMFPMediaPlayer *iface)
IPropertyStore_Release
(
player
->
propstore
);
if
(
player
->
resolver
)
IMFSourceResolver_Release
(
player
->
resolver
);
if
(
player
->
session
)
IMFMediaSession_Release
(
player
->
session
);
DestroyWindow
(
player
->
event_window
);
heap_free
(
player
);
...
...
@@ -1170,6 +1179,43 @@ static const IMFAsyncCallbackVtbl media_player_events_callback_vtbl =
media_player_events_callback_Invoke
,
};
static
ULONG
WINAPI
media_player_session_events_callback_AddRef
(
IMFAsyncCallback
*
iface
)
{
struct
media_player
*
player
=
impl_from_session_events_IMFAsyncCallback
(
iface
);
return
IMFPMediaPlayer_AddRef
(
&
player
->
IMFPMediaPlayer_iface
);
}
static
ULONG
WINAPI
media_player_session_events_callback_Release
(
IMFAsyncCallback
*
iface
)
{
struct
media_player
*
player
=
impl_from_session_events_IMFAsyncCallback
(
iface
);
return
IMFPMediaPlayer_Release
(
&
player
->
IMFPMediaPlayer_iface
);
}
static
HRESULT
WINAPI
media_player_session_events_callback_Invoke
(
IMFAsyncCallback
*
iface
,
IMFAsyncResult
*
result
)
{
struct
media_player
*
player
=
impl_from_session_events_IMFAsyncCallback
(
iface
);
IMFMediaEvent
*
event
;
HRESULT
hr
;
if
(
FAILED
(
hr
=
IMFMediaSession_EndGetEvent
(
player
->
session
,
result
,
&
event
)))
return
S_OK
;
IMFMediaSession_BeginGetEvent
(
player
->
session
,
&
player
->
session_events_callback
,
NULL
);
IMFMediaEvent_Release
(
event
);
return
S_OK
;
}
static
const
IMFAsyncCallbackVtbl
media_player_session_events_callback_vtbl
=
{
media_player_callback_QueryInterface
,
media_player_session_events_callback_AddRef
,
media_player_session_events_callback_Release
,
media_player_callback_GetParameters
,
media_player_session_events_callback_Invoke
,
};
HRESULT
WINAPI
MFPCreateMediaPlayer
(
const
WCHAR
*
url
,
BOOL
start_playback
,
MFP_CREATION_OPTIONS
options
,
IMFPMediaPlayerCallback
*
callback
,
HWND
window
,
IMFPMediaPlayer
**
player
)
{
...
...
@@ -1187,6 +1233,7 @@ HRESULT WINAPI MFPCreateMediaPlayer(const WCHAR *url, BOOL start_playback, MFP_C
object
->
IPropertyStore_iface
.
lpVtbl
=
&
media_player_propstore_vtbl
;
object
->
resolver_callback
.
lpVtbl
=
&
media_player_resolver_callback_vtbl
;
object
->
events_callback
.
lpVtbl
=
&
media_player_events_callback_vtbl
;
object
->
session_events_callback
.
lpVtbl
=
&
media_player_session_events_callback_vtbl
;
object
->
refcount
=
1
;
object
->
callback
=
callback
;
if
(
object
->
callback
)
...
...
@@ -1197,6 +1244,10 @@ HRESULT WINAPI MFPCreateMediaPlayer(const WCHAR *url, BOOL start_playback, MFP_C
goto
failed
;
if
(
FAILED
(
hr
=
MFCreateSourceResolver
(
&
object
->
resolver
)))
goto
failed
;
if
(
FAILED
(
hr
=
MFCreateMediaSession
(
NULL
,
&
object
->
session
)))
goto
failed
;
if
(
FAILED
(
hr
=
IMFMediaSession_BeginGetEvent
(
object
->
session
,
&
object
->
session_events_callback
,
NULL
)))
goto
failed
;
if
(
!
(
object
->
options
&
MFP_OPTION_FREE_THREADED_CALLBACK
))
{
object
->
event_window
=
CreateWindowW
(
eventclassW
,
NULL
,
0
,
0
,
0
,
0
,
0
,
HWND_MESSAGE
,
...
...
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