makefiles: Output rules for building generated .rc files.
[wine.git] / dlls / wmp / player.c
blob519ffa1d18fccba1bc744eacd14d4c69cf42135f
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"
25 WINE_DEFAULT_DEBUG_CHANNEL(wmp);
27 static ATOM player_msg_class;
28 static INIT_ONCE class_init_once;
29 static UINT WM_WMPEVENT;
30 static const WCHAR WMPmessageW[] = {'_', 'W', 'M', 'P', 'M','e','s','s','a','g','e',0};
31 static const WCHAR emptyW[] = {0};
33 static void update_state(WindowsMediaPlayer *wmp, LONG type, LONG state)
35 DISPPARAMS dispparams;
36 VARIANTARG params[1];
38 dispparams.cArgs = 1;
39 dispparams.cNamedArgs = 0;
40 dispparams.rgdispidNamedArgs = NULL;
41 dispparams.rgvarg = params;
43 V_VT(params) = VT_UI4;
44 V_UI4(params) = state;
46 call_sink(wmp->wmpocx, type, &dispparams);
49 static inline WMPMedia *impl_from_IWMPMedia(IWMPMedia *iface)
51 return CONTAINING_RECORD(iface, WMPMedia, IWMPMedia_iface);
54 static inline WindowsMediaPlayer *impl_from_IWMPNetwork(IWMPNetwork *iface)
56 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPNetwork_iface);
59 static inline WindowsMediaPlayer *impl_from_IWMPPlayer4(IWMPPlayer4 *iface)
61 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPPlayer4_iface);
64 static inline WindowsMediaPlayer *impl_from_IWMPPlayer(IWMPPlayer *iface)
66 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPPlayer_iface);
69 static inline WindowsMediaPlayer *impl_from_IWMPControls(IWMPControls *iface)
71 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPControls_iface);
74 static HRESULT WINAPI WMPPlayer4_QueryInterface(IWMPPlayer4 *iface, REFIID riid, void **ppv)
76 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
77 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
80 static ULONG WINAPI WMPPlayer4_AddRef(IWMPPlayer4 *iface)
82 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
83 return IOleObject_AddRef(&This->IOleObject_iface);
86 static ULONG WINAPI WMPPlayer4_Release(IWMPPlayer4 *iface)
88 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
89 return IOleObject_Release(&This->IOleObject_iface);
92 static HRESULT WINAPI WMPPlayer4_GetTypeInfoCount(IWMPPlayer4 *iface, UINT *pctinfo)
94 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
95 FIXME("(%p)->(%p)\n", This, pctinfo);
96 return E_NOTIMPL;
99 static HRESULT WINAPI WMPPlayer4_GetTypeInfo(IWMPPlayer4 *iface, UINT iTInfo,
100 LCID lcid, ITypeInfo **ppTInfo)
102 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
103 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
104 return E_NOTIMPL;
107 static HRESULT WINAPI WMPPlayer4_GetIDsOfNames(IWMPPlayer4 *iface, REFIID riid,
108 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
110 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
111 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
112 return E_NOTIMPL;
115 static HRESULT WINAPI WMPPlayer4_Invoke(IWMPPlayer4 *iface, DISPID dispIdMember,
116 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
117 EXCEPINFO *pExcepInfo, UINT *puArgErr)
119 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
120 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
121 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
122 return E_NOTIMPL;
125 static HRESULT WINAPI WMPPlayer4_close(IWMPPlayer4 *iface)
127 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
128 FIXME("(%p)\n", This);
129 return E_NOTIMPL;
132 static HRESULT WINAPI WMPPlayer4_get_URL(IWMPPlayer4 *iface, BSTR *url)
134 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
136 TRACE("(%p)->(%p)\n", This, url);
138 if (!This->media)
139 return return_bstr(emptyW, url);
141 return return_bstr(This->media->url, url);
144 static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url)
146 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
147 IWMPMedia *media;
148 HRESULT hres;
150 TRACE("(%p)->(%s)\n", This, debugstr_w(url));
152 hres = create_media_from_url(url, 0.0, &media);
154 if (SUCCEEDED(hres)) {
155 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
156 hres = IWMPPlayer4_put_currentMedia(iface, media);
157 IWMPMedia_Release(media); /* put will addref */
159 if (SUCCEEDED(hres)) {
160 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsReady);
161 if (This->auto_start == VARIANT_TRUE)
162 IWMPControls_play(&This->IWMPControls_iface);
165 return hres;
168 static HRESULT WINAPI WMPPlayer4_get_openState(IWMPPlayer4 *iface, WMPOpenState *pwmpos)
170 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
171 FIXME("(%p)->(%p)\n", This, pwmpos);
172 return E_NOTIMPL;
175 static HRESULT WINAPI WMPPlayer4_get_playState(IWMPPlayer4 *iface, WMPPlayState *pwmpps)
177 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
178 FIXME("(%p)->(%p)\n", This, pwmpps);
179 return E_NOTIMPL;
182 static HRESULT WINAPI WMPPlayer4_get_controls(IWMPPlayer4 *iface, IWMPControls **ppControl)
184 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
186 TRACE("(%p)->(%p)\n", This, ppControl);
188 IWMPControls_AddRef(&This->IWMPControls_iface);
189 *ppControl = &This->IWMPControls_iface;
190 return S_OK;
193 static HRESULT WINAPI WMPPlayer4_get_settings(IWMPPlayer4 *iface, IWMPSettings **ppSettings)
195 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
197 TRACE("(%p)->(%p)\n", This, ppSettings);
199 IWMPSettings_AddRef(&This->IWMPSettings_iface);
200 *ppSettings = &This->IWMPSettings_iface;
201 return S_OK;
204 static HRESULT WINAPI WMPPlayer4_get_currentMedia(IWMPPlayer4 *iface, IWMPMedia **media)
206 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
208 TRACE("(%p)->(%p)\n", This, media);
210 *media = NULL;
212 if (This->media == NULL)
213 return S_FALSE;
215 return create_media_from_url(This->media->url, This->media->duration, media);
218 static HRESULT WINAPI WMPPlayer4_put_currentMedia(IWMPPlayer4 *iface, IWMPMedia *pMedia)
220 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
221 TRACE("(%p)->(%p)\n", This, pMedia);
223 if(pMedia == NULL) {
224 return E_POINTER;
226 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistChanging);
227 if(This->media != NULL) {
228 IWMPControls_stop(&This->IWMPControls_iface);
229 IWMPMedia_Release(&This->media->IWMPMedia_iface);
231 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistChanged);
232 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistOpenNoMedia);
234 IWMPMedia_AddRef(pMedia);
235 This->media = unsafe_impl_from_IWMPMedia(pMedia);
236 return S_OK;
239 static HRESULT WINAPI WMPPlayer4_get_mediaCollection(IWMPPlayer4 *iface, IWMPMediaCollection **ppMediaCollection)
241 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
242 FIXME("(%p)->(%p)\n", This, ppMediaCollection);
243 return E_NOTIMPL;
246 static HRESULT WINAPI WMPPlayer4_get_playlistCollection(IWMPPlayer4 *iface, IWMPPlaylistCollection **ppPlaylistCollection)
248 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
249 FIXME("(%p)->(%p)\n", This, ppPlaylistCollection);
250 return E_NOTIMPL;
253 static HRESULT WINAPI WMPPlayer4_get_versionInfo(IWMPPlayer4 *iface, BSTR *version)
255 static const WCHAR versionW[] = {'1','2','.','0','.','7','6','0','1','.','1','6','9','8','2',0};
256 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
258 TRACE("(%p)->(%p)\n", This, version);
260 if (!version)
261 return E_POINTER;
263 return return_bstr(versionW, version);
266 static HRESULT WINAPI WMPPlayer4_launchURL(IWMPPlayer4 *iface, BSTR url)
268 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
269 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
270 return E_NOTIMPL;
273 static HRESULT WINAPI WMPPlayer4_get_network(IWMPPlayer4 *iface, IWMPNetwork **ppQNI)
275 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
276 TRACE("(%p)->(%p)\n", This, ppQNI);
278 IWMPNetwork_AddRef(&This->IWMPNetwork_iface);
279 *ppQNI = &This->IWMPNetwork_iface;
280 return S_OK;
283 static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist **ppPL)
285 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
286 FIXME("(%p)->(%p)\n", This, ppPL);
287 return E_NOTIMPL;
290 static HRESULT WINAPI WMPPlayer4_put_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist *pPL)
292 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
293 FIXME("(%p)->(%p)\n", This, pPL);
294 return E_NOTIMPL;
297 static HRESULT WINAPI WMPPlayer4_get_cdromCollection(IWMPPlayer4 *iface, IWMPCdromCollection **ppCdromCollection)
299 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
300 FIXME("(%p)->(%p)\n", This, ppCdromCollection);
301 return E_NOTIMPL;
304 static HRESULT WINAPI WMPPlayer4_get_closedCaption(IWMPPlayer4 *iface, IWMPClosedCaption **ppClosedCaption)
306 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
307 FIXME("(%p)->(%p)\n", This, ppClosedCaption);
308 return E_NOTIMPL;
311 static HRESULT WINAPI WMPPlayer4_get_isOnline(IWMPPlayer4 *iface, VARIANT_BOOL *pfOnline)
313 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
314 FIXME("(%p)->(%p)\n", This, pfOnline);
315 return E_NOTIMPL;
318 static HRESULT WINAPI WMPPlayer4_get_Error(IWMPPlayer4 *iface, IWMPError **ppError)
320 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
321 FIXME("(%p)->(%p)\n", This, ppError);
322 return E_NOTIMPL;
325 static HRESULT WINAPI WMPPlayer4_get_Status(IWMPPlayer4 *iface, BSTR *pbstrStatus)
327 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
328 FIXME("(%p)->(%p)\n", This, pbstrStatus);
329 return E_NOTIMPL;
332 static HRESULT WINAPI WMPPlayer4_get_dvd(IWMPPlayer4 *iface, IWMPDVD **ppDVD)
334 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
335 FIXME("(%p)->(%p)\n", This, ppDVD);
336 return E_NOTIMPL;
339 static HRESULT WINAPI WMPPlayer4_newPlaylist(IWMPPlayer4 *iface, BSTR name, BSTR url, IWMPPlaylist **ppPlaylist)
341 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
342 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(name), debugstr_w(url), ppPlaylist);
343 return E_NOTIMPL;
346 static HRESULT WINAPI WMPPlayer4_newMedia(IWMPPlayer4 *iface, BSTR url, IWMPMedia **media)
348 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
350 TRACE("(%p)->(%s %p)\n", This, debugstr_w(url), media);
352 return create_media_from_url(url, 0.0, media);
355 static HRESULT WINAPI WMPPlayer4_get_enabled(IWMPPlayer4 *iface, VARIANT_BOOL *pbEnabled)
357 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
358 FIXME("(%p)->(%p)\n", This, pbEnabled);
359 return E_NOTIMPL;
362 static HRESULT WINAPI WMPPlayer4_put_enabled(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
364 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
365 FIXME("(%p)->(%x)\n", This, enabled);
366 return E_NOTIMPL;
369 static HRESULT WINAPI WMPPlayer4_get_fullScreen(IWMPPlayer4 *iface, VARIANT_BOOL *pbFullScreen)
371 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
372 FIXME("(%p)->(%p)\n", This, pbFullScreen);
373 return E_NOTIMPL;
376 static HRESULT WINAPI WMPPlayer4_put_fullScreen(IWMPPlayer4 *iface, VARIANT_BOOL fullscreen)
378 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
379 FIXME("(%p)->(%x)\n", This, fullscreen);
380 return E_NOTIMPL;
383 static HRESULT WINAPI WMPPlayer4_get_enableContextMenu(IWMPPlayer4 *iface, VARIANT_BOOL *pbEnableContextMenu)
385 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
386 FIXME("(%p)->(%p)\n", This, pbEnableContextMenu);
387 return E_NOTIMPL;
390 static HRESULT WINAPI WMPPlayer4_put_enableContextMenu(IWMPPlayer4 *iface, VARIANT_BOOL enable)
392 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
393 FIXME("(%p)->(%x)\n", This, enable);
394 return E_NOTIMPL;
397 static HRESULT WINAPI WMPPlayer4_put_uiMode(IWMPPlayer4 *iface, BSTR mode)
399 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
400 FIXME("(%p)->(%s)\n", This, debugstr_w(mode));
401 return E_NOTIMPL;
404 static HRESULT WINAPI WMPPlayer4_get_uiMode(IWMPPlayer4 *iface, BSTR *pbstrMode)
406 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
407 FIXME("(%p)->(%p)\n", This, pbstrMode);
408 return E_NOTIMPL;
411 static HRESULT WINAPI WMPPlayer4_get_stretchToFit(IWMPPlayer4 *iface, VARIANT_BOOL *enabled)
413 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
414 FIXME("(%p)->(%p)\n", This, enabled);
415 return E_NOTIMPL;
418 static HRESULT WINAPI WMPPlayer4_put_stretchToFit(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
420 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
421 FIXME("(%p)->(%x)\n", This, enabled);
422 return E_NOTIMPL;
425 static HRESULT WINAPI WMPPlayer4_get_windowlessVideo(IWMPPlayer4 *iface, VARIANT_BOOL *enabled)
427 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
428 FIXME("(%p)->(%p)\n", This, enabled);
429 return E_NOTIMPL;
432 static HRESULT WINAPI WMPPlayer4_put_windowlessVideo(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
434 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
435 FIXME("(%p)->(%x)\n", This, enabled);
436 return E_NOTIMPL;
439 static HRESULT WINAPI WMPPlayer4_get_isRemote(IWMPPlayer4 *iface, VARIANT_BOOL *pvarfIsRemote)
441 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
442 FIXME("(%p)->(%p)\n", This, pvarfIsRemote);
443 return E_NOTIMPL;
446 static HRESULT WINAPI WMPPlayer4_get_playerApplication(IWMPPlayer4 *iface, IWMPPlayerApplication **ppIWMPPlayerApplication)
448 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
449 FIXME("(%p)->(%p)\n", This, ppIWMPPlayerApplication);
450 return E_NOTIMPL;
453 static HRESULT WINAPI WMPPlayer4_openPlayer(IWMPPlayer4 *iface, BSTR url)
455 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
456 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
457 return E_NOTIMPL;
460 static HRESULT WINAPI WMPPlayer_QueryInterface(IWMPPlayer *iface, REFIID riid, void **ppv)
462 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
463 return WMPPlayer4_QueryInterface(&This->IWMPPlayer4_iface, riid, ppv);
466 static ULONG WINAPI WMPPlayer_AddRef(IWMPPlayer *iface)
468 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
469 return WMPPlayer4_AddRef(&This->IWMPPlayer4_iface);
472 static ULONG WINAPI WMPPlayer_Release(IWMPPlayer *iface)
474 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
475 return WMPPlayer4_Release(&This->IWMPPlayer4_iface);
478 static HRESULT WINAPI WMPPlayer_GetTypeInfoCount(IWMPPlayer *iface, UINT *pctinfo)
480 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
481 return WMPPlayer4_GetTypeInfoCount(&This->IWMPPlayer4_iface, pctinfo);
484 static HRESULT WINAPI WMPPlayer_GetTypeInfo(IWMPPlayer *iface, UINT iTInfo,
485 LCID lcid, ITypeInfo **ppTInfo)
487 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
489 return WMPPlayer4_GetTypeInfo(&This->IWMPPlayer4_iface, iTInfo,
490 lcid, ppTInfo);
493 static HRESULT WINAPI WMPPlayer_GetIDsOfNames(IWMPPlayer *iface, REFIID riid,
494 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
496 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
497 return WMPPlayer4_GetIDsOfNames(&This->IWMPPlayer4_iface, riid,
498 rgszNames, cNames, lcid, rgDispId);
501 static HRESULT WINAPI WMPPlayer_Invoke(IWMPPlayer *iface, DISPID dispIdMember,
502 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
503 EXCEPINFO *pExcepInfo, UINT *puArgErr)
505 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
506 return WMPPlayer4_Invoke(&This->IWMPPlayer4_iface, dispIdMember,
507 riid, lcid, wFlags, pDispParams, pVarResult,
508 pExcepInfo, puArgErr);
511 static HRESULT WINAPI WMPPlayer_close(IWMPPlayer *iface)
513 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
514 return WMPPlayer4_close(&This->IWMPPlayer4_iface);
517 static HRESULT WINAPI WMPPlayer_get_URL(IWMPPlayer *iface, BSTR *pbstrURL)
519 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
520 return WMPPlayer4_get_URL(&This->IWMPPlayer4_iface, pbstrURL);
523 static HRESULT WINAPI WMPPlayer_put_URL(IWMPPlayer *iface, BSTR url)
525 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
526 return WMPPlayer4_put_URL(&This->IWMPPlayer4_iface, url);
529 static HRESULT WINAPI WMPPlayer_get_openState(IWMPPlayer *iface, WMPOpenState *pwmpos)
531 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
532 return WMPPlayer4_get_openState(&This->IWMPPlayer4_iface, pwmpos);
535 static HRESULT WINAPI WMPPlayer_get_playState(IWMPPlayer *iface, WMPPlayState *pwmpps)
537 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
538 return WMPPlayer4_get_playState(&This->IWMPPlayer4_iface, pwmpps);
541 static HRESULT WINAPI WMPPlayer_get_controls(IWMPPlayer *iface, IWMPControls **ppControl)
543 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
544 return WMPPlayer4_get_controls(&This->IWMPPlayer4_iface, ppControl);
547 static HRESULT WINAPI WMPPlayer_get_settings(IWMPPlayer *iface, IWMPSettings **ppSettings)
549 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
550 return WMPPlayer4_get_settings(&This->IWMPPlayer4_iface, ppSettings);
553 static HRESULT WINAPI WMPPlayer_get_currentMedia(IWMPPlayer *iface, IWMPMedia **ppMedia)
555 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
556 return WMPPlayer4_get_currentMedia(&This->IWMPPlayer4_iface, ppMedia);
559 static HRESULT WINAPI WMPPlayer_put_currentMedia(IWMPPlayer *iface, IWMPMedia *pMedia)
561 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
562 return WMPPlayer4_put_currentMedia(&This->IWMPPlayer4_iface, pMedia);
565 static HRESULT WINAPI WMPPlayer_get_mediaCollection(IWMPPlayer *iface, IWMPMediaCollection **ppMediaCollection)
567 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
568 return WMPPlayer4_get_mediaCollection(&This->IWMPPlayer4_iface, ppMediaCollection);
571 static HRESULT WINAPI WMPPlayer_get_playlistCollection(IWMPPlayer *iface, IWMPPlaylistCollection **ppPlaylistCollection)
573 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
574 return WMPPlayer4_get_playlistCollection(&This->IWMPPlayer4_iface, ppPlaylistCollection);
577 static HRESULT WINAPI WMPPlayer_get_versionInfo(IWMPPlayer *iface, BSTR *version)
579 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
580 return WMPPlayer4_get_versionInfo(&This->IWMPPlayer4_iface, version);
583 static HRESULT WINAPI WMPPlayer_launchURL(IWMPPlayer *iface, BSTR url)
585 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
586 return WMPPlayer4_launchURL(&This->IWMPPlayer4_iface, url);
589 static HRESULT WINAPI WMPPlayer_get_network(IWMPPlayer *iface, IWMPNetwork **ppQNI)
591 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
592 return WMPPlayer4_get_network(&This->IWMPPlayer4_iface, ppQNI);
595 static HRESULT WINAPI WMPPlayer_get_currentPlaylist(IWMPPlayer *iface, IWMPPlaylist **ppPL)
597 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
598 return WMPPlayer4_get_currentPlaylist(&This->IWMPPlayer4_iface, ppPL);
601 static HRESULT WINAPI WMPPlayer_put_currentPlaylist(IWMPPlayer *iface, IWMPPlaylist *pPL)
603 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
604 return WMPPlayer4_put_currentPlaylist(&This->IWMPPlayer4_iface, pPL);
607 static HRESULT WINAPI WMPPlayer_get_cdromCollection(IWMPPlayer *iface, IWMPCdromCollection **ppCdromCollection)
609 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
610 return WMPPlayer4_get_cdromCollection(&This->IWMPPlayer4_iface, ppCdromCollection);
613 static HRESULT WINAPI WMPPlayer_get_closedCaption(IWMPPlayer *iface, IWMPClosedCaption **ppClosedCaption)
615 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
616 return WMPPlayer4_get_closedCaption(&This->IWMPPlayer4_iface, ppClosedCaption);
619 static HRESULT WINAPI WMPPlayer_get_isOnline(IWMPPlayer *iface, VARIANT_BOOL *pfOnline)
621 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
622 return WMPPlayer4_get_isOnline(&This->IWMPPlayer4_iface, pfOnline);
625 static HRESULT WINAPI WMPPlayer_get_Error(IWMPPlayer *iface, IWMPError **ppError)
627 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
628 return WMPPlayer4_get_Error(&This->IWMPPlayer4_iface, ppError);
631 static HRESULT WINAPI WMPPlayer_get_Status(IWMPPlayer *iface, BSTR *pbstrStatus)
633 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
634 return WMPPlayer4_get_Status(&This->IWMPPlayer4_iface, pbstrStatus);
637 static HRESULT WINAPI WMPPlayer_get_enabled(IWMPPlayer *iface, VARIANT_BOOL *pbEnabled)
639 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
640 return WMPPlayer4_get_enabled(&This->IWMPPlayer4_iface, pbEnabled);
643 static HRESULT WINAPI WMPPlayer_put_enabled(IWMPPlayer *iface, VARIANT_BOOL enabled)
645 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
646 return WMPPlayer4_put_enabled(&This->IWMPPlayer4_iface, enabled);
649 static HRESULT WINAPI WMPPlayer_get_fullScreen(IWMPPlayer *iface, VARIANT_BOOL *pbFullScreen)
651 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
652 return WMPPlayer4_get_fullScreen(&This->IWMPPlayer4_iface, pbFullScreen);
655 static HRESULT WINAPI WMPPlayer_put_fullScreen(IWMPPlayer *iface, VARIANT_BOOL fullscreen)
657 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
658 return WMPPlayer4_put_fullScreen(&This->IWMPPlayer4_iface, fullscreen);
661 static HRESULT WINAPI WMPPlayer_get_enableContextMenu(IWMPPlayer *iface, VARIANT_BOOL *pbEnableContextMenu)
663 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
664 return WMPPlayer4_get_enableContextMenu(&This->IWMPPlayer4_iface, pbEnableContextMenu);
667 static HRESULT WINAPI WMPPlayer_put_enableContextMenu(IWMPPlayer *iface, VARIANT_BOOL enable)
669 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
670 return WMPPlayer4_put_enableContextMenu(&This->IWMPPlayer4_iface, enable);
673 static HRESULT WINAPI WMPPlayer_put_uiMode(IWMPPlayer *iface, BSTR mode)
675 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
676 return WMPPlayer4_put_uiMode(&This->IWMPPlayer4_iface, mode);
679 static HRESULT WINAPI WMPPlayer_get_uiMode(IWMPPlayer *iface, BSTR *pbstrMode)
681 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
682 return WMPPlayer4_get_uiMode(&This->IWMPPlayer4_iface, pbstrMode);
685 static IWMPPlayerVtbl WMPPlayerVtbl = {
686 WMPPlayer_QueryInterface,
687 WMPPlayer_AddRef,
688 WMPPlayer_Release,
689 WMPPlayer_GetTypeInfoCount,
690 WMPPlayer_GetTypeInfo,
691 WMPPlayer_GetIDsOfNames,
692 WMPPlayer_Invoke,
693 WMPPlayer_close,
694 WMPPlayer_get_URL,
695 WMPPlayer_put_URL,
696 WMPPlayer_get_openState,
697 WMPPlayer_get_playState,
698 WMPPlayer_get_controls,
699 WMPPlayer_get_settings,
700 WMPPlayer_get_currentMedia,
701 WMPPlayer_put_currentMedia,
702 WMPPlayer_get_mediaCollection,
703 WMPPlayer_get_playlistCollection,
704 WMPPlayer_get_versionInfo,
705 WMPPlayer_launchURL,
706 WMPPlayer_get_network,
707 WMPPlayer_get_currentPlaylist,
708 WMPPlayer_put_currentPlaylist,
709 WMPPlayer_get_cdromCollection,
710 WMPPlayer_get_closedCaption,
711 WMPPlayer_get_isOnline,
712 WMPPlayer_get_Error,
713 WMPPlayer_get_Status,
714 WMPPlayer_get_enabled,
715 WMPPlayer_put_enabled,
716 WMPPlayer_get_fullScreen,
717 WMPPlayer_put_fullScreen,
718 WMPPlayer_get_enableContextMenu,
719 WMPPlayer_put_enableContextMenu,
720 WMPPlayer_put_uiMode,
721 WMPPlayer_get_uiMode,
725 static IWMPPlayer4Vtbl WMPPlayer4Vtbl = {
726 WMPPlayer4_QueryInterface,
727 WMPPlayer4_AddRef,
728 WMPPlayer4_Release,
729 WMPPlayer4_GetTypeInfoCount,
730 WMPPlayer4_GetTypeInfo,
731 WMPPlayer4_GetIDsOfNames,
732 WMPPlayer4_Invoke,
733 WMPPlayer4_close,
734 WMPPlayer4_get_URL,
735 WMPPlayer4_put_URL,
736 WMPPlayer4_get_openState,
737 WMPPlayer4_get_playState,
738 WMPPlayer4_get_controls,
739 WMPPlayer4_get_settings,
740 WMPPlayer4_get_currentMedia,
741 WMPPlayer4_put_currentMedia,
742 WMPPlayer4_get_mediaCollection,
743 WMPPlayer4_get_playlistCollection,
744 WMPPlayer4_get_versionInfo,
745 WMPPlayer4_launchURL,
746 WMPPlayer4_get_network,
747 WMPPlayer4_get_currentPlaylist,
748 WMPPlayer4_put_currentPlaylist,
749 WMPPlayer4_get_cdromCollection,
750 WMPPlayer4_get_closedCaption,
751 WMPPlayer4_get_isOnline,
752 WMPPlayer4_get_Error,
753 WMPPlayer4_get_Status,
754 WMPPlayer4_get_dvd,
755 WMPPlayer4_newPlaylist,
756 WMPPlayer4_newMedia,
757 WMPPlayer4_get_enabled,
758 WMPPlayer4_put_enabled,
759 WMPPlayer4_get_fullScreen,
760 WMPPlayer4_put_fullScreen,
761 WMPPlayer4_get_enableContextMenu,
762 WMPPlayer4_put_enableContextMenu,
763 WMPPlayer4_put_uiMode,
764 WMPPlayer4_get_uiMode,
765 WMPPlayer4_get_stretchToFit,
766 WMPPlayer4_put_stretchToFit,
767 WMPPlayer4_get_windowlessVideo,
768 WMPPlayer4_put_windowlessVideo,
769 WMPPlayer4_get_isRemote,
770 WMPPlayer4_get_playerApplication,
771 WMPPlayer4_openPlayer
774 static inline WindowsMediaPlayer *impl_from_IWMPSettings(IWMPSettings *iface)
776 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPSettings_iface);
779 static HRESULT WINAPI WMPSettings_QueryInterface(IWMPSettings *iface, REFIID riid, void **ppv)
781 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
782 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
785 static ULONG WINAPI WMPSettings_AddRef(IWMPSettings *iface)
787 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
788 return IOleObject_AddRef(&This->IOleObject_iface);
791 static ULONG WINAPI WMPSettings_Release(IWMPSettings *iface)
793 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
794 return IOleObject_Release(&This->IOleObject_iface);
797 static HRESULT WINAPI WMPSettings_GetTypeInfoCount(IWMPSettings *iface, UINT *pctinfo)
799 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
800 FIXME("(%p)->(%p)\n", This, pctinfo);
801 return E_NOTIMPL;
804 static HRESULT WINAPI WMPSettings_GetTypeInfo(IWMPSettings *iface, UINT iTInfo,
805 LCID lcid, ITypeInfo **ppTInfo)
807 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
808 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
809 return E_NOTIMPL;
812 static HRESULT WINAPI WMPSettings_GetIDsOfNames(IWMPSettings *iface, REFIID riid,
813 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
815 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
816 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
817 return E_NOTIMPL;
820 static HRESULT WINAPI WMPSettings_Invoke(IWMPSettings *iface, DISPID dispIdMember,
821 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
822 EXCEPINFO *pExcepInfo, UINT *puArgErr)
824 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
825 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
826 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
827 return E_NOTIMPL;
830 static HRESULT WINAPI WMPSettings_get_isAvailable(IWMPSettings *iface, BSTR item, VARIANT_BOOL *p)
832 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
833 FIXME("(%p)->(%s %p)\n", This, debugstr_w(item), p);
834 return E_NOTIMPL;
837 static HRESULT WINAPI WMPSettings_get_autoStart(IWMPSettings *iface, VARIANT_BOOL *p)
839 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
840 TRACE("(%p)->(%p)\n", This, p);
841 if (!p)
842 return E_POINTER;
843 *p = This->auto_start;
844 return S_OK;
847 static HRESULT WINAPI WMPSettings_put_autoStart(IWMPSettings *iface, VARIANT_BOOL v)
849 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
850 TRACE("(%p)->(%x)\n", This, v);
851 This->auto_start = v;
852 return S_OK;
855 static HRESULT WINAPI WMPSettings_get_baseURL(IWMPSettings *iface, BSTR *p)
857 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
858 FIXME("(%p)->(%p)\n", This, p);
859 return E_NOTIMPL;
862 static HRESULT WINAPI WMPSettings_put_baseURL(IWMPSettings *iface, BSTR v)
864 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
865 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
866 return E_NOTIMPL;
869 static HRESULT WINAPI WMPSettings_get_defaultFrame(IWMPSettings *iface, BSTR *p)
871 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
872 FIXME("(%p)->(%p)\n", This, p);
873 return E_NOTIMPL;
876 static HRESULT WINAPI WMPSettings_put_defaultFrame(IWMPSettings *iface, BSTR v)
878 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
879 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
880 return E_NOTIMPL;
883 static HRESULT WINAPI WMPSettings_get_invokeURLs(IWMPSettings *iface, VARIANT_BOOL *p)
885 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
887 TRACE("(%p)->(%p)\n", This, p);
889 if (!p)
890 return E_POINTER;
891 *p = This->invoke_urls;
892 return S_OK;
895 static HRESULT WINAPI WMPSettings_put_invokeURLs(IWMPSettings *iface, VARIANT_BOOL v)
897 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
898 /* Leaving as FIXME as we don't currently use this */
899 FIXME("(%p)->(%x)\n", This, v);
900 This->invoke_urls = v;
901 return S_OK;
904 static HRESULT WINAPI WMPSettings_get_mute(IWMPSettings *iface, VARIANT_BOOL *p)
906 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
907 FIXME("(%p)->(%p)\n", This, p);
908 return E_NOTIMPL;
911 static HRESULT WINAPI WMPSettings_put_mute(IWMPSettings *iface, VARIANT_BOOL v)
913 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
914 FIXME("(%p)->(%x)\n", This, v);
915 return E_NOTIMPL;
918 static HRESULT WINAPI WMPSettings_get_playCount(IWMPSettings *iface, LONG *p)
920 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
921 FIXME("(%p)->(%p)\n", This, p);
922 return E_NOTIMPL;
925 static HRESULT WINAPI WMPSettings_put_playCount(IWMPSettings *iface, LONG v)
927 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
928 FIXME("(%p)->(%d)\n", This, v);
929 return E_NOTIMPL;
932 static HRESULT WINAPI WMPSettings_get_rate(IWMPSettings *iface, double *p)
934 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
935 FIXME("(%p)->(%p)\n", This, p);
936 return E_NOTIMPL;
939 static HRESULT WINAPI WMPSettings_put_rate(IWMPSettings *iface, double v)
941 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
942 FIXME("(%p)->(%lf)\n", This, v);
943 return E_NOTIMPL;
946 static HRESULT WINAPI WMPSettings_get_balance(IWMPSettings *iface, LONG *p)
948 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
949 FIXME("(%p)->(%p)\n", This, p);
950 return E_NOTIMPL;
953 static HRESULT WINAPI WMPSettings_put_balance(IWMPSettings *iface, LONG v)
955 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
956 FIXME("(%p)->(%d)\n", This, v);
957 return E_NOTIMPL;
960 static HRESULT WINAPI WMPSettings_get_volume(IWMPSettings *iface, LONG *p)
962 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
963 TRACE("(%p)->(%p)\n", This, p);
964 if (!p)
965 return E_POINTER;
966 *p = This->volume;
967 return S_OK;
970 static HRESULT WINAPI WMPSettings_put_volume(IWMPSettings *iface, LONG v)
972 HRESULT hres;
973 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
974 TRACE("(%p)->(%d)\n", This, v);
975 This->volume = v;
976 if (!This->filter_graph) {
977 hres = S_OK;
978 } else {
979 /* IBasicAudio - [-10000, 0], wmp - [0, 100] */
980 v = 10000 * v / 100 - 10000;
981 hres = IBasicAudio_put_Volume(This->basic_audio, v);
983 return hres;
986 static HRESULT WINAPI WMPSettings_getMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL *p)
988 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
989 FIXME("(%p)->(%s %p)\n", This, debugstr_w(mode), p);
990 return E_NOTIMPL;
993 static HRESULT WINAPI WMPSettings_setMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL v)
995 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
996 FIXME("(%p)->(%s %x)\n", This, debugstr_w(mode), v);
997 return E_NOTIMPL;
1000 static HRESULT WINAPI WMPSettings_get_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL *p)
1002 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1004 TRACE("(%p)->(%p)\n", This, p);
1006 if (!p)
1007 return E_POINTER;
1008 *p = This->enable_error_dialogs;
1009 return S_OK;
1012 static HRESULT WINAPI WMPSettings_put_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL v)
1014 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1015 /* Leaving as FIXME as we don't currently use this */
1016 FIXME("(%p)->(%x)\n", This, v);
1017 This->enable_error_dialogs = v;
1018 return S_OK;
1021 static const IWMPSettingsVtbl WMPSettingsVtbl = {
1022 WMPSettings_QueryInterface,
1023 WMPSettings_AddRef,
1024 WMPSettings_Release,
1025 WMPSettings_GetTypeInfoCount,
1026 WMPSettings_GetTypeInfo,
1027 WMPSettings_GetIDsOfNames,
1028 WMPSettings_Invoke,
1029 WMPSettings_get_isAvailable,
1030 WMPSettings_get_autoStart,
1031 WMPSettings_put_autoStart,
1032 WMPSettings_get_baseURL,
1033 WMPSettings_put_baseURL,
1034 WMPSettings_get_defaultFrame,
1035 WMPSettings_put_defaultFrame,
1036 WMPSettings_get_invokeURLs,
1037 WMPSettings_put_invokeURLs,
1038 WMPSettings_get_mute,
1039 WMPSettings_put_mute,
1040 WMPSettings_get_playCount,
1041 WMPSettings_put_playCount,
1042 WMPSettings_get_rate,
1043 WMPSettings_put_rate,
1044 WMPSettings_get_balance,
1045 WMPSettings_put_balance,
1046 WMPSettings_get_volume,
1047 WMPSettings_put_volume,
1048 WMPSettings_getMode,
1049 WMPSettings_setMode,
1050 WMPSettings_get_enableErrorDialogs,
1051 WMPSettings_put_enableErrorDialogs
1054 static HRESULT WINAPI WMPNetwork_QueryInterface(IWMPNetwork *iface, REFIID riid, void **ppv)
1056 if(IsEqualGUID(riid, &IID_IDispatch)) {
1057 *ppv = iface;
1058 }else if(IsEqualGUID(riid, &IID_IWMPNetwork)) {
1059 *ppv = iface;
1060 }else {
1061 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid));
1062 *ppv = NULL;
1063 return E_NOINTERFACE;
1066 IUnknown_AddRef((IUnknown*)*ppv);
1067 return S_OK;
1070 static ULONG WINAPI WMPNetwork_AddRef(IWMPNetwork *iface)
1072 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1073 return IOleObject_AddRef(&This->IOleObject_iface);
1076 static ULONG WINAPI WMPNetwork_Release(IWMPNetwork *iface)
1078 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1079 return IOleObject_Release(&This->IOleObject_iface);
1082 static HRESULT WINAPI WMPNetwork_GetTypeInfoCount(IWMPNetwork *iface, UINT *pctinfo)
1084 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1085 FIXME("(%p)->(%p)\n", This, pctinfo);
1086 return E_NOTIMPL;
1089 static HRESULT WINAPI WMPNetwork_GetTypeInfo(IWMPNetwork *iface, UINT iTInfo,
1090 LCID lcid, ITypeInfo **ppTInfo)
1092 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1093 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
1094 return E_NOTIMPL;
1097 static HRESULT WINAPI WMPNetwork_GetIDsOfNames(IWMPNetwork *iface, REFIID riid,
1098 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1100 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1101 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1102 return E_NOTIMPL;
1105 static HRESULT WINAPI WMPNetwork_Invoke(IWMPNetwork *iface, DISPID dispIdMember,
1106 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1107 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1109 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1110 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1111 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1112 return E_NOTIMPL;
1115 static HRESULT WINAPI WMPNetwork_get_bandWidth(IWMPNetwork *iface, LONG *plBandwidth)
1117 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1118 FIXME("(%p)->(%p)\n", This, plBandwidth);
1119 return E_NOTIMPL;
1122 static HRESULT WINAPI WMPNetwork_get_recoveredPackets(IWMPNetwork *iface, LONG *plRecoveredPackets)
1124 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1125 FIXME("(%p)->(%p)\n", This, plRecoveredPackets);
1126 return E_NOTIMPL;
1129 static HRESULT WINAPI WMPNetwork_get_sourceProtocol(IWMPNetwork *iface, BSTR *pbstrSourceProtocol)
1131 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1132 FIXME("(%p)->(%p)\n", This, pbstrSourceProtocol);
1133 return E_NOTIMPL;
1136 static HRESULT WINAPI WMPNetwork_get_receivedPackets(IWMPNetwork *iface, LONG *plReceivedPackets)
1138 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1139 FIXME("(%p)->(%p)\n", This, plReceivedPackets);
1140 return E_NOTIMPL;
1143 static HRESULT WINAPI WMPNetwork_get_lostPackets(IWMPNetwork *iface, LONG *plLostPackets)
1145 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1146 FIXME("(%p)->(%p)\n", This, plLostPackets);
1147 return E_NOTIMPL;
1150 static HRESULT WINAPI WMPNetwork_get_receptionQuality(IWMPNetwork *iface, LONG *plReceptionQuality)
1152 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1153 FIXME("(%p)->(%p)\n", This, plReceptionQuality);
1154 return E_NOTIMPL;
1157 static HRESULT WINAPI WMPNetwork_get_bufferingCount(IWMPNetwork *iface, LONG *plBufferingCount)
1159 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1160 FIXME("(%p)->(%p)\n", This, plBufferingCount);
1161 return E_NOTIMPL;
1164 static HRESULT WINAPI WMPNetwork_get_bufferingProgress(IWMPNetwork *iface, LONG *plBufferingProgress)
1166 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1167 TRACE("(%p)->(%p)\n", This, plBufferingProgress);
1168 if (!This->filter_graph) {
1169 return S_FALSE;
1171 /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
1172 * For file sources FileAsyncReader->Length should work
1173 * */
1174 FIXME("stub: Returning buffering progress 100\n");
1175 *plBufferingProgress = 100;
1177 return S_OK;
1180 static HRESULT WINAPI WMPNetwork_get_bufferingTime(IWMPNetwork *iface, LONG *plBufferingTime)
1182 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1183 FIXME("(%p)->(%p)\n", This, plBufferingTime);
1184 return E_NOTIMPL;
1187 static HRESULT WINAPI WMPNetwork_put_bufferingTime(IWMPNetwork *iface, LONG lBufferingTime)
1189 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1190 FIXME("(%p)->(%d)\n", This, lBufferingTime);
1191 return E_NOTIMPL;
1194 static HRESULT WINAPI WMPNetwork_get_frameRate(IWMPNetwork *iface, LONG *plFrameRate)
1196 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1197 FIXME("(%p)->(%p)\n", This, plFrameRate);
1198 return E_NOTIMPL;
1201 static HRESULT WINAPI WMPNetwork_get_maxBitRate(IWMPNetwork *iface, LONG *plBitRate)
1203 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1204 FIXME("(%p)->(%p)\n", This, plBitRate);
1205 return E_NOTIMPL;
1208 static HRESULT WINAPI WMPNetwork_get_bitRate(IWMPNetwork *iface, LONG *plBitRate)
1210 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1211 FIXME("(%p)->(%p)\n", This, plBitRate);
1212 return E_NOTIMPL;
1215 static HRESULT WINAPI WMPNetwork_getProxySettings(IWMPNetwork *iface, BSTR bstrProtocol, LONG *plProxySetting)
1217 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1218 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), plProxySetting);
1219 return E_NOTIMPL;
1222 static HRESULT WINAPI WMPNetwork_setProxySettings(IWMPNetwork *iface, BSTR bstrProtocol, LONG lProxySetting)
1224 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1225 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), lProxySetting);
1226 return E_NOTIMPL;
1229 static HRESULT WINAPI WMPNetwork_getProxyName(IWMPNetwork *iface, BSTR bstrProtocol, BSTR *pbstrProxyName)
1231 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1232 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pbstrProxyName);
1233 return E_NOTIMPL;
1236 static HRESULT WINAPI WMPNetwork_setProxyName(IWMPNetwork *iface, BSTR bstrProtocol, BSTR bstrProxyName)
1238 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1239 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrProtocol), debugstr_w(bstrProxyName));
1240 return E_NOTIMPL;
1243 static HRESULT WINAPI WMPNetwork_getProxyPort(IWMPNetwork *iface, BSTR bstrProtocol, LONG *plProxyPort)
1245 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1246 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), plProxyPort);
1247 return E_NOTIMPL;
1250 static HRESULT WINAPI WMPNetwork_setProxyPort(IWMPNetwork *iface, BSTR bstrProtocol, LONG lProxyPort)
1252 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1253 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), lProxyPort);
1254 return E_NOTIMPL;
1257 static HRESULT WINAPI WMPNetwork_getProxyExceptionList(IWMPNetwork *iface, BSTR bstrProtocol, BSTR *pbstrExceptionList)
1259 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1260 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pbstrExceptionList);
1261 return E_NOTIMPL;
1264 static HRESULT WINAPI WMPNetwork_setProxyExceptionList(IWMPNetwork *iface, BSTR bstrProtocol, BSTR bstrExceptionList)
1266 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1267 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrProtocol), debugstr_w(bstrExceptionList));
1268 return E_NOTIMPL;
1271 static HRESULT WINAPI WMPNetwork_getProxyBypassForLocal(IWMPNetwork *iface, BSTR bstrProtocol, VARIANT_BOOL *pfBypassForLocal)
1273 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1274 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pfBypassForLocal);
1275 return E_NOTIMPL;
1278 static HRESULT WINAPI WMPNetwork_setProxyBypassForLocal(IWMPNetwork *iface, BSTR bstrProtocol, VARIANT_BOOL fBypassForLocal)
1280 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1281 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), fBypassForLocal);
1282 return E_NOTIMPL;
1285 static HRESULT WINAPI WMPNetwork_get_maxBandwidth(IWMPNetwork *iface, LONG *plMaxBandwidth)
1287 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1288 FIXME("(%p)->(%p)\n", This, plMaxBandwidth);
1289 return E_NOTIMPL;
1292 static HRESULT WINAPI WMPNetwork_put_maxBandwidth(IWMPNetwork *iface, LONG lMaxBandwidth)
1294 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1295 FIXME("(%p)->(%d)\n", This, lMaxBandwidth);
1296 return E_NOTIMPL;
1299 static HRESULT WINAPI WMPNetwork_get_downloadProgress(IWMPNetwork *iface, LONG *plDownloadProgress)
1301 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1302 TRACE("(%p)->(%p)\n", This, plDownloadProgress);
1303 if (!This->filter_graph) {
1304 return S_FALSE;
1306 /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
1307 * For file sources FileAsyncReader->Length could work or it should just be
1308 * 100
1309 * */
1310 FIXME("stub: Returning download progress 100\n");
1311 *plDownloadProgress = 100;
1313 return S_OK;
1316 static HRESULT WINAPI WMPNetwork_get_encodedFrameRate(IWMPNetwork *iface, LONG *plFrameRate)
1318 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1319 FIXME("(%p)->(%p)\n", This, plFrameRate);
1320 return E_NOTIMPL;
1323 static HRESULT WINAPI WMPNetwork_get_framesSkipped(IWMPNetwork *iface, LONG *plFrames)
1325 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1326 FIXME("(%p)->(%p)\n", This, plFrames);
1327 return E_NOTIMPL;
1330 static const IWMPNetworkVtbl WMPNetworkVtbl = {
1331 WMPNetwork_QueryInterface,
1332 WMPNetwork_AddRef,
1333 WMPNetwork_Release,
1334 WMPNetwork_GetTypeInfoCount,
1335 WMPNetwork_GetTypeInfo,
1336 WMPNetwork_GetIDsOfNames,
1337 WMPNetwork_Invoke,
1338 WMPNetwork_get_bandWidth,
1339 WMPNetwork_get_recoveredPackets,
1340 WMPNetwork_get_sourceProtocol,
1341 WMPNetwork_get_receivedPackets,
1342 WMPNetwork_get_lostPackets,
1343 WMPNetwork_get_receptionQuality,
1344 WMPNetwork_get_bufferingCount,
1345 WMPNetwork_get_bufferingProgress,
1346 WMPNetwork_get_bufferingTime,
1347 WMPNetwork_put_bufferingTime,
1348 WMPNetwork_get_frameRate,
1349 WMPNetwork_get_maxBitRate,
1350 WMPNetwork_get_bitRate,
1351 WMPNetwork_getProxySettings,
1352 WMPNetwork_setProxySettings,
1353 WMPNetwork_getProxyName,
1354 WMPNetwork_setProxyName,
1355 WMPNetwork_getProxyPort,
1356 WMPNetwork_setProxyPort,
1357 WMPNetwork_getProxyExceptionList,
1358 WMPNetwork_setProxyExceptionList,
1359 WMPNetwork_getProxyBypassForLocal,
1360 WMPNetwork_setProxyBypassForLocal,
1361 WMPNetwork_get_maxBandwidth,
1362 WMPNetwork_put_maxBandwidth,
1363 WMPNetwork_get_downloadProgress,
1364 WMPNetwork_get_encodedFrameRate,
1365 WMPNetwork_get_framesSkipped,
1368 static HRESULT WINAPI WMPControls_QueryInterface(IWMPControls *iface, REFIID riid, void **ppv)
1370 if(IsEqualGUID(riid, &IID_IUnknown)) {
1371 *ppv = iface;
1372 }else if(IsEqualGUID(riid, &IID_IDispatch)) {
1373 *ppv = iface;
1374 }else if(IsEqualGUID(riid, &IID_IWMPControls)) {
1375 *ppv = iface;
1376 }else {
1377 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid));
1378 *ppv = NULL;
1379 return E_NOINTERFACE;
1382 IUnknown_AddRef((IUnknown*)*ppv);
1383 return S_OK;
1386 static ULONG WINAPI WMPControls_AddRef(IWMPControls *iface)
1388 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1389 return IOleObject_AddRef(&This->IOleObject_iface);
1392 static ULONG WINAPI WMPControls_Release(IWMPControls *iface)
1394 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1395 return IOleObject_Release(&This->IOleObject_iface);
1398 static HRESULT WINAPI WMPControls_GetTypeInfoCount(IWMPControls *iface, UINT *pctinfo)
1400 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1401 FIXME("(%p)->(%p)\n", This, pctinfo);
1402 return E_NOTIMPL;
1405 static HRESULT WINAPI WMPControls_GetTypeInfo(IWMPControls *iface, UINT iTInfo,
1406 LCID lcid, ITypeInfo **ppTInfo)
1408 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1409 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
1410 return E_NOTIMPL;
1413 static HRESULT WINAPI WMPControls_GetIDsOfNames(IWMPControls *iface, REFIID riid,
1414 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1416 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1417 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1418 return E_NOTIMPL;
1421 static HRESULT WINAPI WMPControls_Invoke(IWMPControls *iface, DISPID dispIdMember,
1422 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1423 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1425 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1426 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1427 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1428 return E_NOTIMPL;
1431 static HRESULT WINAPI WMPControls_get_isAvailable(IWMPControls *iface, BSTR bstrItem, VARIANT_BOOL *pIsAvailable)
1433 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1434 static const WCHAR currentPosition[] = {'c','u','r','r','e','n','t','P','o','s','i','t','i','o','n',0};
1435 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrItem), pIsAvailable);
1436 if (!This->filter_graph) {
1437 *pIsAvailable = VARIANT_FALSE;
1438 } else if (strcmpW(currentPosition, bstrItem) == 0) {
1439 DWORD capabilities;
1440 IMediaSeeking_GetCapabilities(This->media_seeking, &capabilities);
1441 *pIsAvailable = (capabilities & AM_SEEKING_CanSeekAbsolute) ?
1442 VARIANT_TRUE : VARIANT_FALSE;
1443 } else {
1444 FIXME("%s not implemented\n", debugstr_w(bstrItem));
1445 return E_NOTIMPL;
1448 return S_OK;
1451 static HRESULT WINAPI WMPControls_play(IWMPControls *iface)
1453 HRESULT hres = S_OK;
1454 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1456 TRACE("(%p)\n", This);
1458 if (!This->media) {
1459 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
1462 if (!This->filter_graph) {
1463 hres = CoCreateInstance(&CLSID_FilterGraph,
1464 NULL,
1465 CLSCTX_INPROC_SERVER,
1466 &IID_IGraphBuilder,
1467 (void **)&This->filter_graph);
1468 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposOpeningUnknownURL);
1470 if (SUCCEEDED(hres))
1471 hres = IGraphBuilder_RenderFile(This->filter_graph, This->media->url, NULL);
1472 if (SUCCEEDED(hres))
1473 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposMediaOpen);
1474 if (SUCCEEDED(hres))
1475 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaControl,
1476 (void**)&This->media_control);
1477 if (SUCCEEDED(hres))
1478 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaSeeking,
1479 (void**)&This->media_seeking);
1480 if (SUCCEEDED(hres))
1481 hres = IMediaSeeking_SetTimeFormat(This->media_seeking, &TIME_FORMAT_MEDIA_TIME);
1482 if (SUCCEEDED(hres))
1483 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaEvent,
1484 (void**)&This->media_event);
1485 if (SUCCEEDED(hres))
1487 IMediaEventEx *media_event_ex = NULL;
1488 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaEventEx,
1489 (void**)&media_event_ex);
1490 if (SUCCEEDED(hres)) {
1491 hres = IMediaEventEx_SetNotifyWindow(media_event_ex, (OAHWND)This->msg_window,
1492 WM_WMPEVENT, (LONG_PTR)This);
1493 IMediaEventEx_Release(media_event_ex);
1496 if (SUCCEEDED(hres))
1497 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IBasicAudio, (void**)&This->basic_audio);
1498 if (SUCCEEDED(hres))
1499 hres = IWMPSettings_put_volume(&This->IWMPSettings_iface, This->volume);
1502 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
1504 if (SUCCEEDED(hres))
1505 hres = IMediaControl_Run(This->media_control);
1507 if (hres == S_FALSE) {
1508 hres = S_OK; /* S_FALSE will mean that graph is transitioning and that is fine */
1511 if (SUCCEEDED(hres)) {
1512 LONGLONG duration;
1513 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsPlaying);
1514 if (SUCCEEDED(IMediaSeeking_GetDuration(This->media_seeking, &duration)))
1515 This->media->duration = (DOUBLE)duration / 10000000.0f;
1516 } else {
1517 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsUndefined);
1520 return hres;
1523 static HRESULT WINAPI WMPControls_stop(IWMPControls *iface)
1525 HRESULT hres = S_OK;
1526 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1527 TRACE("(%p)\n", This);
1528 if (!This->filter_graph) {
1529 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
1531 if (This->media_control) {
1532 hres = IMediaControl_Stop(This->media_control);
1533 IMediaControl_Release(This->media_control);
1535 if (This->media_event) {
1536 IMediaEvent_Release(This->media_event);
1538 if (This->media_seeking) {
1539 IMediaSeeking_Release(This->media_seeking);
1541 if (This->basic_audio) {
1542 IBasicAudio_Release(This->basic_audio);
1544 IGraphBuilder_Release(This->filter_graph);
1545 This->filter_graph = NULL;
1546 This->media_control = NULL;
1547 This->media_event = NULL;
1548 This->media_seeking = NULL;
1549 This->basic_audio = NULL;
1551 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistOpenNoMedia);
1552 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsStopped);
1553 return hres;
1556 static HRESULT WINAPI WMPControls_pause(IWMPControls *iface)
1558 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1559 FIXME("(%p)\n", This);
1560 return E_NOTIMPL;
1563 static HRESULT WINAPI WMPControls_fastForward(IWMPControls *iface)
1565 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1566 FIXME("(%p)\n", This);
1567 return E_NOTIMPL;
1570 static HRESULT WINAPI WMPControls_fastReverse(IWMPControls *iface)
1572 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1573 FIXME("(%p)\n", This);
1574 return E_NOTIMPL;
1577 static HRESULT WINAPI WMPControls_get_currentPosition(IWMPControls *iface, DOUBLE *pdCurrentPosition)
1579 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1580 HRESULT hres;
1581 LONGLONG currentPosition;
1583 TRACE("(%p)->(%p)\n", This, pdCurrentPosition);
1584 if (!This->media_seeking)
1585 return S_FALSE;
1587 hres = IMediaSeeking_GetCurrentPosition(This->media_seeking, &currentPosition);
1588 *pdCurrentPosition = (DOUBLE) currentPosition / 10000000.0f;
1589 TRACE("hres: %d, pos: %f\n", hres, *pdCurrentPosition);
1590 return hres;
1593 static HRESULT WINAPI WMPControls_put_currentPosition(IWMPControls *iface, DOUBLE dCurrentPosition)
1595 LONGLONG Current;
1596 HRESULT hres;
1597 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1598 TRACE("(%p)->(%f)\n", This, dCurrentPosition);
1599 if (!This->media_seeking)
1600 return S_FALSE;
1602 Current = 10000000 * dCurrentPosition;
1603 hres = IMediaSeeking_SetPositions(This->media_seeking, &Current,
1604 AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
1606 return hres;
1609 static HRESULT WINAPI WMPControls_get_currentPositionString(IWMPControls *iface, BSTR *pbstrCurrentPosition)
1611 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1612 FIXME("(%p)->(%p)\n", This, pbstrCurrentPosition);
1613 return E_NOTIMPL;
1616 static HRESULT WINAPI WMPControls_next(IWMPControls *iface)
1618 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1619 FIXME("(%p)\n", This);
1620 return E_NOTIMPL;
1623 static HRESULT WINAPI WMPControls_previous(IWMPControls *iface)
1625 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1626 FIXME("(%p)\n", This);
1627 return E_NOTIMPL;
1630 static HRESULT WINAPI WMPControls_get_currentItem(IWMPControls *iface, IWMPMedia **ppIWMPMedia)
1632 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1633 FIXME("(%p)->(%p)\n", This, ppIWMPMedia);
1634 return E_NOTIMPL;
1637 static HRESULT WINAPI WMPControls_put_currentItem(IWMPControls *iface, IWMPMedia *pIWMPMedia)
1639 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1640 FIXME("(%p)->(%p)\n", This, pIWMPMedia);
1641 return E_NOTIMPL;
1644 static HRESULT WINAPI WMPControls_get_currentMarker(IWMPControls *iface, LONG *plMarker)
1646 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1647 FIXME("(%p)->(%p)\n", This, plMarker);
1648 return E_NOTIMPL;
1651 static HRESULT WINAPI WMPControls_put_currentMarker(IWMPControls *iface, LONG lMarker)
1653 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1654 FIXME("(%p)->(%d)\n", This, lMarker);
1655 return E_NOTIMPL;
1658 static HRESULT WINAPI WMPControls_playItem(IWMPControls *iface, IWMPMedia *pIWMPMedia)
1660 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1661 FIXME("(%p)->(%p)\n", This, pIWMPMedia);
1662 return E_NOTIMPL;
1665 static const IWMPControlsVtbl WMPControlsVtbl = {
1666 WMPControls_QueryInterface,
1667 WMPControls_AddRef,
1668 WMPControls_Release,
1669 WMPControls_GetTypeInfoCount,
1670 WMPControls_GetTypeInfo,
1671 WMPControls_GetIDsOfNames,
1672 WMPControls_Invoke,
1673 WMPControls_get_isAvailable,
1674 WMPControls_play,
1675 WMPControls_stop,
1676 WMPControls_pause,
1677 WMPControls_fastForward,
1678 WMPControls_fastReverse,
1679 WMPControls_get_currentPosition,
1680 WMPControls_put_currentPosition,
1681 WMPControls_get_currentPositionString,
1682 WMPControls_next,
1683 WMPControls_previous,
1684 WMPControls_get_currentItem,
1685 WMPControls_put_currentItem,
1686 WMPControls_get_currentMarker,
1687 WMPControls_put_currentMarker,
1688 WMPControls_playItem,
1691 static HRESULT WINAPI WMPMedia_QueryInterface(IWMPMedia *iface, REFIID riid, void **ppv)
1693 WMPMedia *This = impl_from_IWMPMedia(iface);
1694 TRACE("(%p)\n", This);
1695 if(IsEqualGUID(&IID_IUnknown, riid)) {
1696 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1697 *ppv = &This->IWMPMedia_iface;
1698 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1699 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1700 *ppv = &This->IWMPMedia_iface;
1701 }else if(IsEqualGUID(&IID_IWMPMedia, riid)) {
1702 TRACE("(%p)->(IID_IWMPMedia %p)\n", This, ppv);
1703 *ppv = &This->IWMPMedia_iface;
1704 }else {
1705 WARN("Unsupported interface %s\n", debugstr_guid(riid));
1706 *ppv = NULL;
1707 return E_NOINTERFACE;
1710 IUnknown_AddRef((IUnknown*)*ppv);
1711 return S_OK;
1714 static ULONG WINAPI WMPMedia_AddRef(IWMPMedia *iface)
1716 WMPMedia *This = impl_from_IWMPMedia(iface);
1717 LONG ref = InterlockedIncrement(&This->ref);
1719 TRACE("(%p) ref=%d\n", This, ref);
1721 return ref;
1724 static ULONG WINAPI WMPMedia_Release(IWMPMedia *iface)
1726 WMPMedia *This = impl_from_IWMPMedia(iface);
1727 LONG ref = InterlockedDecrement(&This->ref);
1729 TRACE("(%p) ref=%d\n", This, ref);
1731 if(!ref) {
1732 heap_free(This->url);
1733 heap_free(This);
1736 return ref;
1739 static HRESULT WINAPI WMPMedia_GetTypeInfoCount(IWMPMedia *iface, UINT *pctinfo)
1741 WMPMedia *This = impl_from_IWMPMedia(iface);
1742 FIXME("(%p)->(%p)\n", This, pctinfo);
1743 return E_NOTIMPL;
1746 static HRESULT WINAPI WMPMedia_GetTypeInfo(IWMPMedia *iface, UINT iTInfo,
1747 LCID lcid, ITypeInfo **ppTInfo)
1749 WMPMedia *This = impl_from_IWMPMedia(iface);
1750 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
1751 return E_NOTIMPL;
1754 static HRESULT WINAPI WMPMedia_GetIDsOfNames(IWMPMedia *iface, REFIID riid,
1755 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1757 WMPMedia *This = impl_from_IWMPMedia(iface);
1758 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1759 return E_NOTIMPL;
1762 static HRESULT WINAPI WMPMedia_Invoke(IWMPMedia *iface, DISPID dispIdMember,
1763 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1764 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1766 WMPMedia *This = impl_from_IWMPMedia(iface);
1767 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1768 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1769 return E_NOTIMPL;
1772 static HRESULT WINAPI WMPMedia_get_isIdentical(IWMPMedia *iface, IWMPMedia *other, VARIANT_BOOL *pvBool)
1774 WMPMedia *This = impl_from_IWMPMedia(iface);
1775 FIXME("(%p)->(%p, %p)\n", This, other, pvBool);
1776 return E_NOTIMPL;
1779 static HRESULT WINAPI WMPMedia_get_sourceURL(IWMPMedia *iface, BSTR *url)
1781 WMPMedia *This = impl_from_IWMPMedia(iface);
1783 TRACE("(%p)->(%p)\n", This, url);
1785 return return_bstr(This->url, url);
1788 static HRESULT WINAPI WMPMedia_get_name(IWMPMedia *iface, BSTR *name)
1790 WMPMedia *This = impl_from_IWMPMedia(iface);
1792 FIXME("(%p)->(%p)\n", This, name);
1794 /* FIXME: this should be a display name */
1795 return return_bstr(This->url, name);
1798 static HRESULT WINAPI WMPMedia_put_name(IWMPMedia *iface, BSTR pbstrName)
1800 WMPMedia *This = impl_from_IWMPMedia(iface);
1801 FIXME("(%p)->(%s)\n", This, debugstr_w(pbstrName));
1802 return E_NOTIMPL;
1805 static HRESULT WINAPI WMPMedia_get_imageSourceWidth(IWMPMedia *iface, LONG *pWidth)
1807 WMPMedia *This = impl_from_IWMPMedia(iface);
1808 FIXME("(%p)->(%p)\n", This, pWidth);
1809 return E_NOTIMPL;
1812 static HRESULT WINAPI WMPMedia_get_imageSourceHeight(IWMPMedia *iface, LONG *pHeight)
1814 WMPMedia *This = impl_from_IWMPMedia(iface);
1815 FIXME("(%p)->(%p)\n", This, pHeight);
1816 return E_NOTIMPL;
1819 static HRESULT WINAPI WMPMedia_get_markerCount(IWMPMedia *iface, LONG* pMarkerCount)
1821 WMPMedia *This = impl_from_IWMPMedia(iface);
1822 FIXME("(%p)->(%p)\n", This, pMarkerCount);
1823 return E_NOTIMPL;
1826 static HRESULT WINAPI WMPMedia_getMarkerTime(IWMPMedia *iface, LONG MarkerNum, DOUBLE *pMarkerTime)
1828 WMPMedia *This = impl_from_IWMPMedia(iface);
1829 FIXME("(%p)->(%d, %p)\n", This, MarkerNum, pMarkerTime);
1830 return E_NOTIMPL;
1833 static HRESULT WINAPI WMPMedia_getMarkerName(IWMPMedia *iface, LONG MarkerNum, BSTR *pbstrMarkerName)
1835 WMPMedia *This = impl_from_IWMPMedia(iface);
1836 FIXME("(%p)->(%d, %p)\n", This, MarkerNum, pbstrMarkerName);
1837 return E_NOTIMPL;
1840 static HRESULT WINAPI WMPMedia_get_duration(IWMPMedia *iface, DOUBLE *pDuration)
1842 /* MSDN: If this property is used with a media item other than the one
1843 * specified in Player.currentMedia, it may not contain a valid value. */
1844 WMPMedia *This = impl_from_IWMPMedia(iface);
1845 TRACE("(%p)->(%p)\n", This, pDuration);
1846 *pDuration = This->duration;
1847 return S_OK;
1850 static HRESULT WINAPI WMPMedia_get_durationString(IWMPMedia *iface, BSTR *pbstrDuration)
1852 WMPMedia *This = impl_from_IWMPMedia(iface);
1853 FIXME("(%p)->(%p)\n", This, pbstrDuration);
1854 return E_NOTIMPL;
1857 static HRESULT WINAPI WMPMedia_get_attributeCount(IWMPMedia *iface, LONG *plCount)
1859 WMPMedia *This = impl_from_IWMPMedia(iface);
1860 FIXME("(%p)->(%p)\n", This, plCount);
1861 return E_NOTIMPL;
1864 static HRESULT WINAPI WMPMedia_getAttributeName(IWMPMedia *iface, LONG lIndex, BSTR *pbstrItemName)
1866 WMPMedia *This = impl_from_IWMPMedia(iface);
1867 FIXME("(%p)->(%d, %p)\n", This, lIndex, pbstrItemName);
1868 return E_NOTIMPL;
1871 static HRESULT WINAPI WMPMedia_getItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR *pbstrVal)
1873 WMPMedia *This = impl_from_IWMPMedia(iface);
1874 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pbstrVal);
1875 return E_NOTIMPL;
1878 static HRESULT WINAPI WMPMedia_setItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR bstrVal)
1880 WMPMedia *This = impl_from_IWMPMedia(iface);
1881 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrItemName), debugstr_w(bstrVal));
1882 return E_NOTIMPL;
1885 static HRESULT WINAPI WMPMedia_getItemInfoByAtom(IWMPMedia *iface, LONG lAtom, BSTR *pbstrVal)
1887 WMPMedia *This = impl_from_IWMPMedia(iface);
1888 FIXME("(%p)->(%d, %p)\n", This, lAtom, pbstrVal);
1889 return E_NOTIMPL;
1892 static HRESULT WINAPI WMPMedia_isMemberOf(IWMPMedia *iface, IWMPPlaylist *pPlaylist, VARIANT_BOOL *pvarfIsMemberOf)
1894 WMPMedia *This = impl_from_IWMPMedia(iface);
1895 FIXME("(%p)->(%p, %p)\n", This, pPlaylist, pvarfIsMemberOf);
1896 return E_NOTIMPL;
1899 static HRESULT WINAPI WMPMedia_isReadOnlyItem(IWMPMedia *iface, BSTR bstrItemName, VARIANT_BOOL *pvarfIsReadOnly)
1901 WMPMedia *This = impl_from_IWMPMedia(iface);
1902 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pvarfIsReadOnly);
1903 return E_NOTIMPL;
1906 static const IWMPMediaVtbl WMPMediaVtbl = {
1907 WMPMedia_QueryInterface,
1908 WMPMedia_AddRef,
1909 WMPMedia_Release,
1910 WMPMedia_GetTypeInfoCount,
1911 WMPMedia_GetTypeInfo,
1912 WMPMedia_GetIDsOfNames,
1913 WMPMedia_Invoke,
1914 WMPMedia_get_isIdentical,
1915 WMPMedia_get_sourceURL,
1916 WMPMedia_get_name,
1917 WMPMedia_put_name,
1918 WMPMedia_get_imageSourceWidth,
1919 WMPMedia_get_imageSourceHeight,
1920 WMPMedia_get_markerCount,
1921 WMPMedia_getMarkerTime,
1922 WMPMedia_getMarkerName,
1923 WMPMedia_get_duration,
1924 WMPMedia_get_durationString,
1925 WMPMedia_get_attributeCount,
1926 WMPMedia_getAttributeName,
1927 WMPMedia_getItemInfo,
1928 WMPMedia_setItemInfo,
1929 WMPMedia_getItemInfoByAtom,
1930 WMPMedia_isMemberOf,
1931 WMPMedia_isReadOnlyItem
1934 static LRESULT WINAPI player_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1936 if (msg == WM_WMPEVENT && wParam == 0) {
1937 WindowsMediaPlayer *wmp = (WindowsMediaPlayer*)lParam;
1938 LONG event_code;
1939 LONG_PTR p1, p2;
1940 HRESULT hr;
1941 if (wmp->media_event) {
1942 do {
1943 hr = IMediaEvent_GetEvent(wmp->media_event, &event_code, &p1, &p2, 0);
1944 if (SUCCEEDED(hr)) {
1945 TRACE("got event_code = 0x%02x\n", event_code);
1946 IMediaEvent_FreeEventParams(wmp->media_event, event_code, p1, p2);
1947 /* For now we only handle EC_COMPLETE */
1948 if (event_code == EC_COMPLETE) {
1949 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsMediaEnded);
1950 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
1951 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsStopped);
1954 } while (hr == S_OK);
1955 } else {
1956 FIXME("Got event from quartz when interfaces are already released\n");
1959 return DefWindowProcW(hwnd, msg, wParam, lParam);
1962 static BOOL WINAPI register_player_msg_class(INIT_ONCE *once, void *param, void **context) {
1963 static WNDCLASSEXW wndclass = {
1964 sizeof(wndclass), CS_DBLCLKS, player_wnd_proc, 0, 0,
1965 NULL, NULL, NULL, NULL, NULL,
1966 WMPmessageW, NULL
1969 wndclass.hInstance = wmp_instance;
1970 player_msg_class = RegisterClassExW(&wndclass);
1971 WM_WMPEVENT= RegisterWindowMessageW(WMPmessageW);
1972 return TRUE;
1975 void unregister_player_msg_class(void) {
1976 if(player_msg_class)
1977 UnregisterClassW(MAKEINTRESOURCEW(player_msg_class), wmp_instance);
1980 BOOL init_player(WindowsMediaPlayer *wmp)
1982 InitOnceExecuteOnce(&class_init_once, register_player_msg_class, NULL, NULL);
1983 wmp->msg_window = CreateWindowW( MAKEINTRESOURCEW(player_msg_class), NULL, 0, 0,
1984 0, 0, 0, HWND_MESSAGE, 0, wmp_instance, wmp );
1985 if (!wmp->msg_window) {
1986 ERR("Failed to create message window, GetLastError: %d\n", GetLastError());
1987 return FALSE;
1989 if (!WM_WMPEVENT) {
1990 ERR("Failed to register window message, GetLastError: %d\n", GetLastError());
1991 return FALSE;
1994 wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl;
1995 wmp->IWMPPlayer_iface.lpVtbl = &WMPPlayerVtbl;
1996 wmp->IWMPSettings_iface.lpVtbl = &WMPSettingsVtbl;
1997 wmp->IWMPControls_iface.lpVtbl = &WMPControlsVtbl;
1998 wmp->IWMPNetwork_iface.lpVtbl = &WMPNetworkVtbl;
2000 wmp->invoke_urls = VARIANT_TRUE;
2001 wmp->auto_start = VARIANT_TRUE;
2002 wmp->volume = 100;
2003 return TRUE;
2006 void destroy_player(WindowsMediaPlayer *wmp)
2008 IWMPControls_stop(&wmp->IWMPControls_iface);
2009 if (wmp->media)
2010 IWMPMedia_Release(&wmp->media->IWMPMedia_iface);
2011 DestroyWindow(wmp->msg_window);
2014 WMPMedia *unsafe_impl_from_IWMPMedia(IWMPMedia *iface)
2016 if (iface->lpVtbl == &WMPMediaVtbl) {
2017 return CONTAINING_RECORD(iface, WMPMedia, IWMPMedia_iface);
2019 return NULL;
2022 HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
2024 WMPMedia *media;
2026 media = heap_alloc_zero(sizeof(*media));
2027 if (!media)
2028 return E_OUTOFMEMORY;
2030 media->IWMPMedia_iface.lpVtbl = &WMPMediaVtbl;
2031 media->url = url ? heap_strdupW(url) : heap_strdupW(emptyW);
2032 media->duration = duration;
2033 media->ref = 1;
2035 if (media->url) {
2036 *ppMedia = &media->IWMPMedia_iface;
2038 return S_OK;
2040 IWMPMedia_Release(&media->IWMPMedia_iface);
2041 return E_OUTOFMEMORY;