Added YUV routines needed for v4l driver, and in the future possibly
[wine/gsoc-2012-control.git] / dlls / dmstyle / dmstyle_main.c
blob5177beee1fca0d854a59f2de3a83a57e69e51355
1 /* DirectMusicStyle Main
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "dmstyle_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
24 LONG DMSTYLE_refCount = 0;
26 typedef struct {
27 IClassFactoryVtbl *lpVtbl;
28 } IClassFactoryImpl;
30 /******************************************************************
31 * DirectMusicSection ClassFactory
33 static HRESULT WINAPI SectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
34 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
36 if (ppobj == NULL) return E_POINTER;
38 return E_NOINTERFACE;
41 static ULONG WINAPI SectionCF_AddRef(LPCLASSFACTORY iface) {
42 DMSTYLE_LockModule();
44 return 2; /* non-heap based object */
47 static ULONG WINAPI SectionCF_Release(LPCLASSFACTORY iface) {
48 DMSTYLE_UnlockModule();
50 return 1; /* non-heap based object */
53 static HRESULT WINAPI SectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
54 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
56 /* nothing here yet */
57 WARN("(%s, %p): not found\n", debugstr_dmguid(riid), ppobj);
59 return E_NOINTERFACE;
62 static HRESULT WINAPI SectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
63 TRACE("(%d)\n", dolock);
65 if (dolock)
66 DMSTYLE_LockModule();
67 else
68 DMSTYLE_UnlockModule();
70 return S_OK;
73 static IClassFactoryVtbl SectionCF_Vtbl = {
74 SectionCF_QueryInterface,
75 SectionCF_AddRef,
76 SectionCF_Release,
77 SectionCF_CreateInstance,
78 SectionCF_LockServer
81 static IClassFactoryImpl Section_CF = {&SectionCF_Vtbl};
83 /******************************************************************
84 * DirectMusicStyle ClassFactory
86 static HRESULT WINAPI StyleCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
87 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
89 if (ppobj == NULL) return E_POINTER;
91 return E_NOINTERFACE;
94 static ULONG WINAPI StyleCF_AddRef(LPCLASSFACTORY iface) {
95 DMSTYLE_LockModule();
97 return 2; /* non-heap based object */
100 static ULONG WINAPI StyleCF_Release(LPCLASSFACTORY iface) {
101 DMSTYLE_UnlockModule();
103 return 1; /* non-heap based object */
106 static HRESULT WINAPI StyleCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
107 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
109 return DMUSIC_CreateDirectMusicStyleImpl (riid, ppobj, pOuter);
112 static HRESULT WINAPI StyleCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
113 TRACE("(%d)\n", dolock);
115 if (dolock)
116 DMSTYLE_LockModule();
117 else
118 DMSTYLE_UnlockModule();
120 return S_OK;
123 static IClassFactoryVtbl StyleCF_Vtbl = {
124 StyleCF_QueryInterface,
125 StyleCF_AddRef,
126 StyleCF_Release,
127 StyleCF_CreateInstance,
128 StyleCF_LockServer
131 static IClassFactoryImpl Style_CF = {&StyleCF_Vtbl};
133 /******************************************************************
134 * DirectMusicChordTrack ClassFactory
136 static HRESULT WINAPI ChordTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
137 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
139 if (ppobj == NULL) return E_POINTER;
141 return E_NOINTERFACE;
144 static ULONG WINAPI ChordTrackCF_AddRef(LPCLASSFACTORY iface) {
145 DMSTYLE_LockModule();
147 return 2; /* non-heap based object */
150 static ULONG WINAPI ChordTrackCF_Release(LPCLASSFACTORY iface) {
151 DMSTYLE_UnlockModule();
153 return 1; /* non-heap based object */
156 static HRESULT WINAPI ChordTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
157 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
159 return DMUSIC_CreateDirectMusicChordTrack (riid, ppobj, pOuter);
162 static HRESULT WINAPI ChordTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
163 TRACE("(%d)\n", dolock);
165 if (dolock)
166 DMSTYLE_LockModule();
167 else
168 DMSTYLE_UnlockModule();
170 return S_OK;
173 static IClassFactoryVtbl ChordTrackCF_Vtbl = {
174 ChordTrackCF_QueryInterface,
175 ChordTrackCF_AddRef,
176 ChordTrackCF_Release,
177 ChordTrackCF_CreateInstance,
178 ChordTrackCF_LockServer
181 static IClassFactoryImpl ChordTrack_CF = {&ChordTrackCF_Vtbl};
183 /******************************************************************
184 * DirectMusicCommandTrack ClassFactory
186 static HRESULT WINAPI CommandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
187 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
189 if (ppobj == NULL) return E_POINTER;
191 return E_NOINTERFACE;
194 static ULONG WINAPI CommandTrackCF_AddRef(LPCLASSFACTORY iface) {
195 DMSTYLE_LockModule();
197 return 2; /* non-heap based object */
200 static ULONG WINAPI CommandTrackCF_Release(LPCLASSFACTORY iface) {
201 DMSTYLE_UnlockModule();
203 return 1; /* non-heap based object */
206 static HRESULT WINAPI CommandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
207 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
209 return DMUSIC_CreateDirectMusicCommandTrack (riid, ppobj, pOuter);
212 static HRESULT WINAPI CommandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
213 TRACE("(%d)\n", dolock);
215 if (dolock)
216 DMSTYLE_LockModule();
217 else
218 DMSTYLE_UnlockModule();
220 return S_OK;
223 static IClassFactoryVtbl CommandTrackCF_Vtbl = {
224 CommandTrackCF_QueryInterface,
225 CommandTrackCF_AddRef,
226 CommandTrackCF_Release,
227 CommandTrackCF_CreateInstance,
228 CommandTrackCF_LockServer
231 static IClassFactoryImpl CommandTrack_CF = {&CommandTrackCF_Vtbl};
233 /******************************************************************
234 * DirectMusicStyleTrack ClassFactory
236 static HRESULT WINAPI StyleTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
237 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
239 if (ppobj == NULL) return E_POINTER;
241 return E_NOINTERFACE;
244 static ULONG WINAPI StyleTrackCF_AddRef(LPCLASSFACTORY iface) {
245 DMSTYLE_LockModule();
247 return 2; /* non-heap based object */
250 static ULONG WINAPI StyleTrackCF_Release(LPCLASSFACTORY iface) {
251 DMSTYLE_UnlockModule();
253 return 1; /* non-heap based object */
256 static HRESULT WINAPI StyleTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
257 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
259 return DMUSIC_CreateDirectMusicStyleTrack (riid, ppobj, pOuter);
262 static HRESULT WINAPI StyleTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
263 TRACE("(%d)\n", dolock);
265 if (dolock)
266 DMSTYLE_LockModule();
267 else
268 DMSTYLE_UnlockModule();
270 return S_OK;
273 static IClassFactoryVtbl StyleTrackCF_Vtbl = {
274 StyleTrackCF_QueryInterface,
275 StyleTrackCF_AddRef,
276 StyleTrackCF_Release,
277 StyleTrackCF_CreateInstance,
278 StyleTrackCF_LockServer
281 static IClassFactoryImpl StyleTrack_CF = {&StyleTrackCF_Vtbl};
283 /******************************************************************
284 * DirectMusicMotifTrack ClassFactory
286 static HRESULT WINAPI MotifTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
287 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
289 if (ppobj == NULL) return E_POINTER;
291 return E_NOINTERFACE;
294 static ULONG WINAPI MotifTrackCF_AddRef(LPCLASSFACTORY iface) {
295 DMSTYLE_LockModule();
297 return 2; /* non-heap based object */
300 static ULONG WINAPI MotifTrackCF_Release(LPCLASSFACTORY iface) {
301 DMSTYLE_UnlockModule();
303 return 1; /* non-heap based object */
306 static HRESULT WINAPI MotifTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
307 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
309 return DMUSIC_CreateDirectMusicMotifTrack (riid, ppobj, pOuter);
312 static HRESULT WINAPI MotifTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
313 TRACE("(%d)\n", dolock);
315 if (dolock)
316 DMSTYLE_LockModule();
317 else
318 DMSTYLE_UnlockModule();
320 return S_OK;
323 static IClassFactoryVtbl MotifTrackCF_Vtbl = {
324 MotifTrackCF_QueryInterface,
325 MotifTrackCF_AddRef,
326 MotifTrackCF_Release,
327 MotifTrackCF_CreateInstance,
328 MotifTrackCF_LockServer
331 static IClassFactoryImpl MotifTrack_CF = {&MotifTrackCF_Vtbl};
333 /******************************************************************
334 * DirectMusicAuditionTrack ClassFactory
336 static HRESULT WINAPI AuditionTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
337 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
339 if (ppobj == NULL) return E_POINTER;
341 return E_NOINTERFACE;
344 static ULONG WINAPI AuditionTrackCF_AddRef(LPCLASSFACTORY iface) {
345 DMSTYLE_LockModule();
347 return 2; /* non-heap based object */
350 static ULONG WINAPI AuditionTrackCF_Release(LPCLASSFACTORY iface) {
351 DMSTYLE_UnlockModule();
353 return 1; /* non-heap based object */
356 static HRESULT WINAPI AuditionTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
357 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
359 return DMUSIC_CreateDirectMusicAuditionTrack (riid, ppobj, pOuter);
362 static HRESULT WINAPI AuditionTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
363 TRACE("(%d)\n", dolock);
365 if (dolock)
366 DMSTYLE_LockModule();
367 else
368 DMSTYLE_UnlockModule();
370 return S_OK;
373 static IClassFactoryVtbl AuditionTrackCF_Vtbl = {
374 AuditionTrackCF_QueryInterface,
375 AuditionTrackCF_AddRef,
376 AuditionTrackCF_Release,
377 AuditionTrackCF_CreateInstance,
378 AuditionTrackCF_LockServer
381 static IClassFactoryImpl AuditionTrack_CF = {&AuditionTrackCF_Vtbl};
383 /******************************************************************
384 * DirectMusicMuteTrack ClassFactory
386 static HRESULT WINAPI MuteTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
387 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
389 if (ppobj == NULL) return E_POINTER;
391 return E_NOINTERFACE;
394 static ULONG WINAPI MuteTrackCF_AddRef(LPCLASSFACTORY iface) {
395 DMSTYLE_LockModule();
397 return 2; /* non-heap based object */
400 static ULONG WINAPI MuteTrackCF_Release(LPCLASSFACTORY iface) {
401 DMSTYLE_UnlockModule();
403 return 1; /* non-heap based object */
406 static HRESULT WINAPI MuteTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
407 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
409 return DMUSIC_CreateDirectMusicMuteTrack (riid, ppobj, pOuter);
412 static HRESULT WINAPI MuteTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
413 TRACE("(%d)\n", dolock);
415 if (dolock)
416 DMSTYLE_LockModule();
417 else
418 DMSTYLE_UnlockModule();
420 return S_OK;
423 static IClassFactoryVtbl MuteTrackCF_Vtbl = {
424 MuteTrackCF_QueryInterface,
425 MuteTrackCF_AddRef,
426 MuteTrackCF_Release,
427 MuteTrackCF_CreateInstance,
428 MuteTrackCF_LockServer
431 static IClassFactoryImpl MuteTrack_CF = {&MuteTrackCF_Vtbl};
433 /******************************************************************
434 * DllMain
438 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
439 if (fdwReason == DLL_PROCESS_ATTACH) {
440 DisableThreadLibraryCalls(hinstDLL);
441 /* FIXME: Initialisation */
442 } else if (fdwReason == DLL_PROCESS_DETACH) {
443 /* FIXME: Cleanup */
446 return TRUE;
450 /******************************************************************
451 * DllCanUnloadNow (DMSTYLE.1)
455 HRESULT WINAPI DllCanUnloadNow(void) {
456 return DMSTYLE_refCount != 0 ? S_FALSE : S_OK;
460 /******************************************************************
461 * DllGetClassObject (DMSTYLE.2)
465 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) {
466 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
468 if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSection) && IsEqualIID (riid, &IID_IClassFactory)) {
469 *ppv = (LPVOID) &Section_CF;
470 IClassFactory_AddRef((IClassFactory*)*ppv);
471 return S_OK;
472 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyle) && IsEqualIID (riid, &IID_IClassFactory)) {
473 *ppv = (LPVOID) &Style_CF;
474 IClassFactory_AddRef((IClassFactory*)*ppv);
475 return S_OK;
476 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicChordTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
477 *ppv = (LPVOID) &ChordTrack_CF;
478 IClassFactory_AddRef((IClassFactory*)*ppv);
479 return S_OK;
480 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCommandTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
481 *ppv = (LPVOID) &CommandTrack_CF;
482 IClassFactory_AddRef((IClassFactory*)*ppv);
483 return S_OK;
484 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyleTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
485 *ppv = (LPVOID) &StyleTrack_CF;
486 IClassFactory_AddRef((IClassFactory*)*ppv);
487 return S_OK;
488 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMotifTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
489 *ppv = (LPVOID) &MotifTrack_CF;
490 IClassFactory_AddRef((IClassFactory*)*ppv);
491 return S_OK;
492 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAuditionTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
493 *ppv = (LPVOID) &AuditionTrack_CF;
494 IClassFactory_AddRef((IClassFactory*)*ppv);
495 return S_OK;
496 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMuteTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
497 *ppv = (LPVOID) &MuteTrack_CF;
498 IClassFactory_AddRef((IClassFactory*)*ppv);
499 return S_OK;
502 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
503 return CLASS_E_CLASSNOTAVAILABLE;