2 * Copyright 2014 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wmp_private.h"
21 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(wmp
);
28 static ATOM player_msg_class
;
29 static INIT_ONCE class_init_once
;
30 static UINT WM_WMPEVENT
;
31 static const WCHAR WMPmessageW
[] = {'_', 'W', 'M', 'P', 'M','e','s','s','a','g','e',0};
32 static const WCHAR emptyW
[] = {0};
34 static void update_state(WindowsMediaPlayer
*wmp
, LONG type
, LONG state
)
36 DISPPARAMS dispparams
;
40 dispparams
.cNamedArgs
= 0;
41 dispparams
.rgdispidNamedArgs
= NULL
;
42 dispparams
.rgvarg
= params
;
44 V_VT(params
) = VT_UI4
;
45 V_UI4(params
) = state
;
47 call_sink(wmp
->wmpocx
, type
, &dispparams
);
50 static inline WMPPlaylist
*impl_from_IWMPPlaylist(IWMPPlaylist
*iface
)
52 return CONTAINING_RECORD(iface
, WMPPlaylist
, IWMPPlaylist_iface
);
55 static inline WMPMedia
*impl_from_IWMPMedia(IWMPMedia
*iface
)
57 return CONTAINING_RECORD(iface
, WMPMedia
, IWMPMedia_iface
);
60 static inline WindowsMediaPlayer
*impl_from_IWMPNetwork(IWMPNetwork
*iface
)
62 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IWMPNetwork_iface
);
65 static inline WindowsMediaPlayer
*impl_from_IWMPPlayer4(IWMPPlayer4
*iface
)
67 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IWMPPlayer4_iface
);
70 static inline WindowsMediaPlayer
*impl_from_IWMPPlayer(IWMPPlayer
*iface
)
72 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IWMPPlayer_iface
);
75 static inline WindowsMediaPlayer
*impl_from_IWMPControls(IWMPControls
*iface
)
77 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IWMPControls_iface
);
80 static HRESULT WINAPI
WMPPlayer4_QueryInterface(IWMPPlayer4
*iface
, REFIID riid
, void **ppv
)
82 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
83 return IOleObject_QueryInterface(&This
->IOleObject_iface
, riid
, ppv
);
86 static ULONG WINAPI
WMPPlayer4_AddRef(IWMPPlayer4
*iface
)
88 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
89 return IOleObject_AddRef(&This
->IOleObject_iface
);
92 static ULONG WINAPI
WMPPlayer4_Release(IWMPPlayer4
*iface
)
94 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
95 return IOleObject_Release(&This
->IOleObject_iface
);
98 static HRESULT WINAPI
WMPPlayer4_GetTypeInfoCount(IWMPPlayer4
*iface
, UINT
*pctinfo
)
100 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
101 FIXME("(%p)->(%p)\n", This
, pctinfo
);
105 static HRESULT WINAPI
WMPPlayer4_GetTypeInfo(IWMPPlayer4
*iface
, UINT iTInfo
,
106 LCID lcid
, ITypeInfo
**ppTInfo
)
108 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
109 FIXME("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
113 static HRESULT WINAPI
WMPPlayer4_GetIDsOfNames(IWMPPlayer4
*iface
, REFIID riid
,
114 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
116 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
117 FIXME("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
121 static HRESULT WINAPI
WMPPlayer4_Invoke(IWMPPlayer4
*iface
, DISPID dispIdMember
,
122 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
123 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
125 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
126 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
127 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
131 static HRESULT WINAPI
WMPPlayer4_close(IWMPPlayer4
*iface
)
133 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
134 FIXME("(%p)\n", This
);
138 static HRESULT WINAPI
WMPPlayer4_get_URL(IWMPPlayer4
*iface
, BSTR
*url
)
140 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
142 TRACE("(%p)->(%p)\n", This
, url
);
145 return return_bstr(emptyW
, url
);
147 return return_bstr(This
->media
->url
, url
);
150 static HRESULT WINAPI
WMPPlayer4_put_URL(IWMPPlayer4
*iface
, BSTR url
)
152 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
156 TRACE("(%p)->(%s)\n", This
, debugstr_w(url
));
158 hres
= create_media_from_url(url
, 0.0, &media
);
160 if (SUCCEEDED(hres
)) {
161 update_state(This
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsTransitioning
);
162 hres
= IWMPPlayer4_put_currentMedia(iface
, media
);
163 IWMPMedia_Release(media
); /* put will addref */
165 if (SUCCEEDED(hres
)) {
166 update_state(This
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsReady
);
167 if (This
->auto_start
== VARIANT_TRUE
)
168 IWMPControls_play(&This
->IWMPControls_iface
);
174 static HRESULT WINAPI
WMPPlayer4_get_openState(IWMPPlayer4
*iface
, WMPOpenState
*pwmpos
)
176 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
177 FIXME("(%p)->(%p)\n", This
, pwmpos
);
181 static HRESULT WINAPI
WMPPlayer4_get_playState(IWMPPlayer4
*iface
, WMPPlayState
*pwmpps
)
183 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
184 FIXME("(%p)->(%p)\n", This
, pwmpps
);
188 static HRESULT WINAPI
WMPPlayer4_get_controls(IWMPPlayer4
*iface
, IWMPControls
**ppControl
)
190 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
192 TRACE("(%p)->(%p)\n", This
, ppControl
);
194 IWMPControls_AddRef(&This
->IWMPControls_iface
);
195 *ppControl
= &This
->IWMPControls_iface
;
199 static HRESULT WINAPI
WMPPlayer4_get_settings(IWMPPlayer4
*iface
, IWMPSettings
**ppSettings
)
201 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
203 TRACE("(%p)->(%p)\n", This
, ppSettings
);
205 IWMPSettings_AddRef(&This
->IWMPSettings_iface
);
206 *ppSettings
= &This
->IWMPSettings_iface
;
210 static HRESULT WINAPI
WMPPlayer4_get_currentMedia(IWMPPlayer4
*iface
, IWMPMedia
**media
)
212 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
214 TRACE("(%p)->(%p)\n", This
, media
);
218 if (This
->media
== NULL
)
221 return create_media_from_url(This
->media
->url
, This
->media
->duration
, media
);
224 static HRESULT WINAPI
WMPPlayer4_put_currentMedia(IWMPPlayer4
*iface
, IWMPMedia
*pMedia
)
226 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
227 TRACE("(%p)->(%p)\n", This
, pMedia
);
232 update_state(This
, DISPID_WMPCOREEVENT_OPENSTATECHANGE
, wmposPlaylistChanging
);
233 if(This
->media
!= NULL
) {
234 IWMPControls_stop(&This
->IWMPControls_iface
);
235 IWMPMedia_Release(&This
->media
->IWMPMedia_iface
);
237 update_state(This
, DISPID_WMPCOREEVENT_OPENSTATECHANGE
, wmposPlaylistChanged
);
238 update_state(This
, DISPID_WMPCOREEVENT_OPENSTATECHANGE
, wmposPlaylistOpenNoMedia
);
240 IWMPMedia_AddRef(pMedia
);
241 This
->media
= unsafe_impl_from_IWMPMedia(pMedia
);
245 static HRESULT WINAPI
WMPPlayer4_get_mediaCollection(IWMPPlayer4
*iface
, IWMPMediaCollection
**ppMediaCollection
)
247 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
248 FIXME("(%p)->(%p)\n", This
, ppMediaCollection
);
252 static HRESULT WINAPI
WMPPlayer4_get_playlistCollection(IWMPPlayer4
*iface
, IWMPPlaylistCollection
**ppPlaylistCollection
)
254 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
255 FIXME("(%p)->(%p)\n", This
, ppPlaylistCollection
);
259 static HRESULT WINAPI
WMPPlayer4_get_versionInfo(IWMPPlayer4
*iface
, BSTR
*version
)
261 static const WCHAR versionW
[] = {'1','2','.','0','.','7','6','0','1','.','1','6','9','8','2',0};
262 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
264 TRACE("(%p)->(%p)\n", This
, version
);
269 return return_bstr(versionW
, version
);
272 static HRESULT WINAPI
WMPPlayer4_launchURL(IWMPPlayer4
*iface
, BSTR url
)
274 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
275 FIXME("(%p)->(%s)\n", This
, debugstr_w(url
));
279 static HRESULT WINAPI
WMPPlayer4_get_network(IWMPPlayer4
*iface
, IWMPNetwork
**ppQNI
)
281 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
282 TRACE("(%p)->(%p)\n", This
, ppQNI
);
284 IWMPNetwork_AddRef(&This
->IWMPNetwork_iface
);
285 *ppQNI
= &This
->IWMPNetwork_iface
;
289 static HRESULT WINAPI
WMPPlayer4_get_currentPlaylist(IWMPPlayer4
*iface
, IWMPPlaylist
**playlist
)
291 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
293 TRACE("(%p)->(%p)\n", This
, playlist
);
297 if (This
->playlist
== NULL
)
300 return create_playlist(This
->playlist
->name
, This
->playlist
->url
, This
->playlist
->count
, playlist
);
303 static HRESULT WINAPI
WMPPlayer4_put_currentPlaylist(IWMPPlayer4
*iface
, IWMPPlaylist
*pPL
)
305 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
306 FIXME("(%p)->(%p)\n", This
, pPL
);
310 static HRESULT WINAPI
WMPPlayer4_get_cdromCollection(IWMPPlayer4
*iface
, IWMPCdromCollection
**ppCdromCollection
)
312 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
313 FIXME("(%p)->(%p)\n", This
, ppCdromCollection
);
317 static HRESULT WINAPI
WMPPlayer4_get_closedCaption(IWMPPlayer4
*iface
, IWMPClosedCaption
**ppClosedCaption
)
319 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
320 FIXME("(%p)->(%p)\n", This
, ppClosedCaption
);
324 static HRESULT WINAPI
WMPPlayer4_get_isOnline(IWMPPlayer4
*iface
, VARIANT_BOOL
*pfOnline
)
326 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
327 FIXME("(%p)->(%p)\n", This
, pfOnline
);
331 static HRESULT WINAPI
WMPPlayer4_get_Error(IWMPPlayer4
*iface
, IWMPError
**ppError
)
333 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
334 FIXME("(%p)->(%p)\n", This
, ppError
);
338 static HRESULT WINAPI
WMPPlayer4_get_Status(IWMPPlayer4
*iface
, BSTR
*pbstrStatus
)
340 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
341 FIXME("(%p)->(%p)\n", This
, pbstrStatus
);
345 static HRESULT WINAPI
WMPPlayer4_get_dvd(IWMPPlayer4
*iface
, IWMPDVD
**ppDVD
)
347 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
348 FIXME("(%p)->(%p)\n", This
, ppDVD
);
352 static HRESULT WINAPI
WMPPlayer4_newPlaylist(IWMPPlayer4
*iface
, BSTR name
, BSTR url
, IWMPPlaylist
**playlist
)
354 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
356 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(name
), debugstr_w(url
), playlist
);
358 /* FIXME: count should be the number of items in the playlist */
359 return create_playlist(name
, url
, 0, playlist
);
362 static HRESULT WINAPI
WMPPlayer4_newMedia(IWMPPlayer4
*iface
, BSTR url
, IWMPMedia
**media
)
364 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
366 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(url
), media
);
368 return create_media_from_url(url
, 0.0, media
);
371 static HRESULT WINAPI
WMPPlayer4_get_enabled(IWMPPlayer4
*iface
, VARIANT_BOOL
*pbEnabled
)
373 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
374 FIXME("(%p)->(%p)\n", This
, pbEnabled
);
378 static HRESULT WINAPI
WMPPlayer4_put_enabled(IWMPPlayer4
*iface
, VARIANT_BOOL enabled
)
380 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
381 FIXME("(%p)->(%x)\n", This
, enabled
);
385 static HRESULT WINAPI
WMPPlayer4_get_fullScreen(IWMPPlayer4
*iface
, VARIANT_BOOL
*pbFullScreen
)
387 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
388 FIXME("(%p)->(%p)\n", This
, pbFullScreen
);
392 static HRESULT WINAPI
WMPPlayer4_put_fullScreen(IWMPPlayer4
*iface
, VARIANT_BOOL fullscreen
)
394 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
395 FIXME("(%p)->(%x)\n", This
, fullscreen
);
399 static HRESULT WINAPI
WMPPlayer4_get_enableContextMenu(IWMPPlayer4
*iface
, VARIANT_BOOL
*pbEnableContextMenu
)
401 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
402 FIXME("(%p)->(%p)\n", This
, pbEnableContextMenu
);
406 static HRESULT WINAPI
WMPPlayer4_put_enableContextMenu(IWMPPlayer4
*iface
, VARIANT_BOOL enable
)
408 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
409 FIXME("(%p)->(%x)\n", This
, enable
);
413 static HRESULT WINAPI
WMPPlayer4_put_uiMode(IWMPPlayer4
*iface
, BSTR mode
)
415 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
416 FIXME("(%p)->(%s)\n", This
, debugstr_w(mode
));
420 static HRESULT WINAPI
WMPPlayer4_get_uiMode(IWMPPlayer4
*iface
, BSTR
*pbstrMode
)
422 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
423 FIXME("(%p)->(%p)\n", This
, pbstrMode
);
427 static HRESULT WINAPI
WMPPlayer4_get_stretchToFit(IWMPPlayer4
*iface
, VARIANT_BOOL
*enabled
)
429 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
430 FIXME("(%p)->(%p)\n", This
, enabled
);
434 static HRESULT WINAPI
WMPPlayer4_put_stretchToFit(IWMPPlayer4
*iface
, VARIANT_BOOL enabled
)
436 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
437 FIXME("(%p)->(%x)\n", This
, enabled
);
441 static HRESULT WINAPI
WMPPlayer4_get_windowlessVideo(IWMPPlayer4
*iface
, VARIANT_BOOL
*enabled
)
443 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
444 FIXME("(%p)->(%p)\n", This
, enabled
);
448 static HRESULT WINAPI
WMPPlayer4_put_windowlessVideo(IWMPPlayer4
*iface
, VARIANT_BOOL enabled
)
450 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
451 FIXME("(%p)->(%x)\n", This
, enabled
);
455 static HRESULT WINAPI
WMPPlayer4_get_isRemote(IWMPPlayer4
*iface
, VARIANT_BOOL
*pvarfIsRemote
)
457 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
458 FIXME("(%p)->(%p)\n", This
, pvarfIsRemote
);
462 static HRESULT WINAPI
WMPPlayer4_get_playerApplication(IWMPPlayer4
*iface
, IWMPPlayerApplication
**ppIWMPPlayerApplication
)
464 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
465 FIXME("(%p)->(%p)\n", This
, ppIWMPPlayerApplication
);
469 static HRESULT WINAPI
WMPPlayer4_openPlayer(IWMPPlayer4
*iface
, BSTR url
)
471 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer4(iface
);
472 FIXME("(%p)->(%s)\n", This
, debugstr_w(url
));
476 static HRESULT WINAPI
WMPPlayer_QueryInterface(IWMPPlayer
*iface
, REFIID riid
, void **ppv
)
478 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
479 return WMPPlayer4_QueryInterface(&This
->IWMPPlayer4_iface
, riid
, ppv
);
482 static ULONG WINAPI
WMPPlayer_AddRef(IWMPPlayer
*iface
)
484 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
485 return WMPPlayer4_AddRef(&This
->IWMPPlayer4_iface
);
488 static ULONG WINAPI
WMPPlayer_Release(IWMPPlayer
*iface
)
490 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
491 return WMPPlayer4_Release(&This
->IWMPPlayer4_iface
);
494 static HRESULT WINAPI
WMPPlayer_GetTypeInfoCount(IWMPPlayer
*iface
, UINT
*pctinfo
)
496 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
497 return WMPPlayer4_GetTypeInfoCount(&This
->IWMPPlayer4_iface
, pctinfo
);
500 static HRESULT WINAPI
WMPPlayer_GetTypeInfo(IWMPPlayer
*iface
, UINT iTInfo
,
501 LCID lcid
, ITypeInfo
**ppTInfo
)
503 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
505 return WMPPlayer4_GetTypeInfo(&This
->IWMPPlayer4_iface
, iTInfo
,
509 static HRESULT WINAPI
WMPPlayer_GetIDsOfNames(IWMPPlayer
*iface
, REFIID riid
,
510 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
512 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
513 return WMPPlayer4_GetIDsOfNames(&This
->IWMPPlayer4_iface
, riid
,
514 rgszNames
, cNames
, lcid
, rgDispId
);
517 static HRESULT WINAPI
WMPPlayer_Invoke(IWMPPlayer
*iface
, DISPID dispIdMember
,
518 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
519 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
521 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
522 return WMPPlayer4_Invoke(&This
->IWMPPlayer4_iface
, dispIdMember
,
523 riid
, lcid
, wFlags
, pDispParams
, pVarResult
,
524 pExcepInfo
, puArgErr
);
527 static HRESULT WINAPI
WMPPlayer_close(IWMPPlayer
*iface
)
529 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
530 return WMPPlayer4_close(&This
->IWMPPlayer4_iface
);
533 static HRESULT WINAPI
WMPPlayer_get_URL(IWMPPlayer
*iface
, BSTR
*pbstrURL
)
535 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
536 return WMPPlayer4_get_URL(&This
->IWMPPlayer4_iface
, pbstrURL
);
539 static HRESULT WINAPI
WMPPlayer_put_URL(IWMPPlayer
*iface
, BSTR url
)
541 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
542 return WMPPlayer4_put_URL(&This
->IWMPPlayer4_iface
, url
);
545 static HRESULT WINAPI
WMPPlayer_get_openState(IWMPPlayer
*iface
, WMPOpenState
*pwmpos
)
547 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
548 return WMPPlayer4_get_openState(&This
->IWMPPlayer4_iface
, pwmpos
);
551 static HRESULT WINAPI
WMPPlayer_get_playState(IWMPPlayer
*iface
, WMPPlayState
*pwmpps
)
553 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
554 return WMPPlayer4_get_playState(&This
->IWMPPlayer4_iface
, pwmpps
);
557 static HRESULT WINAPI
WMPPlayer_get_controls(IWMPPlayer
*iface
, IWMPControls
**ppControl
)
559 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
560 return WMPPlayer4_get_controls(&This
->IWMPPlayer4_iface
, ppControl
);
563 static HRESULT WINAPI
WMPPlayer_get_settings(IWMPPlayer
*iface
, IWMPSettings
**ppSettings
)
565 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
566 return WMPPlayer4_get_settings(&This
->IWMPPlayer4_iface
, ppSettings
);
569 static HRESULT WINAPI
WMPPlayer_get_currentMedia(IWMPPlayer
*iface
, IWMPMedia
**ppMedia
)
571 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
572 return WMPPlayer4_get_currentMedia(&This
->IWMPPlayer4_iface
, ppMedia
);
575 static HRESULT WINAPI
WMPPlayer_put_currentMedia(IWMPPlayer
*iface
, IWMPMedia
*pMedia
)
577 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
578 return WMPPlayer4_put_currentMedia(&This
->IWMPPlayer4_iface
, pMedia
);
581 static HRESULT WINAPI
WMPPlayer_get_mediaCollection(IWMPPlayer
*iface
, IWMPMediaCollection
**ppMediaCollection
)
583 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
584 return WMPPlayer4_get_mediaCollection(&This
->IWMPPlayer4_iface
, ppMediaCollection
);
587 static HRESULT WINAPI
WMPPlayer_get_playlistCollection(IWMPPlayer
*iface
, IWMPPlaylistCollection
**ppPlaylistCollection
)
589 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
590 return WMPPlayer4_get_playlistCollection(&This
->IWMPPlayer4_iface
, ppPlaylistCollection
);
593 static HRESULT WINAPI
WMPPlayer_get_versionInfo(IWMPPlayer
*iface
, BSTR
*version
)
595 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
596 return WMPPlayer4_get_versionInfo(&This
->IWMPPlayer4_iface
, version
);
599 static HRESULT WINAPI
WMPPlayer_launchURL(IWMPPlayer
*iface
, BSTR url
)
601 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
602 return WMPPlayer4_launchURL(&This
->IWMPPlayer4_iface
, url
);
605 static HRESULT WINAPI
WMPPlayer_get_network(IWMPPlayer
*iface
, IWMPNetwork
**ppQNI
)
607 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
608 return WMPPlayer4_get_network(&This
->IWMPPlayer4_iface
, ppQNI
);
611 static HRESULT WINAPI
WMPPlayer_get_currentPlaylist(IWMPPlayer
*iface
, IWMPPlaylist
**ppPL
)
613 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
614 return WMPPlayer4_get_currentPlaylist(&This
->IWMPPlayer4_iface
, ppPL
);
617 static HRESULT WINAPI
WMPPlayer_put_currentPlaylist(IWMPPlayer
*iface
, IWMPPlaylist
*pPL
)
619 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
620 return WMPPlayer4_put_currentPlaylist(&This
->IWMPPlayer4_iface
, pPL
);
623 static HRESULT WINAPI
WMPPlayer_get_cdromCollection(IWMPPlayer
*iface
, IWMPCdromCollection
**ppCdromCollection
)
625 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
626 return WMPPlayer4_get_cdromCollection(&This
->IWMPPlayer4_iface
, ppCdromCollection
);
629 static HRESULT WINAPI
WMPPlayer_get_closedCaption(IWMPPlayer
*iface
, IWMPClosedCaption
**ppClosedCaption
)
631 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
632 return WMPPlayer4_get_closedCaption(&This
->IWMPPlayer4_iface
, ppClosedCaption
);
635 static HRESULT WINAPI
WMPPlayer_get_isOnline(IWMPPlayer
*iface
, VARIANT_BOOL
*pfOnline
)
637 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
638 return WMPPlayer4_get_isOnline(&This
->IWMPPlayer4_iface
, pfOnline
);
641 static HRESULT WINAPI
WMPPlayer_get_Error(IWMPPlayer
*iface
, IWMPError
**ppError
)
643 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
644 return WMPPlayer4_get_Error(&This
->IWMPPlayer4_iface
, ppError
);
647 static HRESULT WINAPI
WMPPlayer_get_Status(IWMPPlayer
*iface
, BSTR
*pbstrStatus
)
649 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
650 return WMPPlayer4_get_Status(&This
->IWMPPlayer4_iface
, pbstrStatus
);
653 static HRESULT WINAPI
WMPPlayer_get_enabled(IWMPPlayer
*iface
, VARIANT_BOOL
*pbEnabled
)
655 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
656 return WMPPlayer4_get_enabled(&This
->IWMPPlayer4_iface
, pbEnabled
);
659 static HRESULT WINAPI
WMPPlayer_put_enabled(IWMPPlayer
*iface
, VARIANT_BOOL enabled
)
661 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
662 return WMPPlayer4_put_enabled(&This
->IWMPPlayer4_iface
, enabled
);
665 static HRESULT WINAPI
WMPPlayer_get_fullScreen(IWMPPlayer
*iface
, VARIANT_BOOL
*pbFullScreen
)
667 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
668 return WMPPlayer4_get_fullScreen(&This
->IWMPPlayer4_iface
, pbFullScreen
);
671 static HRESULT WINAPI
WMPPlayer_put_fullScreen(IWMPPlayer
*iface
, VARIANT_BOOL fullscreen
)
673 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
674 return WMPPlayer4_put_fullScreen(&This
->IWMPPlayer4_iface
, fullscreen
);
677 static HRESULT WINAPI
WMPPlayer_get_enableContextMenu(IWMPPlayer
*iface
, VARIANT_BOOL
*pbEnableContextMenu
)
679 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
680 return WMPPlayer4_get_enableContextMenu(&This
->IWMPPlayer4_iface
, pbEnableContextMenu
);
683 static HRESULT WINAPI
WMPPlayer_put_enableContextMenu(IWMPPlayer
*iface
, VARIANT_BOOL enable
)
685 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
686 return WMPPlayer4_put_enableContextMenu(&This
->IWMPPlayer4_iface
, enable
);
689 static HRESULT WINAPI
WMPPlayer_put_uiMode(IWMPPlayer
*iface
, BSTR mode
)
691 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
692 return WMPPlayer4_put_uiMode(&This
->IWMPPlayer4_iface
, mode
);
695 static HRESULT WINAPI
WMPPlayer_get_uiMode(IWMPPlayer
*iface
, BSTR
*pbstrMode
)
697 WindowsMediaPlayer
*This
= impl_from_IWMPPlayer(iface
);
698 return WMPPlayer4_get_uiMode(&This
->IWMPPlayer4_iface
, pbstrMode
);
701 static IWMPPlayerVtbl WMPPlayerVtbl
= {
702 WMPPlayer_QueryInterface
,
705 WMPPlayer_GetTypeInfoCount
,
706 WMPPlayer_GetTypeInfo
,
707 WMPPlayer_GetIDsOfNames
,
712 WMPPlayer_get_openState
,
713 WMPPlayer_get_playState
,
714 WMPPlayer_get_controls
,
715 WMPPlayer_get_settings
,
716 WMPPlayer_get_currentMedia
,
717 WMPPlayer_put_currentMedia
,
718 WMPPlayer_get_mediaCollection
,
719 WMPPlayer_get_playlistCollection
,
720 WMPPlayer_get_versionInfo
,
722 WMPPlayer_get_network
,
723 WMPPlayer_get_currentPlaylist
,
724 WMPPlayer_put_currentPlaylist
,
725 WMPPlayer_get_cdromCollection
,
726 WMPPlayer_get_closedCaption
,
727 WMPPlayer_get_isOnline
,
729 WMPPlayer_get_Status
,
730 WMPPlayer_get_enabled
,
731 WMPPlayer_put_enabled
,
732 WMPPlayer_get_fullScreen
,
733 WMPPlayer_put_fullScreen
,
734 WMPPlayer_get_enableContextMenu
,
735 WMPPlayer_put_enableContextMenu
,
736 WMPPlayer_put_uiMode
,
737 WMPPlayer_get_uiMode
,
741 static IWMPPlayer4Vtbl WMPPlayer4Vtbl
= {
742 WMPPlayer4_QueryInterface
,
745 WMPPlayer4_GetTypeInfoCount
,
746 WMPPlayer4_GetTypeInfo
,
747 WMPPlayer4_GetIDsOfNames
,
752 WMPPlayer4_get_openState
,
753 WMPPlayer4_get_playState
,
754 WMPPlayer4_get_controls
,
755 WMPPlayer4_get_settings
,
756 WMPPlayer4_get_currentMedia
,
757 WMPPlayer4_put_currentMedia
,
758 WMPPlayer4_get_mediaCollection
,
759 WMPPlayer4_get_playlistCollection
,
760 WMPPlayer4_get_versionInfo
,
761 WMPPlayer4_launchURL
,
762 WMPPlayer4_get_network
,
763 WMPPlayer4_get_currentPlaylist
,
764 WMPPlayer4_put_currentPlaylist
,
765 WMPPlayer4_get_cdromCollection
,
766 WMPPlayer4_get_closedCaption
,
767 WMPPlayer4_get_isOnline
,
768 WMPPlayer4_get_Error
,
769 WMPPlayer4_get_Status
,
771 WMPPlayer4_newPlaylist
,
773 WMPPlayer4_get_enabled
,
774 WMPPlayer4_put_enabled
,
775 WMPPlayer4_get_fullScreen
,
776 WMPPlayer4_put_fullScreen
,
777 WMPPlayer4_get_enableContextMenu
,
778 WMPPlayer4_put_enableContextMenu
,
779 WMPPlayer4_put_uiMode
,
780 WMPPlayer4_get_uiMode
,
781 WMPPlayer4_get_stretchToFit
,
782 WMPPlayer4_put_stretchToFit
,
783 WMPPlayer4_get_windowlessVideo
,
784 WMPPlayer4_put_windowlessVideo
,
785 WMPPlayer4_get_isRemote
,
786 WMPPlayer4_get_playerApplication
,
787 WMPPlayer4_openPlayer
790 static inline WindowsMediaPlayer
*impl_from_IWMPSettings(IWMPSettings
*iface
)
792 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IWMPSettings_iface
);
795 static HRESULT WINAPI
WMPSettings_QueryInterface(IWMPSettings
*iface
, REFIID riid
, void **ppv
)
797 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
798 return IOleObject_QueryInterface(&This
->IOleObject_iface
, riid
, ppv
);
801 static ULONG WINAPI
WMPSettings_AddRef(IWMPSettings
*iface
)
803 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
804 return IOleObject_AddRef(&This
->IOleObject_iface
);
807 static ULONG WINAPI
WMPSettings_Release(IWMPSettings
*iface
)
809 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
810 return IOleObject_Release(&This
->IOleObject_iface
);
813 static HRESULT WINAPI
WMPSettings_GetTypeInfoCount(IWMPSettings
*iface
, UINT
*pctinfo
)
815 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
816 FIXME("(%p)->(%p)\n", This
, pctinfo
);
820 static HRESULT WINAPI
WMPSettings_GetTypeInfo(IWMPSettings
*iface
, UINT iTInfo
,
821 LCID lcid
, ITypeInfo
**ppTInfo
)
823 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
824 FIXME("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
828 static HRESULT WINAPI
WMPSettings_GetIDsOfNames(IWMPSettings
*iface
, REFIID riid
,
829 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
831 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
832 FIXME("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
836 static HRESULT WINAPI
WMPSettings_Invoke(IWMPSettings
*iface
, DISPID dispIdMember
,
837 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
838 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
840 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
841 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
842 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
846 static HRESULT WINAPI
WMPSettings_get_isAvailable(IWMPSettings
*iface
, BSTR item
, VARIANT_BOOL
*p
)
848 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
849 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(item
), p
);
853 static HRESULT WINAPI
WMPSettings_get_autoStart(IWMPSettings
*iface
, VARIANT_BOOL
*p
)
855 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
856 TRACE("(%p)->(%p)\n", This
, p
);
859 *p
= This
->auto_start
;
863 static HRESULT WINAPI
WMPSettings_put_autoStart(IWMPSettings
*iface
, VARIANT_BOOL v
)
865 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
866 TRACE("(%p)->(%x)\n", This
, v
);
867 This
->auto_start
= v
;
871 static HRESULT WINAPI
WMPSettings_get_baseURL(IWMPSettings
*iface
, BSTR
*p
)
873 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
874 FIXME("(%p)->(%p)\n", This
, p
);
878 static HRESULT WINAPI
WMPSettings_put_baseURL(IWMPSettings
*iface
, BSTR v
)
880 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
881 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
885 static HRESULT WINAPI
WMPSettings_get_defaultFrame(IWMPSettings
*iface
, BSTR
*p
)
887 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
888 FIXME("(%p)->(%p)\n", This
, p
);
892 static HRESULT WINAPI
WMPSettings_put_defaultFrame(IWMPSettings
*iface
, BSTR v
)
894 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
895 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
899 static HRESULT WINAPI
WMPSettings_get_invokeURLs(IWMPSettings
*iface
, VARIANT_BOOL
*p
)
901 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
903 TRACE("(%p)->(%p)\n", This
, p
);
907 *p
= This
->invoke_urls
;
911 static HRESULT WINAPI
WMPSettings_put_invokeURLs(IWMPSettings
*iface
, VARIANT_BOOL v
)
913 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
914 /* Leaving as FIXME as we don't currently use this */
915 FIXME("(%p)->(%x)\n", This
, v
);
916 This
->invoke_urls
= v
;
920 static HRESULT WINAPI
WMPSettings_get_mute(IWMPSettings
*iface
, VARIANT_BOOL
*p
)
922 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
923 FIXME("(%p)->(%p)\n", This
, p
);
927 static HRESULT WINAPI
WMPSettings_put_mute(IWMPSettings
*iface
, VARIANT_BOOL v
)
929 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
930 FIXME("(%p)->(%x)\n", This
, v
);
934 static HRESULT WINAPI
WMPSettings_get_playCount(IWMPSettings
*iface
, LONG
*p
)
936 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
937 FIXME("(%p)->(%p)\n", This
, p
);
941 static HRESULT WINAPI
WMPSettings_put_playCount(IWMPSettings
*iface
, LONG v
)
943 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
944 FIXME("(%p)->(%d)\n", This
, v
);
948 static HRESULT WINAPI
WMPSettings_get_rate(IWMPSettings
*iface
, double *p
)
950 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
951 FIXME("(%p)->(%p)\n", This
, p
);
955 static HRESULT WINAPI
WMPSettings_put_rate(IWMPSettings
*iface
, double v
)
957 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
958 FIXME("(%p)->(%lf)\n", This
, v
);
962 static HRESULT WINAPI
WMPSettings_get_balance(IWMPSettings
*iface
, LONG
*p
)
964 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
965 FIXME("(%p)->(%p)\n", This
, p
);
969 static HRESULT WINAPI
WMPSettings_put_balance(IWMPSettings
*iface
, LONG v
)
971 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
972 FIXME("(%p)->(%d)\n", This
, v
);
976 static HRESULT WINAPI
WMPSettings_get_volume(IWMPSettings
*iface
, LONG
*p
)
978 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
979 TRACE("(%p)->(%p)\n", This
, p
);
986 static HRESULT WINAPI
WMPSettings_put_volume(IWMPSettings
*iface
, LONG v
)
988 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
989 TRACE("(%p)->(%d)\n", This
, v
);
991 if (!This
->filter_graph
)
994 /* IBasicAudio - [-10000, 0], wmp - [0, 100] */
995 v
= 10000 * v
/ 100 - 10000;
996 if (!This
->basic_audio
)
999 return IBasicAudio_put_Volume(This
->basic_audio
, v
);
1002 static HRESULT WINAPI
WMPSettings_getMode(IWMPSettings
*iface
, BSTR mode
, VARIANT_BOOL
*p
)
1004 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
1005 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(mode
), p
);
1009 static HRESULT WINAPI
WMPSettings_setMode(IWMPSettings
*iface
, BSTR mode
, VARIANT_BOOL v
)
1011 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
1012 FIXME("(%p)->(%s %x)\n", This
, debugstr_w(mode
), v
);
1016 static HRESULT WINAPI
WMPSettings_get_enableErrorDialogs(IWMPSettings
*iface
, VARIANT_BOOL
*p
)
1018 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
1020 TRACE("(%p)->(%p)\n", This
, p
);
1024 *p
= This
->enable_error_dialogs
;
1028 static HRESULT WINAPI
WMPSettings_put_enableErrorDialogs(IWMPSettings
*iface
, VARIANT_BOOL v
)
1030 WindowsMediaPlayer
*This
= impl_from_IWMPSettings(iface
);
1031 /* Leaving as FIXME as we don't currently use this */
1032 FIXME("(%p)->(%x)\n", This
, v
);
1033 This
->enable_error_dialogs
= v
;
1037 static const IWMPSettingsVtbl WMPSettingsVtbl
= {
1038 WMPSettings_QueryInterface
,
1040 WMPSettings_Release
,
1041 WMPSettings_GetTypeInfoCount
,
1042 WMPSettings_GetTypeInfo
,
1043 WMPSettings_GetIDsOfNames
,
1045 WMPSettings_get_isAvailable
,
1046 WMPSettings_get_autoStart
,
1047 WMPSettings_put_autoStart
,
1048 WMPSettings_get_baseURL
,
1049 WMPSettings_put_baseURL
,
1050 WMPSettings_get_defaultFrame
,
1051 WMPSettings_put_defaultFrame
,
1052 WMPSettings_get_invokeURLs
,
1053 WMPSettings_put_invokeURLs
,
1054 WMPSettings_get_mute
,
1055 WMPSettings_put_mute
,
1056 WMPSettings_get_playCount
,
1057 WMPSettings_put_playCount
,
1058 WMPSettings_get_rate
,
1059 WMPSettings_put_rate
,
1060 WMPSettings_get_balance
,
1061 WMPSettings_put_balance
,
1062 WMPSettings_get_volume
,
1063 WMPSettings_put_volume
,
1064 WMPSettings_getMode
,
1065 WMPSettings_setMode
,
1066 WMPSettings_get_enableErrorDialogs
,
1067 WMPSettings_put_enableErrorDialogs
1070 static HRESULT WINAPI
WMPNetwork_QueryInterface(IWMPNetwork
*iface
, REFIID riid
, void **ppv
)
1072 if(IsEqualGUID(riid
, &IID_IDispatch
)) {
1074 }else if(IsEqualGUID(riid
, &IID_IWMPNetwork
)) {
1077 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid
));
1079 return E_NOINTERFACE
;
1082 IUnknown_AddRef((IUnknown
*)*ppv
);
1086 static ULONG WINAPI
WMPNetwork_AddRef(IWMPNetwork
*iface
)
1088 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1089 return IOleObject_AddRef(&This
->IOleObject_iface
);
1092 static ULONG WINAPI
WMPNetwork_Release(IWMPNetwork
*iface
)
1094 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1095 return IOleObject_Release(&This
->IOleObject_iface
);
1098 static HRESULT WINAPI
WMPNetwork_GetTypeInfoCount(IWMPNetwork
*iface
, UINT
*pctinfo
)
1100 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1101 FIXME("(%p)->(%p)\n", This
, pctinfo
);
1105 static HRESULT WINAPI
WMPNetwork_GetTypeInfo(IWMPNetwork
*iface
, UINT iTInfo
,
1106 LCID lcid
, ITypeInfo
**ppTInfo
)
1108 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1109 FIXME("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1113 static HRESULT WINAPI
WMPNetwork_GetIDsOfNames(IWMPNetwork
*iface
, REFIID riid
,
1114 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1116 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1117 FIXME("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
1121 static HRESULT WINAPI
WMPNetwork_Invoke(IWMPNetwork
*iface
, DISPID dispIdMember
,
1122 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
1123 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1125 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1126 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
1127 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1131 static HRESULT WINAPI
WMPNetwork_get_bandWidth(IWMPNetwork
*iface
, LONG
*plBandwidth
)
1133 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1134 FIXME("(%p)->(%p)\n", This
, plBandwidth
);
1138 static HRESULT WINAPI
WMPNetwork_get_recoveredPackets(IWMPNetwork
*iface
, LONG
*plRecoveredPackets
)
1140 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1141 FIXME("(%p)->(%p)\n", This
, plRecoveredPackets
);
1145 static HRESULT WINAPI
WMPNetwork_get_sourceProtocol(IWMPNetwork
*iface
, BSTR
*pbstrSourceProtocol
)
1147 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1148 FIXME("(%p)->(%p)\n", This
, pbstrSourceProtocol
);
1152 static HRESULT WINAPI
WMPNetwork_get_receivedPackets(IWMPNetwork
*iface
, LONG
*plReceivedPackets
)
1154 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1155 FIXME("(%p)->(%p)\n", This
, plReceivedPackets
);
1159 static HRESULT WINAPI
WMPNetwork_get_lostPackets(IWMPNetwork
*iface
, LONG
*plLostPackets
)
1161 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1162 FIXME("(%p)->(%p)\n", This
, plLostPackets
);
1166 static HRESULT WINAPI
WMPNetwork_get_receptionQuality(IWMPNetwork
*iface
, LONG
*plReceptionQuality
)
1168 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1169 FIXME("(%p)->(%p)\n", This
, plReceptionQuality
);
1173 static HRESULT WINAPI
WMPNetwork_get_bufferingCount(IWMPNetwork
*iface
, LONG
*plBufferingCount
)
1175 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1176 FIXME("(%p)->(%p)\n", This
, plBufferingCount
);
1180 static HRESULT WINAPI
WMPNetwork_get_bufferingProgress(IWMPNetwork
*iface
, LONG
*plBufferingProgress
)
1182 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1183 TRACE("(%p)->(%p)\n", This
, plBufferingProgress
);
1184 if (!This
->filter_graph
) {
1187 /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
1188 * For file sources FileAsyncReader->Length should work
1190 FIXME("stub: Returning buffering progress 100\n");
1191 *plBufferingProgress
= 100;
1196 static HRESULT WINAPI
WMPNetwork_get_bufferingTime(IWMPNetwork
*iface
, LONG
*plBufferingTime
)
1198 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1199 FIXME("(%p)->(%p)\n", This
, plBufferingTime
);
1203 static HRESULT WINAPI
WMPNetwork_put_bufferingTime(IWMPNetwork
*iface
, LONG lBufferingTime
)
1205 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1206 FIXME("(%p)->(%d)\n", This
, lBufferingTime
);
1210 static HRESULT WINAPI
WMPNetwork_get_frameRate(IWMPNetwork
*iface
, LONG
*plFrameRate
)
1212 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1213 FIXME("(%p)->(%p)\n", This
, plFrameRate
);
1217 static HRESULT WINAPI
WMPNetwork_get_maxBitRate(IWMPNetwork
*iface
, LONG
*plBitRate
)
1219 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1220 FIXME("(%p)->(%p)\n", This
, plBitRate
);
1224 static HRESULT WINAPI
WMPNetwork_get_bitRate(IWMPNetwork
*iface
, LONG
*plBitRate
)
1226 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1227 FIXME("(%p)->(%p)\n", This
, plBitRate
);
1231 static HRESULT WINAPI
WMPNetwork_getProxySettings(IWMPNetwork
*iface
, BSTR bstrProtocol
, LONG
*plProxySetting
)
1233 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1234 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(bstrProtocol
), plProxySetting
);
1238 static HRESULT WINAPI
WMPNetwork_setProxySettings(IWMPNetwork
*iface
, BSTR bstrProtocol
, LONG lProxySetting
)
1240 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1241 FIXME("(%p)->(%s, %d)\n", This
, debugstr_w(bstrProtocol
), lProxySetting
);
1245 static HRESULT WINAPI
WMPNetwork_getProxyName(IWMPNetwork
*iface
, BSTR bstrProtocol
, BSTR
*pbstrProxyName
)
1247 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1248 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(bstrProtocol
), pbstrProxyName
);
1252 static HRESULT WINAPI
WMPNetwork_setProxyName(IWMPNetwork
*iface
, BSTR bstrProtocol
, BSTR bstrProxyName
)
1254 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1255 FIXME("(%p)->(%s, %s)\n", This
, debugstr_w(bstrProtocol
), debugstr_w(bstrProxyName
));
1259 static HRESULT WINAPI
WMPNetwork_getProxyPort(IWMPNetwork
*iface
, BSTR bstrProtocol
, LONG
*plProxyPort
)
1261 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1262 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(bstrProtocol
), plProxyPort
);
1266 static HRESULT WINAPI
WMPNetwork_setProxyPort(IWMPNetwork
*iface
, BSTR bstrProtocol
, LONG lProxyPort
)
1268 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1269 FIXME("(%p)->(%s, %d)\n", This
, debugstr_w(bstrProtocol
), lProxyPort
);
1273 static HRESULT WINAPI
WMPNetwork_getProxyExceptionList(IWMPNetwork
*iface
, BSTR bstrProtocol
, BSTR
*pbstrExceptionList
)
1275 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1276 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(bstrProtocol
), pbstrExceptionList
);
1280 static HRESULT WINAPI
WMPNetwork_setProxyExceptionList(IWMPNetwork
*iface
, BSTR bstrProtocol
, BSTR bstrExceptionList
)
1282 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1283 FIXME("(%p)->(%s, %s)\n", This
, debugstr_w(bstrProtocol
), debugstr_w(bstrExceptionList
));
1287 static HRESULT WINAPI
WMPNetwork_getProxyBypassForLocal(IWMPNetwork
*iface
, BSTR bstrProtocol
, VARIANT_BOOL
*pfBypassForLocal
)
1289 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1290 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(bstrProtocol
), pfBypassForLocal
);
1294 static HRESULT WINAPI
WMPNetwork_setProxyBypassForLocal(IWMPNetwork
*iface
, BSTR bstrProtocol
, VARIANT_BOOL fBypassForLocal
)
1296 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1297 FIXME("(%p)->(%s, %d)\n", This
, debugstr_w(bstrProtocol
), fBypassForLocal
);
1301 static HRESULT WINAPI
WMPNetwork_get_maxBandwidth(IWMPNetwork
*iface
, LONG
*plMaxBandwidth
)
1303 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1304 FIXME("(%p)->(%p)\n", This
, plMaxBandwidth
);
1308 static HRESULT WINAPI
WMPNetwork_put_maxBandwidth(IWMPNetwork
*iface
, LONG lMaxBandwidth
)
1310 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1311 FIXME("(%p)->(%d)\n", This
, lMaxBandwidth
);
1315 static HRESULT WINAPI
WMPNetwork_get_downloadProgress(IWMPNetwork
*iface
, LONG
*plDownloadProgress
)
1317 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1318 TRACE("(%p)->(%p)\n", This
, plDownloadProgress
);
1319 if (!This
->filter_graph
) {
1322 /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
1323 * For file sources FileAsyncReader->Length could work or it should just be
1326 FIXME("stub: Returning download progress 100\n");
1327 *plDownloadProgress
= 100;
1332 static HRESULT WINAPI
WMPNetwork_get_encodedFrameRate(IWMPNetwork
*iface
, LONG
*plFrameRate
)
1334 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1335 FIXME("(%p)->(%p)\n", This
, plFrameRate
);
1339 static HRESULT WINAPI
WMPNetwork_get_framesSkipped(IWMPNetwork
*iface
, LONG
*plFrames
)
1341 WindowsMediaPlayer
*This
= impl_from_IWMPNetwork(iface
);
1342 FIXME("(%p)->(%p)\n", This
, plFrames
);
1346 static const IWMPNetworkVtbl WMPNetworkVtbl
= {
1347 WMPNetwork_QueryInterface
,
1350 WMPNetwork_GetTypeInfoCount
,
1351 WMPNetwork_GetTypeInfo
,
1352 WMPNetwork_GetIDsOfNames
,
1354 WMPNetwork_get_bandWidth
,
1355 WMPNetwork_get_recoveredPackets
,
1356 WMPNetwork_get_sourceProtocol
,
1357 WMPNetwork_get_receivedPackets
,
1358 WMPNetwork_get_lostPackets
,
1359 WMPNetwork_get_receptionQuality
,
1360 WMPNetwork_get_bufferingCount
,
1361 WMPNetwork_get_bufferingProgress
,
1362 WMPNetwork_get_bufferingTime
,
1363 WMPNetwork_put_bufferingTime
,
1364 WMPNetwork_get_frameRate
,
1365 WMPNetwork_get_maxBitRate
,
1366 WMPNetwork_get_bitRate
,
1367 WMPNetwork_getProxySettings
,
1368 WMPNetwork_setProxySettings
,
1369 WMPNetwork_getProxyName
,
1370 WMPNetwork_setProxyName
,
1371 WMPNetwork_getProxyPort
,
1372 WMPNetwork_setProxyPort
,
1373 WMPNetwork_getProxyExceptionList
,
1374 WMPNetwork_setProxyExceptionList
,
1375 WMPNetwork_getProxyBypassForLocal
,
1376 WMPNetwork_setProxyBypassForLocal
,
1377 WMPNetwork_get_maxBandwidth
,
1378 WMPNetwork_put_maxBandwidth
,
1379 WMPNetwork_get_downloadProgress
,
1380 WMPNetwork_get_encodedFrameRate
,
1381 WMPNetwork_get_framesSkipped
,
1384 static HRESULT WINAPI
WMPControls_QueryInterface(IWMPControls
*iface
, REFIID riid
, void **ppv
)
1386 if(IsEqualGUID(riid
, &IID_IUnknown
)) {
1388 }else if(IsEqualGUID(riid
, &IID_IDispatch
)) {
1390 }else if(IsEqualGUID(riid
, &IID_IWMPControls
)) {
1393 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid
));
1395 return E_NOINTERFACE
;
1398 IUnknown_AddRef((IUnknown
*)*ppv
);
1402 static ULONG WINAPI
WMPControls_AddRef(IWMPControls
*iface
)
1404 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1405 return IOleObject_AddRef(&This
->IOleObject_iface
);
1408 static ULONG WINAPI
WMPControls_Release(IWMPControls
*iface
)
1410 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1411 return IOleObject_Release(&This
->IOleObject_iface
);
1414 static HRESULT WINAPI
WMPControls_GetTypeInfoCount(IWMPControls
*iface
, UINT
*pctinfo
)
1416 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1417 FIXME("(%p)->(%p)\n", This
, pctinfo
);
1421 static HRESULT WINAPI
WMPControls_GetTypeInfo(IWMPControls
*iface
, UINT iTInfo
,
1422 LCID lcid
, ITypeInfo
**ppTInfo
)
1424 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1425 FIXME("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1429 static HRESULT WINAPI
WMPControls_GetIDsOfNames(IWMPControls
*iface
, REFIID riid
,
1430 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1432 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1433 FIXME("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
1437 static HRESULT WINAPI
WMPControls_Invoke(IWMPControls
*iface
, DISPID dispIdMember
,
1438 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
1439 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1441 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1442 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
1443 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1447 static HRESULT WINAPI
WMPControls_get_isAvailable(IWMPControls
*iface
, BSTR bstrItem
, VARIANT_BOOL
*pIsAvailable
)
1449 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1450 static const WCHAR currentPosition
[] = {'c','u','r','r','e','n','t','P','o','s','i','t','i','o','n',0};
1451 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrItem
), pIsAvailable
);
1452 if (!This
->filter_graph
) {
1453 *pIsAvailable
= VARIANT_FALSE
;
1454 } else if (wcscmp(currentPosition
, bstrItem
) == 0) {
1456 IMediaSeeking_GetCapabilities(This
->media_seeking
, &capabilities
);
1457 *pIsAvailable
= (capabilities
& AM_SEEKING_CanSeekAbsolute
) ?
1458 VARIANT_TRUE
: VARIANT_FALSE
;
1460 FIXME("%s not implemented\n", debugstr_w(bstrItem
));
1467 static HRESULT WINAPI
WMPControls_play(IWMPControls
*iface
)
1469 HRESULT hres
= S_OK
;
1470 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1472 TRACE("(%p)\n", This
);
1475 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE
;
1478 if (!This
->filter_graph
) {
1479 hres
= CoCreateInstance(&CLSID_FilterGraph
,
1481 CLSCTX_INPROC_SERVER
,
1483 (void **)&This
->filter_graph
);
1484 update_state(This
, DISPID_WMPCOREEVENT_OPENSTATECHANGE
, wmposOpeningUnknownURL
);
1486 if (SUCCEEDED(hres
))
1487 hres
= IGraphBuilder_RenderFile(This
->filter_graph
, This
->media
->url
, NULL
);
1488 if (SUCCEEDED(hres
))
1489 update_state(This
, DISPID_WMPCOREEVENT_OPENSTATECHANGE
, wmposMediaOpen
);
1490 if (SUCCEEDED(hres
))
1491 hres
= IGraphBuilder_QueryInterface(This
->filter_graph
, &IID_IMediaControl
,
1492 (void**)&This
->media_control
);
1493 if (SUCCEEDED(hres
))
1494 hres
= IGraphBuilder_QueryInterface(This
->filter_graph
, &IID_IMediaSeeking
,
1495 (void**)&This
->media_seeking
);
1496 if (SUCCEEDED(hres
))
1497 hres
= IMediaSeeking_SetTimeFormat(This
->media_seeking
, &TIME_FORMAT_MEDIA_TIME
);
1498 if (SUCCEEDED(hres
))
1499 hres
= IGraphBuilder_QueryInterface(This
->filter_graph
, &IID_IMediaEvent
,
1500 (void**)&This
->media_event
);
1501 if (SUCCEEDED(hres
))
1503 IMediaEventEx
*media_event_ex
= NULL
;
1504 hres
= IGraphBuilder_QueryInterface(This
->filter_graph
, &IID_IMediaEventEx
,
1505 (void**)&media_event_ex
);
1506 if (SUCCEEDED(hres
)) {
1507 hres
= IMediaEventEx_SetNotifyWindow(media_event_ex
, (OAHWND
)This
->msg_window
,
1508 WM_WMPEVENT
, (LONG_PTR
)This
);
1509 IMediaEventEx_Release(media_event_ex
);
1512 if (SUCCEEDED(hres
))
1513 hres
= IGraphBuilder_QueryInterface(This
->filter_graph
, &IID_IBasicAudio
, (void**)&This
->basic_audio
);
1514 if (SUCCEEDED(hres
))
1515 hres
= IWMPSettings_put_volume(&This
->IWMPSettings_iface
, This
->volume
);
1518 update_state(This
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsTransitioning
);
1520 if (SUCCEEDED(hres
))
1521 hres
= IMediaControl_Run(This
->media_control
);
1523 if (hres
== S_FALSE
) {
1524 hres
= S_OK
; /* S_FALSE will mean that graph is transitioning and that is fine */
1527 if (SUCCEEDED(hres
)) {
1529 update_state(This
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsPlaying
);
1530 if (SUCCEEDED(IMediaSeeking_GetDuration(This
->media_seeking
, &duration
)))
1531 This
->media
->duration
= (DOUBLE
)duration
/ 10000000.0f
;
1533 update_state(This
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsUndefined
);
1539 static HRESULT WINAPI
WMPControls_stop(IWMPControls
*iface
)
1541 HRESULT hres
= S_OK
;
1542 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1543 TRACE("(%p)\n", This
);
1544 if (!This
->filter_graph
) {
1545 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE
;
1547 if (This
->media_control
) {
1548 hres
= IMediaControl_Stop(This
->media_control
);
1549 IMediaControl_Release(This
->media_control
);
1551 if (This
->media_event
) {
1552 IMediaEvent_Release(This
->media_event
);
1554 if (This
->media_seeking
) {
1555 IMediaSeeking_Release(This
->media_seeking
);
1557 if (This
->basic_audio
) {
1558 IBasicAudio_Release(This
->basic_audio
);
1560 IGraphBuilder_Release(This
->filter_graph
);
1561 This
->filter_graph
= NULL
;
1562 This
->media_control
= NULL
;
1563 This
->media_event
= NULL
;
1564 This
->media_seeking
= NULL
;
1565 This
->basic_audio
= NULL
;
1567 update_state(This
, DISPID_WMPCOREEVENT_OPENSTATECHANGE
, wmposPlaylistOpenNoMedia
);
1568 update_state(This
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsStopped
);
1572 static HRESULT WINAPI
WMPControls_pause(IWMPControls
*iface
)
1574 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1575 FIXME("(%p)\n", This
);
1579 static HRESULT WINAPI
WMPControls_fastForward(IWMPControls
*iface
)
1581 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1582 FIXME("(%p)\n", This
);
1586 static HRESULT WINAPI
WMPControls_fastReverse(IWMPControls
*iface
)
1588 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1589 FIXME("(%p)\n", This
);
1593 static HRESULT WINAPI
WMPControls_get_currentPosition(IWMPControls
*iface
, DOUBLE
*pdCurrentPosition
)
1595 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1597 LONGLONG currentPosition
;
1599 TRACE("(%p)->(%p)\n", This
, pdCurrentPosition
);
1600 if (!This
->media_seeking
)
1603 hres
= IMediaSeeking_GetCurrentPosition(This
->media_seeking
, ¤tPosition
);
1604 *pdCurrentPosition
= (DOUBLE
) currentPosition
/ 10000000.0f
;
1605 TRACE("hres: %d, pos: %f\n", hres
, *pdCurrentPosition
);
1609 static HRESULT WINAPI
WMPControls_put_currentPosition(IWMPControls
*iface
, DOUBLE dCurrentPosition
)
1613 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1614 TRACE("(%p)->(%f)\n", This
, dCurrentPosition
);
1615 if (!This
->media_seeking
)
1618 Current
= 10000000 * dCurrentPosition
;
1619 hres
= IMediaSeeking_SetPositions(This
->media_seeking
, &Current
,
1620 AM_SEEKING_AbsolutePositioning
, NULL
, AM_SEEKING_NoPositioning
);
1625 static HRESULT WINAPI
WMPControls_get_currentPositionString(IWMPControls
*iface
, BSTR
*pbstrCurrentPosition
)
1627 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1628 FIXME("(%p)->(%p)\n", This
, pbstrCurrentPosition
);
1632 static HRESULT WINAPI
WMPControls_next(IWMPControls
*iface
)
1634 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1635 FIXME("(%p)\n", This
);
1639 static HRESULT WINAPI
WMPControls_previous(IWMPControls
*iface
)
1641 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1642 FIXME("(%p)\n", This
);
1646 static HRESULT WINAPI
WMPControls_get_currentItem(IWMPControls
*iface
, IWMPMedia
**ppIWMPMedia
)
1648 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1649 FIXME("(%p)->(%p)\n", This
, ppIWMPMedia
);
1653 static HRESULT WINAPI
WMPControls_put_currentItem(IWMPControls
*iface
, IWMPMedia
*pIWMPMedia
)
1655 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1656 FIXME("(%p)->(%p)\n", This
, pIWMPMedia
);
1660 static HRESULT WINAPI
WMPControls_get_currentMarker(IWMPControls
*iface
, LONG
*plMarker
)
1662 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1663 FIXME("(%p)->(%p)\n", This
, plMarker
);
1667 static HRESULT WINAPI
WMPControls_put_currentMarker(IWMPControls
*iface
, LONG lMarker
)
1669 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1670 FIXME("(%p)->(%d)\n", This
, lMarker
);
1674 static HRESULT WINAPI
WMPControls_playItem(IWMPControls
*iface
, IWMPMedia
*pIWMPMedia
)
1676 WindowsMediaPlayer
*This
= impl_from_IWMPControls(iface
);
1677 FIXME("(%p)->(%p)\n", This
, pIWMPMedia
);
1681 static const IWMPControlsVtbl WMPControlsVtbl
= {
1682 WMPControls_QueryInterface
,
1684 WMPControls_Release
,
1685 WMPControls_GetTypeInfoCount
,
1686 WMPControls_GetTypeInfo
,
1687 WMPControls_GetIDsOfNames
,
1689 WMPControls_get_isAvailable
,
1693 WMPControls_fastForward
,
1694 WMPControls_fastReverse
,
1695 WMPControls_get_currentPosition
,
1696 WMPControls_put_currentPosition
,
1697 WMPControls_get_currentPositionString
,
1699 WMPControls_previous
,
1700 WMPControls_get_currentItem
,
1701 WMPControls_put_currentItem
,
1702 WMPControls_get_currentMarker
,
1703 WMPControls_put_currentMarker
,
1704 WMPControls_playItem
,
1707 static HRESULT WINAPI
WMPMedia_QueryInterface(IWMPMedia
*iface
, REFIID riid
, void **ppv
)
1709 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1710 TRACE("(%p)\n", This
);
1711 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1712 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1713 *ppv
= &This
->IWMPMedia_iface
;
1714 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1715 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
1716 *ppv
= &This
->IWMPMedia_iface
;
1717 }else if(IsEqualGUID(&IID_IWMPMedia
, riid
)) {
1718 TRACE("(%p)->(IID_IWMPMedia %p)\n", This
, ppv
);
1719 *ppv
= &This
->IWMPMedia_iface
;
1721 WARN("Unsupported interface %s\n", debugstr_guid(riid
));
1723 return E_NOINTERFACE
;
1726 IUnknown_AddRef((IUnknown
*)*ppv
);
1730 static ULONG WINAPI
WMPMedia_AddRef(IWMPMedia
*iface
)
1732 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1733 LONG ref
= InterlockedIncrement(&This
->ref
);
1735 TRACE("(%p) ref=%d\n", This
, ref
);
1740 static ULONG WINAPI
WMPMedia_Release(IWMPMedia
*iface
)
1742 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1743 LONG ref
= InterlockedDecrement(&This
->ref
);
1745 TRACE("(%p) ref=%d\n", This
, ref
);
1748 heap_free(This
->url
);
1749 heap_free(This
->name
);
1756 static HRESULT WINAPI
WMPMedia_GetTypeInfoCount(IWMPMedia
*iface
, UINT
*pctinfo
)
1758 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1759 FIXME("(%p)->(%p)\n", This
, pctinfo
);
1763 static HRESULT WINAPI
WMPMedia_GetTypeInfo(IWMPMedia
*iface
, UINT iTInfo
,
1764 LCID lcid
, ITypeInfo
**ppTInfo
)
1766 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1767 FIXME("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1771 static HRESULT WINAPI
WMPMedia_GetIDsOfNames(IWMPMedia
*iface
, REFIID riid
,
1772 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1774 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1775 FIXME("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
1779 static HRESULT WINAPI
WMPMedia_Invoke(IWMPMedia
*iface
, DISPID dispIdMember
,
1780 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
1781 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1783 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1784 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
1785 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1789 static HRESULT WINAPI
WMPMedia_get_isIdentical(IWMPMedia
*iface
, IWMPMedia
*other
, VARIANT_BOOL
*pvBool
)
1791 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1792 FIXME("(%p)->(%p, %p)\n", This
, other
, pvBool
);
1796 static HRESULT WINAPI
WMPMedia_get_sourceURL(IWMPMedia
*iface
, BSTR
*url
)
1798 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1800 TRACE("(%p)->(%p)\n", This
, url
);
1802 return return_bstr(This
->url
, url
);
1805 static HRESULT WINAPI
WMPMedia_get_name(IWMPMedia
*iface
, BSTR
*name
)
1807 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1809 TRACE("(%p)->(%p)\n", This
, name
);
1811 return return_bstr(This
->name
, name
);
1814 static HRESULT WINAPI
WMPMedia_put_name(IWMPMedia
*iface
, BSTR name
)
1816 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1818 TRACE("(%p)->(%s)\n", This
, debugstr_w(name
));
1820 if (!name
) return E_POINTER
;
1822 heap_free(This
->name
);
1823 This
->name
= heap_strdupW(name
);
1827 static HRESULT WINAPI
WMPMedia_get_imageSourceWidth(IWMPMedia
*iface
, LONG
*pWidth
)
1829 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1830 FIXME("(%p)->(%p)\n", This
, pWidth
);
1834 static HRESULT WINAPI
WMPMedia_get_imageSourceHeight(IWMPMedia
*iface
, LONG
*pHeight
)
1836 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1837 FIXME("(%p)->(%p)\n", This
, pHeight
);
1841 static HRESULT WINAPI
WMPMedia_get_markerCount(IWMPMedia
*iface
, LONG
* pMarkerCount
)
1843 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1844 FIXME("(%p)->(%p)\n", This
, pMarkerCount
);
1848 static HRESULT WINAPI
WMPMedia_getMarkerTime(IWMPMedia
*iface
, LONG MarkerNum
, DOUBLE
*pMarkerTime
)
1850 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1851 FIXME("(%p)->(%d, %p)\n", This
, MarkerNum
, pMarkerTime
);
1855 static HRESULT WINAPI
WMPMedia_getMarkerName(IWMPMedia
*iface
, LONG MarkerNum
, BSTR
*pbstrMarkerName
)
1857 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1858 FIXME("(%p)->(%d, %p)\n", This
, MarkerNum
, pbstrMarkerName
);
1862 static HRESULT WINAPI
WMPMedia_get_duration(IWMPMedia
*iface
, DOUBLE
*pDuration
)
1864 /* MSDN: If this property is used with a media item other than the one
1865 * specified in Player.currentMedia, it may not contain a valid value. */
1866 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1867 TRACE("(%p)->(%p)\n", This
, pDuration
);
1868 *pDuration
= This
->duration
;
1872 static HRESULT WINAPI
WMPMedia_get_durationString(IWMPMedia
*iface
, BSTR
*pbstrDuration
)
1874 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1875 FIXME("(%p)->(%p)\n", This
, pbstrDuration
);
1879 static HRESULT WINAPI
WMPMedia_get_attributeCount(IWMPMedia
*iface
, LONG
*plCount
)
1881 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1882 FIXME("(%p)->(%p)\n", This
, plCount
);
1886 static HRESULT WINAPI
WMPMedia_getAttributeName(IWMPMedia
*iface
, LONG lIndex
, BSTR
*pbstrItemName
)
1888 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1889 FIXME("(%p)->(%d, %p)\n", This
, lIndex
, pbstrItemName
);
1893 static HRESULT WINAPI
WMPMedia_getItemInfo(IWMPMedia
*iface
, BSTR item_name
, BSTR
*value
)
1895 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1896 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(item_name
), value
);
1897 return return_bstr(NULL
, value
);
1900 static HRESULT WINAPI
WMPMedia_setItemInfo(IWMPMedia
*iface
, BSTR bstrItemName
, BSTR bstrVal
)
1902 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1903 FIXME("(%p)->(%s, %s)\n", This
, debugstr_w(bstrItemName
), debugstr_w(bstrVal
));
1907 static HRESULT WINAPI
WMPMedia_getItemInfoByAtom(IWMPMedia
*iface
, LONG lAtom
, BSTR
*pbstrVal
)
1909 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1910 FIXME("(%p)->(%d, %p)\n", This
, lAtom
, pbstrVal
);
1914 static HRESULT WINAPI
WMPMedia_isMemberOf(IWMPMedia
*iface
, IWMPPlaylist
*pPlaylist
, VARIANT_BOOL
*pvarfIsMemberOf
)
1916 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1917 FIXME("(%p)->(%p, %p)\n", This
, pPlaylist
, pvarfIsMemberOf
);
1921 static HRESULT WINAPI
WMPMedia_isReadOnlyItem(IWMPMedia
*iface
, BSTR bstrItemName
, VARIANT_BOOL
*pvarfIsReadOnly
)
1923 WMPMedia
*This
= impl_from_IWMPMedia(iface
);
1924 FIXME("(%p)->(%s, %p)\n", This
, debugstr_w(bstrItemName
), pvarfIsReadOnly
);
1928 static const IWMPMediaVtbl WMPMediaVtbl
= {
1929 WMPMedia_QueryInterface
,
1932 WMPMedia_GetTypeInfoCount
,
1933 WMPMedia_GetTypeInfo
,
1934 WMPMedia_GetIDsOfNames
,
1936 WMPMedia_get_isIdentical
,
1937 WMPMedia_get_sourceURL
,
1940 WMPMedia_get_imageSourceWidth
,
1941 WMPMedia_get_imageSourceHeight
,
1942 WMPMedia_get_markerCount
,
1943 WMPMedia_getMarkerTime
,
1944 WMPMedia_getMarkerName
,
1945 WMPMedia_get_duration
,
1946 WMPMedia_get_durationString
,
1947 WMPMedia_get_attributeCount
,
1948 WMPMedia_getAttributeName
,
1949 WMPMedia_getItemInfo
,
1950 WMPMedia_setItemInfo
,
1951 WMPMedia_getItemInfoByAtom
,
1952 WMPMedia_isMemberOf
,
1953 WMPMedia_isReadOnlyItem
1956 static HRESULT WINAPI
WMPPlaylist_QueryInterface(IWMPPlaylist
*iface
, REFIID riid
, void **ppv
)
1958 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
1959 TRACE("(%p)\n", This
);
1960 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1961 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1962 *ppv
= &This
->IWMPPlaylist_iface
;
1963 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1964 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
1965 *ppv
= &This
->IWMPPlaylist_iface
;
1966 }else if(IsEqualGUID(&IID_IWMPPlaylist
, riid
)) {
1967 TRACE("(%p)->(IID_IWMPPlaylist %p)\n", This
, ppv
);
1968 *ppv
= &This
->IWMPPlaylist_iface
;
1970 WARN("Unsupported interface %s\n", debugstr_guid(riid
));
1972 return E_NOINTERFACE
;
1975 IUnknown_AddRef((IUnknown
*)*ppv
);
1979 static ULONG WINAPI
WMPPlaylist_AddRef(IWMPPlaylist
*iface
)
1981 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
1982 LONG ref
= InterlockedIncrement(&This
->ref
);
1984 TRACE("(%p) ref=%d\n", This
, ref
);
1989 static ULONG WINAPI
WMPPlaylist_Release(IWMPPlaylist
*iface
)
1991 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
1992 LONG ref
= InterlockedDecrement(&This
->ref
);
1994 TRACE("(%p) ref=%d\n", This
, ref
);
1997 heap_free(This
->url
);
1998 heap_free(This
->name
);
2005 static HRESULT WINAPI
WMPPlaylist_GetTypeInfoCount(IWMPPlaylist
*iface
, UINT
*pctinfo
)
2007 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2008 FIXME("(%p)->(%p)\n", This
, pctinfo
);
2012 static HRESULT WINAPI
WMPPlaylist_GetTypeInfo(IWMPPlaylist
*iface
, UINT iTInfo
,
2013 LCID lcid
, ITypeInfo
**ppTInfo
)
2015 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2016 FIXME("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2020 static HRESULT WINAPI
WMPPlaylist_GetIDsOfNames(IWMPPlaylist
*iface
, REFIID riid
,
2021 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2023 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2024 FIXME("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
2028 static HRESULT WINAPI
WMPPlaylist_Invoke(IWMPPlaylist
*iface
, DISPID dispIdMember
,
2029 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
2030 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2032 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2033 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
2034 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2038 static HRESULT WINAPI
WMPPlaylist_get_count(IWMPPlaylist
*iface
, LONG
*count
)
2040 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2042 TRACE("(%p)->(%p)\n", This
, count
);
2044 if (!count
) return E_POINTER
;
2045 *count
= This
->count
;
2050 static HRESULT WINAPI
WMPPlaylist_get_name(IWMPPlaylist
*iface
, BSTR
*name
)
2052 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2054 TRACE("(%p)->(%p)\n", This
, name
);
2056 return return_bstr(This
->name
, name
);
2059 static HRESULT WINAPI
WMPPlaylist_put_name(IWMPPlaylist
*iface
, BSTR name
)
2061 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2063 TRACE("(%p)->(%s)\n", This
, debugstr_w(name
));
2065 if (!name
) return E_POINTER
;
2067 heap_free(This
->name
);
2068 This
->name
= heap_strdupW(name
);
2072 static HRESULT WINAPI
WMPPlaylist_get_attributeCount(IWMPPlaylist
*iface
, LONG
*count
)
2074 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2075 FIXME("(%p)->(%p)\n", This
, count
);
2079 static HRESULT WINAPI
WMPPlaylist_get_attributeName(IWMPPlaylist
*iface
, LONG index
, BSTR
*attribute_name
)
2081 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2082 FIXME("(%p)->(%d %p)\n", This
, index
, attribute_name
);
2086 static HRESULT WINAPI
WMPPlaylist_get_Item(IWMPPlaylist
*iface
, LONG index
, IWMPMedia
**media
)
2088 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2089 FIXME("(%p)->(%d %p)\n", This
, index
, media
);
2093 static HRESULT WINAPI
WMPPlaylist_getItemInfo(IWMPPlaylist
*iface
, BSTR name
, BSTR
*value
)
2095 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2096 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), value
);
2100 static HRESULT WINAPI
WMPPlaylist_setItemInfo(IWMPPlaylist
*iface
, BSTR name
, BSTR value
)
2102 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2103 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(name
), debugstr_w(value
));
2107 static HRESULT WINAPI
WMPPlaylist_get_isIdentical(IWMPPlaylist
*iface
, IWMPPlaylist
*playlist
, VARIANT_BOOL
*var
)
2109 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2110 FIXME("(%p)->(%p %p)\n", This
, playlist
, var
);
2114 static HRESULT WINAPI
WMPPlaylist_clear(IWMPPlaylist
*iface
)
2116 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2117 FIXME("(%p)\n", This
);
2121 static HRESULT WINAPI
WMPPlaylist_insertItem(IWMPPlaylist
*iface
, LONG index
, IWMPMedia
*media
)
2123 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2124 FIXME("(%p)->(%d %p)\n", This
, index
, media
);
2128 static HRESULT WINAPI
WMPPlaylist_appendItem(IWMPPlaylist
*iface
, IWMPMedia
*media
)
2130 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2131 FIXME("(%p)->(%p)\n", This
, media
);
2135 static HRESULT WINAPI
WMPPlaylist_removeItem(IWMPPlaylist
*iface
, IWMPMedia
*media
)
2137 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2138 FIXME("(%p)->(%p)\n", This
, media
);
2142 static HRESULT WINAPI
WMPPlaylist_moveItem(IWMPPlaylist
*iface
, LONG old_index
, LONG new_index
)
2144 WMPPlaylist
*This
= impl_from_IWMPPlaylist(iface
);
2145 FIXME("(%p)->(%d %d)\n", This
, old_index
, new_index
);
2149 static const IWMPPlaylistVtbl WMPPlaylistVtbl
= {
2150 WMPPlaylist_QueryInterface
,
2152 WMPPlaylist_Release
,
2153 WMPPlaylist_GetTypeInfoCount
,
2154 WMPPlaylist_GetTypeInfo
,
2155 WMPPlaylist_GetIDsOfNames
,
2157 WMPPlaylist_get_count
,
2158 WMPPlaylist_get_name
,
2159 WMPPlaylist_put_name
,
2160 WMPPlaylist_get_attributeCount
,
2161 WMPPlaylist_get_attributeName
,
2162 WMPPlaylist_get_Item
,
2163 WMPPlaylist_getItemInfo
,
2164 WMPPlaylist_setItemInfo
,
2165 WMPPlaylist_get_isIdentical
,
2167 WMPPlaylist_insertItem
,
2168 WMPPlaylist_appendItem
,
2169 WMPPlaylist_removeItem
,
2170 WMPPlaylist_moveItem
2173 static LRESULT WINAPI
player_wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
2175 if (msg
== WM_WMPEVENT
&& wParam
== 0) {
2176 WindowsMediaPlayer
*wmp
= (WindowsMediaPlayer
*)lParam
;
2180 if (wmp
->media_event
) {
2182 hr
= IMediaEvent_GetEvent(wmp
->media_event
, &event_code
, &p1
, &p2
, 0);
2183 if (SUCCEEDED(hr
)) {
2184 TRACE("got event_code = 0x%02x\n", event_code
);
2185 IMediaEvent_FreeEventParams(wmp
->media_event
, event_code
, p1
, p2
);
2186 /* For now we only handle EC_COMPLETE */
2187 if (event_code
== EC_COMPLETE
) {
2188 update_state(wmp
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsMediaEnded
);
2189 update_state(wmp
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsTransitioning
);
2190 update_state(wmp
, DISPID_WMPCOREEVENT_PLAYSTATECHANGE
, wmppsStopped
);
2193 } while (hr
== S_OK
);
2195 FIXME("Got event from quartz when interfaces are already released\n");
2198 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
2201 static BOOL WINAPI
register_player_msg_class(INIT_ONCE
*once
, void *param
, void **context
) {
2202 static WNDCLASSEXW wndclass
= {
2203 sizeof(wndclass
), CS_DBLCLKS
, player_wnd_proc
, 0, 0,
2204 NULL
, NULL
, NULL
, NULL
, NULL
,
2208 wndclass
.hInstance
= wmp_instance
;
2209 player_msg_class
= RegisterClassExW(&wndclass
);
2210 WM_WMPEVENT
= RegisterWindowMessageW(WMPmessageW
);
2214 void unregister_player_msg_class(void) {
2215 if(player_msg_class
)
2216 UnregisterClassW(MAKEINTRESOURCEW(player_msg_class
), wmp_instance
);
2219 BOOL
init_player(WindowsMediaPlayer
*wmp
)
2221 IWMPPlaylist
*playlist
;
2223 static const WCHAR nameW
[] = {'P','l','a','y','l','i','s','t','1',0};
2225 InitOnceExecuteOnce(&class_init_once
, register_player_msg_class
, NULL
, NULL
);
2226 wmp
->msg_window
= CreateWindowW( MAKEINTRESOURCEW(player_msg_class
), NULL
, 0, 0,
2227 0, 0, 0, HWND_MESSAGE
, 0, wmp_instance
, wmp
);
2228 if (!wmp
->msg_window
) {
2229 ERR("Failed to create message window, GetLastError: %d\n", GetLastError());
2233 ERR("Failed to register window message, GetLastError: %d\n", GetLastError());
2237 wmp
->IWMPPlayer4_iface
.lpVtbl
= &WMPPlayer4Vtbl
;
2238 wmp
->IWMPPlayer_iface
.lpVtbl
= &WMPPlayerVtbl
;
2239 wmp
->IWMPSettings_iface
.lpVtbl
= &WMPSettingsVtbl
;
2240 wmp
->IWMPControls_iface
.lpVtbl
= &WMPControlsVtbl
;
2241 wmp
->IWMPNetwork_iface
.lpVtbl
= &WMPNetworkVtbl
;
2243 name
= SysAllocString(nameW
);
2244 if (SUCCEEDED(create_playlist(name
, NULL
, 0, &playlist
)))
2245 wmp
->playlist
= unsafe_impl_from_IWMPPlaylist(playlist
);
2247 wmp
->playlist
= NULL
;
2248 SysFreeString(name
);
2250 wmp
->invoke_urls
= VARIANT_TRUE
;
2251 wmp
->auto_start
= VARIANT_TRUE
;
2256 void destroy_player(WindowsMediaPlayer
*wmp
)
2258 IWMPControls_stop(&wmp
->IWMPControls_iface
);
2260 IWMPMedia_Release(&wmp
->media
->IWMPMedia_iface
);
2262 IWMPPlaylist_Release(&wmp
->playlist
->IWMPPlaylist_iface
);
2263 DestroyWindow(wmp
->msg_window
);
2266 WMPMedia
*unsafe_impl_from_IWMPMedia(IWMPMedia
*iface
)
2268 if (iface
->lpVtbl
== &WMPMediaVtbl
) {
2269 return CONTAINING_RECORD(iface
, WMPMedia
, IWMPMedia_iface
);
2274 WMPPlaylist
*unsafe_impl_from_IWMPPlaylist(IWMPPlaylist
*iface
)
2276 if (iface
->lpVtbl
== &WMPPlaylistVtbl
) {
2277 return CONTAINING_RECORD(iface
, WMPPlaylist
, IWMPPlaylist_iface
);
2282 HRESULT
create_media_from_url(BSTR url
, double duration
, IWMPMedia
**ppMedia
)
2288 WCHAR
*name_dup
, slashW
[] = {'/',0};
2290 media
= heap_alloc_zero(sizeof(*media
));
2292 return E_OUTOFMEMORY
;
2294 media
->IWMPMedia_iface
.lpVtbl
= &WMPMediaVtbl
;
2298 media
->url
= heap_strdupW(url
);
2299 name_dup
= heap_strdupW(url
);
2301 hr
= CreateUri(name_dup
, Uri_CREATE_ALLOW_RELATIVE
| Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, 0, &uri
);
2304 heap_free(name_dup
);
2305 IWMPMedia_Release(&media
->IWMPMedia_iface
);
2308 hr
= IUri_GetPath(uri
, &path
);
2311 heap_free(name_dup
);
2313 IWMPMedia_Release(&media
->IWMPMedia_iface
);
2317 /* GetPath() will return "/" for invalid uri's
2318 * only strip extension when uri is valid
2320 if (wcscmp(path
, slashW
) != 0)
2321 PathRemoveExtensionW(name_dup
);
2322 PathStripPathW(name_dup
);
2324 media
->name
= name_dup
;
2326 SysFreeString(path
);
2331 media
->url
= heap_strdupW(emptyW
);
2332 media
->name
= heap_strdupW(emptyW
);
2335 media
->duration
= duration
;
2339 *ppMedia
= &media
->IWMPMedia_iface
;
2343 IWMPMedia_Release(&media
->IWMPMedia_iface
);
2344 return E_OUTOFMEMORY
;
2347 HRESULT
create_playlist(BSTR name
, BSTR url
, LONG count
, IWMPPlaylist
**ppPlaylist
)
2349 WMPPlaylist
*playlist
;
2351 playlist
= heap_alloc_zero(sizeof(*playlist
));
2353 return E_OUTOFMEMORY
;
2355 playlist
->IWMPPlaylist_iface
.lpVtbl
= &WMPPlaylistVtbl
;
2356 playlist
->url
= url
? heap_strdupW(url
) : heap_strdupW(emptyW
);
2357 playlist
->name
= name
? heap_strdupW(name
) : heap_strdupW(emptyW
);
2359 playlist
->count
= count
;
2363 *ppPlaylist
= &playlist
->IWMPPlaylist_iface
;
2367 IWMPPlaylist_Release(&playlist
->IWMPPlaylist_iface
);
2368 return E_OUTOFMEMORY
;