2 * Copyright 2012 Austin English
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
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore
);
33 static inline void *heap_alloc(size_t len
)
35 return HeapAlloc(GetProcessHeap(), 0, len
);
38 static inline BOOL
heap_free(void *mem
)
40 return HeapFree(GetProcessHeap(), 0, mem
);
43 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
45 TRACE("(0x%p, %d, %p)\n", hinstDLL
, fdwReason
, lpvReserved
);
49 case DLL_WINE_PREATTACH
:
50 return FALSE
; /* prefer native version */
51 case DLL_PROCESS_ATTACH
:
52 DisableThreadLibraryCalls(hinstDLL
);
59 HRESULT WINAPI
DllRegisterServer(void)
66 HRESULT WINAPI
WMCreateEditor(IWMMetadataEditor
**editor
)
68 FIXME("(%p): stub\n", editor
);
76 IWMReader IWMReader_iface
;
80 static inline WMReader
*impl_from_IWMReader(IWMReader
*iface
)
82 return CONTAINING_RECORD(iface
, WMReader
, IWMReader_iface
);
85 static HRESULT WINAPI
WMReader_QueryInterface(IWMReader
*iface
, REFIID riid
, void **ppv
)
87 WMReader
*This
= impl_from_IWMReader(iface
);
89 if(IsEqualGUID(riid
, &IID_IUnknown
)) {
90 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
91 *ppv
= &This
->IWMReader_iface
;
92 }else if(IsEqualGUID(riid
, &IID_IWMReader
)) {
93 TRACE("(%p)->(IID_IWMReader %p)\n", This
, ppv
);
94 *ppv
= &This
->IWMReader_iface
;
97 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
101 IUnknown_AddRef((IUnknown
*)*ppv
);
105 static ULONG WINAPI
WMReader_AddRef(IWMReader
*iface
)
107 WMReader
*This
= impl_from_IWMReader(iface
);
108 LONG ref
= InterlockedIncrement(&This
->ref
);
110 TRACE("(%p) ref=%d\n", This
, ref
);
115 static ULONG WINAPI
WMReader_Release(IWMReader
*iface
)
117 WMReader
*This
= impl_from_IWMReader(iface
);
118 LONG ref
= InterlockedDecrement(&This
->ref
);
120 TRACE("(%p) ref=%d\n", This
, ref
);
128 static HRESULT WINAPI
WMReader_Open(IWMReader
*iface
, const WCHAR
*url
, IWMReaderCallback
*callback
, void *context
)
130 WMReader
*This
= impl_from_IWMReader(iface
);
131 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(url
), callback
, context
);
135 static HRESULT WINAPI
WMReader_Close(IWMReader
*iface
)
137 WMReader
*This
= impl_from_IWMReader(iface
);
138 FIXME("(%p)\n", This
);
142 static HRESULT WINAPI
WMReader_GetOutputCount(IWMReader
*iface
, DWORD
*outputs
)
144 WMReader
*This
= impl_from_IWMReader(iface
);
145 FIXME("(%p)->(%p)\n", This
, outputs
);
149 static HRESULT WINAPI
WMReader_GetOutputProps(IWMReader
*iface
, DWORD output_num
, IWMOutputMediaProps
**output
)
151 WMReader
*This
= impl_from_IWMReader(iface
);
152 FIXME("(%p)->(%u %p)\n", This
, output_num
, output
);
156 static HRESULT WINAPI
WMReader_SetOutputProps(IWMReader
*iface
, DWORD output_num
, IWMOutputMediaProps
*output
)
158 WMReader
*This
= impl_from_IWMReader(iface
);
159 FIXME("(%p)->(%u %p)\n", This
, output_num
, output
);
163 static HRESULT WINAPI
WMReader_GetOutputFormatCount(IWMReader
*iface
, DWORD output_num
, DWORD
*formats
)
165 WMReader
*This
= impl_from_IWMReader(iface
);
166 FIXME("(%p)->(%u %p)\n", This
, output_num
, formats
);
170 static HRESULT WINAPI
WMReader_GetOutputFormat(IWMReader
*iface
, DWORD output_num
, DWORD format_num
, IWMOutputMediaProps
**props
)
172 WMReader
*This
= impl_from_IWMReader(iface
);
173 FIXME("(%p)->(%u %u %p)\n", This
, output_num
, format_num
, props
);
177 static HRESULT WINAPI
WMReader_Start(IWMReader
*iface
, QWORD start
, QWORD duration
, float rate
, void *context
)
179 WMReader
*This
= impl_from_IWMReader(iface
);
180 FIXME("(%p)->(%s %s %f %p)\n", This
, wine_dbgstr_longlong(start
), wine_dbgstr_longlong(duration
), rate
, context
);
184 static HRESULT WINAPI
WMReader_Stop(IWMReader
*iface
)
186 WMReader
*This
= impl_from_IWMReader(iface
);
187 FIXME("(%p)\n", This
);
191 static HRESULT WINAPI
WMReader_Pause(IWMReader
*iface
)
193 WMReader
*This
= impl_from_IWMReader(iface
);
194 FIXME("(%p)\n", This
);
198 static HRESULT WINAPI
WMReader_Resume(IWMReader
*iface
)
200 WMReader
*This
= impl_from_IWMReader(iface
);
201 FIXME("(%p)\n", This
);
205 static const IWMReaderVtbl WMReaderVtbl
= {
206 WMReader_QueryInterface
,
211 WMReader_GetOutputCount
,
212 WMReader_GetOutputProps
,
213 WMReader_SetOutputProps
,
214 WMReader_GetOutputFormatCount
,
215 WMReader_GetOutputFormat
,
222 HRESULT WINAPI
WMCreateReader(IUnknown
*reserved
, DWORD rights
, IWMReader
**ret_reader
)
226 TRACE("(%p, %x, %p)\n", reserved
, rights
, ret_reader
);
228 reader
= heap_alloc(sizeof(*reader
));
230 return E_OUTOFMEMORY
;
232 reader
->IWMReader_iface
.lpVtbl
= &WMReaderVtbl
;
235 *ret_reader
= &reader
->IWMReader_iface
;
239 HRESULT WINAPI
WMCreateSyncReader(IUnknown
*pcert
, DWORD rights
, IWMSyncReader
**syncreader
)
241 FIXME("(%p, %x, %p): stub\n", pcert
, rights
, syncreader
);
249 IWMProfileManager IWMProfileManager_iface
;
253 static inline WMProfileManager
*impl_from_IWMProfileManager(IWMProfileManager
*iface
)
255 return CONTAINING_RECORD(iface
, WMProfileManager
, IWMProfileManager_iface
);
258 static HRESULT WINAPI
WMProfileManager_QueryInterface(IWMProfileManager
*iface
, REFIID riid
, void **ppv
)
260 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
262 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
263 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
264 *ppv
= &This
->IWMProfileManager_iface
;
265 }else if(IsEqualGUID(&IID_IWMProfileManager
, riid
)) {
266 TRACE("(%p)->(IID_IWMProfileManager %p)\n", This
, ppv
);
267 *ppv
= &This
->IWMProfileManager_iface
;
270 return E_NOINTERFACE
;
273 IUnknown_AddRef((IUnknown
*)*ppv
);
277 static ULONG WINAPI
WMProfileManager_AddRef(IWMProfileManager
*iface
)
279 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
280 LONG ref
= InterlockedIncrement(&This
->ref
);
282 TRACE("(%p) ref=%d\n", This
, ref
);
287 static ULONG WINAPI
WMProfileManager_Release(IWMProfileManager
*iface
)
289 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
290 LONG ref
= InterlockedDecrement(&This
->ref
);
292 TRACE("(%p) ref=%d\n", This
, ref
);
300 static HRESULT WINAPI
WMProfileManager_CreateEmptyProfile(IWMProfileManager
*iface
, WMT_VERSION version
, IWMProfile
**ret
)
302 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
303 FIXME("(%p)->(%x %p)\n", This
, version
, ret
);
307 static HRESULT WINAPI
WMProfileManager_LoadProfileByID(IWMProfileManager
*iface
, REFGUID guid
, IWMProfile
**ret
)
309 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
310 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(guid
), ret
);
314 static HRESULT WINAPI
WMProfileManager_LoadProfileByData(IWMProfileManager
*iface
, const WCHAR
*profile
, IWMProfile
**ret
)
316 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
317 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(profile
), ret
);
321 static HRESULT WINAPI
WMProfileManager_SaveProfile(IWMProfileManager
*iface
, IWMProfile
*profile
, WCHAR
*profile_str
, DWORD
*len
)
323 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
324 FIXME("(%p)->(%p %p %p)\n", This
, profile
, profile_str
, len
);
328 static HRESULT WINAPI
WMProfileManager_GetSystemProfileCount(IWMProfileManager
*iface
, DWORD
*ret
)
330 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
331 FIXME("(%p)->(%p)\n", This
, ret
);
335 static HRESULT WINAPI
WMProfileManager_LoadSystemProfile(IWMProfileManager
*iface
, DWORD index
, IWMProfile
**ret
)
337 WMProfileManager
*This
= impl_from_IWMProfileManager(iface
);
338 FIXME("(%p)->(%d %p)\n", This
, index
, ret
);
342 static const IWMProfileManagerVtbl WMProfileManagerVtbl
= {
343 WMProfileManager_QueryInterface
,
344 WMProfileManager_AddRef
,
345 WMProfileManager_Release
,
346 WMProfileManager_CreateEmptyProfile
,
347 WMProfileManager_LoadProfileByID
,
348 WMProfileManager_LoadProfileByData
,
349 WMProfileManager_SaveProfile
,
350 WMProfileManager_GetSystemProfileCount
,
351 WMProfileManager_LoadSystemProfile
354 HRESULT WINAPI
WMCreateProfileManager(IWMProfileManager
**ret
)
356 WMProfileManager
*profile_mgr
;
358 TRACE("(%p)\n", ret
);
360 profile_mgr
= heap_alloc(sizeof(*profile_mgr
));
362 return E_OUTOFMEMORY
;
364 profile_mgr
->IWMProfileManager_iface
.lpVtbl
= &WMProfileManagerVtbl
;
365 profile_mgr
->ref
= 1;
367 *ret
= &profile_mgr
->IWMProfileManager_iface
;