wmp: Add seeking and duration.
[wine.git] / dlls / wmp / player.c
blob0a6d598dc22b5a4f15c9a67c970e39e6ec82981e
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};
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 *pbstrURL)
134 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
135 TRACE("(%p)->(%p)\n", This, pbstrURL);
136 if(This->wmpmedia == NULL) {
137 return S_FALSE;
139 return IWMPMedia_get_sourceURL(This->wmpmedia, pbstrURL);
142 static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url)
144 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
145 IWMPMedia *media;
146 HRESULT hres;
147 TRACE("(%p)->(%s)\n", This, debugstr_w(url));
148 if(url == NULL) {
149 return E_POINTER;
152 hres = create_media_from_url(url, &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 hres = IWMPControls_play(&This->IWMPControls_iface);
166 return hres;
169 static HRESULT WINAPI WMPPlayer4_get_openState(IWMPPlayer4 *iface, WMPOpenState *pwmpos)
171 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
172 FIXME("(%p)->(%p)\n", This, pwmpos);
173 return E_NOTIMPL;
176 static HRESULT WINAPI WMPPlayer4_get_playState(IWMPPlayer4 *iface, WMPPlayState *pwmpps)
178 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
179 FIXME("(%p)->(%p)\n", This, pwmpps);
180 return E_NOTIMPL;
183 static HRESULT WINAPI WMPPlayer4_get_controls(IWMPPlayer4 *iface, IWMPControls **ppControl)
185 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
187 TRACE("(%p)->(%p)\n", This, ppControl);
189 IWMPControls_AddRef(&This->IWMPControls_iface);
190 *ppControl = &This->IWMPControls_iface;
191 return S_OK;
194 static HRESULT WINAPI WMPPlayer4_get_settings(IWMPPlayer4 *iface, IWMPSettings **ppSettings)
196 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
198 TRACE("(%p)->(%p)\n", This, ppSettings);
200 IWMPSettings_AddRef(&This->IWMPSettings_iface);
201 *ppSettings = &This->IWMPSettings_iface;
202 return S_OK;
205 static HRESULT WINAPI WMPPlayer4_get_currentMedia(IWMPPlayer4 *iface, IWMPMedia **ppMedia)
207 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
208 TRACE("(%p)->(%p)\n", This, ppMedia);
209 if(This->wmpmedia == NULL) {
210 return S_FALSE;
212 IWMPMedia_AddRef(This->wmpmedia);
213 *ppMedia = This->wmpmedia;
214 return S_OK;
217 static HRESULT WINAPI WMPPlayer4_put_currentMedia(IWMPPlayer4 *iface, IWMPMedia *pMedia)
219 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
220 TRACE("(%p)->(%p)\n", This, pMedia);
222 if(pMedia == NULL) {
223 return E_POINTER;
225 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistChanging);
226 if(This->wmpmedia != NULL) {
227 IWMPControls_stop(&This->IWMPControls_iface);
228 IWMPMedia_Release(This->wmpmedia);
230 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistChanged);
231 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistOpenNoMedia);
233 IWMPMedia_AddRef(pMedia);
234 This->wmpmedia = pMedia;
235 return S_OK;
238 static HRESULT WINAPI WMPPlayer4_get_mediaCollection(IWMPPlayer4 *iface, IWMPMediaCollection **ppMediaCollection)
240 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
241 FIXME("(%p)->(%p)\n", This, ppMediaCollection);
242 return E_NOTIMPL;
245 static HRESULT WINAPI WMPPlayer4_get_playlistCollection(IWMPPlayer4 *iface, IWMPPlaylistCollection **ppPlaylistCollection)
247 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
248 FIXME("(%p)->(%p)\n", This, ppPlaylistCollection);
249 return E_NOTIMPL;
252 static HRESULT WINAPI WMPPlayer4_get_versionInfo(IWMPPlayer4 *iface, BSTR *version)
254 static const WCHAR versionW[] = {'1','2','.','0','.','7','6','0','1','.','1','6','9','8','2',0};
255 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
257 TRACE("(%p)->(%p)\n", This, version);
259 if (!version)
260 return E_POINTER;
262 *version = SysAllocString(versionW);
263 return *version ? S_OK : E_OUTOFMEMORY;
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 **ppMedia)
348 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
349 FIXME("(%p)->(%p)\n", This, ppMedia);
350 return E_NOTIMPL;
353 static HRESULT WINAPI WMPPlayer4_get_enabled(IWMPPlayer4 *iface, VARIANT_BOOL *pbEnabled)
355 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
356 FIXME("(%p)->(%p)\n", This, pbEnabled);
357 return E_NOTIMPL;
360 static HRESULT WINAPI WMPPlayer4_put_enabled(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
362 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
363 FIXME("(%p)->(%x)\n", This, enabled);
364 return E_NOTIMPL;
367 static HRESULT WINAPI WMPPlayer4_get_fullScreen(IWMPPlayer4 *iface, VARIANT_BOOL *pbFullScreen)
369 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
370 FIXME("(%p)->(%p)\n", This, pbFullScreen);
371 return E_NOTIMPL;
374 static HRESULT WINAPI WMPPlayer4_put_fullScreen(IWMPPlayer4 *iface, VARIANT_BOOL fullscreen)
376 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
377 FIXME("(%p)->(%x)\n", This, fullscreen);
378 return E_NOTIMPL;
381 static HRESULT WINAPI WMPPlayer4_get_enableContextMenu(IWMPPlayer4 *iface, VARIANT_BOOL *pbEnableContextMenu)
383 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
384 FIXME("(%p)->(%p)\n", This, pbEnableContextMenu);
385 return E_NOTIMPL;
388 static HRESULT WINAPI WMPPlayer4_put_enableContextMenu(IWMPPlayer4 *iface, VARIANT_BOOL enable)
390 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
391 FIXME("(%p)->(%x)\n", This, enable);
392 return E_NOTIMPL;
395 static HRESULT WINAPI WMPPlayer4_put_uiMode(IWMPPlayer4 *iface, BSTR mode)
397 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
398 FIXME("(%p)->(%s)\n", This, debugstr_w(mode));
399 return E_NOTIMPL;
402 static HRESULT WINAPI WMPPlayer4_get_uiMode(IWMPPlayer4 *iface, BSTR *pbstrMode)
404 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
405 FIXME("(%p)->(%p)\n", This, pbstrMode);
406 return E_NOTIMPL;
409 static HRESULT WINAPI WMPPlayer4_get_stretchToFit(IWMPPlayer4 *iface, VARIANT_BOOL *enabled)
411 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
412 FIXME("(%p)->(%p)\n", This, enabled);
413 return E_NOTIMPL;
416 static HRESULT WINAPI WMPPlayer4_put_stretchToFit(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
418 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
419 FIXME("(%p)->(%x)\n", This, enabled);
420 return E_NOTIMPL;
423 static HRESULT WINAPI WMPPlayer4_get_windowlessVideo(IWMPPlayer4 *iface, VARIANT_BOOL *enabled)
425 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
426 FIXME("(%p)->(%p)\n", This, enabled);
427 return E_NOTIMPL;
430 static HRESULT WINAPI WMPPlayer4_put_windowlessVideo(IWMPPlayer4 *iface, VARIANT_BOOL enabled)
432 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
433 FIXME("(%p)->(%x)\n", This, enabled);
434 return E_NOTIMPL;
437 static HRESULT WINAPI WMPPlayer4_get_isRemote(IWMPPlayer4 *iface, VARIANT_BOOL *pvarfIsRemote)
439 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
440 FIXME("(%p)->(%p)\n", This, pvarfIsRemote);
441 return E_NOTIMPL;
444 static HRESULT WINAPI WMPPlayer4_get_playerApplication(IWMPPlayer4 *iface, IWMPPlayerApplication **ppIWMPPlayerApplication)
446 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
447 FIXME("(%p)->(%p)\n", This, ppIWMPPlayerApplication);
448 return E_NOTIMPL;
451 static HRESULT WINAPI WMPPlayer4_openPlayer(IWMPPlayer4 *iface, BSTR url)
453 WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
454 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
455 return E_NOTIMPL;
458 static HRESULT WINAPI WMPPlayer_QueryInterface(IWMPPlayer *iface, REFIID riid, void **ppv)
460 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
461 return WMPPlayer4_QueryInterface(&This->IWMPPlayer4_iface, riid, ppv);
464 static ULONG WINAPI WMPPlayer_AddRef(IWMPPlayer *iface)
466 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
467 return WMPPlayer4_AddRef(&This->IWMPPlayer4_iface);
470 static ULONG WINAPI WMPPlayer_Release(IWMPPlayer *iface)
472 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
473 return WMPPlayer4_Release(&This->IWMPPlayer4_iface);
476 static HRESULT WINAPI WMPPlayer_GetTypeInfoCount(IWMPPlayer *iface, UINT *pctinfo)
478 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
479 return WMPPlayer4_GetTypeInfoCount(&This->IWMPPlayer4_iface, pctinfo);
482 static HRESULT WINAPI WMPPlayer_GetTypeInfo(IWMPPlayer *iface, UINT iTInfo,
483 LCID lcid, ITypeInfo **ppTInfo)
485 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
487 return WMPPlayer4_GetTypeInfo(&This->IWMPPlayer4_iface, iTInfo,
488 lcid, ppTInfo);
491 static HRESULT WINAPI WMPPlayer_GetIDsOfNames(IWMPPlayer *iface, REFIID riid,
492 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
494 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
495 return WMPPlayer4_GetIDsOfNames(&This->IWMPPlayer4_iface, riid,
496 rgszNames, cNames, lcid, rgDispId);
499 static HRESULT WINAPI WMPPlayer_Invoke(IWMPPlayer *iface, DISPID dispIdMember,
500 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
501 EXCEPINFO *pExcepInfo, UINT *puArgErr)
503 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
504 return WMPPlayer4_Invoke(&This->IWMPPlayer4_iface, dispIdMember,
505 riid, lcid, wFlags, pDispParams, pVarResult,
506 pExcepInfo, puArgErr);
509 static HRESULT WINAPI WMPPlayer_close(IWMPPlayer *iface)
511 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
512 return WMPPlayer4_close(&This->IWMPPlayer4_iface);
515 static HRESULT WINAPI WMPPlayer_get_URL(IWMPPlayer *iface, BSTR *pbstrURL)
517 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
518 return WMPPlayer4_get_URL(&This->IWMPPlayer4_iface, pbstrURL);
521 static HRESULT WINAPI WMPPlayer_put_URL(IWMPPlayer *iface, BSTR url)
523 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
524 return WMPPlayer4_put_URL(&This->IWMPPlayer4_iface, url);
527 static HRESULT WINAPI WMPPlayer_get_openState(IWMPPlayer *iface, WMPOpenState *pwmpos)
529 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
530 return WMPPlayer4_get_openState(&This->IWMPPlayer4_iface, pwmpos);
533 static HRESULT WINAPI WMPPlayer_get_playState(IWMPPlayer *iface, WMPPlayState *pwmpps)
535 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
536 return WMPPlayer4_get_playState(&This->IWMPPlayer4_iface, pwmpps);
539 static HRESULT WINAPI WMPPlayer_get_controls(IWMPPlayer *iface, IWMPControls **ppControl)
541 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
542 return WMPPlayer4_get_controls(&This->IWMPPlayer4_iface, ppControl);
545 static HRESULT WINAPI WMPPlayer_get_settings(IWMPPlayer *iface, IWMPSettings **ppSettings)
547 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
548 return WMPPlayer4_get_settings(&This->IWMPPlayer4_iface, ppSettings);
551 static HRESULT WINAPI WMPPlayer_get_currentMedia(IWMPPlayer *iface, IWMPMedia **ppMedia)
553 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
554 return WMPPlayer4_get_currentMedia(&This->IWMPPlayer4_iface, ppMedia);
557 static HRESULT WINAPI WMPPlayer_put_currentMedia(IWMPPlayer *iface, IWMPMedia *pMedia)
559 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
560 return WMPPlayer4_put_currentMedia(&This->IWMPPlayer4_iface, pMedia);
563 static HRESULT WINAPI WMPPlayer_get_mediaCollection(IWMPPlayer *iface, IWMPMediaCollection **ppMediaCollection)
565 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
566 return WMPPlayer4_get_mediaCollection(&This->IWMPPlayer4_iface, ppMediaCollection);
569 static HRESULT WINAPI WMPPlayer_get_playlistCollection(IWMPPlayer *iface, IWMPPlaylistCollection **ppPlaylistCollection)
571 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
572 return WMPPlayer4_get_playlistCollection(&This->IWMPPlayer4_iface, ppPlaylistCollection);
575 static HRESULT WINAPI WMPPlayer_get_versionInfo(IWMPPlayer *iface, BSTR *version)
577 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
578 return WMPPlayer4_get_versionInfo(&This->IWMPPlayer4_iface, version);
581 static HRESULT WINAPI WMPPlayer_launchURL(IWMPPlayer *iface, BSTR url)
583 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
584 return WMPPlayer4_launchURL(&This->IWMPPlayer4_iface, url);
587 static HRESULT WINAPI WMPPlayer_get_network(IWMPPlayer *iface, IWMPNetwork **ppQNI)
589 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
590 return WMPPlayer4_get_network(&This->IWMPPlayer4_iface, ppQNI);
593 static HRESULT WINAPI WMPPlayer_get_currentPlaylist(IWMPPlayer *iface, IWMPPlaylist **ppPL)
595 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
596 return WMPPlayer4_get_currentPlaylist(&This->IWMPPlayer4_iface, ppPL);
599 static HRESULT WINAPI WMPPlayer_put_currentPlaylist(IWMPPlayer *iface, IWMPPlaylist *pPL)
601 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
602 return WMPPlayer4_put_currentPlaylist(&This->IWMPPlayer4_iface, pPL);
605 static HRESULT WINAPI WMPPlayer_get_cdromCollection(IWMPPlayer *iface, IWMPCdromCollection **ppCdromCollection)
607 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
608 return WMPPlayer4_get_cdromCollection(&This->IWMPPlayer4_iface, ppCdromCollection);
611 static HRESULT WINAPI WMPPlayer_get_closedCaption(IWMPPlayer *iface, IWMPClosedCaption **ppClosedCaption)
613 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
614 return WMPPlayer4_get_closedCaption(&This->IWMPPlayer4_iface, ppClosedCaption);
617 static HRESULT WINAPI WMPPlayer_get_isOnline(IWMPPlayer *iface, VARIANT_BOOL *pfOnline)
619 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
620 return WMPPlayer4_get_isOnline(&This->IWMPPlayer4_iface, pfOnline);
623 static HRESULT WINAPI WMPPlayer_get_Error(IWMPPlayer *iface, IWMPError **ppError)
625 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
626 return WMPPlayer4_get_Error(&This->IWMPPlayer4_iface, ppError);
629 static HRESULT WINAPI WMPPlayer_get_Status(IWMPPlayer *iface, BSTR *pbstrStatus)
631 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
632 return WMPPlayer4_get_Status(&This->IWMPPlayer4_iface, pbstrStatus);
635 static HRESULT WINAPI WMPPlayer_get_enabled(IWMPPlayer *iface, VARIANT_BOOL *pbEnabled)
637 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
638 return WMPPlayer4_get_enabled(&This->IWMPPlayer4_iface, pbEnabled);
641 static HRESULT WINAPI WMPPlayer_put_enabled(IWMPPlayer *iface, VARIANT_BOOL enabled)
643 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
644 return WMPPlayer4_put_enabled(&This->IWMPPlayer4_iface, enabled);
647 static HRESULT WINAPI WMPPlayer_get_fullScreen(IWMPPlayer *iface, VARIANT_BOOL *pbFullScreen)
649 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
650 return WMPPlayer4_get_fullScreen(&This->IWMPPlayer4_iface, pbFullScreen);
653 static HRESULT WINAPI WMPPlayer_put_fullScreen(IWMPPlayer *iface, VARIANT_BOOL fullscreen)
655 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
656 return WMPPlayer4_put_fullScreen(&This->IWMPPlayer4_iface, fullscreen);
659 static HRESULT WINAPI WMPPlayer_get_enableContextMenu(IWMPPlayer *iface, VARIANT_BOOL *pbEnableContextMenu)
661 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
662 return WMPPlayer4_get_enableContextMenu(&This->IWMPPlayer4_iface, pbEnableContextMenu);
665 static HRESULT WINAPI WMPPlayer_put_enableContextMenu(IWMPPlayer *iface, VARIANT_BOOL enable)
667 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
668 return WMPPlayer4_put_enableContextMenu(&This->IWMPPlayer4_iface, enable);
671 static HRESULT WINAPI WMPPlayer_put_uiMode(IWMPPlayer *iface, BSTR mode)
673 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
674 return WMPPlayer4_put_uiMode(&This->IWMPPlayer4_iface, mode);
677 static HRESULT WINAPI WMPPlayer_get_uiMode(IWMPPlayer *iface, BSTR *pbstrMode)
679 WindowsMediaPlayer *This = impl_from_IWMPPlayer(iface);
680 return WMPPlayer4_get_uiMode(&This->IWMPPlayer4_iface, pbstrMode);
683 static IWMPPlayerVtbl WMPPlayerVtbl = {
684 WMPPlayer_QueryInterface,
685 WMPPlayer_AddRef,
686 WMPPlayer_Release,
687 WMPPlayer_GetTypeInfoCount,
688 WMPPlayer_GetTypeInfo,
689 WMPPlayer_GetIDsOfNames,
690 WMPPlayer_Invoke,
691 WMPPlayer_close,
692 WMPPlayer_get_URL,
693 WMPPlayer_put_URL,
694 WMPPlayer_get_openState,
695 WMPPlayer_get_playState,
696 WMPPlayer_get_controls,
697 WMPPlayer_get_settings,
698 WMPPlayer_get_currentMedia,
699 WMPPlayer_put_currentMedia,
700 WMPPlayer_get_mediaCollection,
701 WMPPlayer_get_playlistCollection,
702 WMPPlayer_get_versionInfo,
703 WMPPlayer_launchURL,
704 WMPPlayer_get_network,
705 WMPPlayer_get_currentPlaylist,
706 WMPPlayer_put_currentPlaylist,
707 WMPPlayer_get_cdromCollection,
708 WMPPlayer_get_closedCaption,
709 WMPPlayer_get_isOnline,
710 WMPPlayer_get_Error,
711 WMPPlayer_get_Status,
712 WMPPlayer_get_enabled,
713 WMPPlayer_put_enabled,
714 WMPPlayer_get_fullScreen,
715 WMPPlayer_put_fullScreen,
716 WMPPlayer_get_enableContextMenu,
717 WMPPlayer_put_enableContextMenu,
718 WMPPlayer_put_uiMode,
719 WMPPlayer_get_uiMode,
723 static IWMPPlayer4Vtbl WMPPlayer4Vtbl = {
724 WMPPlayer4_QueryInterface,
725 WMPPlayer4_AddRef,
726 WMPPlayer4_Release,
727 WMPPlayer4_GetTypeInfoCount,
728 WMPPlayer4_GetTypeInfo,
729 WMPPlayer4_GetIDsOfNames,
730 WMPPlayer4_Invoke,
731 WMPPlayer4_close,
732 WMPPlayer4_get_URL,
733 WMPPlayer4_put_URL,
734 WMPPlayer4_get_openState,
735 WMPPlayer4_get_playState,
736 WMPPlayer4_get_controls,
737 WMPPlayer4_get_settings,
738 WMPPlayer4_get_currentMedia,
739 WMPPlayer4_put_currentMedia,
740 WMPPlayer4_get_mediaCollection,
741 WMPPlayer4_get_playlistCollection,
742 WMPPlayer4_get_versionInfo,
743 WMPPlayer4_launchURL,
744 WMPPlayer4_get_network,
745 WMPPlayer4_get_currentPlaylist,
746 WMPPlayer4_put_currentPlaylist,
747 WMPPlayer4_get_cdromCollection,
748 WMPPlayer4_get_closedCaption,
749 WMPPlayer4_get_isOnline,
750 WMPPlayer4_get_Error,
751 WMPPlayer4_get_Status,
752 WMPPlayer4_get_dvd,
753 WMPPlayer4_newPlaylist,
754 WMPPlayer4_newMedia,
755 WMPPlayer4_get_enabled,
756 WMPPlayer4_put_enabled,
757 WMPPlayer4_get_fullScreen,
758 WMPPlayer4_put_fullScreen,
759 WMPPlayer4_get_enableContextMenu,
760 WMPPlayer4_put_enableContextMenu,
761 WMPPlayer4_put_uiMode,
762 WMPPlayer4_get_uiMode,
763 WMPPlayer4_get_stretchToFit,
764 WMPPlayer4_put_stretchToFit,
765 WMPPlayer4_get_windowlessVideo,
766 WMPPlayer4_put_windowlessVideo,
767 WMPPlayer4_get_isRemote,
768 WMPPlayer4_get_playerApplication,
769 WMPPlayer4_openPlayer
772 static inline WindowsMediaPlayer *impl_from_IWMPSettings(IWMPSettings *iface)
774 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPSettings_iface);
777 static HRESULT WINAPI WMPSettings_QueryInterface(IWMPSettings *iface, REFIID riid, void **ppv)
779 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
780 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
783 static ULONG WINAPI WMPSettings_AddRef(IWMPSettings *iface)
785 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
786 return IOleObject_AddRef(&This->IOleObject_iface);
789 static ULONG WINAPI WMPSettings_Release(IWMPSettings *iface)
791 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
792 return IOleObject_Release(&This->IOleObject_iface);
795 static HRESULT WINAPI WMPSettings_GetTypeInfoCount(IWMPSettings *iface, UINT *pctinfo)
797 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
798 FIXME("(%p)->(%p)\n", This, pctinfo);
799 return E_NOTIMPL;
802 static HRESULT WINAPI WMPSettings_GetTypeInfo(IWMPSettings *iface, UINT iTInfo,
803 LCID lcid, ITypeInfo **ppTInfo)
805 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
806 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
807 return E_NOTIMPL;
810 static HRESULT WINAPI WMPSettings_GetIDsOfNames(IWMPSettings *iface, REFIID riid,
811 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
813 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
814 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
815 return E_NOTIMPL;
818 static HRESULT WINAPI WMPSettings_Invoke(IWMPSettings *iface, DISPID dispIdMember,
819 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
820 EXCEPINFO *pExcepInfo, UINT *puArgErr)
822 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
823 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
824 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
825 return E_NOTIMPL;
828 static HRESULT WINAPI WMPSettings_get_isAvailable(IWMPSettings *iface, BSTR item, VARIANT_BOOL *p)
830 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
831 FIXME("(%p)->(%s %p)\n", This, debugstr_w(item), p);
832 return E_NOTIMPL;
835 static HRESULT WINAPI WMPSettings_get_autoStart(IWMPSettings *iface, VARIANT_BOOL *p)
837 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
838 TRACE("(%p)->(%p)\n", This, p);
839 if (!p)
840 return E_POINTER;
841 *p = This->auto_start;
842 return S_OK;
845 static HRESULT WINAPI WMPSettings_put_autoStart(IWMPSettings *iface, VARIANT_BOOL v)
847 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
848 TRACE("(%p)->(%x)\n", This, v);
849 This->auto_start = v;
850 return S_OK;
853 static HRESULT WINAPI WMPSettings_get_baseURL(IWMPSettings *iface, BSTR *p)
855 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
856 FIXME("(%p)->(%p)\n", This, p);
857 return E_NOTIMPL;
860 static HRESULT WINAPI WMPSettings_put_baseURL(IWMPSettings *iface, BSTR v)
862 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
863 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
864 return E_NOTIMPL;
867 static HRESULT WINAPI WMPSettings_get_defaultFrame(IWMPSettings *iface, BSTR *p)
869 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
870 FIXME("(%p)->(%p)\n", This, p);
871 return E_NOTIMPL;
874 static HRESULT WINAPI WMPSettings_put_defaultFrame(IWMPSettings *iface, BSTR v)
876 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
877 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
878 return E_NOTIMPL;
881 static HRESULT WINAPI WMPSettings_get_invokeURLs(IWMPSettings *iface, VARIANT_BOOL *p)
883 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
885 TRACE("(%p)->(%p)\n", This, p);
887 if (!p)
888 return E_POINTER;
889 *p = This->invoke_urls;
890 return S_OK;
893 static HRESULT WINAPI WMPSettings_put_invokeURLs(IWMPSettings *iface, VARIANT_BOOL v)
895 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
896 /* Leaving as FIXME as we don't currently use this */
897 FIXME("(%p)->(%x)\n", This, v);
898 This->invoke_urls = v;
899 return S_OK;
902 static HRESULT WINAPI WMPSettings_get_mute(IWMPSettings *iface, VARIANT_BOOL *p)
904 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
905 FIXME("(%p)->(%p)\n", This, p);
906 return E_NOTIMPL;
909 static HRESULT WINAPI WMPSettings_put_mute(IWMPSettings *iface, VARIANT_BOOL v)
911 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
912 FIXME("(%p)->(%x)\n", This, v);
913 return E_NOTIMPL;
916 static HRESULT WINAPI WMPSettings_get_playCount(IWMPSettings *iface, LONG *p)
918 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
919 FIXME("(%p)->(%p)\n", This, p);
920 return E_NOTIMPL;
923 static HRESULT WINAPI WMPSettings_put_playCount(IWMPSettings *iface, LONG v)
925 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
926 FIXME("(%p)->(%d)\n", This, v);
927 return E_NOTIMPL;
930 static HRESULT WINAPI WMPSettings_get_rate(IWMPSettings *iface, double *p)
932 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
933 FIXME("(%p)->(%p)\n", This, p);
934 return E_NOTIMPL;
937 static HRESULT WINAPI WMPSettings_put_rate(IWMPSettings *iface, double v)
939 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
940 FIXME("(%p)->(%lf)\n", This, v);
941 return E_NOTIMPL;
944 static HRESULT WINAPI WMPSettings_get_balance(IWMPSettings *iface, LONG *p)
946 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
947 FIXME("(%p)->(%p)\n", This, p);
948 return E_NOTIMPL;
951 static HRESULT WINAPI WMPSettings_put_balance(IWMPSettings *iface, LONG v)
953 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
954 FIXME("(%p)->(%d)\n", This, v);
955 return E_NOTIMPL;
958 static HRESULT WINAPI WMPSettings_get_volume(IWMPSettings *iface, LONG *p)
960 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
961 FIXME("(%p)->(%p)\n", This, p);
962 return E_NOTIMPL;
965 static HRESULT WINAPI WMPSettings_put_volume(IWMPSettings *iface, LONG v)
967 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
968 FIXME("(%p)->(%d)\n", This, v);
969 return E_NOTIMPL;
972 static HRESULT WINAPI WMPSettings_getMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL *p)
974 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
975 FIXME("(%p)->(%s %p)\n", This, debugstr_w(mode), p);
976 return E_NOTIMPL;
979 static HRESULT WINAPI WMPSettings_setMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL v)
981 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
982 FIXME("(%p)->(%s %x)\n", This, debugstr_w(mode), v);
983 return E_NOTIMPL;
986 static HRESULT WINAPI WMPSettings_get_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL *p)
988 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
990 TRACE("(%p)->(%p)\n", This, p);
992 if (!p)
993 return E_POINTER;
994 *p = This->enable_error_dialogs;
995 return S_OK;
998 static HRESULT WINAPI WMPSettings_put_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL v)
1000 WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
1001 /* Leaving as FIXME as we don't currently use this */
1002 FIXME("(%p)->(%x)\n", This, v);
1003 This->enable_error_dialogs = v;
1004 return S_OK;
1007 static const IWMPSettingsVtbl WMPSettingsVtbl = {
1008 WMPSettings_QueryInterface,
1009 WMPSettings_AddRef,
1010 WMPSettings_Release,
1011 WMPSettings_GetTypeInfoCount,
1012 WMPSettings_GetTypeInfo,
1013 WMPSettings_GetIDsOfNames,
1014 WMPSettings_Invoke,
1015 WMPSettings_get_isAvailable,
1016 WMPSettings_get_autoStart,
1017 WMPSettings_put_autoStart,
1018 WMPSettings_get_baseURL,
1019 WMPSettings_put_baseURL,
1020 WMPSettings_get_defaultFrame,
1021 WMPSettings_put_defaultFrame,
1022 WMPSettings_get_invokeURLs,
1023 WMPSettings_put_invokeURLs,
1024 WMPSettings_get_mute,
1025 WMPSettings_put_mute,
1026 WMPSettings_get_playCount,
1027 WMPSettings_put_playCount,
1028 WMPSettings_get_rate,
1029 WMPSettings_put_rate,
1030 WMPSettings_get_balance,
1031 WMPSettings_put_balance,
1032 WMPSettings_get_volume,
1033 WMPSettings_put_volume,
1034 WMPSettings_getMode,
1035 WMPSettings_setMode,
1036 WMPSettings_get_enableErrorDialogs,
1037 WMPSettings_put_enableErrorDialogs
1040 static HRESULT WINAPI WMPNetwork_QueryInterface(IWMPNetwork *iface, REFIID riid, void **ppv)
1042 if(IsEqualGUID(riid, &IID_IDispatch)) {
1043 *ppv = iface;
1044 }else if(IsEqualGUID(riid, &IID_IWMPNetwork)) {
1045 *ppv = iface;
1046 }else {
1047 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid));
1048 *ppv = NULL;
1049 return E_NOINTERFACE;
1052 IUnknown_AddRef((IUnknown*)*ppv);
1053 return S_OK;
1056 static ULONG WINAPI WMPNetwork_AddRef(IWMPNetwork *iface)
1058 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1059 return IOleObject_AddRef(&This->IOleObject_iface);
1062 static ULONG WINAPI WMPNetwork_Release(IWMPNetwork *iface)
1064 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1065 return IOleObject_Release(&This->IOleObject_iface);
1068 static HRESULT WINAPI WMPNetwork_GetTypeInfoCount(IWMPNetwork *iface, UINT *pctinfo)
1070 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1071 FIXME("(%p)->(%p)\n", This, pctinfo);
1072 return E_NOTIMPL;
1075 static HRESULT WINAPI WMPNetwork_GetTypeInfo(IWMPNetwork *iface, UINT iTInfo,
1076 LCID lcid, ITypeInfo **ppTInfo)
1078 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1079 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
1080 return E_NOTIMPL;
1083 static HRESULT WINAPI WMPNetwork_GetIDsOfNames(IWMPNetwork *iface, REFIID riid,
1084 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1086 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1087 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1088 return E_NOTIMPL;
1091 static HRESULT WINAPI WMPNetwork_Invoke(IWMPNetwork *iface, DISPID dispIdMember,
1092 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1093 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1095 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1096 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1097 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1098 return E_NOTIMPL;
1101 static HRESULT WINAPI WMPNetwork_get_bandWidth(IWMPNetwork *iface, LONG *plBandwidth)
1103 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1104 FIXME("(%p)->(%p)\n", This, plBandwidth);
1105 return E_NOTIMPL;
1108 static HRESULT WINAPI WMPNetwork_get_recoveredPackets(IWMPNetwork *iface, LONG *plRecoveredPackets)
1110 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1111 FIXME("(%p)->(%p)\n", This, plRecoveredPackets);
1112 return E_NOTIMPL;
1115 static HRESULT WINAPI WMPNetwork_get_sourceProtocol(IWMPNetwork *iface, BSTR *pbstrSourceProtocol)
1117 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1118 FIXME("(%p)->(%p)\n", This, pbstrSourceProtocol);
1119 return E_NOTIMPL;
1122 static HRESULT WINAPI WMPNetwork_get_receivedPackets(IWMPNetwork *iface, LONG *plReceivedPackets)
1124 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1125 FIXME("(%p)->(%p)\n", This, plReceivedPackets);
1126 return E_NOTIMPL;
1129 static HRESULT WINAPI WMPNetwork_get_lostPackets(IWMPNetwork *iface, LONG *plLostPackets)
1131 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1132 FIXME("(%p)->(%p)\n", This, plLostPackets);
1133 return E_NOTIMPL;
1136 static HRESULT WINAPI WMPNetwork_get_receptionQuality(IWMPNetwork *iface, LONG *plReceptionQuality)
1138 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1139 FIXME("(%p)->(%p)\n", This, plReceptionQuality);
1140 return E_NOTIMPL;
1143 static HRESULT WINAPI WMPNetwork_get_bufferingCount(IWMPNetwork *iface, LONG *plBufferingCount)
1145 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1146 FIXME("(%p)->(%p)\n", This, plBufferingCount);
1147 return E_NOTIMPL;
1150 static HRESULT WINAPI WMPNetwork_get_bufferingProgress(IWMPNetwork *iface, LONG *plBufferingProgress)
1152 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1153 FIXME("(%p)->(%p)\n", This, plBufferingProgress);
1154 return E_NOTIMPL;
1157 static HRESULT WINAPI WMPNetwork_get_bufferingTime(IWMPNetwork *iface, LONG *plBufferingTime)
1159 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1160 FIXME("(%p)->(%p)\n", This, plBufferingTime);
1161 return E_NOTIMPL;
1164 static HRESULT WINAPI WMPNetwork_put_bufferingTime(IWMPNetwork *iface, LONG lBufferingTime)
1166 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1167 FIXME("(%p)->(%d)\n", This, lBufferingTime);
1168 return E_NOTIMPL;
1171 static HRESULT WINAPI WMPNetwork_get_frameRate(IWMPNetwork *iface, LONG *plFrameRate)
1173 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1174 FIXME("(%p)->(%p)\n", This, plFrameRate);
1175 return E_NOTIMPL;
1178 static HRESULT WINAPI WMPNetwork_get_maxBitRate(IWMPNetwork *iface, LONG *plBitRate)
1180 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1181 FIXME("(%p)->(%p)\n", This, plBitRate);
1182 return E_NOTIMPL;
1185 static HRESULT WINAPI WMPNetwork_get_bitRate(IWMPNetwork *iface, LONG *plBitRate)
1187 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1188 FIXME("(%p)->(%p)\n", This, plBitRate);
1189 return E_NOTIMPL;
1192 static HRESULT WINAPI WMPNetwork_getProxySettings(IWMPNetwork *iface, BSTR bstrProtocol, LONG *plProxySetting)
1194 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1195 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), plProxySetting);
1196 return E_NOTIMPL;
1199 static HRESULT WINAPI WMPNetwork_setProxySettings(IWMPNetwork *iface, BSTR bstrProtocol, LONG lProxySetting)
1201 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1202 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), lProxySetting);
1203 return E_NOTIMPL;
1206 static HRESULT WINAPI WMPNetwork_getProxyName(IWMPNetwork *iface, BSTR bstrProtocol, BSTR *pbstrProxyName)
1208 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1209 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pbstrProxyName);
1210 return E_NOTIMPL;
1213 static HRESULT WINAPI WMPNetwork_setProxyName(IWMPNetwork *iface, BSTR bstrProtocol, BSTR bstrProxyName)
1215 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1216 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrProtocol), debugstr_w(bstrProxyName));
1217 return E_NOTIMPL;
1220 static HRESULT WINAPI WMPNetwork_getProxyPort(IWMPNetwork *iface, BSTR bstrProtocol, LONG *plProxyPort)
1222 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1223 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), plProxyPort);
1224 return E_NOTIMPL;
1227 static HRESULT WINAPI WMPNetwork_setProxyPort(IWMPNetwork *iface, BSTR bstrProtocol, LONG lProxyPort)
1229 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1230 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), lProxyPort);
1231 return E_NOTIMPL;
1234 static HRESULT WINAPI WMPNetwork_getProxyExceptionList(IWMPNetwork *iface, BSTR bstrProtocol, BSTR *pbstrExceptionList)
1236 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1237 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pbstrExceptionList);
1238 return E_NOTIMPL;
1241 static HRESULT WINAPI WMPNetwork_setProxyExceptionList(IWMPNetwork *iface, BSTR bstrProtocol, BSTR bstrExceptionList)
1243 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1244 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrProtocol), debugstr_w(bstrExceptionList));
1245 return E_NOTIMPL;
1248 static HRESULT WINAPI WMPNetwork_getProxyBypassForLocal(IWMPNetwork *iface, BSTR bstrProtocol, VARIANT_BOOL *pfBypassForLocal)
1250 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1251 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrProtocol), pfBypassForLocal);
1252 return E_NOTIMPL;
1255 static HRESULT WINAPI WMPNetwork_setProxyBypassForLocal(IWMPNetwork *iface, BSTR bstrProtocol, VARIANT_BOOL fBypassForLocal)
1257 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1258 FIXME("(%p)->(%s, %d)\n", This, debugstr_w(bstrProtocol), fBypassForLocal);
1259 return E_NOTIMPL;
1262 static HRESULT WINAPI WMPNetwork_get_maxBandwidth(IWMPNetwork *iface, LONG *plMaxBandwidth)
1264 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1265 FIXME("(%p)->(%p)\n", This, plMaxBandwidth);
1266 return E_NOTIMPL;
1269 static HRESULT WINAPI WMPNetwork_put_maxBandwidth(IWMPNetwork *iface, LONG lMaxBandwidth)
1271 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1272 FIXME("(%p)->(%d)\n", This, lMaxBandwidth);
1273 return E_NOTIMPL;
1276 static HRESULT WINAPI WMPNetwork_get_downloadProgress(IWMPNetwork *iface, LONG *plDownloadProgress)
1278 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1279 FIXME("(%p)->(%p)\n", This, plDownloadProgress);
1280 return E_NOTIMPL;
1283 static HRESULT WINAPI WMPNetwork_get_encodedFrameRate(IWMPNetwork *iface, LONG *plFrameRate)
1285 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1286 FIXME("(%p)->(%p)\n", This, plFrameRate);
1287 return E_NOTIMPL;
1290 static HRESULT WINAPI WMPNetwork_get_framesSkipped(IWMPNetwork *iface, LONG *plFrames)
1292 WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
1293 FIXME("(%p)->(%p)\n", This, plFrames);
1294 return E_NOTIMPL;
1297 static const IWMPNetworkVtbl WMPNetworkVtbl = {
1298 WMPNetwork_QueryInterface,
1299 WMPNetwork_AddRef,
1300 WMPNetwork_Release,
1301 WMPNetwork_GetTypeInfoCount,
1302 WMPNetwork_GetTypeInfo,
1303 WMPNetwork_GetIDsOfNames,
1304 WMPNetwork_Invoke,
1305 WMPNetwork_get_bandWidth,
1306 WMPNetwork_get_recoveredPackets,
1307 WMPNetwork_get_sourceProtocol,
1308 WMPNetwork_get_receivedPackets,
1309 WMPNetwork_get_lostPackets,
1310 WMPNetwork_get_receptionQuality,
1311 WMPNetwork_get_bufferingCount,
1312 WMPNetwork_get_bufferingProgress,
1313 WMPNetwork_get_bufferingTime,
1314 WMPNetwork_put_bufferingTime,
1315 WMPNetwork_get_frameRate,
1316 WMPNetwork_get_maxBitRate,
1317 WMPNetwork_get_bitRate,
1318 WMPNetwork_getProxySettings,
1319 WMPNetwork_setProxySettings,
1320 WMPNetwork_getProxyName,
1321 WMPNetwork_setProxyName,
1322 WMPNetwork_getProxyPort,
1323 WMPNetwork_setProxyPort,
1324 WMPNetwork_getProxyExceptionList,
1325 WMPNetwork_setProxyExceptionList,
1326 WMPNetwork_getProxyBypassForLocal,
1327 WMPNetwork_setProxyBypassForLocal,
1328 WMPNetwork_get_maxBandwidth,
1329 WMPNetwork_put_maxBandwidth,
1330 WMPNetwork_get_downloadProgress,
1331 WMPNetwork_get_encodedFrameRate,
1332 WMPNetwork_get_framesSkipped,
1335 static HRESULT WINAPI WMPControls_QueryInterface(IWMPControls *iface, REFIID riid, void **ppv)
1337 if(IsEqualGUID(riid, &IID_IDispatch)) {
1338 *ppv = iface;
1339 }else if(IsEqualGUID(riid, &IID_IWMPControls)) {
1340 *ppv = iface;
1341 }else {
1342 WARN("Unsupported interface (%s)\n", wine_dbgstr_guid(riid));
1343 *ppv = NULL;
1344 return E_NOINTERFACE;
1347 IUnknown_AddRef((IUnknown*)*ppv);
1348 return S_OK;
1351 static ULONG WINAPI WMPControls_AddRef(IWMPControls *iface)
1353 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1354 return IOleObject_AddRef(&This->IOleObject_iface);
1357 static ULONG WINAPI WMPControls_Release(IWMPControls *iface)
1359 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1360 return IOleObject_Release(&This->IOleObject_iface);
1363 static HRESULT WINAPI WMPControls_GetTypeInfoCount(IWMPControls *iface, UINT *pctinfo)
1365 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1366 FIXME("(%p)->(%p)\n", This, pctinfo);
1367 return E_NOTIMPL;
1370 static HRESULT WINAPI WMPControls_GetTypeInfo(IWMPControls *iface, UINT iTInfo,
1371 LCID lcid, ITypeInfo **ppTInfo)
1373 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1374 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
1375 return E_NOTIMPL;
1378 static HRESULT WINAPI WMPControls_GetIDsOfNames(IWMPControls *iface, REFIID riid,
1379 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1381 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1382 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1383 return E_NOTIMPL;
1386 static HRESULT WINAPI WMPControls_Invoke(IWMPControls *iface, DISPID dispIdMember,
1387 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1388 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1390 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1391 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1392 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1393 return E_NOTIMPL;
1396 static HRESULT WINAPI WMPControls_get_isAvailable(IWMPControls *iface, BSTR bstrItem, VARIANT_BOOL *pIsAvailable)
1398 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1399 static const WCHAR currentPosition[] = {'c','u','r','r','e','n','t','P','o','s','i','t','i','o','n',0};
1400 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrItem), pIsAvailable);
1401 if (!This->filter_graph) {
1402 *pIsAvailable = VARIANT_FALSE;
1403 } else if (strcmpW(currentPosition, bstrItem) == 0) {
1404 DWORD capabilities;
1405 IMediaSeeking_GetCapabilities(This->media_seeking, &capabilities);
1406 *pIsAvailable = (capabilities & AM_SEEKING_CanSeekAbsolute) ?
1407 VARIANT_TRUE : VARIANT_FALSE;
1408 } else {
1409 FIXME("%s not implemented\n", debugstr_w(bstrItem));
1410 return E_NOTIMPL;
1413 return S_OK;
1416 static HRESULT WINAPI WMPControls_play(IWMPControls *iface)
1418 HRESULT hres = S_OK;
1419 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1420 WMPMedia *media;
1422 TRACE("(%p)\n", This);
1424 if (!This->wmpmedia) {
1425 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
1428 media = unsafe_impl_from_IWMPMedia(This->wmpmedia);
1429 if (!media) {
1430 FIXME("No support for non-builtin IWMPMedia implementations\n");
1431 return E_INVALIDARG;
1434 if (!This->filter_graph) {
1435 hres = CoCreateInstance(&CLSID_FilterGraph,
1436 NULL,
1437 CLSCTX_INPROC_SERVER,
1438 &IID_IGraphBuilder,
1439 (void **)&This->filter_graph);
1440 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposOpeningUnknownURL);
1442 if (SUCCEEDED(hres))
1443 hres = IGraphBuilder_RenderFile(This->filter_graph, media->url, NULL);
1444 if (SUCCEEDED(hres))
1445 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposMediaOpen);
1446 if (SUCCEEDED(hres))
1447 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaControl,
1448 (void**)&This->media_control);
1449 if (SUCCEEDED(hres))
1450 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaSeeking,
1451 (void**)&This->media_seeking);
1452 if (SUCCEEDED(hres))
1453 hres = IMediaSeeking_SetTimeFormat(This->media_seeking, &TIME_FORMAT_MEDIA_TIME);
1454 if (SUCCEEDED(hres))
1455 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaEvent,
1456 (void**)&This->media_event);
1457 if (SUCCEEDED(hres))
1459 IMediaEventEx *media_event_ex = NULL;
1460 hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IMediaEventEx,
1461 (void**)&media_event_ex);
1462 if (SUCCEEDED(hres)) {
1463 hres = IMediaEventEx_SetNotifyWindow(media_event_ex, (OAHWND)This->msg_window,
1464 WM_WMPEVENT, (LONG_PTR)This);
1465 IMediaEventEx_Release(media_event_ex);
1470 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
1472 if (SUCCEEDED(hres))
1473 hres = IMediaControl_Run(This->media_control);
1475 if (hres == S_FALSE) {
1476 hres = S_OK; /* S_FALSE will mean that graph is transitioning and that is fine */
1479 if (SUCCEEDED(hres)) {
1480 LONGLONG duration;
1481 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsPlaying);
1482 if (SUCCEEDED(IMediaSeeking_GetDuration(This->media_seeking, &duration)))
1483 media->duration = (DOUBLE)duration / 10000000.0f;
1484 } else {
1485 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsUndefined);
1488 return hres;
1491 static HRESULT WINAPI WMPControls_stop(IWMPControls *iface)
1493 HRESULT hres = S_OK;
1494 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1495 TRACE("(%p)\n", This);
1496 if (!This->filter_graph) {
1497 return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
1499 if (This->media_control) {
1500 hres = IMediaControl_Stop(This->media_control);
1501 IMediaControl_Release(This->media_control);
1503 if (This->media_event) {
1504 IMediaEvent_Release(This->media_event);
1506 if (This->media_seeking) {
1507 IMediaSeeking_Release(This->media_seeking);
1509 IGraphBuilder_Release(This->filter_graph);
1510 This->filter_graph = NULL;
1511 This->media_control = NULL;
1512 This->media_event = NULL;
1513 This->media_seeking = NULL;
1515 update_state(This, DISPID_WMPCOREEVENT_OPENSTATECHANGE, wmposPlaylistOpenNoMedia);
1516 update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsStopped);
1517 return hres;
1520 static HRESULT WINAPI WMPControls_pause(IWMPControls *iface)
1522 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1523 FIXME("(%p)\n", This);
1524 return E_NOTIMPL;
1527 static HRESULT WINAPI WMPControls_fastForward(IWMPControls *iface)
1529 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1530 FIXME("(%p)\n", This);
1531 return E_NOTIMPL;
1534 static HRESULT WINAPI WMPControls_fastReverse(IWMPControls *iface)
1536 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1537 FIXME("(%p)\n", This);
1538 return E_NOTIMPL;
1541 static HRESULT WINAPI WMPControls_get_currentPosition(IWMPControls *iface, DOUBLE *pdCurrentPosition)
1543 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1544 HRESULT hres;
1545 LONGLONG currentPosition;
1547 TRACE("(%p)->(%p)\n", This, pdCurrentPosition);
1548 if (!This->media_seeking)
1549 return S_FALSE;
1551 hres = IMediaSeeking_GetCurrentPosition(This->media_seeking, &currentPosition);
1552 *pdCurrentPosition = (DOUBLE) currentPosition / 10000000.0f;
1553 TRACE("hres: %d, pos: %f\n", hres, *pdCurrentPosition);
1554 return hres;
1557 static HRESULT WINAPI WMPControls_put_currentPosition(IWMPControls *iface, DOUBLE dCurrentPosition)
1559 LONGLONG Current;
1560 HRESULT hres;
1561 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1562 TRACE("(%p)->(%f)\n", This, dCurrentPosition);
1563 if (!This->media_seeking)
1564 return S_FALSE;
1566 Current = 10000000 * dCurrentPosition;
1567 hres = IMediaSeeking_SetPositions(This->media_seeking, &Current,
1568 AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
1570 return hres;
1573 static HRESULT WINAPI WMPControls_get_currentPositionString(IWMPControls *iface, BSTR *pbstrCurrentPosition)
1575 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1576 FIXME("(%p)->(%p)\n", This, pbstrCurrentPosition);
1577 return E_NOTIMPL;
1580 static HRESULT WINAPI WMPControls_next(IWMPControls *iface)
1582 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1583 FIXME("(%p)\n", This);
1584 return E_NOTIMPL;
1587 static HRESULT WINAPI WMPControls_previous(IWMPControls *iface)
1589 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1590 FIXME("(%p)\n", This);
1591 return E_NOTIMPL;
1594 static HRESULT WINAPI WMPControls_get_currentItem(IWMPControls *iface, IWMPMedia **ppIWMPMedia)
1596 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1597 FIXME("(%p)->(%p)\n", This, ppIWMPMedia);
1598 return E_NOTIMPL;
1601 static HRESULT WINAPI WMPControls_put_currentItem(IWMPControls *iface, IWMPMedia *pIWMPMedia)
1603 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1604 FIXME("(%p)->(%p)\n", This, pIWMPMedia);
1605 return E_NOTIMPL;
1608 static HRESULT WINAPI WMPControls_get_currentMarker(IWMPControls *iface, LONG *plMarker)
1610 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1611 FIXME("(%p)->(%p)\n", This, plMarker);
1612 return E_NOTIMPL;
1615 static HRESULT WINAPI WMPControls_put_currentMarker(IWMPControls *iface, LONG lMarker)
1617 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1618 FIXME("(%p)->(%d)\n", This, lMarker);
1619 return E_NOTIMPL;
1622 static HRESULT WINAPI WMPControls_playItem(IWMPControls *iface, IWMPMedia *pIWMPMedia)
1624 WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
1625 FIXME("(%p)->(%p)\n", This, pIWMPMedia);
1626 return E_NOTIMPL;
1629 static const IWMPControlsVtbl WMPControlsVtbl = {
1630 WMPControls_QueryInterface,
1631 WMPControls_AddRef,
1632 WMPControls_Release,
1633 WMPControls_GetTypeInfoCount,
1634 WMPControls_GetTypeInfo,
1635 WMPControls_GetIDsOfNames,
1636 WMPControls_Invoke,
1637 WMPControls_get_isAvailable,
1638 WMPControls_play,
1639 WMPControls_stop,
1640 WMPControls_pause,
1641 WMPControls_fastForward,
1642 WMPControls_fastReverse,
1643 WMPControls_get_currentPosition,
1644 WMPControls_put_currentPosition,
1645 WMPControls_get_currentPositionString,
1646 WMPControls_next,
1647 WMPControls_previous,
1648 WMPControls_get_currentItem,
1649 WMPControls_put_currentItem,
1650 WMPControls_get_currentMarker,
1651 WMPControls_put_currentMarker,
1652 WMPControls_playItem,
1655 static HRESULT WINAPI WMPMedia_QueryInterface(IWMPMedia *iface, REFIID riid, void **ppv)
1657 WMPMedia *This = impl_from_IWMPMedia(iface);
1658 TRACE("(%p)\n", This);
1659 if(IsEqualGUID(&IID_IUnknown, riid)) {
1660 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1661 *ppv = &This->IWMPMedia_iface;
1662 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1663 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1664 *ppv = &This->IWMPMedia_iface;
1665 }else if(IsEqualGUID(&IID_IWMPMedia, riid)) {
1666 TRACE("(%p)->(IID_IWMPMedia %p)\n", This, ppv);
1667 *ppv = &This->IWMPMedia_iface;
1668 }else {
1669 WARN("Unsupported interface %s\n", debugstr_guid(riid));
1670 *ppv = NULL;
1671 return E_NOINTERFACE;
1674 IUnknown_AddRef((IUnknown*)*ppv);
1675 return S_OK;
1678 static ULONG WINAPI WMPMedia_AddRef(IWMPMedia *iface)
1680 WMPMedia *This = impl_from_IWMPMedia(iface);
1681 LONG ref = InterlockedIncrement(&This->ref);
1683 TRACE("(%p) ref=%d\n", This, ref);
1685 return ref;
1688 static ULONG WINAPI WMPMedia_Release(IWMPMedia *iface)
1690 WMPMedia *This = impl_from_IWMPMedia(iface);
1691 LONG ref = InterlockedDecrement(&This->ref);
1693 TRACE("(%p) ref=%d\n", This, ref);
1695 if(!ref) {
1696 heap_free(This->url);
1697 heap_free(This);
1700 return ref;
1703 static HRESULT WINAPI WMPMedia_GetTypeInfoCount(IWMPMedia *iface, UINT *pctinfo)
1705 WMPMedia *This = impl_from_IWMPMedia(iface);
1706 FIXME("(%p)->(%p)\n", This, pctinfo);
1707 return E_NOTIMPL;
1710 static HRESULT WINAPI WMPMedia_GetTypeInfo(IWMPMedia *iface, UINT iTInfo,
1711 LCID lcid, ITypeInfo **ppTInfo)
1713 WMPMedia *This = impl_from_IWMPMedia(iface);
1714 FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
1715 return E_NOTIMPL;
1718 static HRESULT WINAPI WMPMedia_GetIDsOfNames(IWMPMedia *iface, REFIID riid,
1719 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1721 WMPMedia *This = impl_from_IWMPMedia(iface);
1722 FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1723 return E_NOTIMPL;
1726 static HRESULT WINAPI WMPMedia_Invoke(IWMPMedia *iface, DISPID dispIdMember,
1727 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1728 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1730 WMPMedia *This = impl_from_IWMPMedia(iface);
1731 FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
1732 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1733 return E_NOTIMPL;
1736 static HRESULT WINAPI WMPMedia_get_isIdentical(IWMPMedia *iface, IWMPMedia *other, VARIANT_BOOL *pvBool)
1738 WMPMedia *This = impl_from_IWMPMedia(iface);
1739 FIXME("(%p)->(%p, %p)\n", This, other, pvBool);
1740 return E_NOTIMPL;
1743 static HRESULT WINAPI WMPMedia_get_sourceURL(IWMPMedia *iface, BSTR *pbstrSourceUrl)
1745 WMPMedia *This = impl_from_IWMPMedia(iface);
1746 BSTR url;
1747 TRACE("(%p)->(%p)\n", This, pbstrSourceUrl);
1748 url = SysAllocString(This->url);
1749 if (url) {
1750 *pbstrSourceUrl = url;
1751 return S_OK;
1753 return E_OUTOFMEMORY;
1756 static HRESULT WINAPI WMPMedia_get_name(IWMPMedia *iface, BSTR *pbstrName)
1758 WMPMedia *This = impl_from_IWMPMedia(iface);
1759 FIXME("(%p)->(%p)\n", This, pbstrName);
1760 return E_NOTIMPL;
1763 static HRESULT WINAPI WMPMedia_put_name(IWMPMedia *iface, BSTR pbstrName)
1765 WMPMedia *This = impl_from_IWMPMedia(iface);
1766 FIXME("(%p)->(%s)\n", This, debugstr_w(pbstrName));
1767 return E_NOTIMPL;
1770 static HRESULT WINAPI WMPMedia_get_imageSourceWidth(IWMPMedia *iface, LONG *pWidth)
1772 WMPMedia *This = impl_from_IWMPMedia(iface);
1773 FIXME("(%p)->(%p)\n", This, pWidth);
1774 return E_NOTIMPL;
1777 static HRESULT WINAPI WMPMedia_get_imageSourceHeight(IWMPMedia *iface, LONG *pHeight)
1779 WMPMedia *This = impl_from_IWMPMedia(iface);
1780 FIXME("(%p)->(%p)\n", This, pHeight);
1781 return E_NOTIMPL;
1784 static HRESULT WINAPI WMPMedia_get_markerCount(IWMPMedia *iface, LONG* pMarkerCount)
1786 WMPMedia *This = impl_from_IWMPMedia(iface);
1787 FIXME("(%p)->(%p)\n", This, pMarkerCount);
1788 return E_NOTIMPL;
1791 static HRESULT WINAPI WMPMedia_getMarkerTime(IWMPMedia *iface, LONG MarkerNum, DOUBLE *pMarkerTime)
1793 WMPMedia *This = impl_from_IWMPMedia(iface);
1794 FIXME("(%p)->(%d, %p)\n", This, MarkerNum, pMarkerTime);
1795 return E_NOTIMPL;
1798 static HRESULT WINAPI WMPMedia_getMarkerName(IWMPMedia *iface, LONG MarkerNum, BSTR *pbstrMarkerName)
1800 WMPMedia *This = impl_from_IWMPMedia(iface);
1801 FIXME("(%p)->(%d, %p)\n", This, MarkerNum, pbstrMarkerName);
1802 return E_NOTIMPL;
1805 static HRESULT WINAPI WMPMedia_get_duration(IWMPMedia *iface, DOUBLE *pDuration)
1807 /* MSDN: If this property is used with a media item other than the one
1808 * specified in Player.currentMedia, it may not contain a valid value. */
1809 WMPMedia *This = impl_from_IWMPMedia(iface);
1810 TRACE("(%p)->(%p)\n", This, pDuration);
1811 *pDuration = This->duration;
1812 return S_OK;
1815 static HRESULT WINAPI WMPMedia_get_durationString(IWMPMedia *iface, BSTR *pbstrDuration)
1817 WMPMedia *This = impl_from_IWMPMedia(iface);
1818 FIXME("(%p)->(%p)\n", This, pbstrDuration);
1819 return E_NOTIMPL;
1822 static HRESULT WINAPI WMPMedia_get_attributeCount(IWMPMedia *iface, LONG *plCount)
1824 WMPMedia *This = impl_from_IWMPMedia(iface);
1825 FIXME("(%p)->(%p)\n", This, plCount);
1826 return E_NOTIMPL;
1829 static HRESULT WINAPI WMPMedia_getAttributeName(IWMPMedia *iface, LONG lIndex, BSTR *pbstrItemName)
1831 WMPMedia *This = impl_from_IWMPMedia(iface);
1832 FIXME("(%p)->(%d, %p)\n", This, lIndex, pbstrItemName);
1833 return E_NOTIMPL;
1836 static HRESULT WINAPI WMPMedia_getItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR *pbstrVal)
1838 WMPMedia *This = impl_from_IWMPMedia(iface);
1839 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pbstrVal);
1840 return E_NOTIMPL;
1843 static HRESULT WINAPI WMPMedia_setItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR bstrVal)
1845 WMPMedia *This = impl_from_IWMPMedia(iface);
1846 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrItemName), debugstr_w(bstrVal));
1847 return E_NOTIMPL;
1850 static HRESULT WINAPI WMPMedia_getItemInfoByAtom(IWMPMedia *iface, LONG lAtom, BSTR *pbstrVal)
1852 WMPMedia *This = impl_from_IWMPMedia(iface);
1853 FIXME("(%p)->(%d, %p)\n", This, lAtom, pbstrVal);
1854 return E_NOTIMPL;
1857 static HRESULT WINAPI WMPMedia_isMemberOf(IWMPMedia *iface, IWMPPlaylist *pPlaylist, VARIANT_BOOL *pvarfIsMemberOf)
1859 WMPMedia *This = impl_from_IWMPMedia(iface);
1860 FIXME("(%p)->(%p, %p)\n", This, pPlaylist, pvarfIsMemberOf);
1861 return E_NOTIMPL;
1864 static HRESULT WINAPI WMPMedia_isReadOnlyItem(IWMPMedia *iface, BSTR bstrItemName, VARIANT_BOOL *pvarfIsReadOnly)
1866 WMPMedia *This = impl_from_IWMPMedia(iface);
1867 FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pvarfIsReadOnly);
1868 return E_NOTIMPL;
1871 static const IWMPMediaVtbl WMPMediaVtbl = {
1872 WMPMedia_QueryInterface,
1873 WMPMedia_AddRef,
1874 WMPMedia_Release,
1875 WMPMedia_GetTypeInfoCount,
1876 WMPMedia_GetTypeInfo,
1877 WMPMedia_GetIDsOfNames,
1878 WMPMedia_Invoke,
1879 WMPMedia_get_isIdentical,
1880 WMPMedia_get_sourceURL,
1881 WMPMedia_get_name,
1882 WMPMedia_put_name,
1883 WMPMedia_get_imageSourceWidth,
1884 WMPMedia_get_imageSourceHeight,
1885 WMPMedia_get_markerCount,
1886 WMPMedia_getMarkerTime,
1887 WMPMedia_getMarkerName,
1888 WMPMedia_get_duration,
1889 WMPMedia_get_durationString,
1890 WMPMedia_get_attributeCount,
1891 WMPMedia_getAttributeName,
1892 WMPMedia_getItemInfo,
1893 WMPMedia_setItemInfo,
1894 WMPMedia_getItemInfoByAtom,
1895 WMPMedia_isMemberOf,
1896 WMPMedia_isReadOnlyItem
1899 static LRESULT WINAPI player_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1901 if (msg == WM_WMPEVENT && wParam == 0) {
1902 WindowsMediaPlayer *wmp = (WindowsMediaPlayer*)lParam;
1903 LONG event_code;
1904 LONG_PTR p1, p2;
1905 HRESULT hr;
1906 if (wmp->media_event) {
1907 do {
1908 hr = IMediaEvent_GetEvent(wmp->media_event, &event_code, &p1, &p2, 0);
1909 if (SUCCEEDED(hr)) {
1910 TRACE("got event_code = 0x%02x\n", event_code);
1911 IMediaEvent_FreeEventParams(wmp->media_event, event_code, p1, p2);
1912 /* For now we only handle EC_COMPLETE */
1913 if (event_code == EC_COMPLETE) {
1914 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsMediaEnded);
1915 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning);
1916 update_state(wmp, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsStopped);
1919 } while (hr == S_OK);
1920 } else {
1921 FIXME("Got event from quartz when interfaces are already released\n");
1924 return DefWindowProcW(hwnd, msg, wParam, lParam);
1927 static BOOL WINAPI register_player_msg_class(INIT_ONCE *once, void *param, void **context) {
1928 static WNDCLASSEXW wndclass = {
1929 sizeof(wndclass), CS_DBLCLKS, player_wnd_proc, 0, 0,
1930 NULL, NULL, NULL, NULL, NULL,
1931 WMPmessageW, NULL
1934 wndclass.hInstance = wmp_instance;
1935 player_msg_class = RegisterClassExW(&wndclass);
1936 WM_WMPEVENT= RegisterWindowMessageW(WMPmessageW);
1937 return TRUE;
1940 void unregister_player_msg_class(void) {
1941 if(player_msg_class)
1942 UnregisterClassW(MAKEINTRESOURCEW(player_msg_class), wmp_instance);
1945 BOOL init_player(WindowsMediaPlayer *wmp)
1947 InitOnceExecuteOnce(&class_init_once, register_player_msg_class, NULL, NULL);
1948 wmp->msg_window = CreateWindowW( MAKEINTRESOURCEW(player_msg_class), NULL, 0, 0,
1949 0, 0, 0, HWND_MESSAGE, 0, wmp_instance, wmp );
1950 if (!wmp->msg_window) {
1951 ERR("Failed to create message window, GetLastError: %d\n", GetLastError());
1952 return FALSE;
1954 if (!WM_WMPEVENT) {
1955 ERR("Failed to register window message, GetLastError: %d\n", GetLastError());
1956 return FALSE;
1959 wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl;
1960 wmp->IWMPPlayer_iface.lpVtbl = &WMPPlayerVtbl;
1961 wmp->IWMPSettings_iface.lpVtbl = &WMPSettingsVtbl;
1962 wmp->IWMPControls_iface.lpVtbl = &WMPControlsVtbl;
1963 wmp->IWMPNetwork_iface.lpVtbl = &WMPNetworkVtbl;
1965 wmp->invoke_urls = VARIANT_TRUE;
1966 wmp->auto_start = VARIANT_TRUE;
1967 return TRUE;
1970 void destroy_player(WindowsMediaPlayer *wmp)
1972 IWMPControls_stop(&wmp->IWMPControls_iface);
1973 if(wmp->wmpmedia)
1974 IWMPMedia_Release(wmp->wmpmedia);
1975 DestroyWindow(wmp->msg_window);
1978 WMPMedia *unsafe_impl_from_IWMPMedia(IWMPMedia *iface)
1980 if (iface->lpVtbl == &WMPMediaVtbl) {
1981 return CONTAINING_RECORD(iface, WMPMedia, IWMPMedia_iface);
1983 return NULL;
1986 HRESULT create_media_from_url(BSTR url, IWMPMedia **ppMedia)
1988 WMPMedia *media = heap_alloc_zero(sizeof(WMPMedia));
1990 if (!media) {
1991 return E_OUTOFMEMORY;
1994 media->IWMPMedia_iface.lpVtbl = &WMPMediaVtbl;
1995 media->url = heap_strdupW(url);
1996 media->ref = 1;
1998 if (media->url) {
1999 *ppMedia = &media->IWMPMedia_iface;
2001 return S_OK;
2003 IWMPMedia_Release(&media->IWMPMedia_iface);
2004 return E_OUTOFMEMORY;