wined3d: Replace wined3d_surface_update_desc() with wined3d_texture_update_desc().
[wine.git] / dlls / wmvcore / wmvcore_main.c
blob33825427200afd8df10d4f6f61d9cbc0512b158e
1 /*
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
19 #include "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "initguid.h"
28 #include "wmsdkidl.h"
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);
47 switch (fdwReason)
49 case DLL_WINE_PREATTACH:
50 return FALSE; /* prefer native version */
51 case DLL_PROCESS_ATTACH:
52 DisableThreadLibraryCalls(hinstDLL);
53 break;
56 return TRUE;
59 HRESULT WINAPI DllRegisterServer(void)
61 FIXME("(): stub\n");
63 return S_OK;
66 HRESULT WINAPI WMCreateEditor(IWMMetadataEditor **editor)
68 FIXME("(%p): stub\n", editor);
70 *editor = NULL;
72 return E_NOTIMPL;
75 typedef struct {
76 IWMReader IWMReader_iface;
77 LONG ref;
78 } WMReader;
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;
95 }else {
96 *ppv = NULL;
97 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
98 return E_NOINTERFACE;
101 IUnknown_AddRef((IUnknown*)*ppv);
102 return S_OK;
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);
112 return 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);
122 if(!ref)
123 heap_free(This);
125 return 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);
132 return E_NOTIMPL;
135 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
137 WMReader *This = impl_from_IWMReader(iface);
138 FIXME("(%p)\n", This);
139 return E_NOTIMPL;
142 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *outputs)
144 WMReader *This = impl_from_IWMReader(iface);
145 FIXME("(%p)->(%p)\n", This, outputs);
146 return E_NOTIMPL;
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);
153 return E_NOTIMPL;
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);
160 return E_NOTIMPL;
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);
167 return E_NOTIMPL;
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);
174 return E_NOTIMPL;
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);
181 return E_NOTIMPL;
184 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
186 WMReader *This = impl_from_IWMReader(iface);
187 FIXME("(%p)\n", This);
188 return E_NOTIMPL;
191 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
193 WMReader *This = impl_from_IWMReader(iface);
194 FIXME("(%p)\n", This);
195 return E_NOTIMPL;
198 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
200 WMReader *This = impl_from_IWMReader(iface);
201 FIXME("(%p)\n", This);
202 return E_NOTIMPL;
205 static const IWMReaderVtbl WMReaderVtbl = {
206 WMReader_QueryInterface,
207 WMReader_AddRef,
208 WMReader_Release,
209 WMReader_Open,
210 WMReader_Close,
211 WMReader_GetOutputCount,
212 WMReader_GetOutputProps,
213 WMReader_SetOutputProps,
214 WMReader_GetOutputFormatCount,
215 WMReader_GetOutputFormat,
216 WMReader_Start,
217 WMReader_Stop,
218 WMReader_Pause,
219 WMReader_Resume
222 HRESULT WINAPI WMCreateReader(IUnknown *reserved, DWORD rights, IWMReader **ret_reader)
224 WMReader *reader;
226 TRACE("(%p, %x, %p)\n", reserved, rights, ret_reader);
228 reader = heap_alloc(sizeof(*reader));
229 if(!reader)
230 return E_OUTOFMEMORY;
232 reader->IWMReader_iface.lpVtbl = &WMReaderVtbl;
233 reader->ref = 1;
235 *ret_reader = &reader->IWMReader_iface;
236 return E_NOTIMPL;
239 HRESULT WINAPI WMCreateSyncReader(IUnknown *pcert, DWORD rights, IWMSyncReader **syncreader)
241 FIXME("(%p, %x, %p): stub\n", pcert, rights, syncreader);
243 *syncreader = NULL;
245 return E_NOTIMPL;
248 typedef struct {
249 IWMProfileManager IWMProfileManager_iface;
250 LONG ref;
251 } WMProfileManager;
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;
268 }else {
269 *ppv = NULL;
270 return E_NOINTERFACE;
273 IUnknown_AddRef((IUnknown*)*ppv);
274 return S_OK;
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);
284 return 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);
294 if(!ref)
295 heap_free(This);
297 return 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);
304 return E_NOTIMPL;
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);
311 return E_NOTIMPL;
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);
318 return E_NOTIMPL;
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);
325 return E_NOTIMPL;
328 static HRESULT WINAPI WMProfileManager_GetSystemProfileCount(IWMProfileManager *iface, DWORD *ret)
330 WMProfileManager *This = impl_from_IWMProfileManager(iface);
331 FIXME("(%p)->(%p)\n", This, ret);
332 return E_NOTIMPL;
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);
339 return E_NOTIMPL;
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));
361 if(!profile_mgr)
362 return E_OUTOFMEMORY;
364 profile_mgr->IWMProfileManager_iface.lpVtbl = &WMProfileManagerVtbl;
365 profile_mgr->ref = 1;
367 *ret = &profile_mgr->IWMProfileManager_iface;
368 return S_OK;