mfplay: Implement GetCharacteristics().
[wine/zf.git] / dlls / dmime / markertrack.c
blobf41bed668a6835e148b3d90f84269a96c44ddfb2
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 type,
121 MUSIC_TIME time, MUSIC_TIME *next, void *param)
123 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
125 TRACE("(%p, %s, %d, %p, %p)\n", This, debugstr_dmguid(type), time, next, param);
127 if (!param)
128 return E_POINTER;
130 if (IsEqualGUID(type, &GUID_Play_Marker)) {
131 FIXME("GUID_Play_Marker not handled yet\n");
132 return S_FALSE;
134 if (IsEqualGUID(type, &GUID_Valid_Start_Time)) {
135 FIXME("GUID_Valid_Start_Time not handled yet\n");
136 return DMUS_E_NOT_FOUND;
139 return DMUS_E_GET_UNSUPPORTED;
142 static HRESULT WINAPI IDirectMusicTrackImpl_SetParam(IDirectMusicTrack *iface, REFGUID type,
143 MUSIC_TIME time, void *param)
145 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
147 TRACE("(%p, %s, %d, %p): not supported\n", This, debugstr_dmguid(type), time, param);
148 return DMUS_E_SET_UNSUPPORTED;
151 static HRESULT WINAPI IDirectMusicTrackImpl_IsParamSupported(IDirectMusicTrack *iface,
152 REFGUID rguidType)
154 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
156 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
157 if (IsEqualGUID (rguidType, &GUID_Play_Marker)
158 || IsEqualGUID (rguidType, &GUID_Valid_Start_Time)) {
159 TRACE("param supported\n");
160 return S_OK;
162 TRACE("param unsupported\n");
163 return DMUS_E_TYPE_UNSUPPORTED;
166 static HRESULT WINAPI IDirectMusicTrackImpl_AddNotificationType(IDirectMusicTrack *iface,
167 REFGUID rguidNotificationType)
169 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
170 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
171 return S_OK;
174 static HRESULT WINAPI IDirectMusicTrackImpl_RemoveNotificationType(IDirectMusicTrack *iface,
175 REFGUID rguidNotificationType)
177 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
178 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
179 return S_OK;
182 static HRESULT WINAPI IDirectMusicTrackImpl_Clone(IDirectMusicTrack *iface, MUSIC_TIME mtStart,
183 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
185 IDirectMusicMarkerTrack *This = impl_from_IDirectMusicTrack(iface);
186 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
187 return S_OK;
190 static const IDirectMusicTrackVtbl dmtrack_vtbl = {
191 IDirectMusicTrackImpl_QueryInterface,
192 IDirectMusicTrackImpl_AddRef,
193 IDirectMusicTrackImpl_Release,
194 IDirectMusicTrackImpl_Init,
195 IDirectMusicTrackImpl_InitPlay,
196 IDirectMusicTrackImpl_EndPlay,
197 IDirectMusicTrackImpl_Play,
198 IDirectMusicTrackImpl_GetParam,
199 IDirectMusicTrackImpl_SetParam,
200 IDirectMusicTrackImpl_IsParamSupported,
201 IDirectMusicTrackImpl_AddNotificationType,
202 IDirectMusicTrackImpl_RemoveNotificationType,
203 IDirectMusicTrackImpl_Clone
206 static HRESULT WINAPI marker_IPersistStream_Load(IPersistStream *iface, IStream *stream)
208 FIXME(": Loading not implemented yet\n");
209 return S_OK;
212 static const IPersistStreamVtbl persiststream_vtbl = {
213 dmobj_IPersistStream_QueryInterface,
214 dmobj_IPersistStream_AddRef,
215 dmobj_IPersistStream_Release,
216 dmobj_IPersistStream_GetClassID,
217 unimpl_IPersistStream_IsDirty,
218 marker_IPersistStream_Load,
219 unimpl_IPersistStream_Save,
220 unimpl_IPersistStream_GetSizeMax
223 /* for ClassFactory */
224 HRESULT WINAPI create_dmmarkertrack(REFIID lpcGUID, void **ppobj)
226 IDirectMusicMarkerTrack *track;
227 HRESULT hr;
229 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
230 if (!track) {
231 *ppobj = NULL;
232 return E_OUTOFMEMORY;
234 track->IDirectMusicTrack_iface.lpVtbl = &dmtrack_vtbl;
235 track->ref = 1;
236 dmobject_init(&track->dmobj, &CLSID_DirectMusicMarkerTrack,
237 (IUnknown *)&track->IDirectMusicTrack_iface);
238 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
240 DMIME_LockModule();
241 hr = IDirectMusicTrack_QueryInterface(&track->IDirectMusicTrack_iface, lpcGUID, ppobj);
242 IDirectMusicTrack_Release(&track->IDirectMusicTrack_iface);
244 return hr;