wmp: Add IWMPMedia stub.

Signed-off-by: Anton Romanov <theli.ua@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Romanov 2018-03-08 08:42:07 -08:00 committed by Alexandre Julliard
parent e36b765be4
commit 9a89db9897
7 changed files with 426 additions and 8 deletions

View File

@ -308,6 +308,7 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
if(!ref) { if(!ref) {
release_client_site(This); release_client_site(This);
ConnectionPointContainer_Destroy(This); ConnectionPointContainer_Destroy(This);
destroy_player(This);
heap_free(This); heap_free(This);
} }

View File

@ -22,6 +22,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(wmp); WINE_DEFAULT_DEBUG_CHANNEL(wmp);
static inline WMPMedia *impl_from_IWMPMedia(IWMPMedia *iface)
{
return CONTAINING_RECORD(iface, WMPMedia, IWMPMedia_iface);
}
static inline WindowsMediaPlayer *impl_from_IWMPPlayer4(IWMPPlayer4 *iface) static inline WindowsMediaPlayer *impl_from_IWMPPlayer4(IWMPPlayer4 *iface)
{ {
return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPPlayer4_iface); return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPPlayer4_iface);
@ -98,15 +103,23 @@ static HRESULT WINAPI WMPPlayer4_close(IWMPPlayer4 *iface)
static HRESULT WINAPI WMPPlayer4_get_URL(IWMPPlayer4 *iface, BSTR *pbstrURL) static HRESULT WINAPI WMPPlayer4_get_URL(IWMPPlayer4 *iface, BSTR *pbstrURL)
{ {
WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface); WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
FIXME("(%p)->(%p)\n", This, pbstrURL); TRACE("(%p)->(%p)\n", This, pbstrURL);
return E_NOTIMPL; if(This->wmpmedia == NULL) {
return S_FALSE;
}
return IWMPMedia_get_sourceURL(This->wmpmedia, pbstrURL);
} }
static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url) static HRESULT WINAPI WMPPlayer4_put_URL(IWMPPlayer4 *iface, BSTR url)
{ {
WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface); WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(url)); IWMPMedia *media;
return E_NOTIMPL; TRACE("(%p)->(%s)\n", This, debugstr_w(url));
if(url == NULL) {
return E_POINTER;
}
media = create_media_from_url(url);
return IWMPPlayer4_put_currentMedia(iface, media);
} }
static HRESULT WINAPI WMPPlayer4_get_openState(IWMPPlayer4 *iface, WMPOpenState *pwmpos) static HRESULT WINAPI WMPPlayer4_get_openState(IWMPPlayer4 *iface, WMPOpenState *pwmpos)
@ -148,15 +161,28 @@ static HRESULT WINAPI WMPPlayer4_get_settings(IWMPPlayer4 *iface, IWMPSettings *
static HRESULT WINAPI WMPPlayer4_get_currentMedia(IWMPPlayer4 *iface, IWMPMedia **ppMedia) static HRESULT WINAPI WMPPlayer4_get_currentMedia(IWMPPlayer4 *iface, IWMPMedia **ppMedia)
{ {
WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface); WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
FIXME("(%p)->(%p)\n", This, ppMedia); TRACE("(%p)->(%p)\n", This, ppMedia);
return E_NOTIMPL; if(This->wmpmedia == NULL) {
return S_FALSE;
}
IWMPMedia_AddRef(This->wmpmedia);
*ppMedia = This->wmpmedia;
return S_OK;
} }
static HRESULT WINAPI WMPPlayer4_put_currentMedia(IWMPPlayer4 *iface, IWMPMedia *pMedia) static HRESULT WINAPI WMPPlayer4_put_currentMedia(IWMPPlayer4 *iface, IWMPMedia *pMedia)
{ {
WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface); WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface);
FIXME("(%p)->(%p)\n", This, pMedia); TRACE("(%p)->(%p)\n", This, pMedia);
return E_NOTIMPL; if(pMedia == NULL) {
return E_POINTER;
}
if(This->wmpmedia != NULL) {
IWMPMedia_Release(This->wmpmedia);
}
This->wmpmedia = pMedia;
IWMPMedia_AddRef(This->wmpmedia);
return S_OK;
} }
static HRESULT WINAPI WMPPlayer4_get_mediaCollection(IWMPPlayer4 *iface, IWMPMediaCollection **ppMediaCollection) static HRESULT WINAPI WMPPlayer4_get_mediaCollection(IWMPPlayer4 *iface, IWMPMediaCollection **ppMediaCollection)
@ -1157,6 +1183,241 @@ static const IWMPControlsVtbl WMPControlsVtbl = {
WMPControls_playItem, WMPControls_playItem,
}; };
static HRESULT WINAPI WMPMedia_QueryInterface(IWMPMedia *iface, REFIID riid, void **ppv)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
TRACE("(%p)\n", This);
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = &This->IWMPMedia_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = &This->IWMPMedia_iface;
}else if(IsEqualGUID(&IID_IWMPMedia, riid)) {
TRACE("(%p)->(IID_IWMPMedia %p)\n", This, ppv);
*ppv = &This->IWMPMedia_iface;
}else {
WARN("Unsupported interface %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI WMPMedia_AddRef(IWMPMedia *iface)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI WMPMedia_Release(IWMPMedia *iface)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
heap_free(This->url);
heap_free(This);
}
return ref;
}
static HRESULT WINAPI WMPMedia_GetTypeInfoCount(IWMPMedia *iface, UINT *pctinfo)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pctinfo);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_GetTypeInfo(IWMPMedia *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_GetIDsOfNames(IWMPMedia *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_Invoke(IWMPMedia *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_isIdentical(IWMPMedia *iface, IWMPMedia *other, VARIANT_BOOL *pvBool)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p, %p)\n", This, other, pvBool);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_sourceURL(IWMPMedia *iface, BSTR *pbstrSourceUrl)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pbstrSourceUrl);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_name(IWMPMedia *iface, BSTR *pbstrName)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pbstrName);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_put_name(IWMPMedia *iface, BSTR pbstrName)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(pbstrName));
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_imageSourceWidth(IWMPMedia *iface, LONG *pWidth)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pWidth);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_imageSourceHeight(IWMPMedia *iface, LONG *pHeight)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pHeight);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_markerCount(IWMPMedia *iface, LONG* pMarkerCount)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pMarkerCount);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_getMarkerTime(IWMPMedia *iface, LONG MarkerNum, DOUBLE *pMarkerTime)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%d, %p)\n", This, MarkerNum, pMarkerTime);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_getMarkerName(IWMPMedia *iface, LONG MarkerNum, BSTR *pbstrMarkerName)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%d, %p)\n", This, MarkerNum, pbstrMarkerName);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_duration(IWMPMedia *iface, DOUBLE *pDuration)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pDuration);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_durationString(IWMPMedia *iface, BSTR *pbstrDuration)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, pbstrDuration);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_get_attributeCount(IWMPMedia *iface, LONG *plCount)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p)\n", This, plCount);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_getAttributeName(IWMPMedia *iface, LONG lIndex, BSTR *pbstrItemName)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%d, %p)\n", This, lIndex, pbstrItemName);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_getItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR *pbstrVal)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pbstrVal);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_setItemInfo(IWMPMedia *iface, BSTR bstrItemName, BSTR bstrVal)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%s, %s)\n", This, debugstr_w(bstrItemName), debugstr_w(bstrVal));
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_getItemInfoByAtom(IWMPMedia *iface, LONG lAtom, BSTR *pbstrVal)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%d, %p)\n", This, lAtom, pbstrVal);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_isMemberOf(IWMPMedia *iface, IWMPPlaylist *pPlaylist, VARIANT_BOOL *pvarfIsMemberOf)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%p, %p)\n", This, pPlaylist, pvarfIsMemberOf);
return E_NOTIMPL;
}
static HRESULT WINAPI WMPMedia_isReadOnlyItem(IWMPMedia *iface, BSTR bstrItemName, VARIANT_BOOL *pvarfIsReadOnly)
{
WMPMedia *This = impl_from_IWMPMedia(iface);
FIXME("(%p)->(%s, %p)\n", This, debugstr_w(bstrItemName), pvarfIsReadOnly);
return E_NOTIMPL;
}
static const IWMPMediaVtbl WMPMediaVtbl = {
WMPMedia_QueryInterface,
WMPMedia_AddRef,
WMPMedia_Release,
WMPMedia_GetTypeInfoCount,
WMPMedia_GetTypeInfo,
WMPMedia_GetIDsOfNames,
WMPMedia_Invoke,
WMPMedia_get_isIdentical,
WMPMedia_get_sourceURL,
WMPMedia_get_name,
WMPMedia_put_name,
WMPMedia_get_imageSourceWidth,
WMPMedia_get_imageSourceHeight,
WMPMedia_get_markerCount,
WMPMedia_getMarkerTime,
WMPMedia_getMarkerName,
WMPMedia_get_duration,
WMPMedia_get_durationString,
WMPMedia_get_attributeCount,
WMPMedia_getAttributeName,
WMPMedia_getItemInfo,
WMPMedia_setItemInfo,
WMPMedia_getItemInfoByAtom,
WMPMedia_isMemberOf,
WMPMedia_isReadOnlyItem
};
void init_player(WindowsMediaPlayer *wmp) void init_player(WindowsMediaPlayer *wmp)
{ {
wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl; wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl;
@ -1167,3 +1428,19 @@ void init_player(WindowsMediaPlayer *wmp)
wmp->invoke_urls = VARIANT_TRUE; wmp->invoke_urls = VARIANT_TRUE;
wmp->auto_start = VARIANT_TRUE; wmp->auto_start = VARIANT_TRUE;
} }
void destroy_player(WindowsMediaPlayer *wmp)
{
if(wmp->wmpmedia)
IWMPMedia_Release(wmp->wmpmedia);
}
IWMPMedia* create_media_from_url(BSTR url){
WMPMedia *media = heap_alloc_zero(sizeof(WMPMedia));
media->IWMPMedia_iface.lpVtbl = &WMPMediaVtbl;
media->url = heap_strdupW(url);
media->ref = 1;
return &media->IWMPMedia_iface;
}

View File

@ -2,3 +2,6 @@ TESTDLL = wmp.dll
IMPORTS = ole32 oleaut32 user32 gdi32 IMPORTS = ole32 oleaut32 user32 gdi32
C_SRCS = oleobj.c C_SRCS = oleobj.c
RC_SRCS = \
rsrc.rc

BIN
dlls/wmp/tests/av.mp4 Normal file

Binary file not shown.

View File

@ -18,12 +18,16 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define COBJMACROS #define COBJMACROS
#include <stdarg.h>
#include <initguid.h> #include <initguid.h>
#include <windef.h>
#include <winbase.h>
#include <windows.h> #include <windows.h>
#include <wmp.h> #include <wmp.h>
#include <olectl.h> #include <olectl.h>
#include "wine/test.h" #include "wine/test.h"
#include "wine/heap.h"
#define DEFINE_EXPECT(func) \ #define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
@ -49,6 +53,12 @@
expect_ ## func = called_ ## func = FALSE; \ expect_ ## func = called_ ## func = FALSE; \
}while(0) }while(0)
#define CHECK_CALLED_OR_BROKEN(func) \
do { \
ok(called_ ## func || broken(1), "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
DEFINE_EXPECT(GetContainer); DEFINE_EXPECT(GetContainer);
DEFINE_EXPECT(GetExtendedControl); DEFINE_EXPECT(GetExtendedControl);
DEFINE_EXPECT(GetWindow); DEFINE_EXPECT(GetWindow);
@ -60,6 +70,32 @@ DEFINE_EXPECT(GetWindowContext);
DEFINE_EXPECT(ShowObject); DEFINE_EXPECT(ShowObject);
DEFINE_EXPECT(OnShowWindow_FALSE); DEFINE_EXPECT(OnShowWindow_FALSE);
static const WCHAR mp4file[] = {'a','v','.','m','p','4',0};
static inline WCHAR *load_resource(const WCHAR *name)
{
static WCHAR pathW[MAX_PATH];
DWORD written;
HANDLE file;
HRSRC res;
void *ptr;
GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW);
lstrcatW(pathW, name);
file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW),
GetLastError());
res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
ok( res != 0, "couldn't find resource\n" );
ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
CloseHandle( file );
return pathW;
}
static HWND container_hwnd; static HWND container_hwnd;
static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv) static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
@ -859,9 +895,12 @@ static void test_wmp_ifaces(IOleObject *oleobj)
IWMPSettings *settings, *settings_qi; IWMPSettings *settings, *settings_qi;
IWMPPlayer4 *player4; IWMPPlayer4 *player4;
IWMPPlayer *player; IWMPPlayer *player;
IWMPMedia *media;
IWMPControls *controls; IWMPControls *controls;
VARIANT_BOOL vbool; VARIANT_BOOL vbool;
HRESULT hres; HRESULT hres;
BSTR filename;
BSTR url;
hres = IOleObject_QueryInterface(oleobj, &IID_IWMPPlayer4, (void**)&player4); hres = IOleObject_QueryInterface(oleobj, &IID_IWMPPlayer4, (void**)&player4);
ok(hres == S_OK, "Could not get IWMPPlayer4 iface: %08x\n", hres); ok(hres == S_OK, "Could not get IWMPPlayer4 iface: %08x\n", hres);
@ -878,6 +917,52 @@ static void test_wmp_ifaces(IOleObject *oleobj)
IWMPControls_Release(controls); IWMPControls_Release(controls);
media = NULL;
hres = IWMPPlayer4_QueryInterface(player4, &IID_IWMPMedia, (void**)&media);
ok(hres == E_NOINTERFACE, "get_currentMedia SUCCEEDED: %08x\n", hres);
ok(media == NULL, "media != NULL\n");
/* Test media put/get */
media = NULL;
hres = IWMPPlayer4_get_currentMedia(player4, &media);
ok(hres == S_FALSE, "get_currentMedia SUCCEEDED\n");
ok(media == NULL, "media != NULL\n");
filename = SysAllocString(load_resource(mp4file));
SET_EXPECT(GetContainer);
SET_EXPECT(Invoke_USERMODE);
hres = IWMPPlayer4_put_URL(player4, filename);
ok(hres == S_OK, "IWMPPlayer4_put_URL failed: %08x\n", hres);
todo_wine CHECK_CALLED_OR_BROKEN(GetContainer);
todo_wine CHECK_CALLED(Invoke_USERMODE);
url = NULL;
SET_EXPECT(Invoke_USERMODE);
hres = IWMPPlayer4_get_URL(player4, &url);
todo_wine ok(hres == S_OK, "IWMPPlayer4_get_URL failed: %08x\n", hres);
todo_wine ok(0 == lstrcmpW(url, filename), "%s != %s", wine_dbgstr_w(url), wine_dbgstr_w(filename));
todo_wine CHECK_CALLED(Invoke_USERMODE);
SysFreeString(url);
hres = IWMPPlayer4_get_currentMedia(player4, &media);
ok(hres == S_OK, "get_currentMedia failed: %08x\n", hres);
ok(media != NULL, "media = (%p)\n", media);
SET_EXPECT(GetContainer);
hres = IWMPPlayer4_put_currentMedia(player4, media);
ok(hres == S_OK, "put_currentMedia failed: %08x\n", hres);
todo_wine CHECK_CALLED_OR_BROKEN(GetContainer);
IWMPMedia_Release(media);
hres = IWMPPlayer4_get_currentMedia(player4, &media);
ok(hres == S_OK, "get_currentMedia failed: %08x\n", hres);
ok(media != NULL, "media = (%p)\n", media);
IWMPMedia_Release(media);
settings = NULL; settings = NULL;
hres = IWMPPlayer4_get_settings(player4, &settings); hres = IWMPPlayer4_get_settings(player4, &settings);
ok(hres == S_OK, "get_settings failed: %08x\n", hres); ok(hres == S_OK, "get_settings failed: %08x\n", hres);
@ -934,6 +1019,7 @@ static void test_wmp_ifaces(IOleObject *oleobj)
IWMPSettings_Release(settings); IWMPSettings_Release(settings);
IWMPPlayer_Release(player); IWMPPlayer_Release(player);
SysFreeString(filename);
} }
#define test_rect_size(a,b,c) _test_rect_size(__LINE__,a,b,c) #define test_rect_size(a,b,c) _test_rect_size(__LINE__,a,b,c)

22
dlls/wmp/tests/rsrc.rc Normal file
View File

@ -0,0 +1,22 @@
/*
* Resource file for wmp tests.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windef.h"
/* @makedep: av.mp4 */
av.mp4 RCDATA "av.mp4"

View File

@ -20,6 +20,7 @@
#include "windows.h" #include "windows.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/unicode.h"
#include "ole2.h" #include "ole2.h"
#include "wmp.h" #include "wmp.h"
@ -34,6 +35,14 @@ typedef struct {
IID iid; IID iid;
} ConnectionPoint; } ConnectionPoint;
typedef struct {
IWMPMedia IWMPMedia_iface;
LONG ref;
WCHAR *url;
} WMPMedia;
struct WindowsMediaPlayer { struct WindowsMediaPlayer {
IOleObject IOleObject_iface; IOleObject IOleObject_iface;
IProvideClassInfo2 IProvideClassInfo2_iface; IProvideClassInfo2 IProvideClassInfo2_iface;
@ -58,9 +67,13 @@ struct WindowsMediaPlayer {
VARIANT_BOOL enable_error_dialogs; VARIANT_BOOL enable_error_dialogs;
ConnectionPoint *wmpocx; ConnectionPoint *wmpocx;
IWMPMedia *wmpmedia;
}; };
void init_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN; void init_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
void destroy_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
IWMPMedia* create_media_from_url(BSTR url);
void ConnectionPointContainer_Init(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN; void ConnectionPointContainer_Init(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Destroy(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN; void ConnectionPointContainer_Destroy(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
@ -69,3 +82,19 @@ HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**)
void unregister_wmp_class(void) DECLSPEC_HIDDEN; void unregister_wmp_class(void) DECLSPEC_HIDDEN;
extern HINSTANCE wmp_instance DECLSPEC_HIDDEN; extern HINSTANCE wmp_instance DECLSPEC_HIDDEN;
static inline WCHAR *heap_strdupW(const WCHAR *str)
{
WCHAR *ret;
if(str) {
size_t size = strlenW(str)+1;
ret = heap_alloc(size*sizeof(WCHAR));
if(ret)
memcpy(ret, str, size*sizeof(WCHAR));
}else {
ret = NULL;
}
return ret;
}