wmp: Improve playlist creation.

Signed-off-by: Gijs Vermeulen <gijsvrm@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2019-08-03 17:45:54 +02:00 committed by Alexandre Julliard
parent 2477aa7a10
commit 649e294886
2 changed files with 16 additions and 7 deletions

View File

@ -286,11 +286,18 @@ static HRESULT WINAPI WMPPlayer4_get_network(IWMPPlayer4 *iface, IWMPNetwork **p
return S_OK;
}
static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist **ppPL)
static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist **playlist)
{
WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
FIXME("(%p)->(%p)\n", This, ppPL);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, playlist);
*playlist = NULL;
if (This->playlist == NULL)
return S_FALSE;
return create_playlist(This->playlist->name, This->playlist->url, playlist);
}
static HRESULT WINAPI WMPPlayer4_put_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist *pPL)
@ -2197,6 +2204,8 @@ void unregister_player_msg_class(void) {
BOOL init_player(WindowsMediaPlayer *wmp)
{
IWMPPlaylist *playlist;
BSTR name;
static const WCHAR nameW[] = {'P','l','a','y','l','i','s','t','1',0};
InitOnceExecuteOnce(&class_init_once, register_player_msg_class, NULL, NULL);
wmp->msg_window = CreateWindowW( MAKEINTRESOURCEW(player_msg_class), NULL, 0, 0,
@ -2216,10 +2225,12 @@ BOOL init_player(WindowsMediaPlayer *wmp)
wmp->IWMPControls_iface.lpVtbl = &WMPControlsVtbl;
wmp->IWMPNetwork_iface.lpVtbl = &WMPNetworkVtbl;
if (SUCCEEDED(create_playlist(NULL, NULL, &playlist)))
name = SysAllocString(nameW);
if (SUCCEEDED(create_playlist(name, NULL, &playlist)))
wmp->playlist = unsafe_impl_from_IWMPPlaylist(playlist);
else
wmp->playlist = NULL;
SysFreeString(name);
wmp->invoke_urls = VARIANT_TRUE;
wmp->auto_start = VARIANT_TRUE;

View File

@ -945,12 +945,10 @@ static void test_wmp_ifaces(IOleObject *oleobj)
playlist = NULL;
hres = IWMPPlayer4_get_currentPlaylist(player4, &playlist);
todo_wine {
ok(hres == S_OK, "IWMPPlayer4_get_currentPlaylist failed: %08x\n", hres);
ok(playlist != NULL, "playlist != NULL\n");
}
if (playlist) IWMPPlaylist_Release(playlist);
IWMPPlaylist_Release(playlist);
media = NULL;
hres = IWMPPlayer4_QueryInterface(player4, &IID_IWMPMedia, (void**)&media);