kernel32/nls: Added LOCALE_SNAN entries.
[wine.git] / dlls / dmime / markertrack.c
blob32dd025ed4f4d006623c172e756c8fb2e39827f6
1 /* IDirectMusicMarkerTrack 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 "dmime_private.h"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
25 /*****************************************************************************
26 * IDirectMusicMarkerTrack implementation
28 typedef struct IDirectMusicMarkerTrack {
29 IDirectMusicTrack IDirectMusicTrack_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicMarkerTrack;
34 /* IDirectMusicMarkerTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicMarkerTrack *impl_from_IDirectMusicTrack(IDirectMusicTrack *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicMarkerTrack, IDirectMusicTrack_iface);
40 static HRESULT WINAPI IDirectMusicTrackImpl_QueryInterface(IDirectMusicTrack *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(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 *ret_iface = iface;
51 else if (IsEqualIID(riid, &IID_IPersistStream))
52 *ret_iface = &This->dmobj.IPersistStream_iface;
53 else {
54 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
55 return E_NOINTERFACE;
58 IUnknown_AddRef((IUnknown*)*ret_iface);
59 return S_OK;
62 static ULONG WINAPI IDirectMusicTrackImpl_AddRef(IDirectMusicTrack *iface)
64 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
65 LONG ref = InterlockedIncrement(&This->ref);
67 TRACE("(%p) ref=%d\n", This, ref);
69 return ref;
72 static ULONG WINAPI IDirectMusicTrackImpl_Release(IDirectMusicTrack *iface)
74 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
75 LONG ref = InterlockedDecrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
79 if (!ref) {
80 HeapFree(GetProcessHeap(), 0, This);
81 DMIME_UnlockModule();
84 return ref;
87 static HRESULT WINAPI IDirectMusicTrackImpl_Init(IDirectMusicTrack *iface,
88 IDirectMusicSegment *pSegment)
90 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
91 FIXME("(%p, %p): stub\n", This, pSegment);
92 return S_OK;
95 static HRESULT WINAPI IDirectMusicTrackImpl_InitPlay(IDirectMusicTrack *iface,
96 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
97 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
99 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
100 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
101 return S_OK;
104 static HRESULT WINAPI IDirectMusicTrackImpl_EndPlay(IDirectMusicTrack *iface, void *pStateData)
106 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
111 static HRESULT WINAPI IDirectMusicTrackImpl_Play(IDirectMusicTrack *iface, void *pStateData,
112 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
113 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
115 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
116 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
117 return S_OK;
120 static HRESULT WINAPI IDirectMusicTrackImpl_GetParam(IDirectMusicTrack *iface, REFGUID rguidType,
121 MUSIC_TIME mtTime, MUSIC_TIME *pmtNext, void *pParam)
123 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
124 FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
125 return S_OK;
128 static HRESULT WINAPI IDirectMusicTrackImpl_SetParam(IDirectMusicTrack *iface, REFGUID rguidType,
129 MUSIC_TIME mtTime, void *pParam)
131 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
132 FIXME("(%p, %s, %d, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
133 return S_OK;
136 static HRESULT WINAPI IDirectMusicTrackImpl_IsParamSupported(IDirectMusicTrack *iface,
137 REFGUID rguidType)
139 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
141 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
142 if (IsEqualGUID (rguidType, &GUID_Play_Marker)
143 || IsEqualGUID (rguidType, &GUID_Valid_Start_Time)) {
144 TRACE("param supported\n");
145 return S_OK;
147 TRACE("param unsupported\n");
148 return DMUS_E_TYPE_UNSUPPORTED;
151 static HRESULT WINAPI IDirectMusicTrackImpl_AddNotificationType(IDirectMusicTrack *iface,
152 REFGUID rguidNotificationType)
154 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
155 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
156 return S_OK;
159 static HRESULT WINAPI IDirectMusicTrackImpl_RemoveNotificationType(IDirectMusicTrack *iface,
160 REFGUID rguidNotificationType)
162 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
163 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
164 return S_OK;
167 static HRESULT WINAPI IDirectMusicTrackImpl_Clone(IDirectMusicTrack *iface, MUSIC_TIME mtStart,
168 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
170 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
171 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
172 return S_OK;
175 static const IDirectMusicTrackVtbl dmtrack_vtbl = {
176 IDirectMusicTrackImpl_QueryInterface,
177 IDirectMusicTrackImpl_AddRef,
178 IDirectMusicTrackImpl_Release,
179 IDirectMusicTrackImpl_Init,
180 IDirectMusicTrackImpl_InitPlay,
181 IDirectMusicTrackImpl_EndPlay,
182 IDirectMusicTrackImpl_Play,
183 IDirectMusicTrackImpl_GetParam,
184 IDirectMusicTrackImpl_SetParam,
185 IDirectMusicTrackImpl_IsParamSupported,
186 IDirectMusicTrackImpl_AddNotificationType,
187 IDirectMusicTrackImpl_RemoveNotificationType,
188 IDirectMusicTrackImpl_Clone
191 static HRESULT WINAPI marker_IPersistStream_Load(IPersistStream *iface, IStream *stream)
193 FIXME(": Loading not implemented yet\n");
194 return S_OK;
197 static const IPersistStreamVtbl persiststream_vtbl = {
198 dmobj_IPersistStream_QueryInterface,
199 dmobj_IPersistStream_AddRef,
200 dmobj_IPersistStream_Release,
201 dmobj_IPersistStream_GetClassID,
202 unimpl_IPersistStream_IsDirty,
203 marker_IPersistStream_Load,
204 unimpl_IPersistStream_Save,
205 unimpl_IPersistStream_GetSizeMax
208 /* for ClassFactory */
209 HRESULT WINAPI create_dmmarkertrack(REFIID lpcGUID, void **ppobj)
211 IDirectMusicMarkerTrack *track;
212 HRESULT hr;
214 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
215 if (!track) {
216 *ppobj = NULL;
217 return E_OUTOFMEMORY;
219 track->IDirectMusicTrack_iface.lpVtbl = &dmtrack_vtbl;
220 track->ref = 1;
221 dmobject_init(&track->dmobj, &CLSID_DirectMusicMarkerTrack,
222 (IUnknown *)&track->IDirectMusicTrack_iface);
223 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
225 DMIME_LockModule();
226 hr = IDirectMusicTrack_QueryInterface(&track->IDirectMusicTrack_iface, lpcGUID, ppobj);
227 IDirectMusicTrack_Release(&track->IDirectMusicTrack_iface);
229 return hr;