Add icm.h for colour management.
[wine/hacks.git] / dlls / dmime / song.c
blobdbcb17dca57a3b08405c2e43159cf7b0779ff7c1
1 /* IDirectMusicSong Implementation
3 * Copyright (C) 2003 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 <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "wingdi.h"
26 #include "wine/debug.h"
28 #include "dmime_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
32 /* IDirectMusicSong IUnknown part: */
33 HRESULT WINAPI IDirectMusicSongImpl_QueryInterface (LPDIRECTMUSICSONG iface, REFIID riid, LPVOID *ppobj)
35 ICOM_THIS(IDirectMusicSongImpl,iface);
37 if (IsEqualIID (riid, &IID_IUnknown) ||
38 IsEqualIID (riid, &IID_IDirectMusicSong)) {
39 IDirectMusicSongImpl_AddRef(iface);
40 *ppobj = This;
41 return S_OK;
44 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
45 return E_NOINTERFACE;
48 ULONG WINAPI IDirectMusicSongImpl_AddRef (LPDIRECTMUSICSONG iface)
50 ICOM_THIS(IDirectMusicSongImpl,iface);
51 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
52 return ++(This->ref);
55 ULONG WINAPI IDirectMusicSongImpl_Release (LPDIRECTMUSICSONG iface)
57 ICOM_THIS(IDirectMusicSongImpl,iface);
58 ULONG ref = --This->ref;
59 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60 if (ref == 0) {
61 HeapFree(GetProcessHeap(), 0, This);
63 return ref;
66 /* IDirectMusicSong IDirectMusicSong part: */
67 HRESULT WINAPI IDirectMusicSongImpl_Compose (LPDIRECTMUSICSONG iface)
69 ICOM_THIS(IDirectMusicSongImpl,iface);
71 FIXME("(%p): stub\n", This);
73 return S_OK;
76 HRESULT WINAPI IDirectMusicSongImpl_GetParam (LPDIRECTMUSICSONG iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam)
78 ICOM_THIS(IDirectMusicSongImpl,iface);
80 FIXME("(%p, %s, %ld, %ld, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), dwGroupBits, dwIndex, mtTime, pmtNext, pParam);
82 return S_OK;
85 HRESULT WINAPI IDirectMusicSongImpl_GetSegment (LPDIRECTMUSICSONG iface, WCHAR* pwzName, IDirectMusicSegment** ppSegment)
87 ICOM_THIS(IDirectMusicSongImpl,iface);
89 FIXME("(%p, %p, %p): stub\n", This, pwzName, ppSegment);
91 return S_OK;
94 HRESULT WINAPI IDirectMusicSongImpl_GetAudioPathConfig (LPDIRECTMUSICSONG iface, IUnknown** ppAudioPathConfig)
96 ICOM_THIS(IDirectMusicSongImpl,iface);
98 FIXME("(%p, %p): stub\n", This, ppAudioPathConfig);
100 return S_OK;
103 HRESULT WINAPI IDirectMusicSongImpl_Download (LPDIRECTMUSICSONG iface, IUnknown* pAudioPath)
105 ICOM_THIS(IDirectMusicSongImpl,iface);
107 FIXME("(%p, %p): stub\n", This, pAudioPath);
109 return S_OK;
112 HRESULT WINAPI IDirectMusicSongImpl_Unload (LPDIRECTMUSICSONG iface, IUnknown* pAudioPath)
114 ICOM_THIS(IDirectMusicSongImpl,iface);
116 FIXME("(%p, %p): stub\n", This, pAudioPath);
118 return S_OK;
121 HRESULT WINAPI IDirectMusicSongImpl_EnumSegment (LPDIRECTMUSICSONG iface, DWORD dwIndex, IDirectMusicSegment** ppSegment)
123 ICOM_THIS(IDirectMusicSongImpl,iface);
125 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, ppSegment);
127 return S_OK;
130 ICOM_VTABLE(IDirectMusicSong) DirectMusicSong_Vtbl =
132 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
133 IDirectMusicSongImpl_QueryInterface,
134 IDirectMusicSongImpl_AddRef,
135 IDirectMusicSongImpl_Release,
136 IDirectMusicSongImpl_Compose,
137 IDirectMusicSongImpl_GetParam,
138 IDirectMusicSongImpl_GetSegment,
139 IDirectMusicSongImpl_GetAudioPathConfig,
140 IDirectMusicSongImpl_Download,
141 IDirectMusicSongImpl_Unload,
142 IDirectMusicSongImpl_EnumSegment
145 /* for ClassFactory */
146 HRESULT WINAPI DMUSIC_CreateDirectMusicSong (LPCGUID lpcGUID, LPDIRECTMUSICSONG *ppDMSng, LPUNKNOWN pUnkOuter)
148 IDirectMusicSongImpl* dmsong;
150 if (IsEqualIID (lpcGUID, &IID_IDirectMusicSong)) {
151 dmsong = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongImpl));
152 if (NULL == dmsong) {
153 *ppDMSng = (LPDIRECTMUSICSONG) NULL;
154 return E_OUTOFMEMORY;
156 dmsong->lpVtbl = &DirectMusicSong_Vtbl;
157 dmsong->ref = 1;
158 *ppDMSng = (LPDIRECTMUSICSONG) dmsong;
159 return S_OK;
161 WARN("No interface found\n");
163 return E_NOINTERFACE;
166 /*****************************************************************************
167 * IDirectMusicSongObject implementation
169 /* IDirectMusicSongObject IUnknown part: */
170 HRESULT WINAPI IDirectMusicSongObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
172 ICOM_THIS(IDirectMusicSongObject,iface);
174 if (IsEqualIID (riid, &IID_IUnknown)
175 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
176 IDirectMusicSongObject_AddRef(iface);
177 *ppobj = This;
178 return S_OK;
179 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
180 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
181 *ppobj = (LPPERSISTSTREAM)This->pStream;
182 return S_OK;
183 } else if (IsEqualIID (riid, &IID_IDirectMusicSong)) {
184 IDirectMusicSong_AddRef ((LPDIRECTMUSICSONG)This->pSong);
185 *ppobj = (LPDIRECTMUSICSONG)This->pSong;
186 return S_OK;
188 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
189 return E_NOINTERFACE;
192 ULONG WINAPI IDirectMusicSongObject_AddRef (LPDIRECTMUSICOBJECT iface)
194 ICOM_THIS(IDirectMusicSongObject,iface);
195 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
196 return ++(This->ref);
199 ULONG WINAPI IDirectMusicSongObject_Release (LPDIRECTMUSICOBJECT iface)
201 ICOM_THIS(IDirectMusicSongObject,iface);
202 ULONG ref = --This->ref;
203 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
204 if (ref == 0) {
205 HeapFree(GetProcessHeap(), 0, This);
207 return ref;
210 /* IDirectMusicSongObject IDirectMusicObject part: */
211 HRESULT WINAPI IDirectMusicSongObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
213 ICOM_THIS(IDirectMusicSongObject,iface);
215 TRACE("(%p, %p)\n", This, pDesc);
216 pDesc = This->pDesc;
218 return S_OK;
221 HRESULT WINAPI IDirectMusicSongObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
223 ICOM_THIS(IDirectMusicSongObject,iface);
225 TRACE("(%p, %p)\n", This, pDesc);
226 This->pDesc = pDesc;
228 return S_OK;
231 HRESULT WINAPI IDirectMusicSongObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
233 ICOM_THIS(IDirectMusicSongObject,iface);
235 FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
237 return S_OK;
240 ICOM_VTABLE(IDirectMusicObject) DirectMusicSongObject_Vtbl =
242 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
243 IDirectMusicSongObject_QueryInterface,
244 IDirectMusicSongObject_AddRef,
245 IDirectMusicSongObject_Release,
246 IDirectMusicSongObject_GetDescriptor,
247 IDirectMusicSongObject_SetDescriptor,
248 IDirectMusicSongObject_ParseDescriptor
251 /* for ClassFactory */
252 HRESULT WINAPI DMUSIC_CreateDirectMusicSongObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
254 IDirectMusicSongObject *obj;
256 TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
257 if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
258 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongObject));
259 if (NULL == obj) {
260 *ppObject = (LPDIRECTMUSICOBJECT) NULL;
261 return E_OUTOFMEMORY;
263 obj->lpVtbl = &DirectMusicSongObject_Vtbl;
264 obj->ref = 1;
265 /* prepare IPersistStream */
266 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongObjectStream));
267 obj->pStream->lpVtbl = &DirectMusicSongObjectStream_Vtbl;
268 obj->pStream->ref = 1;
269 obj->pStream->pParentObject = obj;
270 /* prepare IDirectMusicSong */
271 DMUSIC_CreateDirectMusicSong (&IID_IDirectMusicSong, (LPDIRECTMUSICSONG*)&obj->pSong, NULL);
272 obj->pSong->pObject = obj;
273 *ppObject = (LPDIRECTMUSICOBJECT) obj;
274 return S_OK;
276 WARN("No interface found\n");
278 return E_NOINTERFACE;
281 /*****************************************************************************
282 * IDirectMusicSongObjectStream implementation
284 /* IDirectMusicSongObjectStream IUnknown part: */
285 HRESULT WINAPI IDirectMusicSongObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
287 ICOM_THIS(IDirectMusicSongObjectStream,iface);
289 if (IsEqualIID (riid, &IID_IUnknown)
290 || IsEqualIID (riid, &IID_IPersistStream)) {
291 IDirectMusicSongObjectStream_AddRef(iface);
292 *ppobj = This;
293 return S_OK;
295 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
296 return E_NOINTERFACE;
299 ULONG WINAPI IDirectMusicSongObjectStream_AddRef (LPPERSISTSTREAM iface)
301 ICOM_THIS(IDirectMusicSongObjectStream,iface);
302 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
303 return ++(This->ref);
306 ULONG WINAPI IDirectMusicSongObjectStream_Release (LPPERSISTSTREAM iface)
308 ICOM_THIS(IDirectMusicSongObjectStream,iface);
309 ULONG ref = --This->ref;
310 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
311 if (ref == 0) {
312 HeapFree(GetProcessHeap(), 0, This);
314 return ref;
317 /* IDirectMusicSongObjectStream IPersist part: */
318 HRESULT WINAPI IDirectMusicSongObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
320 return E_NOTIMPL;
323 /* IDirectMusicSongObjectStream IPersistStream part: */
324 HRESULT WINAPI IDirectMusicSongObjectStream_IsDirty (LPPERSISTSTREAM iface)
326 return E_NOTIMPL;
329 HRESULT WINAPI IDirectMusicSongObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
331 FIXME(": Loading not implemented yet\n");
332 return S_OK;
335 HRESULT WINAPI IDirectMusicSongObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
337 return E_NOTIMPL;
340 HRESULT WINAPI IDirectMusicSongObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
342 return E_NOTIMPL;
345 ICOM_VTABLE(IPersistStream) DirectMusicSongObjectStream_Vtbl =
347 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
348 IDirectMusicSongObjectStream_QueryInterface,
349 IDirectMusicSongObjectStream_AddRef,
350 IDirectMusicSongObjectStream_Release,
351 IDirectMusicSongObjectStream_GetClassID,
352 IDirectMusicSongObjectStream_IsDirty,
353 IDirectMusicSongObjectStream_Load,
354 IDirectMusicSongObjectStream_Save,
355 IDirectMusicSongObjectStream_GetSizeMax