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
27338bc4
Commit
27338bc4
authored
Aug 20, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmp: Improve URL property handling.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
54ec72bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
11 deletions
+55
-11
player.c
dlls/wmp/player.c
+6
-11
media.c
dlls/wmp/tests/media.c
+49
-0
No files found.
dlls/wmp/player.c
View file @
27338bc4
...
...
@@ -28,7 +28,7 @@ static ATOM player_msg_class;
static
INIT_ONCE
class_init_once
;
static
UINT
WM_WMPEVENT
;
static
const
WCHAR
WMPmessageW
[]
=
{
'_'
,
'W'
,
'M'
,
'P'
,
'M'
,
'e'
,
's'
,
's'
,
'a'
,
'g'
,
'e'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
0
};
static
void
update_state
(
WindowsMediaPlayer
*
wmp
,
LONG
type
,
LONG
state
)
{
...
...
@@ -135,9 +135,8 @@ static HRESULT WINAPI WMPPlayer4_get_URL(IWMPPlayer4 *iface, BSTR *url)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
url
);
if
(
This
->
media
==
NULL
)
{
return
S_FALSE
;
}
if
(
!
This
->
media
)
return
return_bstr
(
emptyW
,
url
);
return
return_bstr
(
This
->
media
->
url
,
url
);
}
...
...
@@ -147,10 +146,8 @@ static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url)
WindowsMediaPlayer
*
This
=
impl_from_IWMPPlayer4
(
iface
);
IWMPMedia
*
media
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
url
));
if
(
url
==
NULL
)
{
return
E_POINTER
;
}
hres
=
create_media_from_url
(
url
,
0
.
0
,
&
media
);
...
...
@@ -161,9 +158,8 @@ static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url)
}
if
(
SUCCEEDED
(
hres
))
{
update_state
(
This
,
DISPID_WMPCOREEVENT_PLAYSTATECHANGE
,
wmppsReady
);
if
(
This
->
auto_start
==
VARIANT_TRUE
)
{
hres
=
IWMPControls_play
(
&
This
->
IWMPControls_iface
);
}
if
(
This
->
auto_start
==
VARIANT_TRUE
)
IWMPControls_play
(
&
This
->
IWMPControls_iface
);
}
return
hres
;
...
...
@@ -2025,7 +2021,6 @@ WMPMedia *unsafe_impl_from_IWMPMedia(IWMPMedia *iface)
HRESULT
create_media_from_url
(
BSTR
url
,
double
duration
,
IWMPMedia
**
ppMedia
)
{
static
const
WCHAR
emptyW
[]
=
{
0
};
WMPMedia
*
media
;
media
=
heap_alloc_zero
(
sizeof
(
*
media
));
...
...
dlls/wmp/tests/media.c
View file @
27338bc4
...
...
@@ -562,6 +562,54 @@ todo_wine
IWMPPlayer4_Release
(
player
);
}
static
void
test_player_url
(
void
)
{
IWMPPlayer4
*
player
;
BSTR
str
,
str2
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_WindowsMediaPlayer
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWMPPlayer4
,
(
void
**
)
&
player
);
if
(
hr
==
REGDB_E_CLASSNOTREG
)
{
win_skip
(
"CLSID_WindowsMediaPlayer is not registered.
\n
"
);
return
;
}
ok
(
hr
==
S_OK
,
"Failed to create media player instance, hr %#x.
\n
"
,
hr
);
hr
=
IWMPPlayer4_get_URL
(
player
,
&
str
);
ok
(
hr
==
S_OK
,
"Failed to get url, hr %#x.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"Unexpected url %s.
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
str2
=
SysAllocString
(
mp3file
);
hr
=
IWMPPlayer4_put_URL
(
player
,
str2
);
ok
(
hr
==
S_OK
,
"Failed to set url, hr %#x.
\n
"
,
hr
);
hr
=
IWMPPlayer4_put_URL
(
player
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to set url, hr %#x.
\n
"
,
hr
);
hr
=
IWMPPlayer4_get_URL
(
player
,
&
str
);
ok
(
hr
==
S_OK
,
"Failed to set url, hr %#x.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"Unexpected url, %s.
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
/* Empty url */
hr
=
IWMPPlayer4_put_URL
(
player
,
str2
);
ok
(
hr
==
S_OK
,
"Failed to set url, hr %#x.
\n
"
,
hr
);
str
=
SysAllocStringLen
(
NULL
,
0
);
hr
=
IWMPPlayer4_put_URL
(
player
,
str
);
ok
(
hr
==
S_OK
,
"Failed to set url, hr %#x.
\n
"
,
hr
);
SysFreeString
(
str
);
hr
=
IWMPPlayer4_get_URL
(
player
,
&
str
);
ok
(
hr
==
S_OK
,
"Failed to set url, hr %#x.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"Unexpected url, %s.
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
SysFreeString
(
str2
);
IWMPPlayer4_Release
(
player
);
}
START_TEST
(
media
)
{
CoInitialize
(
NULL
);
...
...
@@ -571,6 +619,7 @@ START_TEST(media)
completed_event
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
test_media_item
();
test_player_url
();
if
(
test_wmp
())
{
test_completion_event
();
}
else
{
...
...
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