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
58d0cb0d
Commit
58d0cb0d
authored
Apr 13, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplay: Handle shutdown state in CreateMediaItemFromURL().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
71d53224
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
6 deletions
+78
-6
player.c
dlls/mfplay/player.c
+21
-6
mfplay.c
dlls/mfplay/tests/mfplay.c
+57
-0
No files found.
dlls/mfplay/player.c
View file @
58d0cb0d
...
...
@@ -806,18 +806,17 @@ static HRESULT WINAPI media_player_GetState(IMFPMediaPlayer *iface, MFP_MEDIAPLA
return
S_OK
;
}
static
HRESULT
WINAPI
media_player_CreateMediaItemFromURL
(
IMFPMediaPlayer
*
iface
,
static
HRESULT
media_player_create_item_from_url
(
struct
media_player
*
player
,
const
WCHAR
*
url
,
BOOL
sync
,
DWORD_PTR
user_data
,
IMFPMediaItem
**
ret
)
{
struct
media_player
*
player
=
impl_from_IMFPMediaPlayer
(
iface
);
struct
media_item
*
item
;
MF_OBJECT_TYPE
obj_type
;
IUnknown
*
object
;
HRESULT
hr
;
TRACE
(
"%p, %s, %d, %lx, %p.
\n
"
,
iface
,
debugstr_w
(
url
),
sync
,
user_data
,
ret
)
;
*
ret
=
NULL
;
if
(
FAILED
(
hr
=
create_media_item
(
iface
,
user_data
,
&
item
)))
if
(
FAILED
(
hr
=
create_media_item
(
&
player
->
IMFPMediaPlayer_
iface
,
user_data
,
&
item
)))
return
hr
;
if
(
url
&&
!
(
item
->
url
=
wcsdup
(
url
)))
...
...
@@ -828,8 +827,6 @@ static HRESULT WINAPI media_player_CreateMediaItemFromURL(IMFPMediaPlayer *iface
if
(
sync
)
{
*
ret
=
NULL
;
if
(
SUCCEEDED
(
hr
=
IMFSourceResolver_CreateObjectFromURL
(
player
->
resolver
,
url
,
MF_RESOLUTION_MEDIASOURCE
,
player
->
propstore
,
&
obj_type
,
&
object
)))
{
...
...
@@ -853,6 +850,24 @@ static HRESULT WINAPI media_player_CreateMediaItemFromURL(IMFPMediaPlayer *iface
return
hr
;
}
static
HRESULT
WINAPI
media_player_CreateMediaItemFromURL
(
IMFPMediaPlayer
*
iface
,
const
WCHAR
*
url
,
BOOL
sync
,
DWORD_PTR
user_data
,
IMFPMediaItem
**
ret
)
{
struct
media_player
*
player
=
impl_from_IMFPMediaPlayer
(
iface
);
HRESULT
hr
;
TRACE
(
"%p, %s, %d, %lx, %p.
\n
"
,
iface
,
debugstr_w
(
url
),
sync
,
user_data
,
ret
);
EnterCriticalSection
(
&
player
->
cs
);
if
(
player
->
state
==
MFP_MEDIAPLAYER_STATE_SHUTDOWN
)
hr
=
MF_E_SHUTDOWN
;
else
hr
=
media_player_create_item_from_url
(
player
,
url
,
sync
,
user_data
,
ret
);
LeaveCriticalSection
(
&
player
->
cs
);
return
hr
;
}
static
HRESULT
WINAPI
media_player_CreateMediaItemFromObject
(
IMFPMediaPlayer
*
iface
,
IUnknown
*
object
,
BOOL
sync
,
DWORD_PTR
user_data
,
IMFPMediaItem
**
item
)
{
...
...
dlls/mfplay/tests/mfplay.c
View file @
58d0cb0d
...
...
@@ -23,6 +23,7 @@
#include "windef.h"
#include "winbase.h"
#include "mfplay.h"
#include "mferror.h"
#include "wine/test.h"
...
...
@@ -119,7 +120,63 @@ static void test_create_player(void)
IMFPMediaPlayer_Release
(
player
);
}
static
void
test_shutdown
(
void
)
{
IMFPMediaPlayer
*
player
;
float
slowest
,
fastest
;
HRESULT
hr
;
MFP_MEDIAPLAYER_STATE
state
;
IMFPMediaItem
*
item
;
HWND
window
;
hr
=
MFPCreateMediaPlayer
(
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
player
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetState
(
player
,
&
state
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
state
==
MFP_MEDIAPLAYER_STATE_EMPTY
,
"Unexpected state %d.
\n
"
,
state
);
hr
=
IMFPMediaPlayer_Shutdown
(
player
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
/* Check methods in shutdown state. */
hr
=
IMFPMediaPlayer_Play
(
player
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_Pause
(
player
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_Stop
(
player
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetSupportedRates
(
player
,
TRUE
,
&
slowest
,
&
fastest
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetState
(
player
,
&
state
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
state
==
MFP_MEDIAPLAYER_STATE_SHUTDOWN
,
"Unexpected state %d.
\n
"
,
state
);
hr
=
IMFPMediaPlayer_CreateMediaItemFromURL
(
player
,
L"url"
,
TRUE
,
0
,
&
item
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_ClearMediaItem
(
player
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetMediaItem
(
player
,
&
item
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetVideoWindow
(
player
,
&
window
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_Shutdown
(
player
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IMFPMediaPlayer_Release
(
player
);
}
START_TEST
(
mfplay
)
{
test_create_player
();
test_shutdown
();
}
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