2 * Implementation of IMediaStream Interface
4 * Copyright 2005, 2008 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/debug.h"
31 #include "amstream_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(amstream
);
39 IDirectDrawMediaStream IDirectDrawMediaStream_iface
;
41 IMultiMediaStream
* Parent
;
43 STREAM_TYPE StreamType
;
44 } IDirectDrawMediaStreamImpl
;
46 static inline IDirectDrawMediaStreamImpl
*impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream
*iface
)
48 return CONTAINING_RECORD(iface
, IDirectDrawMediaStreamImpl
, IDirectDrawMediaStream_iface
);
51 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_QueryInterface(IDirectDrawMediaStream
*iface
,
52 REFIID riid
, void **ppv
)
54 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
56 TRACE("(%p/%p)->(%s,%p)\n", iface
, This
, debugstr_guid(riid
), ppv
);
58 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
59 IsEqualGUID(riid
, &IID_IMediaStream
) ||
60 IsEqualGUID(riid
, &IID_IDirectDrawMediaStream
))
62 IUnknown_AddRef(iface
);
67 ERR("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppv
);
71 static ULONG WINAPI
IDirectDrawMediaStreamImpl_AddRef(IDirectDrawMediaStream
*iface
)
73 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
75 TRACE("(%p/%p)\n", iface
, This
);
77 return InterlockedIncrement(&This
->ref
);
80 static ULONG WINAPI
IDirectDrawMediaStreamImpl_Release(IDirectDrawMediaStream
*iface
)
82 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
83 ULONG ref
= InterlockedDecrement(&This
->ref
);
85 TRACE("(%p/%p)\n", iface
, This
);
88 HeapFree(GetProcessHeap(), 0, This
);
93 /*** IMediaStream methods ***/
94 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_GetMultiMediaStream(IDirectDrawMediaStream
*iface
,
95 IMultiMediaStream
** ppMultiMediaStream
)
97 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
99 FIXME("(%p/%p)->(%p) stub!\n", This
, iface
, ppMultiMediaStream
);
104 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_GetInformation(IDirectDrawMediaStream
*iface
,
105 MSPID
*pPurposeId
, STREAM_TYPE
*pType
)
107 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
109 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, pPurposeId
, pType
);
112 *pPurposeId
= This
->PurposeId
;
114 *pType
= This
->StreamType
;
119 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_SetSameFormat(IDirectDrawMediaStream
*iface
,
120 IMediaStream
*pStreamThatHasDesiredFormat
, DWORD dwFlags
)
122 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
124 FIXME("(%p/%p)->(%p,%x) stub!\n", This
, iface
, pStreamThatHasDesiredFormat
, dwFlags
);
129 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_AllocateSample(IDirectDrawMediaStream
*iface
,
130 DWORD dwFlags
, IStreamSample
**ppSample
)
132 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
134 FIXME("(%p/%p)->(%x,%p) stub!\n", This
, iface
, dwFlags
, ppSample
);
139 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_CreateSharedSample(IDirectDrawMediaStream
*iface
,
140 IStreamSample
*pExistingSample
, DWORD dwFlags
, IStreamSample
**ppSample
)
142 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
144 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This
, iface
, pExistingSample
, dwFlags
, ppSample
);
149 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_SendEndOfStream(IDirectDrawMediaStream
*iface
,
152 IDirectDrawMediaStreamImpl
*This
= impl_from_IDirectDrawMediaStream(iface
);
154 FIXME("(%p/%p)->(%x) stub!\n", This
, iface
, dwFlags
);
159 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream
*iface
,
160 DDSURFACEDESC
*pDDSDCurrent
, IDirectDrawPalette
**ppDirectDrawPalette
,
161 DDSURFACEDESC
*pDDSDDesired
, DWORD
*pdwFlags
)
163 FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface
, pDDSDCurrent
, ppDirectDrawPalette
, pDDSDDesired
,
170 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_SetFormat(IDirectDrawMediaStream
*iface
,
171 const DDSURFACEDESC
*pDDSurfaceDesc
, IDirectDrawPalette
*pDirectDrawPalette
)
173 FIXME("(%p)->(%p,%p) stub!\n", iface
, pDDSurfaceDesc
, pDirectDrawPalette
);
178 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_GetDirectDraw(IDirectDrawMediaStream
*iface
,
179 IDirectDraw
**ppDirectDraw
)
181 FIXME("(%p)->(%p) stub!\n", iface
, ppDirectDraw
);
186 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_SetDirectDraw(IDirectDrawMediaStream
*iface
,
187 IDirectDraw
*pDirectDraw
)
189 FIXME("(%p)->(%p) stub!\n", iface
, pDirectDraw
);
194 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_CreateSample(IDirectDrawMediaStream
*iface
,
195 IDirectDrawSurface
*pSurface
, const RECT
*pRect
, DWORD dwFlags
,
196 IDirectDrawStreamSample
**ppSample
)
198 FIXME("(%p)->(%p,%p,%x,%p) stub!\n", iface
, pSurface
, pRect
, dwFlags
, ppSample
);
203 static HRESULT WINAPI
IDirectDrawMediaStreamImpl_GetTimePerFrame(IDirectDrawMediaStream
*iface
,
204 STREAM_TIME
*pFrameTime
)
206 FIXME("(%p)->(%p) stub!\n", iface
, pFrameTime
);
211 static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl
=
213 IDirectDrawMediaStreamImpl_QueryInterface
,
214 IDirectDrawMediaStreamImpl_AddRef
,
215 IDirectDrawMediaStreamImpl_Release
,
216 IDirectDrawMediaStreamImpl_GetMultiMediaStream
,
217 IDirectDrawMediaStreamImpl_GetInformation
,
218 IDirectDrawMediaStreamImpl_SetSameFormat
,
219 IDirectDrawMediaStreamImpl_AllocateSample
,
220 IDirectDrawMediaStreamImpl_CreateSharedSample
,
221 IDirectDrawMediaStreamImpl_SendEndOfStream
,
222 IDirectDrawMediaStreamImpl_GetFormat
,
223 IDirectDrawMediaStreamImpl_SetFormat
,
224 IDirectDrawMediaStreamImpl_GetDirectDraw
,
225 IDirectDrawMediaStreamImpl_SetDirectDraw
,
226 IDirectDrawMediaStreamImpl_CreateSample
,
227 IDirectDrawMediaStreamImpl_GetTimePerFrame
230 HRESULT
mediastream_create(IMultiMediaStream
*Parent
, const MSPID
*pPurposeId
,
231 STREAM_TYPE StreamType
, IMediaStream
**ppMediaStream
)
233 IDirectDrawMediaStreamImpl
*object
;
235 TRACE("(%p,%s,%p)\n", Parent
, debugstr_guid(pPurposeId
), ppMediaStream
);
237 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectDrawMediaStreamImpl
));
240 ERR("Out of memory\n");
241 return E_OUTOFMEMORY
;
244 object
->IDirectDrawMediaStream_iface
.lpVtbl
= &DirectDrawMediaStream_Vtbl
;
247 object
->Parent
= Parent
;
248 object
->PurposeId
= *pPurposeId
;
249 object
->StreamType
= StreamType
;
251 *ppMediaStream
= (IMediaStream
*)&object
->IDirectDrawMediaStream_iface
;