Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
352da005
Commit
352da005
authored
Jun 18, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplay: Create media item on player creation, when url is specified.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
617d14bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
player.c
dlls/mfplay/player.c
+29
-0
mfplay.c
dlls/mfplay/tests/mfplay.c
+20
-0
No files found.
dlls/mfplay/player.c
View file @
352da005
...
...
@@ -1911,14 +1911,26 @@ static const IMFAsyncCallbackVtbl media_player_session_events_callback_vtbl =
media_player_session_events_callback_Invoke
,
};
/***********************************************************************
* MFPCreateMediaPlayer (mfplay.@)
*/
HRESULT
WINAPI
MFPCreateMediaPlayer
(
const
WCHAR
*
url
,
BOOL
start_playback
,
MFP_CREATION_OPTIONS
options
,
IMFPMediaPlayerCallback
*
callback
,
HWND
window
,
IMFPMediaPlayer
**
player
)
{
struct
media_player
*
object
;
IMFPMediaItem
*
item
;
HRESULT
hr
;
TRACE
(
"%s, %d, %#x, %p, %p, %p.
\n
"
,
debugstr_w
(
url
),
start_playback
,
options
,
callback
,
window
,
player
);
if
(
!
player
)
return
E_POINTER
;
*
player
=
NULL
;
if
(
!
url
&&
start_playback
)
return
E_INVALIDARG
;
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
...
...
@@ -1950,6 +1962,23 @@ HRESULT WINAPI MFPCreateMediaPlayer(const WCHAR *url, BOOL start_playback, MFP_C
0
,
mfplay_instance
,
NULL
);
}
if
(
url
)
{
if
(
FAILED
(
hr
=
media_player_create_item_from_url
(
object
,
url
,
TRUE
,
0
,
&
item
)))
{
WARN
(
"Failed to create media item, hr %#x.
\n
"
,
hr
);
goto
failed
;
}
hr
=
IMFPMediaPlayer_SetMediaItem
(
&
object
->
IMFPMediaPlayer_iface
,
item
);
IMFPMediaItem_Release
(
item
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to set media item, hr %#x.
\n
"
,
hr
);
goto
failed
;
}
}
*
player
=
&
object
->
IMFPMediaPlayer_iface
;
return
S_OK
;
...
...
dlls/mfplay/tests/mfplay.c
View file @
352da005
...
...
@@ -87,6 +87,26 @@ static void test_create_player(void)
HWND
window
;
HRESULT
hr
;
hr
=
MFPCreateMediaPlayer
(
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
FAILED
(
hr
),
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFPCreateMediaPlayer
(
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
FAILED
(
hr
),
"Unexpected hr %#x.
\n
"
,
hr
);
player
=
(
void
*
)
0xdeadbeef
;
hr
=
MFPCreateMediaPlayer
(
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
player
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
player
,
"Unexpected pointer %p.
\n
"
,
player
);
hr
=
MFPCreateMediaPlayer
(
L"doesnotexist.mp4"
,
FALSE
,
0
,
&
callback
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFPCreateMediaPlayer
(
L"doesnotexist.mp4"
,
FALSE
,
0
,
&
callback
,
NULL
,
&
player
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFPCreateMediaPlayer
(
NULL
,
TRUE
,
0
,
&
callback
,
NULL
,
&
player
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFPCreateMediaPlayer
(
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
player
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
...
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