user32: Try to load libpng only once.
[wine.git] / dlls / dmstyle / mutetrack.c
blob67bfbc30dc716a5472db79a7ca25d380decbf18f
1 /* IDirectMusicMuteTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmstyle_private.h"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
25 /*****************************************************************************
26 * IDirectMusicMuteTrack implementation
28 typedef struct IDirectMusicMuteTrack {
29 IDirectMusicTrack8 IDirectMusicTrack8_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicMuteTrack;
34 /* IDirectMusicMuteTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicMuteTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicMuteTrack, IDirectMusicTrack8_iface);
40 static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
45 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface);
47 *ret_iface = NULL;
49 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) ||
50 IsEqualIID(riid, &IID_IDirectMusicTrack8))
51 *ret_iface = iface;
52 else if (IsEqualIID(riid, &IID_IPersistStream))
53 *ret_iface = &This->dmobj.IPersistStream_iface;
54 else {
55 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
56 return E_NOINTERFACE;
59 IUnknown_AddRef((IUnknown*)*ret_iface);
60 return S_OK;
63 static ULONG WINAPI IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8 *iface)
65 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
66 LONG ref = InterlockedIncrement(&This->ref);
68 TRACE("(%p) ref=%d\n", This, ref);
70 return ref;
73 static ULONG WINAPI IDirectMusicTrack8Impl_Release(IDirectMusicTrack8 *iface)
75 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
76 LONG ref = InterlockedDecrement(&This->ref);
78 TRACE("(%p) ref=%d\n", This, ref);
80 if (!ref) {
81 HeapFree(GetProcessHeap(), 0, This);
82 DMSTYLE_UnlockModule();
85 return ref;
88 static HRESULT WINAPI IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface,
89 IDirectMusicSegment *pSegment)
91 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
92 FIXME("(%p, %p): stub\n", This, pSegment);
93 return S_OK;
96 static HRESULT WINAPI IDirectMusicTrack8Impl_InitPlay(IDirectMusicTrack8 *iface,
97 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
98 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
100 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
101 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
102 return S_OK;
105 static HRESULT WINAPI IDirectMusicTrack8Impl_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
107 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
108 FIXME("(%p, %p): stub\n", This, pStateData);
109 return S_OK;
112 static HRESULT WINAPI IDirectMusicTrack8Impl_Play(IDirectMusicTrack8 *iface, void *pStateData,
113 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
114 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
116 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
117 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
118 return S_OK;
121 static HRESULT WINAPI IDirectMusicTrack8Impl_GetParam(IDirectMusicTrack8 *iface, REFGUID rguidType,
122 MUSIC_TIME mtTime, MUSIC_TIME *pmtNext, void *pParam)
124 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
125 FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
126 return S_OK;
129 static HRESULT WINAPI IDirectMusicTrack8Impl_SetParam(IDirectMusicTrack8 *iface, REFGUID rguidType,
130 MUSIC_TIME mtTime, void *pParam)
132 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
133 FIXME("(%p, %s, %d, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
134 return S_OK;
137 static HRESULT WINAPI IDirectMusicTrack8Impl_IsParamSupported(IDirectMusicTrack8 *iface,
138 REFGUID rguidType)
140 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
142 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
144 if (!rguidType)
145 return E_POINTER;
147 if (IsEqualGUID (rguidType, &GUID_MuteParam)) {
148 TRACE("param supported\n");
149 return S_OK;
151 TRACE("param unsupported\n");
152 return DMUS_E_TYPE_UNSUPPORTED;
155 static HRESULT WINAPI IDirectMusicTrack8Impl_AddNotificationType(IDirectMusicTrack8 *iface,
156 REFGUID notiftype)
158 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
160 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
161 return E_NOTIMPL;
164 static HRESULT WINAPI IDirectMusicTrack8Impl_RemoveNotificationType(IDirectMusicTrack8 *iface,
165 REFGUID notiftype)
167 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
169 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
170 return E_NOTIMPL;
173 static HRESULT WINAPI IDirectMusicTrack8Impl_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
174 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
176 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
177 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
178 return S_OK;
181 static HRESULT WINAPI IDirectMusicTrack8Impl_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
182 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
183 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
185 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
186 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
187 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
188 return S_OK;
191 static HRESULT WINAPI IDirectMusicTrack8Impl_GetParamEx(IDirectMusicTrack8 *iface,
192 REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME *prtNext, void *pParam,
193 void *pStateData, DWORD dwFlags)
195 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
196 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
197 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
198 return S_OK;
201 static HRESULT WINAPI IDirectMusicTrack8Impl_SetParamEx(IDirectMusicTrack8 *iface,
202 REFGUID rguidType, REFERENCE_TIME rtTime, void *pParam, void *pStateData, DWORD dwFlags)
204 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
205 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
206 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
207 return S_OK;
210 static HRESULT WINAPI IDirectMusicTrack8Impl_Compose(IDirectMusicTrack8 *iface, IUnknown *context,
211 DWORD trackgroup, IDirectMusicTrack **track)
213 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
215 TRACE("(%p, %p, %d, %p): method not implemented\n", This, context, trackgroup, track);
216 return E_NOTIMPL;
219 static HRESULT WINAPI IDirectMusicTrack8Impl_Join(IDirectMusicTrack8 *iface,
220 IDirectMusicTrack *newtrack, MUSIC_TIME join, IUnknown *context, DWORD trackgroup,
221 IDirectMusicTrack **resulttrack)
223 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
224 TRACE("(%p, %p, %d, %p, %d, %p): stub\n", This, newtrack, join, context, trackgroup,
225 resulttrack);
226 return E_NOTIMPL;
229 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
230 IDirectMusicTrack8Impl_QueryInterface,
231 IDirectMusicTrack8Impl_AddRef,
232 IDirectMusicTrack8Impl_Release,
233 IDirectMusicTrack8Impl_Init,
234 IDirectMusicTrack8Impl_InitPlay,
235 IDirectMusicTrack8Impl_EndPlay,
236 IDirectMusicTrack8Impl_Play,
237 IDirectMusicTrack8Impl_GetParam,
238 IDirectMusicTrack8Impl_SetParam,
239 IDirectMusicTrack8Impl_IsParamSupported,
240 IDirectMusicTrack8Impl_AddNotificationType,
241 IDirectMusicTrack8Impl_RemoveNotificationType,
242 IDirectMusicTrack8Impl_Clone,
243 IDirectMusicTrack8Impl_PlayEx,
244 IDirectMusicTrack8Impl_GetParamEx,
245 IDirectMusicTrack8Impl_SetParamEx,
246 IDirectMusicTrack8Impl_Compose,
247 IDirectMusicTrack8Impl_Join
250 static inline IDirectMusicMuteTrack * impl_from_IPersistStream(IPersistStream *iface)
252 return CONTAINING_RECORD(iface, IDirectMusicMuteTrack, dmobj.IPersistStream_iface);
255 static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
257 FIXME(": Loading not implemented yet\n");
258 return S_OK;
261 static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
262 BOOL cleardirty)
264 IDirectMusicMuteTrack *This = impl_from_IPersistStream(iface);
266 FIXME("(%p, %p, %d): stub\n", This, stream, cleardirty);
268 if (!stream)
269 return E_POINTER;
271 return E_NOTIMPL;
274 static const IPersistStreamVtbl persiststream_vtbl = {
275 dmobj_IPersistStream_QueryInterface,
276 dmobj_IPersistStream_AddRef,
277 dmobj_IPersistStream_Release,
278 dmobj_IPersistStream_GetClassID,
279 unimpl_IPersistStream_IsDirty,
280 IPersistStreamImpl_Load,
281 IPersistStreamImpl_Save,
282 unimpl_IPersistStream_GetSizeMax
285 /* for ClassFactory */
286 HRESULT WINAPI create_dmmutetrack(REFIID lpcGUID, void **ppobj)
288 IDirectMusicMuteTrack *track;
289 HRESULT hr;
291 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
292 if (!track) {
293 *ppobj = NULL;
294 return E_OUTOFMEMORY;
296 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
297 track->ref = 1;
298 dmobject_init(&track->dmobj, &CLSID_DirectMusicMuteTrack,
299 (IUnknown *)&track->IDirectMusicTrack8_iface);
300 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
302 DMSTYLE_LockModule();
303 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
304 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
306 return hr;