gdi32: Fix leak in GdiDeleteSpoolFileHandle.
[wine.git] / dlls / wmp / player.c
blob583f584790719b3dcf0bf807a8ed9962b1fa064d
1 /*
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"
22 #include <nserror.h>
23 #include "wmpids.h"
24 #include "shlwapi.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;
32 static void update_state(WindowsMediaPlayer *wmp, LONG type, LONG state)
34 DISPPARAMS dispparams;
35 VARIANTARG params[1];
37 dispparams.cArgs = 1;
38 dispparams.cNamedArgs = 0;
39 dispparams.rgdispidNamedArgs = NULL;
40 dispparams.rgvarg = params;
42 V_VT(params) = VT_UI4;
43 V_UI4(params) = state;
45 call_sink(wmp->wmpocx, type, &dispparams);
48 static inline WMPPlaylist *impl_from_IWMPPlaylist(IWMPPlaylist *iface)
50 return CONTAINING_RECORD(iface, WMPPlaylist, IWMPPlaylist_iface);
53 static inline WMPMedia *impl_from_IWMPMedia(IWMPMedia *iface)
55 return CONTAINING_RECORD(iface, WMPMedia, IWMPMedia_iface);
58 static inline WindowsMediaPlayer *impl_from_IWMPNetwork(IWMPNetwork *iface)
60 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPNetwork_iface);
63 static inline WindowsMediaPlayer *impl_from_IWMPPlayer4(IWMPPlayer4 *iface)
65 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPPlayer4_iface);
68 static inline WindowsMediaPlayer *impl_from_IWMPPlayer(IWMPPlayer *iface)
70 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPPlayer_iface);
73 static inline WindowsMediaPlayer *impl_from_IWMPControls(IWMPControls *iface)
75 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPControls_iface);
78 static HRESULT WINAPI WMPPlayer4_QueryInterface(IWMPPlayer4 *iface, REFIID riid, void **ppv)
80 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
81 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
84 static ULONG WINAPI WMPPlayer4_AddRef(IWMPPlayer4 *iface)
86 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
87 return IOleObject_AddRef(&This->IOleObject_iface);
90 static ULONG WINAPI WMPPlayer4_Release(IWMPPlayer4 *iface)
92 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
93 return IOleObject_Release(&This->IOleObject_iface);
96 static HRESULT WINAPI WMPPlayer4_GetTypeInfoCount(IWMPPlayer4 *iface, UINT *pctinfo)
98 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
99 FIXME("(%p)->(%p)\n", This, pctinfo);
100 return E_NOTIMPL;
103 static HRESULT WINAPI WMPPlayer4_GetTypeInfo(IWMPPlayer4 *iface, UINT iTInfo,
104 LCID lcid, ITypeInfo **ppTInfo)
106 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
107 FIXME("(%p)->(%u %ld %p)\n", This, iTInfo, lcid, ppTInfo);
108 return E_NOTIMPL;
111 static HRESULT WINAPI WMPPlayer4_GetIDsOfNames(IWMPPlayer4 *iface, REFIID riid,
112 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
114 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
115 FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
116 return E_NOTIMPL;
119 static HRESULT WINAPI WMPPlayer4_Invoke(IWMPPlayer4 *iface, DISPID dispIdMember,
120 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
121 EXCEPINFO *pExcepInfo, UINT *puArgErr)
123 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
124 FIXME("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
125 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
126 return E_NOTIMPL;
129 static HRESULT WINAPI WMPPlayer4_close(IWMPPlayer4 *iface)
131 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
132 FIXME("(%p)\n", This);
133 return E_NOTIMPL;
136 static HRESULT WINAPI WMPPlayer4_get_URL(IWMPPlayer4 *iface, BSTR *url)
138 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
140 TRACE("(%p)->(%p)\n", This, url);
142 if (!This->media)
143 return return_bstr(L"", url);
145 return return_bstr(This->media->url, url);
148 static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url)
150 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
151 IWMPMedia *media;
152 HRESULT hres;
154 TRACE("(%p)->(%s)\n", This, debugstr_w(url));
156 hres = create_media_from_url(url, 0.0, &media);
158 if (SUCCEEDED(hres)) {
159 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
160 hres = IWMPPlayer4_put_currentMedia(iface, media);
161 IWMPMedia_Release(media); /* put will addref */
163 if (SUCCEEDED(hres)) {
164 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsReady);
165 if (This->auto_start == VARIANT_TRUE)
166 IWMPControls_play(&This->IWMPControls_iface);
169 return hres;
172 static HRESULT WINAPI WMPPlayer4_get_openState(IWMPPlayer4 *iface, WMPOpenState *pwmpos)
174 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
175 FIXME("(%p)->(%p)\n", This, pwmpos);
176 return E_NOTIMPL;
179 static HRESULT WINAPI WMPPlayer4_get_playState(IWMPPlayer4 *iface, WMPPlayState *pwmpps)
181 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
182 FIXME("(%p)->(%p)\n", This, pwmpps);
183 return E_NOTIMPL;
186 static HRESULT WINAPI WMPPlayer4_get_controls(IWMPPlayer4 *iface, IWMPControls **ppControl)
188 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
190 TRACE("(%p)->(%p)\n", This, ppControl);
192 IWMPControls_AddRef(&This->IWMPControls_iface);
193 *ppControl = &This->IWMPControls_iface;
194 return S_OK;
197 static HRESULT WINAPI WMPPlayer4_get_settings(IWMPPlayer4 *iface, IWMPSettings **ppSettings)
199 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
201 TRACE("(%p)->(%p)\n", This, ppSettings);
203 IWMPSettings_AddRef(&This->IWMPSettings_iface);
204 *ppSettings = &This->IWMPSettings_iface;
205 return S_OK;
208 static HRESULT WINAPI WMPPlayer4_get_currentMedia(IWMPPlayer4 *iface, IWMPMedia **media)
210 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
212 TRACE("(%p)->(%p)\n", This, media);
214 *media = NULL;
216 if (This->media == NULL)
217 return S_FALSE;
219 return create_media_from_url(This->media->url, This->media->duration, media);
222 static HRESULT WINAPI WMPPlayer4_put_currentMedia(IWMPPlayer4 *iface, IWMPMedia *pMedia)
224 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
225 TRACE("(%p)->(%p)\n", This, pMedia);
227 if(pMedia == NULL) {
228 return E_POINTER;
230 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistChanging);
231 if(This->media != NULL) {
232 IWMPControls_stop(&This->IWMPControls_iface);
233 IWMPMedia_Release(&This->media->IWMPMedia_iface);
235 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistChanged);
236 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistOpenNoMedia);
238 IWMPMedia_AddRef(pMedia);
239 This->media = unsafe_impl_from_IWMPMedia(pMedia);
240 return S_OK;
243 static HRESULT WINAPI WMPPlayer4_get_mediaCollection(IWMPPlayer4 *iface, IWMPMediaCollection **ppMediaCollection)
245 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
246 FIXME("(%p)->(%p)\n", This, ppMediaCollection);
247 return E_NOTIMPL;
250 static HRESULT WINAPI WMPPlayer4_get_playlistCollection(IWMPPlayer4 *iface, IWMPPlaylistCollection **ppPlaylistCollection)
252 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
253 FIXME("(%p)->(%p)\n", This, ppPlaylistCollection);
254 return E_NOTIMPL;
257 static HRESULT WINAPI WMPPlayer4_get_versionInfo(IWMPPlayer4 *iface, BSTR *version)
259 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
261 TRACE("(%p)->(%p)\n", This, version);
263 if (!version)
264 return E_POINTER;
266 return return_bstr(L"12.0.7601.16982", version);
269 static HRESULT WINAPI WMPPlayer4_launchURL(IWMPPlayer4 *iface, BSTR url)
271 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
272 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
273 return E_NOTIMPL;
276 static HRESULT WINAPI WMPPlayer4_get_network(IWMPPlayer4 *iface, IWMPNetwork **ppQNI)
278 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
279 TRACE("(%p)->(%p)\n", This, ppQNI);
281 IWMPNetwork_AddRef(&This->IWMPNetwork_iface);
282 *ppQNI = &This->IWMPNetwork_iface;
283 return S_OK;
286 static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist **playlist)
288 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
290 TRACE("(%p)->(%p)\n", This, playlist);
292 *playlist = NULL;
294 if (This->playlist == NULL)
295 return S_FALSE;
297 return create_playlist(This->playlist->name, This->playlist->url, This->playlist->count, playlist);
300 static HRESULT WINAPI WMPPlayer4_put_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist *pPL)
302 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
303 FIXME("(%p)->(%p)\n", This, pPL);
304 return E_NOTIMPL;
307 static HRESULT WINAPI WMPPlayer4_get_cdromCollection(IWMPPlayer4 *iface, IWMPCdromCollection **ppCdromCollection)
309 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
310 FIXME("(%p)->(%p)\n", This, ppCdromCollection);
311 return E_NOTIMPL;
314 static HRESULT WINAPI WMPPlayer4_get_closedCaption(IWMPPlayer4 *iface, IWMPClosedCaption **ppClosedCaption)
316 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
317 FIXME("(%p)->(%p)\n", This, ppClosedCaption);
318 return E_NOTIMPL;
321 static HRESULT WINAPI WMPPlayer4_get_isOnline(IWMPPlayer4 *iface, VARIANT_BOOL *pfOnline)
323 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
324 FIXME("(%p)->(%p)\n", This, pfOnline);
325 return E_NOTIMPL;
328 static HRESULT WINAPI WMPPlayer4_get_Error(IWMPPlayer4 *iface, IWMPError **ppError)
330 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
331 FIXME("(%p)->(%p)\n", This, ppError);
332 return E_NOTIMPL;
335 static HRESULT WINAPI WMPPlayer4_get_Status(IWMPPlayer4 *iface, BSTR *pbstrStatus)
337 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
338 FIXME("(%p)->(%p)\n", This, pbstrStatus);
339 return E_NOTIMPL;
342 static HRESULT WINAPI WMPPlayer4_get_dvd(IWMPPlayer4 *iface, IWMPDVD **ppDVD)
344 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
345 FIXME("(%p)->(%p)\n", This, ppDVD);
346 return E_NOTIMPL;
349 static HRESULT WINAPI WMPPlayer4_newPlaylist(IWMPPlayer4 *iface, BSTR name, BSTR url, IWMPPlaylist **playlist)
351 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
353 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(name), debugstr_w(url), playlist);
355 /* FIXME: count should be the number of items in the playlist */
356 return create_playlist(name, url, 0, playlist);
359 static HRESULT WINAPI WMPPlayer4_newMedia(IWMPPlayer4 *iface, BSTR url, IWMPMedia **media)
361 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
363 TRACE("(%p)->(%s %p)\n", This, debugstr_w(url), media);
365 return create_media_from_url(url, 0.0, media);
368 static HRESULT WINAPI WMPPlayer4_get_enabled(IWMPPlayer4 *iface, VARIANT_BOOL *pbEnabled)
370 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
371 FIXME("(%p)->(%p)\n", This, pbEnabled);
372 return E_NOTIMPL;
375 static HRESULT WINAPI WMPPlayer4_put_enabled(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
377 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
378 FIXME("(%p)->(%x)\n", This, enabled);
379 return E_NOTIMPL;
382 static HRESULT WINAPI WMPPlayer4_get_fullScreen(IWMPPlayer4 *iface, VARIANT_BOOL *pbFullScreen)
384 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
385 FIXME("(%p)->(%p)\n", This, pbFullScreen);
386 return E_NOTIMPL;
389 static HRESULT WINAPI WMPPlayer4_put_fullScreen(IWMPPlayer4 *iface, VARIANT_BOOL fullscreen)
391 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
392 FIXME("(%p)->(%x)\n", This, fullscreen);
393 return E_NOTIMPL;
396 static HRESULT WINAPI WMPPlayer4_get_enableContextMenu(IWMPPlayer4 *iface, VARIANT_BOOL *pbEnableContextMenu)
398 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
399 FIXME("(%p)->(%p)\n", This, pbEnableContextMenu);
400 return E_NOTIMPL;
403 static HRESULT WINAPI WMPPlayer4_put_enableContextMenu(IWMPPlayer4 *iface, VARIANT_BOOL enable)
405 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
406 FIXME("(%p)->(%x)\n", This, enable);
407 return E_NOTIMPL;
410 static HRESULT WINAPI WMPPlayer4_put_uiMode(IWMPPlayer4 *iface, BSTR mode)
412 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
413 FIXME("(%p)->(%s)\n", This, debugstr_w(mode));
414 return E_NOTIMPL;
417 static HRESULT WINAPI WMPPlayer4_get_uiMode(IWMPPlayer4 *iface, BSTR *pbstrMode)
419 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
420 FIXME("(%p)->(%p)\n", This, pbstrMode);
421 return E_NOTIMPL;
424 static HRESULT WINAPI WMPPlayer4_get_stretchToFit(IWMPPlayer4 *iface, VARIANT_BOOL *enabled)
426 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
427 FIXME("(%p)->(%p)\n", This, enabled);
428 return E_NOTIMPL;
431 static HRESULT WINAPI WMPPlayer4_put_stretchToFit(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
433 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
434 FIXME("(%p)->(%x)\n", This, enabled);
435 return E_NOTIMPL;
438 static HRESULT WINAPI WMPPlayer4_get_windowlessVideo(IWMPPlayer4 *iface, VARIANT_BOOL *enabled)
440 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
441 FIXME("(%p)->(%p)\n", This, enabled);
442 return E_NOTIMPL;
445 static HRESULT WINAPI WMPPlayer4_put_windowlessVideo(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
447 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
448 FIXME("(%p)->(%x)\n", This, enabled);
449 return E_NOTIMPL;
452 static HRESULT WINAPI WMPPlayer4_get_isRemote(IWMPPlayer4 *iface, VARIANT_BOOL *pvarfIsRemote)
454 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
455 FIXME("(%p)->(%p)\n", This, pvarfIsRemote);
456 return E_NOTIMPL;
459 static HRESULT WINAPI WMPPlayer4_get_playerApplication(IWMPPlayer4 *iface, IWMPPlayerApplication **ppIWMPPlayerApplication)
461 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
462 FIXME("(%p)->(%p)\n", This, ppIWMPPlayerApplication);
463 return E_NOTIMPL;
466 static HRESULT WINAPI WMPPlayer4_openPlayer(IWMPPlayer4 *iface, BSTR url)
468 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
469 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
470 return E_NOTIMPL;
473 static HRESULT WINAPI WMPPlayer_QueryInterface(IWMPPlayer *iface, REFIID riid, void **ppv)
475 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
476 return WMPPlayer4_QueryInterface(&This->IWMPPlayer4_iface, riid, ppv);
479 static ULONG WINAPI WMPPlayer_AddRef(IWMPPlayer *iface)
481 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
482 return WMPPlayer4_AddRef(&This->IWMPPlayer4_iface);
485 static ULONG WINAPI WMPPlayer_Release(IWMPPlayer *iface)
487 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
488 return WMPPlayer4_Release(&This->IWMPPlayer4_iface);
491 static HRESULT WINAPI WMPPlayer_GetTypeInfoCount(IWMPPlayer *iface, UINT *pctinfo)
493 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
494 return WMPPlayer4_GetTypeInfoCount(&This->IWMPPlayer4_iface, pctinfo);
497 static HRESULT WINAPI WMPPlayer_GetTypeInfo(IWMPPlayer *iface, UINT iTInfo,
498 LCID lcid, ITypeInfo **ppTInfo)
500 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
502 return WMPPlayer4_GetTypeInfo(&This->IWMPPlayer4_iface, iTInfo,
503 lcid, ppTInfo);
506 static HRESULT WINAPI WMPPlayer_GetIDsOfNames(IWMPPlayer *iface, REFIID riid,
507 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
509 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
510 return WMPPlayer4_GetIDsOfNames(&This->IWMPPlayer4_iface, riid,
511 rgszNames, cNames, lcid, rgDispId);
514 static HRESULT WINAPI WMPPlayer_Invoke(IWMPPlayer *iface, DISPID dispIdMember,
515 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
516 EXCEPINFO *pExcepInfo, UINT *puArgErr)
518 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
519 return WMPPlayer4_Invoke(&This->IWMPPlayer4_iface, dispIdMember,
520 riid, lcid, wFlags, pDispParams, pVarResult,
521 pExcepInfo, puArgErr);
524 static HRESULT WINAPI WMPPlayer_close(IWMPPlayer *iface)
526 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
527 return WMPPlayer4_close(&This->IWMPPlayer4_iface);
530 static HRESULT WINAPI WMPPlayer_get_URL(IWMPPlayer *iface, BSTR *pbstrURL)
532 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
533 return WMPPlayer4_get_URL(&This->IWMPPlayer4_iface, pbstrURL);
536 static HRESULT WINAPI WMPPlayer_put_URL(IWMPPlayer *iface, BSTR url)
538 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
539 return WMPPlayer4_put_URL(&This->IWMPPlayer4_iface, url);
542 static HRESULT WINAPI WMPPlayer_get_openState(IWMPPlayer *iface, WMPOpenState *pwmpos)
544 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
545 return WMPPlayer4_get_openState(&This->IWMPPlayer4_iface, pwmpos);
548 static HRESULT WINAPI WMPPlayer_get_playState(IWMPPlayer *iface, WMPPlayState *pwmpps)
550 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
551 return WMPPlayer4_get_playState(&This->IWMPPlayer4_iface, pwmpps);
554 static HRESULT WINAPI WMPPlayer_get_controls(IWMPPlayer *iface, IWMPControls **ppControl)
556 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
557 return WMPPlayer4_get_controls(&This->IWMPPlayer4_iface, ppControl);
560 static HRESULT WINAPI WMPPlayer_get_settings(IWMPPlayer *iface, IWMPSettings **ppSettings)
562 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
563 return WMPPlayer4_get_settings(&This->IWMPPlayer4_iface, ppSettings);
566 static HRESULT WINAPI WMPPlayer_get_currentMedia(IWMPPlayer *iface, IWMPMedia **ppMedia)
568 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
569 return WMPPlayer4_get_currentMedia(&This->IWMPPlayer4_iface, ppMedia);
572 static HRESULT WINAPI WMPPlayer_put_currentMedia(IWMPPlayer *iface, IWMPMedia *pMedia)
574 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
575 return WMPPlayer4_put_currentMedia(&This->IWMPPlayer4_iface, pMedia);
578 static HRESULT WINAPI WMPPlayer_get_mediaCollection(IWMPPlayer *iface, IWMPMediaCollection **ppMediaCollection)
580 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
581 return WMPPlayer4_get_mediaCollection(&This->IWMPPlayer4_iface, ppMediaCollection);
584 static HRESULT WINAPI WMPPlayer_get_playlistCollection(IWMPPlayer *iface, IWMPPlaylistCollection **ppPlaylistCollection)
586 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
587 return WMPPlayer4_get_playlistCollection(&This->IWMPPlayer4_iface, ppPlaylistCollection);
590 static HRESULT WINAPI WMPPlayer_get_versionInfo(IWMPPlayer *iface, BSTR *version)
592 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
593 return WMPPlayer4_get_versionInfo(&This->IWMPPlayer4_iface, version);
596 static HRESULT WINAPI WMPPlayer_launchURL(IWMPPlayer *iface, BSTR url)
598 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
599 return WMPPlayer4_launchURL(&This->IWMPPlayer4_iface, url);
602 static HRESULT WINAPI WMPPlayer_get_network(IWMPPlayer *iface, IWMPNetwork **ppQNI)
604 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
605 return WMPPlayer4_get_network(&This->IWMPPlayer4_iface, ppQNI);
608 static HRESULT WINAPI WMPPlayer_get_currentPlaylist(IWMPPlayer *iface, IWMPPlaylist **ppPL)
610 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
611 return WMPPlayer4_get_currentPlaylist(&This->IWMPPlayer4_iface, ppPL);
614 static HRESULT WINAPI WMPPlayer_put_currentPlaylist(IWMPPlayer *iface, IWMPPlaylist *pPL)
616 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
617 return WMPPlayer4_put_currentPlaylist(&This->IWMPPlayer4_iface, pPL);
620 static HRESULT WINAPI WMPPlayer_get_cdromCollection(IWMPPlayer *iface, IWMPCdromCollection **ppCdromCollection)
622 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
623 return WMPPlayer4_get_cdromCollection(&This->IWMPPlayer4_iface, ppCdromCollection);
626 static HRESULT WINAPI WMPPlayer_get_closedCaption(IWMPPlayer *iface, IWMPClosedCaption **ppClosedCaption)
628 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
629 return WMPPlayer4_get_closedCaption(&This->IWMPPlayer4_iface, ppClosedCaption);
632 static HRESULT WINAPI WMPPlayer_get_isOnline(IWMPPlayer *iface, VARIANT_BOOL *pfOnline)
634 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
635 return WMPPlayer4_get_isOnline(&This->IWMPPlayer4_iface, pfOnline);
638 static HRESULT WINAPI WMPPlayer_get_Error(IWMPPlayer *iface, IWMPError **ppError)
640 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
641 return WMPPlayer4_get_Error(&This->IWMPPlayer4_iface, ppError);
644 static HRESULT WINAPI WMPPlayer_get_Status(IWMPPlayer *iface, BSTR *pbstrStatus)
646 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
647 return WMPPlayer4_get_Status(&This->IWMPPlayer4_iface, pbstrStatus);
650 static HRESULT WINAPI WMPPlayer_get_enabled(IWMPPlayer *iface, VARIANT_BOOL *pbEnabled)
652 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
653 return WMPPlayer4_get_enabled(&This->IWMPPlayer4_iface, pbEnabled);
656 static HRESULT WINAPI WMPPlayer_put_enabled(IWMPPlayer *iface, VARIANT_BOOL enabled)
658 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
659 return WMPPlayer4_put_enabled(&This->IWMPPlayer4_iface, enabled);
662 static HRESULT WINAPI WMPPlayer_get_fullScreen(IWMPPlayer *iface, VARIANT_BOOL *pbFullScreen)
664 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
665 return WMPPlayer4_get_fullScreen(&This->IWMPPlayer4_iface, pbFullScreen);
668 static HRESULT WINAPI WMPPlayer_put_fullScreen(IWMPPlayer *iface, VARIANT_BOOL fullscreen)
670 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
671 return WMPPlayer4_put_fullScreen(&This->IWMPPlayer4_iface, fullscreen);
674 static HRESULT WINAPI WMPPlayer_get_enableContextMenu(IWMPPlayer *iface, VARIANT_BOOL *pbEnableContextMenu)
676 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
677 return WMPPlayer4_get_enableContextMenu(&This->IWMPPlayer4_iface, pbEnableContextMenu);
680 static HRESULT WINAPI WMPPlayer_put_enableContextMenu(IWMPPlayer *iface, VARIANT_BOOL enable)
682 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
683 return WMPPlayer4_put_enableContextMenu(&This->IWMPPlayer4_iface, enable);
686 static HRESULT WINAPI WMPPlayer_put_uiMode(IWMPPlayer *iface, BSTR mode)
688 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
689 return WMPPlayer4_put_uiMode(&This->IWMPPlayer4_iface, mode);
692 static HRESULT WINAPI WMPPlayer_get_uiMode(IWMPPlayer *iface, BSTR *pbstrMode)
694 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
695 return WMPPlayer4_get_uiMode(&This->IWMPPlayer4_iface, pbstrMode);
698 static IWMPPlayerVtbl WMPPlayerVtbl = {
699 WMPPlayer_QueryInterface,
700 WMPPlayer_AddRef,
701 WMPPlayer_Release,
702 WMPPlayer_GetTypeInfoCount,
703 WMPPlayer_GetTypeInfo,
704 WMPPlayer_GetIDsOfNames,
705 WMPPlayer_Invoke,
706 WMPPlayer_close,
707 WMPPlayer_get_URL,
708 WMPPlayer_put_URL,
709 WMPPlayer_get_openState,
710 WMPPlayer_get_playState,
711 WMPPlayer_get_controls,
712 WMPPlayer_get_settings,
713 WMPPlayer_get_currentMedia,
714 WMPPlayer_put_currentMedia,
715 WMPPlayer_get_mediaCollection,
716 WMPPlayer_get_playlistCollection,
717 WMPPlayer_get_versionInfo,
718 WMPPlayer_launchURL,
719 WMPPlayer_get_network,
720 WMPPlayer_get_currentPlaylist,
721 WMPPlayer_put_currentPlaylist,
722 WMPPlayer_get_cdromCollection,
723 WMPPlayer_get_closedCaption,
724 WMPPlayer_get_isOnline,
725 WMPPlayer_get_Error,
726 WMPPlayer_get_Status,
727 WMPPlayer_get_enabled,
728 WMPPlayer_put_enabled,
729 WMPPlayer_get_fullScreen,
730 WMPPlayer_put_fullScreen,
731 WMPPlayer_get_enableContextMenu,
732 WMPPlayer_put_enableContextMenu,
733 WMPPlayer_put_uiMode,
734 WMPPlayer_get_uiMode,
738 static IWMPPlayer4Vtbl WMPPlayer4Vtbl = {
739 WMPPlayer4_QueryInterface,
740 WMPPlayer4_AddRef,
741 WMPPlayer4_Release,
742 WMPPlayer4_GetTypeInfoCount,
743 WMPPlayer4_GetTypeInfo,
744 WMPPlayer4_GetIDsOfNames,
745 WMPPlayer4_Invoke,
746 WMPPlayer4_close,
747 WMPPlayer4_get_URL,
748 WMPPlayer4_put_URL,
749 WMPPlayer4_get_openState,
750 WMPPlayer4_get_playState,
751 WMPPlayer4_get_controls,
752 WMPPlayer4_get_settings,
753 WMPPlayer4_get_currentMedia,
754 WMPPlayer4_put_currentMedia,
755 WMPPlayer4_get_mediaCollection,
756 WMPPlayer4_get_playlistCollection,
757 WMPPlayer4_get_versionInfo,
758 WMPPlayer4_launchURL,
759 WMPPlayer4_get_network,
760 WMPPlayer4_get_currentPlaylist,
761 WMPPlayer4_put_currentPlaylist,
762 WMPPlayer4_get_cdromCollection,
763 WMPPlayer4_get_closedCaption,
764 WMPPlayer4_get_isOnline,
765 WMPPlayer4_get_Error,
766 WMPPlayer4_get_Status,
767 WMPPlayer4_get_dvd,
768 WMPPlayer4_newPlaylist,
769 WMPPlayer4_newMedia,
770 WMPPlayer4_get_enabled,
771 WMPPlayer4_put_enabled,
772 WMPPlayer4_get_fullScreen,
773 WMPPlayer4_put_fullScreen,
774 WMPPlayer4_get_enableContextMenu,
775 WMPPlayer4_put_enableContextMenu,
776 WMPPlayer4_put_uiMode,
777 WMPPlayer4_get_uiMode,
778 WMPPlayer4_get_stretchToFit,
779 WMPPlayer4_put_stretchToFit,
780 WMPPlayer4_get_windowlessVideo,
781 WMPPlayer4_put_windowlessVideo,
782 WMPPlayer4_get_isRemote,
783 WMPPlayer4_get_playerApplication,
784 WMPPlayer4_openPlayer
787 static inline WindowsMediaPlayer *impl_from_IWMPSettings(IWMPSettings *iface)
789 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPSettings_iface);
792 static HRESULT WINAPI WMPSettings_QueryInterface(IWMPSettings *iface, REFIID riid, void **ppv)
794 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
795 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
798 static ULONG WINAPI WMPSettings_AddRef(IWMPSettings *iface)
800 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
801 return IOleObject_AddRef(&This->IOleObject_iface);
804 static ULONG WINAPI WMPSettings_Release(IWMPSettings *iface)
806 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
807 return IOleObject_Release(&This->IOleObject_iface);
810 static HRESULT WINAPI WMPSettings_GetTypeInfoCount(IWMPSettings *iface, UINT *pctinfo)
812 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
813 FIXME("(%p)->(%p)\n", This, pctinfo);
814 return E_NOTIMPL;
817 static HRESULT WINAPI WMPSettings_GetTypeInfo(IWMPSettings *iface, UINT iTInfo,
818 LCID lcid, ITypeInfo **ppTInfo)
820 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
821 FIXME("(%p)->(%u %ld %p)\n", This, iTInfo, lcid, ppTInfo);
822 return E_NOTIMPL;
825 static HRESULT WINAPI WMPSettings_GetIDsOfNames(IWMPSettings *iface, REFIID riid,
826 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
828 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
829 FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
830 return E_NOTIMPL;
833 static HRESULT WINAPI WMPSettings_Invoke(IWMPSettings *iface, DISPID dispIdMember,
834 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
835 EXCEPINFO *pExcepInfo, UINT *puArgErr)
837 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
838 FIXME("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
839 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
840 return E_NOTIMPL;
843 static HRESULT WINAPI WMPSettings_get_isAvailable(IWMPSettings *iface, BSTR item, VARIANT_BOOL *p)
845 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
846 FIXME("(%p)->(%s %p)\n", This, debugstr_w(item), p);
847 return E_NOTIMPL;
850 static HRESULT WINAPI WMPSettings_get_autoStart(IWMPSettings *iface, VARIANT_BOOL *p)
852 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
853 TRACE("(%p)->(%p)\n", This, p);
854 if (!p)
855 return E_POINTER;
856 *p = This->auto_start;
857 return S_OK;
860 static HRESULT WINAPI WMPSettings_put_autoStart(IWMPSettings *iface, VARIANT_BOOL v)
862 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
863 TRACE("(%p)->(%x)\n", This, v);
864 This->auto_start = v;
865 return S_OK;
868 static HRESULT WINAPI WMPSettings_get_baseURL(IWMPSettings *iface, BSTR *p)
870 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
871 FIXME("(%p)->(%p)\n", This, p);
872 return E_NOTIMPL;
875 static HRESULT WINAPI WMPSettings_put_baseURL(IWMPSettings *iface, BSTR v)
877 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
878 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
879 return E_NOTIMPL;
882 static HRESULT WINAPI WMPSettings_get_defaultFrame(IWMPSettings *iface, BSTR *p)
884 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
885 FIXME("(%p)->(%p)\n", This, p);
886 return E_NOTIMPL;
889 static HRESULT WINAPI WMPSettings_put_defaultFrame(IWMPSettings *iface, BSTR v)
891 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
892 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
893 return E_NOTIMPL;
896 static HRESULT WINAPI WMPSettings_get_invokeURLs(IWMPSettings *iface, VARIANT_BOOL *p)
898 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
900 TRACE("(%p)->(%p)\n", This, p);
902 if (!p)
903 return E_POINTER;
904 *p = This->invoke_urls;
905 return S_OK;
908 static HRESULT WINAPI WMPSettings_put_invokeURLs(IWMPSettings *iface, VARIANT_BOOL v)
910 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
911 /* Leaving as FIXME as we don't currently use this */
912 FIXME("(%p)->(%x)\n", This, v);
913 This->invoke_urls = v;
914 return S_OK;
917 static HRESULT WINAPI WMPSettings_get_mute(IWMPSettings *iface, VARIANT_BOOL *p)
919 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
920 FIXME("(%p)->(%p)\n", This, p);
921 return E_NOTIMPL;
924 static HRESULT WINAPI WMPSettings_put_mute(IWMPSettings *iface, VARIANT_BOOL v)
926 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
927 FIXME("(%p)->(%x)\n", This, v);
928 return E_NOTIMPL;
931 static HRESULT WINAPI WMPSettings_get_playCount(IWMPSettings *iface, LONG *p)
933 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
934 FIXME("(%p)->(%p)\n", This, p);
935 return E_NOTIMPL;
938 static HRESULT WINAPI WMPSettings_put_playCount(IWMPSettings *iface, LONG v)
940 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
941 FIXME("(%p)->(%ld)\n", This, v);
942 return E_NOTIMPL;
945 static HRESULT WINAPI WMPSettings_get_rate(IWMPSettings *iface, double *p)
947 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
948 FIXME("(%p)->(%p)\n", This, p);
949 return E_NOTIMPL;
952 static HRESULT WINAPI WMPSettings_put_rate(IWMPSettings *iface, double v)
954 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
955 FIXME("(%p)->(%lf)\n", This, v);
956 return E_NOTIMPL;
959 static HRESULT WINAPI WMPSettings_get_balance(IWMPSettings *iface, LONG *p)
961 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
962 FIXME("(%p)->(%p)\n", This, p);
963 return E_NOTIMPL;
966 static HRESULT WINAPI WMPSettings_put_balance(IWMPSettings *iface, LONG v)
968 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
969 FIXME("(%p)->(%ld)\n", This, v);
970 return E_NOTIMPL;
973 static HRESULT WINAPI WMPSettings_get_volume(IWMPSettings *iface, LONG *p)
975 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
976 TRACE("(%p)->(%p)\n", This, p);
977 if (!p)
978 return E_POINTER;
979 *p = This->volume;
980 return S_OK;
983 static HRESULT WINAPI WMPSettings_put_volume(IWMPSettings *iface, LONG v)
985 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
986 TRACE("(%p)->(%ld)\n", This, v);
987 This->volume = v;
988 if (!This->filter_graph)
989 return S_OK;
991 /* IBasicAudio - [-10000, 0], wmp - [0, 100] */
992 v = 10000 * v / 100 - 10000;
993 if (!This->basic_audio)
994 return S_FALSE;
996 return IBasicAudio_put_Volume(This->basic_audio, v);
999 static HRESULT WINAPI WMPSettings_getMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL *p)
1001 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1002 FIXME("(%p)->(%s %p)\n", This, debugstr_w(mode), p);
1003 return E_NOTIMPL;
1006 static HRESULT WINAPI WMPSettings_setMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL v)
1008 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1009 FIXME("(%p)->(%s %x)\n", This, debugstr_w(mode), v);
1010 return E_NOTIMPL;
1013 static HRESULT WINAPI WMPSettings_get_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL *p)
1015 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1017 TRACE("(%p)->(%p)\n", This, p);
1019 if (!p)
1020 return E_POINTER;
1021 *p = This->enable_error_dialogs;
1022 return S_OK;
1025 static HRESULT WINAPI WMPSettings_put_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL v)
1027 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1028 /* Leaving as FIXME as we don't currently use this */
1029 FIXME("(%p)->(%x)\n", This, v);
1030 This->enable_error_dialogs = v;
1031 return S_OK;
1034 static const IWMPSettingsVtbl WMPSettingsVtbl = {
1035 WMPSettings_QueryInterface,
1036 WMPSettings_AddRef,
1037 WMPSettings_Release,
1038 WMPSettings_GetTypeInfoCount,
1039 WMPSettings_GetTypeInfo,
1040 WMPSettings_GetIDsOfNames,
1041 WMPSettings_Invoke,
1042 WMPSettings_get_isAvailable,
1043 WMPSettings_get_autoStart,
1044 WMPSettings_put_autoStart,
1045 WMPSettings_get_baseURL,
1046 WMPSettings_put_baseURL,
1047 WMPSettings_get_defaultFrame,
1048 WMPSettings_put_defaultFrame,
1049 WMPSettings_get_invokeURLs,
1050 WMPSettings_put_invokeURLs,
1051 WMPSettings_get_mute,
1052 WMPSettings_put_mute,
1053 WMPSettings_get_playCount,
1054 WMPSettings_put_playCount,
1055 WMPSettings_get_rate,
1056 WMPSettings_put_rate,
1057 WMPSettings_get_balance,
1058 WMPSettings_put_balance,
1059 WMPSettings_get_volume,
1060 WMPSettings_put_volume,
1061 WMPSettings_getMode,
1062 WMPSettings_setMode,
1063 WMPSettings_get_enableErrorDialogs,
1064 WMPSettings_put_enableErrorDialogs
1067 static HRESULT WINAPI WMPNetwork_QueryInterface(IWMPNetwork *iface, REFIID riid, void **ppv)
1069 if(IsEqualGUID(riid, &IID_IDispatch)) {
1070 *ppv = iface;
1071 }else if(IsEqualGUID(riid, &IID_IWMPNetwork)) {
1072 *ppv = iface;
1073 }else {
1074 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid));
1075 *ppv = NULL;
1076 return E_NOINTERFACE;
1079 IUnknown_AddRef((IUnknown*)*ppv);
1080 return S_OK;
1083 static ULONG WINAPI WMPNetwork_AddRef(IWMPNetwork *iface)
1085 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1086 return IOleObject_AddRef(&This->IOleObject_iface);
1089 static ULONG WINAPI WMPNetwork_Release(IWMPNetwork *iface)
1091 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1092 return IOleObject_Release(&This->IOleObject_iface);
1095 static HRESULT WINAPI WMPNetwork_GetTypeInfoCount(IWMPNetwork *iface, UINT *pctinfo)
1097 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1098 FIXME("(%p)->(%p)\n", This, pctinfo);
1099 return E_NOTIMPL;
1102 static HRESULT WINAPI WMPNetwork_GetTypeInfo(IWMPNetwork *iface, UINT iTInfo,
1103 LCID lcid, ITypeInfo **ppTInfo)
1105 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1106 FIXME("(%p)->(%u %ld %p)\n", This, iTInfo, lcid, ppTInfo);
1107 return E_NOTIMPL;
1110 static HRESULT WINAPI WMPNetwork_GetIDsOfNames(IWMPNetwork *iface, REFIID riid,
1111 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1113 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1114 FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1115 return E_NOTIMPL;
1118 static HRESULT WINAPI WMPNetwork_Invoke(IWMPNetwork *iface, DISPID dispIdMember,
1119 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1120 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1122 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1123 FIXME("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1124 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1125 return E_NOTIMPL;
1128 static HRESULT WINAPI WMPNetwork_get_bandWidth(IWMPNetwork *iface, LONG *plBandwidth)
1130 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1131 FIXME("(%p)->(%p)\n", This, plBandwidth);
1132 return E_NOTIMPL;
1135 static HRESULT WINAPI WMPNetwork_get_recoveredPackets(IWMPNetwork *iface, LONG *plRecoveredPackets)
1137 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1138 FIXME("(%p)->(%p)\n", This, plRecoveredPackets);
1139 return E_NOTIMPL;
1142 static HRESULT WINAPI WMPNetwork_get_sourceProtocol(IWMPNetwork *iface, BSTR *pbstrSourceProtocol)
1144 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1145 FIXME("(%p)->(%p)\n", This, pbstrSourceProtocol);
1146 return E_NOTIMPL;
1149 static HRESULT WINAPI WMPNetwork_get_receivedPackets(IWMPNetwork *iface, LONG *plReceivedPackets)
1151 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1152 FIXME("(%p)->(%p)\n", This, plReceivedPackets);
1153 return E_NOTIMPL;
1156 static HRESULT WINAPI WMPNetwork_get_lostPackets(IWMPNetwork *iface, LONG *plLostPackets)
1158 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1159 FIXME("(%p)->(%p)\n", This, plLostPackets);
1160 return E_NOTIMPL;
1163 static HRESULT WINAPI WMPNetwork_get_receptionQuality(IWMPNetwork *iface, LONG *plReceptionQuality)
1165 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1166 FIXME("(%p)->(%p)\n", This, plReceptionQuality);
1167 return E_NOTIMPL;
1170 static HRESULT WINAPI WMPNetwork_get_bufferingCount(IWMPNetwork *iface, LONG *plBufferingCount)
1172 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1173 FIXME("(%p)->(%p)\n", This, plBufferingCount);
1174 return E_NOTIMPL;
1177 static HRESULT WINAPI WMPNetwork_get_bufferingProgress(IWMPNetwork *iface, LONG *plBufferingProgress)
1179 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1180 TRACE("(%p)->(%p)\n", This, plBufferingProgress);
1181 if (!This->filter_graph) {
1182 return S_FALSE;
1184 /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
1185 * For file sources FileAsyncReader->Length should work
1186 * */
1187 FIXME("stub: Returning buffering progress 100\n");
1188 *plBufferingProgress = 100;
1190 return S_OK;
1193 static HRESULT WINAPI WMPNetwork_get_bufferingTime(IWMPNetwork *iface, LONG *plBufferingTime)
1195 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1196 FIXME("(%p)->(%p)\n", This, plBufferingTime);
1197 return E_NOTIMPL;
1200 static HRESULT WINAPI WMPNetwork_put_bufferingTime(IWMPNetwork *iface, LONG lBufferingTime)
1202 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1203 FIXME("(%p)->(%ld)\n", This, lBufferingTime);
1204 return E_NOTIMPL;
1207 static HRESULT WINAPI WMPNetwork_get_frameRate(IWMPNetwork *iface, LONG *plFrameRate)
1209 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1210 FIXME("(%p)->(%p)\n", This, plFrameRate);
1211 return E_NOTIMPL;
1214 static HRESULT WINAPI WMPNetwork_get_maxBitRate(IWMPNetwork *iface, LONG *plBitRate)
1216 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1217 FIXME("(%p)->(%p)\n", This, plBitRate);
1218 return E_NOTIMPL;
1221 static HRESULT WINAPI WMPNetwork_get_bitRate(IWMPNetwork *iface, LONG *plBitRate)
1223 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1224 FIXME("(%p)->(%p)\n", This, plBitRate);
1225 return E_NOTIMPL;
1228 static HRESULT WINAPI WMPNetwork_getProxySettings(IWMPNetwork *iface, BSTR bstrProtocol, LONG *plProxySetting)
1230 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1231 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), plProxySetting);
1232 return E_NOTIMPL;
1235 static HRESULT WINAPI WMPNetwork_setProxySettings(IWMPNetwork *iface, BSTR bstrProtocol, LONG lProxySetting)
1237 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1238 FIXME("(%p)->(%s, %ld)\n", This, debugstr_w(bstrProtocol), lProxySetting);
1239 return E_NOTIMPL;
1242 static HRESULT WINAPI WMPNetwork_getProxyName(IWMPNetwork *iface, BSTR bstrProtocol, BSTR *pbstrProxyName)
1244 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1245 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pbstrProxyName);
1246 return E_NOTIMPL;
1249 static HRESULT WINAPI WMPNetwork_setProxyName(IWMPNetwork *iface, BSTR bstrProtocol, BSTR bstrProxyName)
1251 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1252 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrProtocol), debugstr_w(bstrProxyName));
1253 return E_NOTIMPL;
1256 static HRESULT WINAPI WMPNetwork_getProxyPort(IWMPNetwork *iface, BSTR bstrProtocol, LONG *plProxyPort)
1258 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1259 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), plProxyPort);
1260 return E_NOTIMPL;
1263 static HRESULT WINAPI WMPNetwork_setProxyPort(IWMPNetwork *iface, BSTR bstrProtocol, LONG lProxyPort)
1265 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1266 FIXME("(%p)->(%s, %ld)\n", This, debugstr_w(bstrProtocol), lProxyPort);
1267 return E_NOTIMPL;
1270 static HRESULT WINAPI WMPNetwork_getProxyExceptionList(IWMPNetwork *iface, BSTR bstrProtocol, BSTR *pbstrExceptionList)
1272 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1273 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pbstrExceptionList);
1274 return E_NOTIMPL;
1277 static HRESULT WINAPI WMPNetwork_setProxyExceptionList(IWMPNetwork *iface, BSTR bstrProtocol, BSTR bstrExceptionList)
1279 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1280 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrProtocol), debugstr_w(bstrExceptionList));
1281 return E_NOTIMPL;
1284 static HRESULT WINAPI WMPNetwork_getProxyBypassForLocal(IWMPNetwork *iface, BSTR bstrProtocol, VARIANT_BOOL *pfBypassForLocal)
1286 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1287 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pfBypassForLocal);
1288 return E_NOTIMPL;
1291 static HRESULT WINAPI WMPNetwork_setProxyBypassForLocal(IWMPNetwork *iface, BSTR bstrProtocol, VARIANT_BOOL fBypassForLocal)
1293 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1294 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), fBypassForLocal);
1295 return E_NOTIMPL;
1298 static HRESULT WINAPI WMPNetwork_get_maxBandwidth(IWMPNetwork *iface, LONG *plMaxBandwidth)
1300 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1301 FIXME("(%p)->(%p)\n", This, plMaxBandwidth);
1302 return E_NOTIMPL;
1305 static HRESULT WINAPI WMPNetwork_put_maxBandwidth(IWMPNetwork *iface, LONG lMaxBandwidth)
1307 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1308 FIXME("(%p)->(%ld)\n", This, lMaxBandwidth);
1309 return E_NOTIMPL;
1312 static HRESULT WINAPI WMPNetwork_get_downloadProgress(IWMPNetwork *iface, LONG *plDownloadProgress)
1314 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1315 TRACE("(%p)->(%p)\n", This, plDownloadProgress);
1316 if (!This->filter_graph) {
1317 return S_FALSE;
1319 /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
1320 * For file sources FileAsyncReader->Length could work or it should just be
1321 * 100
1322 * */
1323 FIXME("stub: Returning download progress 100\n");
1324 *plDownloadProgress = 100;
1326 return S_OK;
1329 static HRESULT WINAPI WMPNetwork_get_encodedFrameRate(IWMPNetwork *iface, LONG *plFrameRate)
1331 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1332 FIXME("(%p)->(%p)\n", This, plFrameRate);
1333 return E_NOTIMPL;
1336 static HRESULT WINAPI WMPNetwork_get_framesSkipped(IWMPNetwork *iface, LONG *plFrames)
1338 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1339 FIXME("(%p)->(%p)\n", This, plFrames);
1340 return E_NOTIMPL;
1343 static const IWMPNetworkVtbl WMPNetworkVtbl = {
1344 WMPNetwork_QueryInterface,
1345 WMPNetwork_AddRef,
1346 WMPNetwork_Release,
1347 WMPNetwork_GetTypeInfoCount,
1348 WMPNetwork_GetTypeInfo,
1349 WMPNetwork_GetIDsOfNames,
1350 WMPNetwork_Invoke,
1351 WMPNetwork_get_bandWidth,
1352 WMPNetwork_get_recoveredPackets,
1353 WMPNetwork_get_sourceProtocol,
1354 WMPNetwork_get_receivedPackets,
1355 WMPNetwork_get_lostPackets,
1356 WMPNetwork_get_receptionQuality,
1357 WMPNetwork_get_bufferingCount,
1358 WMPNetwork_get_bufferingProgress,
1359 WMPNetwork_get_bufferingTime,
1360 WMPNetwork_put_bufferingTime,
1361 WMPNetwork_get_frameRate,
1362 WMPNetwork_get_maxBitRate,
1363 WMPNetwork_get_bitRate,
1364 WMPNetwork_getProxySettings,
1365 WMPNetwork_setProxySettings,
1366 WMPNetwork_getProxyName,
1367 WMPNetwork_setProxyName,
1368 WMPNetwork_getProxyPort,
1369 WMPNetwork_setProxyPort,
1370 WMPNetwork_getProxyExceptionList,
1371 WMPNetwork_setProxyExceptionList,
1372 WMPNetwork_getProxyBypassForLocal,
1373 WMPNetwork_setProxyBypassForLocal,
1374 WMPNetwork_get_maxBandwidth,
1375 WMPNetwork_put_maxBandwidth,
1376 WMPNetwork_get_downloadProgress,
1377 WMPNetwork_get_encodedFrameRate,
1378 WMPNetwork_get_framesSkipped,
1381 static HRESULT WINAPI WMPControls_QueryInterface(IWMPControls *iface, REFIID riid, void **ppv)
1383 if(IsEqualGUID(riid, &IID_IUnknown)) {
1384 *ppv = iface;
1385 }else if(IsEqualGUID(riid, &IID_IDispatch)) {
1386 *ppv = iface;
1387 }else if(IsEqualGUID(riid, &IID_IWMPControls)) {
1388 *ppv = iface;
1389 }else {
1390 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid));
1391 *ppv = NULL;
1392 return E_NOINTERFACE;
1395 IUnknown_AddRef((IUnknown*)*ppv);
1396 return S_OK;
1399 static ULONG WINAPI WMPControls_AddRef(IWMPControls *iface)
1401 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1402 return IOleObject_AddRef(&This->IOleObject_iface);
1405 static ULONG WINAPI WMPControls_Release(IWMPControls *iface)
1407 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1408 return IOleObject_Release(&This->IOleObject_iface);
1411 static HRESULT WINAPI WMPControls_GetTypeInfoCount(IWMPControls *iface, UINT *pctinfo)
1413 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1414 FIXME("(%p)->(%p)\n", This, pctinfo);
1415 return E_NOTIMPL;
1418 static HRESULT WINAPI WMPControls_GetTypeInfo(IWMPControls *iface, UINT iTInfo,
1419 LCID lcid, ITypeInfo **ppTInfo)
1421 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1422 FIXME("(%p)->(%u %ld %p)\n", This, iTInfo, lcid, ppTInfo);
1423 return E_NOTIMPL;
1426 static HRESULT WINAPI WMPControls_GetIDsOfNames(IWMPControls *iface, REFIID riid,
1427 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1429 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1430 FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1431 return E_NOTIMPL;
1434 static HRESULT WINAPI WMPControls_Invoke(IWMPControls *iface, DISPID dispIdMember,
1435 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1436 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1438 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1439 FIXME("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1440 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1441 return E_NOTIMPL;
1444 static HRESULT WINAPI WMPControls_get_isAvailable(IWMPControls *iface, BSTR bstrItem, VARIANT_BOOL *pIsAvailable)
1446 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1447 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrItem), pIsAvailable);
1448 if (!This->filter_graph) {
1449 *pIsAvailable = VARIANT_FALSE;
1450 } else if (wcscmp(L"currentPosition", bstrItem) == 0) {
1451 DWORD capabilities;
1452 IMediaSeeking_GetCapabilities(This->media_seeking, &capabilities);
1453 *pIsAvailable = (capabilities & AM_SEEKING_CanSeekAbsolute) ?
1454 VARIANT_TRUE : VARIANT_FALSE;
1455 } else {
1456 FIXME("%s not implemented\n", debugstr_w(bstrItem));
1457 return E_NOTIMPL;
1460 return S_OK;
1463 static HRESULT WINAPI WMPControls_play(IWMPControls *iface)
1465 HRESULT hres = S_OK;
1466 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1468 TRACE("(%p)\n", This);
1470 if (!This->media) {
1471 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
1474 if (!This->filter_graph) {
1475 hres = CoCreateInstance(&CLSID_FilterGraph,
1476 NULL,
1477 CLSCTX_INPROC_SERVER,
1478 &IID_IGraphBuilder,
1479 (void **)&This->filter_graph);
1480 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposOpeningUnknownURL);
1482 if (SUCCEEDED(hres))
1483 hres = IGraphBuilder_RenderFile(This->filter_graph, This->media->url, NULL);
1484 if (SUCCEEDED(hres))
1485 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposMediaOpen);
1486 if (SUCCEEDED(hres))
1487 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaControl,
1488 (void**)&This->media_control);
1489 if (SUCCEEDED(hres))
1490 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaSeeking,
1491 (void**)&This->media_seeking);
1492 if (SUCCEEDED(hres))
1493 hres = IMediaSeeking_SetTimeFormat(This->media_seeking, &TIME_FORMAT_MEDIA_TIME);
1494 if (SUCCEEDED(hres))
1495 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaEvent,
1496 (void**)&This->media_event);
1497 if (SUCCEEDED(hres))
1499 IMediaEventEx *media_event_ex = NULL;
1500 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaEventEx,
1501 (void**)&media_event_ex);
1502 if (SUCCEEDED(hres)) {
1503 hres = IMediaEventEx_SetNotifyWindow(media_event_ex, (OAHWND)This->msg_window,
1504 WM_WMPEVENT, (LONG_PTR)This);
1505 IMediaEventEx_Release(media_event_ex);
1508 if (SUCCEEDED(hres))
1509 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IBasicAudio, (void**)&This->basic_audio);
1510 if (SUCCEEDED(hres))
1511 hres = IWMPSettings_put_volume(&This->IWMPSettings_iface, This->volume);
1513 if (FAILED(hres))
1515 if (This->filter_graph)
1517 IGraphBuilder_Release(This->filter_graph);
1518 This->filter_graph = NULL;
1520 if (This->media_control)
1522 IMediaControl_Release(This->media_control);
1523 This->media_control = NULL;
1525 if (This->media_seeking)
1527 IMediaSeeking_Release(This->media_seeking);
1528 This->media_seeking = NULL;
1530 if (This->media_event)
1532 IMediaEvent_Release(This->media_event);
1533 This->media_event = NULL;
1535 if (This->basic_audio)
1537 IBasicAudio_Release(This->basic_audio);
1538 This->basic_audio = NULL;
1543 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
1545 if (SUCCEEDED(hres))
1546 hres = IMediaControl_Run(This->media_control);
1548 if (hres == S_FALSE) {
1549 hres = S_OK; /* S_FALSE will mean that graph is transitioning and that is fine */
1552 if (SUCCEEDED(hres)) {
1553 LONGLONG duration;
1554 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsPlaying);
1555 if (SUCCEEDED(IMediaSeeking_GetDuration(This->media_seeking, &duration)))
1556 This->media->duration = (DOUBLE)duration / 10000000.0f;
1557 } else {
1558 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsUndefined);
1561 return hres;
1564 static HRESULT WINAPI WMPControls_stop(IWMPControls *iface)
1566 HRESULT hres = S_OK;
1567 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1568 TRACE("(%p)\n", This);
1569 if (!This->filter_graph) {
1570 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
1572 if (This->media_control) {
1573 hres = IMediaControl_Stop(This->media_control);
1574 IMediaControl_Release(This->media_control);
1576 if (This->media_event) {
1577 IMediaEvent_Release(This->media_event);
1579 if (This->media_seeking) {
1580 IMediaSeeking_Release(This->media_seeking);
1582 if (This->basic_audio) {
1583 IBasicAudio_Release(This->basic_audio);
1585 IGraphBuilder_Release(This->filter_graph);
1586 This->filter_graph = NULL;
1587 This->media_control = NULL;
1588 This->media_event = NULL;
1589 This->media_seeking = NULL;
1590 This->basic_audio = NULL;
1592 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistOpenNoMedia);
1593 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsStopped);
1594 return hres;
1597 static HRESULT WINAPI WMPControls_pause(IWMPControls *iface)
1599 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1600 FIXME("(%p)\n", This);
1601 return E_NOTIMPL;
1604 static HRESULT WINAPI WMPControls_fastForward(IWMPControls *iface)
1606 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1607 FIXME("(%p)\n", This);
1608 return E_NOTIMPL;
1611 static HRESULT WINAPI WMPControls_fastReverse(IWMPControls *iface)
1613 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1614 FIXME("(%p)\n", This);
1615 return E_NOTIMPL;
1618 static HRESULT WINAPI WMPControls_get_currentPosition(IWMPControls *iface, DOUBLE *pdCurrentPosition)
1620 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1621 HRESULT hres;
1622 LONGLONG currentPosition;
1624 TRACE("(%p)->(%p)\n", This, pdCurrentPosition);
1625 if (!This->media_seeking)
1626 return S_FALSE;
1628 hres = IMediaSeeking_GetCurrentPosition(This->media_seeking, &currentPosition);
1629 *pdCurrentPosition = (DOUBLE) currentPosition / 10000000.0f;
1630 TRACE("hres: %ld, pos: %f\n", hres, *pdCurrentPosition);
1631 return hres;
1634 static HRESULT WINAPI WMPControls_put_currentPosition(IWMPControls *iface, DOUBLE dCurrentPosition)
1636 LONGLONG Current;
1637 HRESULT hres;
1638 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1639 TRACE("(%p)->(%f)\n", This, dCurrentPosition);
1640 if (!This->media_seeking)
1641 return S_FALSE;
1643 Current = 10000000 * dCurrentPosition;
1644 hres = IMediaSeeking_SetPositions(This->media_seeking, &Current,
1645 AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
1647 return hres;
1650 static HRESULT WINAPI WMPControls_get_currentPositionString(IWMPControls *iface, BSTR *pbstrCurrentPosition)
1652 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1653 FIXME("(%p)->(%p)\n", This, pbstrCurrentPosition);
1654 return E_NOTIMPL;
1657 static HRESULT WINAPI WMPControls_next(IWMPControls *iface)
1659 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1660 FIXME("(%p)\n", This);
1661 return E_NOTIMPL;
1664 static HRESULT WINAPI WMPControls_previous(IWMPControls *iface)
1666 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1667 FIXME("(%p)\n", This);
1668 return E_NOTIMPL;
1671 static HRESULT WINAPI WMPControls_get_currentItem(IWMPControls *iface, IWMPMedia **ppIWMPMedia)
1673 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1674 FIXME("(%p)->(%p)\n", This, ppIWMPMedia);
1675 return E_NOTIMPL;
1678 static HRESULT WINAPI WMPControls_put_currentItem(IWMPControls *iface, IWMPMedia *pIWMPMedia)
1680 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1681 FIXME("(%p)->(%p)\n", This, pIWMPMedia);
1682 return E_NOTIMPL;
1685 static HRESULT WINAPI WMPControls_get_currentMarker(IWMPControls *iface, LONG *plMarker)
1687 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1688 FIXME("(%p)->(%p)\n", This, plMarker);
1689 return E_NOTIMPL;
1692 static HRESULT WINAPI WMPControls_put_currentMarker(IWMPControls *iface, LONG lMarker)
1694 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1695 FIXME("(%p)->(%ld)\n", This, lMarker);
1696 return E_NOTIMPL;
1699 static HRESULT WINAPI WMPControls_playItem(IWMPControls *iface, IWMPMedia *pIWMPMedia)
1701 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1702 FIXME("(%p)->(%p)\n", This, pIWMPMedia);
1703 return E_NOTIMPL;
1706 static const IWMPControlsVtbl WMPControlsVtbl = {
1707 WMPControls_QueryInterface,
1708 WMPControls_AddRef,
1709 WMPControls_Release,
1710 WMPControls_GetTypeInfoCount,
1711 WMPControls_GetTypeInfo,
1712 WMPControls_GetIDsOfNames,
1713 WMPControls_Invoke,
1714 WMPControls_get_isAvailable,
1715 WMPControls_play,
1716 WMPControls_stop,
1717 WMPControls_pause,
1718 WMPControls_fastForward,
1719 WMPControls_fastReverse,
1720 WMPControls_get_currentPosition,
1721 WMPControls_put_currentPosition,
1722 WMPControls_get_currentPositionString,
1723 WMPControls_next,
1724 WMPControls_previous,
1725 WMPControls_get_currentItem,
1726 WMPControls_put_currentItem,
1727 WMPControls_get_currentMarker,
1728 WMPControls_put_currentMarker,
1729 WMPControls_playItem,
1732 static HRESULT WINAPI WMPMedia_QueryInterface(IWMPMedia *iface, REFIID riid, void **ppv)
1734 WMPMedia *This = impl_from_IWMPMedia(iface);
1735 TRACE("(%p)\n", This);
1736 if(IsEqualGUID(&IID_IUnknown, riid)) {
1737 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1738 *ppv = &This->IWMPMedia_iface;
1739 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1740 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1741 *ppv = &This->IWMPMedia_iface;
1742 }else if(IsEqualGUID(&IID_IWMPMedia, riid)) {
1743 TRACE("(%p)->(IID_IWMPMedia %p)\n", This, ppv);
1744 *ppv = &This->IWMPMedia_iface;
1745 }else {
1746 WARN("Unsupported interface %s\n", debugstr_guid(riid));
1747 *ppv = NULL;
1748 return E_NOINTERFACE;
1751 IUnknown_AddRef((IUnknown*)*ppv);
1752 return S_OK;
1755 static ULONG WINAPI WMPMedia_AddRef(IWMPMedia *iface)
1757 WMPMedia *This = impl_from_IWMPMedia(iface);
1758 LONG ref = InterlockedIncrement(&This->ref);
1760 TRACE("(%p) ref=%ld\n", This, ref);
1762 return ref;
1765 static ULONG WINAPI WMPMedia_Release(IWMPMedia *iface)
1767 WMPMedia *This = impl_from_IWMPMedia(iface);
1768 LONG ref = InterlockedDecrement(&This->ref);
1770 TRACE("(%p) ref=%ld\n", This, ref);
1772 if(!ref) {
1773 free(This->url);
1774 free(This->name);
1775 free(This);
1778 return ref;
1781 static HRESULT WINAPI WMPMedia_GetTypeInfoCount(IWMPMedia *iface, UINT *pctinfo)
1783 WMPMedia *This = impl_from_IWMPMedia(iface);
1784 FIXME("(%p)->(%p)\n", This, pctinfo);
1785 return E_NOTIMPL;
1788 static HRESULT WINAPI WMPMedia_GetTypeInfo(IWMPMedia *iface, UINT iTInfo,
1789 LCID lcid, ITypeInfo **ppTInfo)
1791 WMPMedia *This = impl_from_IWMPMedia(iface);
1792 FIXME("(%p)->(%u %ld %p)\n", This, iTInfo, lcid, ppTInfo);
1793 return E_NOTIMPL;
1796 static HRESULT WINAPI WMPMedia_GetIDsOfNames(IWMPMedia *iface, REFIID riid,
1797 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1799 WMPMedia *This = impl_from_IWMPMedia(iface);
1800 FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1801 return E_NOTIMPL;
1804 static HRESULT WINAPI WMPMedia_Invoke(IWMPMedia *iface, DISPID dispIdMember,
1805 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1806 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1808 WMPMedia *This = impl_from_IWMPMedia(iface);
1809 FIXME("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1810 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1811 return E_NOTIMPL;
1814 static HRESULT WINAPI WMPMedia_get_isIdentical(IWMPMedia *iface, IWMPMedia *other, VARIANT_BOOL *pvBool)
1816 WMPMedia *This = impl_from_IWMPMedia(iface);
1817 FIXME("(%p)->(%p, %p)\n", This, other, pvBool);
1818 return E_NOTIMPL;
1821 static HRESULT WINAPI WMPMedia_get_sourceURL(IWMPMedia *iface, BSTR *url)
1823 WMPMedia *This = impl_from_IWMPMedia(iface);
1825 TRACE("(%p)->(%p)\n", This, url);
1827 return return_bstr(This->url, url);
1830 static HRESULT WINAPI WMPMedia_get_name(IWMPMedia *iface, BSTR *name)
1832 WMPMedia *This = impl_from_IWMPMedia(iface);
1834 TRACE("(%p)->(%p)\n", This, name);
1836 return return_bstr(This->name, name);
1839 static HRESULT WINAPI WMPMedia_put_name(IWMPMedia *iface, BSTR name)
1841 WMPMedia *This = impl_from_IWMPMedia(iface);
1843 TRACE("(%p)->(%s)\n", This, debugstr_w(name));
1845 if (!name) return E_POINTER;
1847 free(This->name);
1848 This->name = wcsdup(name);
1849 return S_OK;
1852 static HRESULT WINAPI WMPMedia_get_imageSourceWidth(IWMPMedia *iface, LONG *pWidth)
1854 WMPMedia *This = impl_from_IWMPMedia(iface);
1855 FIXME("(%p)->(%p)\n", This, pWidth);
1856 return E_NOTIMPL;
1859 static HRESULT WINAPI WMPMedia_get_imageSourceHeight(IWMPMedia *iface, LONG *pHeight)
1861 WMPMedia *This = impl_from_IWMPMedia(iface);
1862 FIXME("(%p)->(%p)\n", This, pHeight);
1863 return E_NOTIMPL;
1866 static HRESULT WINAPI WMPMedia_get_markerCount(IWMPMedia *iface, LONG* pMarkerCount)
1868 WMPMedia *This = impl_from_IWMPMedia(iface);
1869 FIXME("(%p)->(%p)\n", This, pMarkerCount);
1870 return E_NOTIMPL;
1873 static HRESULT WINAPI WMPMedia_getMarkerTime(IWMPMedia *iface, LONG MarkerNum, DOUBLE *pMarkerTime)
1875 WMPMedia *This = impl_from_IWMPMedia(iface);
1876 FIXME("(%p)->(%ld, %p)\n", This, MarkerNum, pMarkerTime);
1877 return E_NOTIMPL;
1880 static HRESULT WINAPI WMPMedia_getMarkerName(IWMPMedia *iface, LONG MarkerNum, BSTR *pbstrMarkerName)
1882 WMPMedia *This = impl_from_IWMPMedia(iface);
1883 FIXME("(%p)->(%ld, %p)\n", This, MarkerNum, pbstrMarkerName);
1884 return E_NOTIMPL;
1887 static HRESULT WINAPI WMPMedia_get_duration(IWMPMedia *iface, DOUBLE *pDuration)
1889 /* MSDN: If this property is used with a media item other than the one
1890 * specified in Player.currentMedia, it may not contain a valid value. */
1891 WMPMedia *This = impl_from_IWMPMedia(iface);
1892 TRACE("(%p)->(%p)\n", This, pDuration);
1893 *pDuration = This->duration;
1894 return S_OK;
1897 static HRESULT WINAPI WMPMedia_get_durationString(IWMPMedia *iface, BSTR *pbstrDuration)
1899 WMPMedia *This = impl_from_IWMPMedia(iface);
1900 FIXME("(%p)->(%p)\n", This, pbstrDuration);
1901 return E_NOTIMPL;
1904 static HRESULT WINAPI WMPMedia_get_attributeCount(IWMPMedia *iface, LONG *plCount)
1906 WMPMedia *This = impl_from_IWMPMedia(iface);
1907 FIXME("(%p)->(%p)\n", This, plCount);
1908 return E_NOTIMPL;
1911 static HRESULT WINAPI WMPMedia_getAttributeName(IWMPMedia *iface, LONG lIndex, BSTR *pbstrItemName)
1913 WMPMedia *This = impl_from_IWMPMedia(iface);
1914 FIXME("(%p)->(%ld, %p)\n", This, lIndex, pbstrItemName);
1915 return E_NOTIMPL;
1918 static HRESULT WINAPI WMPMedia_getItemInfo(IWMPMedia *iface, BSTR item_name, BSTR *value)
1920 WMPMedia *This = impl_from_IWMPMedia(iface);
1921 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(item_name), value);
1922 return return_bstr(NULL, value);
1925 static HRESULT WINAPI WMPMedia_setItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR bstrVal)
1927 WMPMedia *This = impl_from_IWMPMedia(iface);
1928 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrItemName), debugstr_w(bstrVal));
1929 return E_NOTIMPL;
1932 static HRESULT WINAPI WMPMedia_getItemInfoByAtom(IWMPMedia *iface, LONG lAtom, BSTR *pbstrVal)
1934 WMPMedia *This = impl_from_IWMPMedia(iface);
1935 FIXME("(%p)->(%ld, %p)\n", This, lAtom, pbstrVal);
1936 return E_NOTIMPL;
1939 static HRESULT WINAPI WMPMedia_isMemberOf(IWMPMedia *iface, IWMPPlaylist *pPlaylist, VARIANT_BOOL *pvarfIsMemberOf)
1941 WMPMedia *This = impl_from_IWMPMedia(iface);
1942 FIXME("(%p)->(%p, %p)\n", This, pPlaylist, pvarfIsMemberOf);
1943 return E_NOTIMPL;
1946 static HRESULT WINAPI WMPMedia_isReadOnlyItem(IWMPMedia *iface, BSTR bstrItemName, VARIANT_BOOL *pvarfIsReadOnly)
1948 WMPMedia *This = impl_from_IWMPMedia(iface);
1949 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pvarfIsReadOnly);
1950 return E_NOTIMPL;
1953 static const IWMPMediaVtbl WMPMediaVtbl = {
1954 WMPMedia_QueryInterface,
1955 WMPMedia_AddRef,
1956 WMPMedia_Release,
1957 WMPMedia_GetTypeInfoCount,
1958 WMPMedia_GetTypeInfo,
1959 WMPMedia_GetIDsOfNames,
1960 WMPMedia_Invoke,
1961 WMPMedia_get_isIdentical,
1962 WMPMedia_get_sourceURL,
1963 WMPMedia_get_name,
1964 WMPMedia_put_name,
1965 WMPMedia_get_imageSourceWidth,
1966 WMPMedia_get_imageSourceHeight,
1967 WMPMedia_get_markerCount,
1968 WMPMedia_getMarkerTime,
1969 WMPMedia_getMarkerName,
1970 WMPMedia_get_duration,
1971 WMPMedia_get_durationString,
1972 WMPMedia_get_attributeCount,
1973 WMPMedia_getAttributeName,
1974 WMPMedia_getItemInfo,
1975 WMPMedia_setItemInfo,
1976 WMPMedia_getItemInfoByAtom,
1977 WMPMedia_isMemberOf,
1978 WMPMedia_isReadOnlyItem
1981 static HRESULT WINAPI WMPPlaylist_QueryInterface(IWMPPlaylist *iface, REFIID riid, void **ppv)
1983 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
1984 TRACE("(%p)\n", This);
1985 if(IsEqualGUID(&IID_IUnknown, riid)) {
1986 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1987 *ppv = &This->IWMPPlaylist_iface;
1988 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1989 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1990 *ppv = &This->IWMPPlaylist_iface;
1991 }else if(IsEqualGUID(&IID_IWMPPlaylist, riid)) {
1992 TRACE("(%p)->(IID_IWMPPlaylist %p)\n", This, ppv);
1993 *ppv = &This->IWMPPlaylist_iface;
1994 }else {
1995 WARN("Unsupported interface %s\n", debugstr_guid(riid));
1996 *ppv = NULL;
1997 return E_NOINTERFACE;
2000 IUnknown_AddRef((IUnknown*)*ppv);
2001 return S_OK;
2004 static ULONG WINAPI WMPPlaylist_AddRef(IWMPPlaylist *iface)
2006 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2007 LONG ref = InterlockedIncrement(&This->ref);
2009 TRACE("(%p) ref=%ld\n", This, ref);
2011 return ref;
2014 static ULONG WINAPI WMPPlaylist_Release(IWMPPlaylist *iface)
2016 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2017 LONG ref = InterlockedDecrement(&This->ref);
2019 TRACE("(%p) ref=%ld\n", This, ref);
2021 if(!ref) {
2022 free(This->url);
2023 free(This->name);
2024 free(This);
2027 return ref;
2030 static HRESULT WINAPI WMPPlaylist_GetTypeInfoCount(IWMPPlaylist *iface, UINT *pctinfo)
2032 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2033 FIXME("(%p)->(%p)\n", This, pctinfo);
2034 return E_NOTIMPL;
2037 static HRESULT WINAPI WMPPlaylist_GetTypeInfo(IWMPPlaylist *iface, UINT iTInfo,
2038 LCID lcid, ITypeInfo **ppTInfo)
2040 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2041 FIXME("(%p)->(%u %ld %p)\n", This, iTInfo, lcid, ppTInfo);
2042 return E_NOTIMPL;
2045 static HRESULT WINAPI WMPPlaylist_GetIDsOfNames(IWMPPlaylist *iface, REFIID riid,
2046 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2048 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2049 FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
2050 return E_NOTIMPL;
2053 static HRESULT WINAPI WMPPlaylist_Invoke(IWMPPlaylist *iface, DISPID dispIdMember,
2054 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2055 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2057 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2058 FIXME("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
2059 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2060 return E_NOTIMPL;
2063 static HRESULT WINAPI WMPPlaylist_get_count(IWMPPlaylist *iface, LONG *count)
2065 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2067 TRACE("(%p)->(%p)\n", This, count);
2069 if (!count) return E_POINTER;
2070 *count = This->count;
2072 return S_OK;
2075 static HRESULT WINAPI WMPPlaylist_get_name(IWMPPlaylist *iface, BSTR *name)
2077 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2079 TRACE("(%p)->(%p)\n", This, name);
2081 return return_bstr(This->name, name);
2084 static HRESULT WINAPI WMPPlaylist_put_name(IWMPPlaylist *iface, BSTR name)
2086 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2088 TRACE("(%p)->(%s)\n", This, debugstr_w(name));
2090 if (!name) return E_POINTER;
2092 free(This->name);
2093 This->name = wcsdup(name);
2094 return S_OK;
2097 static HRESULT WINAPI WMPPlaylist_get_attributeCount(IWMPPlaylist *iface, LONG *count)
2099 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2100 FIXME("(%p)->(%p)\n", This, count);
2101 return E_NOTIMPL;
2104 static HRESULT WINAPI WMPPlaylist_get_attributeName(IWMPPlaylist *iface, LONG index, BSTR *attribute_name)
2106 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2107 FIXME("(%p)->(%ld %p)\n", This, index, attribute_name);
2108 return E_NOTIMPL;
2111 static HRESULT WINAPI WMPPlaylist_get_Item(IWMPPlaylist *iface, LONG index, IWMPMedia **media)
2113 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2114 FIXME("(%p)->(%ld %p)\n", This, index, media);
2115 return E_NOTIMPL;
2118 static HRESULT WINAPI WMPPlaylist_getItemInfo(IWMPPlaylist *iface, BSTR name, BSTR *value)
2120 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2121 FIXME("(%p)->(%s %p)\n", This, debugstr_w(name), value);
2122 return E_NOTIMPL;
2125 static HRESULT WINAPI WMPPlaylist_setItemInfo(IWMPPlaylist *iface, BSTR name, BSTR value)
2127 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2128 FIXME("(%p)->(%s %s)\n", This, debugstr_w(name), debugstr_w(value));
2129 return E_NOTIMPL;
2132 static HRESULT WINAPI WMPPlaylist_get_isIdentical(IWMPPlaylist *iface, IWMPPlaylist *playlist, VARIANT_BOOL *var)
2134 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2135 FIXME("(%p)->(%p %p)\n", This, playlist, var);
2136 return E_NOTIMPL;
2139 static HRESULT WINAPI WMPPlaylist_clear(IWMPPlaylist *iface)
2141 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2142 FIXME("(%p)\n", This);
2143 return E_NOTIMPL;
2146 static HRESULT WINAPI WMPPlaylist_insertItem(IWMPPlaylist *iface, LONG index, IWMPMedia *media)
2148 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2149 FIXME("(%p)->(%ld %p)\n", This, index, media);
2150 return E_NOTIMPL;
2153 static HRESULT WINAPI WMPPlaylist_appendItem(IWMPPlaylist *iface, IWMPMedia *media)
2155 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2156 FIXME("(%p)->(%p)\n", This, media);
2157 return S_OK;
2160 static HRESULT WINAPI WMPPlaylist_removeItem(IWMPPlaylist *iface, IWMPMedia *media)
2162 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2163 FIXME("(%p)->(%p)\n", This, media);
2164 return E_NOTIMPL;
2167 static HRESULT WINAPI WMPPlaylist_moveItem(IWMPPlaylist *iface, LONG old_index, LONG new_index)
2169 WMPPlaylist *This = impl_from_IWMPPlaylist(iface);
2170 FIXME("(%p)->(%ld %ld)\n", This, old_index, new_index);
2171 return E_NOTIMPL;
2174 static const IWMPPlaylistVtbl WMPPlaylistVtbl = {
2175 WMPPlaylist_QueryInterface,
2176 WMPPlaylist_AddRef,
2177 WMPPlaylist_Release,
2178 WMPPlaylist_GetTypeInfoCount,
2179 WMPPlaylist_GetTypeInfo,
2180 WMPPlaylist_GetIDsOfNames,
2181 WMPPlaylist_Invoke,
2182 WMPPlaylist_get_count,
2183 WMPPlaylist_get_name,
2184 WMPPlaylist_put_name,
2185 WMPPlaylist_get_attributeCount,
2186 WMPPlaylist_get_attributeName,
2187 WMPPlaylist_get_Item,
2188 WMPPlaylist_getItemInfo,
2189 WMPPlaylist_setItemInfo,
2190 WMPPlaylist_get_isIdentical,
2191 WMPPlaylist_clear,
2192 WMPPlaylist_insertItem,
2193 WMPPlaylist_appendItem,
2194 WMPPlaylist_removeItem,
2195 WMPPlaylist_moveItem
2198 static LRESULT WINAPI player_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2200 if (msg == WM_WMPEVENT && wParam == 0) {
2201 WindowsMediaPlayer *wmp = (WindowsMediaPlayer*)lParam;
2202 LONG event_code;
2203 LONG_PTR p1, p2;
2204 HRESULT hr;
2205 if (wmp->media_event) {
2206 do {
2207 hr = IMediaEvent_GetEvent(wmp->media_event, &event_code, &p1, &p2, 0);
2208 if (SUCCEEDED(hr)) {
2209 TRACE("got event_code = 0x%02lx\n", event_code);
2210 IMediaEvent_FreeEventParams(wmp->media_event, event_code, p1, p2);
2211 /* For now we only handle EC_COMPLETE */
2212 if (event_code == EC_COMPLETE) {
2213 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsMediaEnded);
2214 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
2215 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsStopped);
2218 } while (hr == S_OK);
2219 } else {
2220 FIXME("Got event from quartz when interfaces are already released\n");
2223 return DefWindowProcW(hwnd, msg, wParam, lParam);
2226 static BOOL WINAPI register_player_msg_class(INIT_ONCE *once, void *param, void **context) {
2227 static WNDCLASSEXW wndclass = {
2228 sizeof(wndclass), CS_DBLCLKS, player_wnd_proc, 0, 0,
2229 NULL, NULL, NULL, NULL, NULL,
2230 L"_WMPMessage", NULL
2233 wndclass.hInstance = wmp_instance;
2234 player_msg_class = RegisterClassExW(&wndclass);
2235 WM_WMPEVENT= RegisterWindowMessageW(L"_WMPMessage");
2236 return TRUE;
2239 void unregister_player_msg_class(void) {
2240 if(player_msg_class)
2241 UnregisterClassW(MAKEINTRESOURCEW(player_msg_class), wmp_instance);
2244 BOOL init_player(WindowsMediaPlayer *wmp)
2246 IWMPPlaylist *playlist;
2247 BSTR name;
2249 InitOnceExecuteOnce(&class_init_once, register_player_msg_class, NULL, NULL);
2250 wmp->msg_window = CreateWindowW( MAKEINTRESOURCEW(player_msg_class), NULL, 0, 0,
2251 0, 0, 0, HWND_MESSAGE, 0, wmp_instance, wmp );
2252 if (!wmp->msg_window) {
2253 ERR("Failed to create message window, GetLastError: %ld\n", GetLastError());
2254 return FALSE;
2256 if (!WM_WMPEVENT) {
2257 ERR("Failed to register window message, GetLastError: %ld\n", GetLastError());
2258 return FALSE;
2261 wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl;
2262 wmp->IWMPPlayer_iface.lpVtbl = &WMPPlayerVtbl;
2263 wmp->IWMPSettings_iface.lpVtbl = &WMPSettingsVtbl;
2264 wmp->IWMPControls_iface.lpVtbl = &WMPControlsVtbl;
2265 wmp->IWMPNetwork_iface.lpVtbl = &WMPNetworkVtbl;
2267 name = SysAllocString(L"Playlist1");
2268 if (SUCCEEDED(create_playlist(name, NULL, 0, &playlist)))
2269 wmp->playlist = unsafe_impl_from_IWMPPlaylist(playlist);
2270 else
2271 wmp->playlist = NULL;
2272 SysFreeString(name);
2274 wmp->invoke_urls = VARIANT_TRUE;
2275 wmp->auto_start = VARIANT_TRUE;
2276 wmp->volume = 100;
2277 return TRUE;
2280 void destroy_player(WindowsMediaPlayer *wmp)
2282 IWMPControls_stop(&wmp->IWMPControls_iface);
2283 if (wmp->media)
2284 IWMPMedia_Release(&wmp->media->IWMPMedia_iface);
2285 if (wmp->playlist)
2286 IWMPPlaylist_Release(&wmp->playlist->IWMPPlaylist_iface);
2287 DestroyWindow(wmp->msg_window);
2290 WMPMedia *unsafe_impl_from_IWMPMedia(IWMPMedia *iface)
2292 if (iface->lpVtbl == &WMPMediaVtbl) {
2293 return CONTAINING_RECORD(iface, WMPMedia, IWMPMedia_iface);
2295 return NULL;
2298 WMPPlaylist *unsafe_impl_from_IWMPPlaylist(IWMPPlaylist *iface)
2300 if (iface->lpVtbl == &WMPPlaylistVtbl) {
2301 return CONTAINING_RECORD(iface, WMPPlaylist, IWMPPlaylist_iface);
2303 return NULL;
2306 HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
2308 WMPMedia *media;
2309 IUri *uri;
2310 BSTR path;
2311 HRESULT hr;
2312 WCHAR *name_dup;
2314 media = calloc(1, sizeof(*media));
2315 if (!media)
2316 return E_OUTOFMEMORY;
2318 media->IWMPMedia_iface.lpVtbl = &WMPMediaVtbl;
2320 if (url)
2322 media->url = wcsdup(url);
2323 name_dup = wcsdup(url);
2325 hr = CreateUri(name_dup, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, &uri);
2326 if (FAILED(hr))
2328 free(name_dup);
2329 IWMPMedia_Release(&media->IWMPMedia_iface);
2330 return hr;
2332 hr = IUri_GetPath(uri, &path);
2333 if (hr != S_OK)
2335 free(name_dup);
2336 IUri_Release(uri);
2337 IWMPMedia_Release(&media->IWMPMedia_iface);
2338 return hr;
2341 /* GetPath() will return "/" for invalid uri's
2342 * only strip extension when uri is valid
2344 if (wcscmp(path, L"/") != 0)
2345 PathRemoveExtensionW(name_dup);
2346 PathStripPathW(name_dup);
2348 media->name = name_dup;
2350 SysFreeString(path);
2351 IUri_Release(uri);
2353 else
2355 media->url = wcsdup(L"");
2356 media->name = wcsdup(L"");
2359 media->duration = duration;
2360 media->ref = 1;
2362 if (media->url) {
2363 *ppMedia = &media->IWMPMedia_iface;
2365 return S_OK;
2367 IWMPMedia_Release(&media->IWMPMedia_iface);
2368 return E_OUTOFMEMORY;
2371 HRESULT create_playlist(BSTR name, BSTR url, LONG count, IWMPPlaylist **ppPlaylist)
2373 WMPPlaylist *playlist;
2375 playlist = calloc(1, sizeof(*playlist));
2376 if (!playlist)
2377 return E_OUTOFMEMORY;
2379 playlist->IWMPPlaylist_iface.lpVtbl = &WMPPlaylistVtbl;
2380 playlist->url = wcsdup(url ? url : L"");
2381 playlist->name = wcsdup(name ? name : L"");
2382 playlist->ref = 1;
2383 playlist->count = count;
2385 if (playlist->url)
2387 *ppPlaylist = &playlist->IWMPPlaylist_iface;
2388 return S_OK;
2391 IWMPPlaylist_Release(&playlist->IWMPPlaylist_iface);
2392 return E_OUTOFMEMORY;