2 * Implementation of MediaStream Filter
4 * Copyright 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 IMediaStreamFilter IMediaStreamFilter_iface
;
41 CRITICAL_SECTION csFilter
;
43 REFERENCE_TIME rtStreamStart
;
44 IReferenceClock
* pClock
;
45 FILTER_INFO filterInfo
;
46 } IMediaStreamFilterImpl
;
48 static inline IMediaStreamFilterImpl
*impl_from_IMediaStreamFilter(IMediaStreamFilter
*iface
)
50 return CONTAINING_RECORD(iface
, IMediaStreamFilterImpl
, IMediaStreamFilter_iface
);
53 /*** IUnknown methods ***/
55 static HRESULT WINAPI
MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter
*iface
, REFIID riid
,
58 IMediaStreamFilterImpl
*This
= impl_from_IMediaStreamFilter(iface
);
60 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), ppv
);
64 if (IsEqualIID(riid
, &IID_IUnknown
))
66 else if (IsEqualIID(riid
, &IID_IPersist
))
68 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
70 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
72 else if (IsEqualIID(riid
, &IID_IMediaStreamFilter
))
77 IUnknown_AddRef((IUnknown
*)(*ppv
));
84 static ULONG WINAPI
MediaStreamFilterImpl_AddRef(IMediaStreamFilter
*iface
)
86 IMediaStreamFilterImpl
*This
= impl_from_IMediaStreamFilter(iface
);
87 ULONG refCount
= InterlockedIncrement(&This
->ref
);
89 TRACE("(%p)->() AddRef from %d\n", iface
, refCount
- 1);
94 static ULONG WINAPI
MediaStreamFilterImpl_Release(IMediaStreamFilter
*iface
)
96 IMediaStreamFilterImpl
*This
= impl_from_IMediaStreamFilter(iface
);
97 ULONG refCount
= InterlockedDecrement(&This
->ref
);
99 TRACE("(%p)->() Release from %d\n", iface
, refCount
+ 1);
102 HeapFree(GetProcessHeap(), 0, This
);
107 /*** IPersist methods ***/
109 static HRESULT WINAPI
MediaStreamFilterImpl_GetClassID(IMediaStreamFilter
* iface
, CLSID
* pClsid
)
111 TRACE("(%p)->(%p)\n", iface
, pClsid
);
113 *pClsid
= CLSID_MediaStreamFilter
;
118 /*** IMediaFilter methods ***/
120 static HRESULT WINAPI
MediaStreamFilterImpl_Stop(IMediaStreamFilter
* iface
)
122 FIXME("(%p)->(): Stub!\n", iface
);
127 static HRESULT WINAPI
MediaStreamFilterImpl_Pause(IMediaStreamFilter
* iface
)
129 FIXME("(%p)->(): Stub!\n", iface
);
134 static HRESULT WINAPI
MediaStreamFilterImpl_Run(IMediaStreamFilter
* iface
, REFERENCE_TIME tStart
)
136 FIXME("(%p)->(%s): Stub!\n", iface
, wine_dbgstr_longlong(tStart
));
141 static HRESULT WINAPI
MediaStreamFilterImpl_GetState(IMediaStreamFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
143 FIXME("(%p)->(%d,%p): Stub!\n", iface
, dwMilliSecsTimeout
, pState
);
148 static HRESULT WINAPI
MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter
* iface
, IReferenceClock
*pClock
)
150 TRACE("(%p)->(%p): Stub!\n", iface
, pClock
);
155 static HRESULT WINAPI
MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter
* iface
, IReferenceClock
**ppClock
)
157 FIXME("(%p)->(%p): Stub!\n", iface
, ppClock
);
162 /*** IBaseFilter methods ***/
164 static HRESULT WINAPI
MediaStreamFilterImpl_EnumPins(IMediaStreamFilter
* iface
, IEnumPins
**ppEnum
)
166 FIXME("(%p)->(%p): Stub!\n", iface
, ppEnum
);
171 static HRESULT WINAPI
MediaStreamFilterImpl_FindPin(IMediaStreamFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
173 FIXME("(%p)->(%s,%p): Stub!\n", iface
, debugstr_w(Id
), ppPin
);
178 static HRESULT WINAPI
MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter
* iface
, FILTER_INFO
*pInfo
)
180 FIXME("(%p)->(%p): Stub!\n", iface
, pInfo
);
185 static HRESULT WINAPI
MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
187 FIXME("(%p)->(%p, %s): Stub!\n", iface
, pGraph
, debugstr_w(pName
));
192 static HRESULT WINAPI
MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter
* iface
, LPWSTR
*pVendorInfo
)
194 FIXME("(%p)->(%p): Stub!\n", iface
, pVendorInfo
);
199 /*** IMediaStreamFilter methods ***/
201 static HRESULT WINAPI
MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter
* iface
, IAMMediaStream
*pAMMediaStream
)
203 FIXME("(%p)->(%p): Stub!\n", iface
, pAMMediaStream
);
208 static HRESULT WINAPI
MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter
* iface
, REFMSPID idPurpose
, IMediaStream
**ppMediaStream
)
210 FIXME("(%p)->(%s,%p): Stub!\n", iface
, debugstr_guid(idPurpose
), ppMediaStream
);
215 static HRESULT WINAPI
MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter
* iface
, LONG Index
, IMediaStream
**ppMediaStream
)
217 FIXME("(%p)->(%d,%p): Stub!\n", iface
, Index
, ppMediaStream
);
222 static HRESULT WINAPI
MediaStreamFilterImpl_SupportSeeking(IMediaStreamFilter
* iface
, BOOL bRenderer
)
224 FIXME("(%p)->(%d): Stub!\n", iface
, bRenderer
);
229 static HRESULT WINAPI
MediaStreamFilterImpl_ReferenceTimeToStreamTime(IMediaStreamFilter
* iface
, REFERENCE_TIME
*pTime
)
231 FIXME("(%p)->(%p): Stub!\n", iface
, pTime
);
236 static HRESULT WINAPI
MediaStreamFilterImpl_GetCurrentStreamTime(IMediaStreamFilter
* iface
, REFERENCE_TIME
*pCurrentStreamTime
)
238 FIXME("(%p)->(%p): Stub!\n", iface
, pCurrentStreamTime
);
243 static HRESULT WINAPI
MediaStreamFilterImpl_WaitUntil(IMediaStreamFilter
* iface
, REFERENCE_TIME WaitStreamTime
)
245 FIXME("(%p)->(%s): Stub!\n", iface
, wine_dbgstr_longlong(WaitStreamTime
));
250 static HRESULT WINAPI
MediaStreamFilterImpl_Flush(IMediaStreamFilter
* iface
, BOOL bCancelEOS
)
252 FIXME("(%p)->(%d): Stub!\n", iface
, bCancelEOS
);
257 static HRESULT WINAPI
MediaStreamFilterImpl_EndOfStream(IMediaStreamFilter
* iface
)
259 FIXME("(%p)->(): Stub!\n", iface
);
264 static const IMediaStreamFilterVtbl MediaStreamFilter_Vtbl
=
266 MediaStreamFilterImpl_QueryInterface
,
267 MediaStreamFilterImpl_AddRef
,
268 MediaStreamFilterImpl_Release
,
269 MediaStreamFilterImpl_GetClassID
,
270 MediaStreamFilterImpl_Stop
,
271 MediaStreamFilterImpl_Pause
,
272 MediaStreamFilterImpl_Run
,
273 MediaStreamFilterImpl_GetState
,
274 MediaStreamFilterImpl_SetSyncSource
,
275 MediaStreamFilterImpl_GetSyncSource
,
276 MediaStreamFilterImpl_EnumPins
,
277 MediaStreamFilterImpl_FindPin
,
278 MediaStreamFilterImpl_QueryFilterInfo
,
279 MediaStreamFilterImpl_JoinFilterGraph
,
280 MediaStreamFilterImpl_QueryVendorInfo
,
281 MediaStreamFilterImpl_AddMediaStream
,
282 MediaStreamFilterImpl_GetMediaStream
,
283 MediaStreamFilterImpl_EnumMediaStreams
,
284 MediaStreamFilterImpl_SupportSeeking
,
285 MediaStreamFilterImpl_ReferenceTimeToStreamTime
,
286 MediaStreamFilterImpl_GetCurrentStreamTime
,
287 MediaStreamFilterImpl_WaitUntil
,
288 MediaStreamFilterImpl_Flush
,
289 MediaStreamFilterImpl_EndOfStream
292 HRESULT
MediaStreamFilter_create(IUnknown
*pUnkOuter
, void **ppObj
)
294 IMediaStreamFilterImpl
* object
;
296 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
299 return CLASS_E_NOAGGREGATION
;
301 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IMediaStreamFilterImpl
));
304 ERR("Out of memory\n");
305 return E_OUTOFMEMORY
;
308 object
->IMediaStreamFilter_iface
.lpVtbl
= &MediaStreamFilter_Vtbl
;