msxml3: Don't return REFIID to avoid compiler warnings.
[wine/multimedia.git] / dlls / amstream / mediastreamfilter.c
blob887413648bd4fc16cc0c1dd4c71a723b565de632
1 /*
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"
26 #define COBJMACROS
28 #include "winbase.h"
29 #include "wingdi.h"
31 #include "amstream_private.h"
32 #include "amstream.h"
34 #include "ddstream.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
38 typedef struct {
39 IMediaStreamFilter IMediaStreamFilter_iface;
40 LONG ref;
41 CRITICAL_SECTION csFilter;
42 FILTER_STATE state;
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,
56 void **ppv)
58 IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
60 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
62 *ppv = NULL;
64 if (IsEqualIID(riid, &IID_IUnknown))
65 *ppv = This;
66 else if (IsEqualIID(riid, &IID_IPersist))
67 *ppv = This;
68 else if (IsEqualIID(riid, &IID_IMediaFilter))
69 *ppv = This;
70 else if (IsEqualIID(riid, &IID_IBaseFilter))
71 *ppv = This;
72 else if (IsEqualIID(riid, &IID_IMediaStreamFilter))
73 *ppv = This;
75 if (*ppv)
77 IUnknown_AddRef((IUnknown *)(*ppv));
78 return S_OK;
81 return E_NOINTERFACE;
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);
91 return refCount;
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);
101 if (!refCount)
102 HeapFree(GetProcessHeap(), 0, This);
104 return refCount;
107 /*** IPersist methods ***/
109 static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID * pClsid)
111 TRACE("(%p)->(%p)\n", iface, pClsid);
113 *pClsid = CLSID_MediaStreamFilter;
115 return S_OK;
118 /*** IMediaFilter methods ***/
120 static HRESULT WINAPI MediaStreamFilterImpl_Stop(IMediaStreamFilter * iface)
122 FIXME("(%p)->(): Stub!\n", iface);
124 return E_NOTIMPL;
127 static HRESULT WINAPI MediaStreamFilterImpl_Pause(IMediaStreamFilter * iface)
129 FIXME("(%p)->(): Stub!\n", iface);
131 return E_NOTIMPL;
134 static HRESULT WINAPI MediaStreamFilterImpl_Run(IMediaStreamFilter * iface, REFERENCE_TIME tStart)
136 FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(tStart));
138 return E_NOTIMPL;
141 static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
143 FIXME("(%p)->(%d,%p): Stub!\n", iface, dwMilliSecsTimeout, pState);
145 return E_NOTIMPL;
148 static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter * iface, IReferenceClock *pClock)
150 TRACE("(%p)->(%p): Stub!\n", iface, pClock);
152 return E_NOTIMPL;
155 static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter * iface, IReferenceClock **ppClock)
157 FIXME("(%p)->(%p): Stub!\n", iface, ppClock);
159 return E_NOTIMPL;
162 /*** IBaseFilter methods ***/
164 static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface, IEnumPins **ppEnum)
166 FIXME("(%p)->(%p): Stub!\n", iface, ppEnum);
168 return E_NOTIMPL;
171 static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface, LPCWSTR Id, IPin **ppPin)
173 FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_w(Id), ppPin);
175 return E_NOTIMPL;
178 static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter * iface, FILTER_INFO *pInfo)
180 FIXME("(%p)->(%p): Stub!\n", iface, pInfo);
182 return E_NOTIMPL;
185 static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
187 FIXME("(%p)->(%p, %s): Stub!\n", iface, pGraph, debugstr_w(pName));
189 return E_NOTIMPL;
192 static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface, LPWSTR *pVendorInfo)
194 FIXME("(%p)->(%p): Stub!\n", iface, pVendorInfo);
196 return E_NOTIMPL;
199 /*** IMediaStreamFilter methods ***/
201 static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface, IAMMediaStream *pAMMediaStream)
203 FIXME("(%p)->(%p): Stub!\n", iface, pAMMediaStream);
205 return E_NOTIMPL;
208 static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* iface, REFMSPID idPurpose, IMediaStream **ppMediaStream)
210 FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_guid(idPurpose), ppMediaStream);
212 return E_NOTIMPL;
215 static HRESULT WINAPI MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter* iface, LONG Index, IMediaStream **ppMediaStream)
217 FIXME("(%p)->(%d,%p): Stub!\n", iface, Index, ppMediaStream);
219 return E_NOTIMPL;
222 static HRESULT WINAPI MediaStreamFilterImpl_SupportSeeking(IMediaStreamFilter* iface, BOOL bRenderer)
224 FIXME("(%p)->(%d): Stub!\n", iface, bRenderer);
226 return E_NOTIMPL;
229 static HRESULT WINAPI MediaStreamFilterImpl_ReferenceTimeToStreamTime(IMediaStreamFilter* iface, REFERENCE_TIME *pTime)
231 FIXME("(%p)->(%p): Stub!\n", iface, pTime);
233 return E_NOTIMPL;
236 static HRESULT WINAPI MediaStreamFilterImpl_GetCurrentStreamTime(IMediaStreamFilter* iface, REFERENCE_TIME *pCurrentStreamTime)
238 FIXME("(%p)->(%p): Stub!\n", iface, pCurrentStreamTime);
240 return E_NOTIMPL;
243 static HRESULT WINAPI MediaStreamFilterImpl_WaitUntil(IMediaStreamFilter* iface, REFERENCE_TIME WaitStreamTime)
245 FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(WaitStreamTime));
247 return E_NOTIMPL;
250 static HRESULT WINAPI MediaStreamFilterImpl_Flush(IMediaStreamFilter* iface, BOOL bCancelEOS)
252 FIXME("(%p)->(%d): Stub!\n", iface, bCancelEOS);
254 return E_NOTIMPL;
257 static HRESULT WINAPI MediaStreamFilterImpl_EndOfStream(IMediaStreamFilter* iface)
259 FIXME("(%p)->(): Stub!\n", iface);
261 return E_NOTIMPL;
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);
298 if( pUnkOuter )
299 return CLASS_E_NOAGGREGATION;
301 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl));
302 if (!object)
304 ERR("Out of memory\n");
305 return E_OUTOFMEMORY;
308 object->IMediaStreamFilter_iface.lpVtbl = &MediaStreamFilter_Vtbl;
309 object->ref = 1;
311 *ppObj = object;
313 return S_OK;