2 * Null Renderer (Promiscuous, not rendering anything at all!)
4 * Copyright 2004 Christian Costa
5 * Copyright 2008 Maarten Lankhorst
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSSTRUCT
25 #define NONAMELESSUNION
26 #include "quartz_private.h"
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
44 static const IBaseFilterVtbl NullRenderer_Vtbl
;
45 static const IUnknownVtbl IInner_VTable
;
46 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
;
48 typedef struct NullRendererImpl
50 BaseRenderer renderer
;
52 const IUnknownVtbl
* IInner_vtbl
;
53 const IAMFilterMiscFlagsVtbl
*IAMFilterMiscFlags_vtbl
;
60 static HRESULT WINAPI
NullRenderer_DoRenderSample(BaseRenderer
*iface
, IMediaSample
*pMediaSample
)
65 static HRESULT WINAPI
NullRenderer_CheckMediaType(BaseRenderer
*iface
, const AM_MEDIA_TYPE
* pmt
)
67 TRACE("Not a stub!\n");
71 static const BaseRendererFuncTable RendererFuncTable
= {
72 NullRenderer_CheckMediaType
,
73 NullRenderer_DoRenderSample
,
93 HRESULT
NullRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
96 NullRendererImpl
* pNullRenderer
;
98 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
102 pNullRenderer
= CoTaskMemAlloc(sizeof(NullRendererImpl
));
103 pNullRenderer
->pUnkOuter
= pUnkOuter
;
104 pNullRenderer
->bUnkOuterValid
= FALSE
;
105 pNullRenderer
->bAggregatable
= FALSE
;
106 pNullRenderer
->IInner_vtbl
= &IInner_VTable
;
107 pNullRenderer
->IAMFilterMiscFlags_vtbl
= &IAMFilterMiscFlags_Vtbl
;
109 hr
= BaseRenderer_Init(&pNullRenderer
->renderer
, &NullRenderer_Vtbl
, pUnkOuter
, &CLSID_NullRenderer
, (DWORD_PTR
)(__FILE__
": NullRendererImpl.csFilter"), &RendererFuncTable
);
113 BaseRendererImpl_Release(&pNullRenderer
->renderer
.filter
.IBaseFilter_iface
);
114 CoTaskMemFree(pNullRenderer
);
117 *ppv
= pNullRenderer
;
122 static HRESULT WINAPI
NullRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
124 ICOM_THIS_MULTI(NullRendererImpl
, IInner_vtbl
, iface
);
125 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
127 if (This
->bAggregatable
)
128 This
->bUnkOuterValid
= TRUE
;
132 if (IsEqualIID(riid
, &IID_IUnknown
))
133 *ppv
= &This
->IInner_vtbl
;
134 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
135 *ppv
= &This
->IAMFilterMiscFlags_vtbl
;
139 hr
= BaseRendererImpl_QueryInterface(&This
->renderer
.filter
.IBaseFilter_iface
, riid
, ppv
);
146 IUnknown_AddRef((IUnknown
*)(*ppv
));
150 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IVideoWindow
))
151 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
153 return E_NOINTERFACE
;
156 static ULONG WINAPI
NullRendererInner_AddRef(IUnknown
* iface
)
158 ICOM_THIS_MULTI(NullRendererImpl
, IInner_vtbl
, iface
);
159 return BaseFilterImpl_AddRef(&This
->renderer
.filter
.IBaseFilter_iface
);
162 static ULONG WINAPI
NullRendererInner_Release(IUnknown
* iface
)
164 ICOM_THIS_MULTI(NullRendererImpl
, IInner_vtbl
, iface
);
165 ULONG refCount
= BaseRendererImpl_Release(&This
->renderer
.filter
.IBaseFilter_iface
);
169 TRACE("Destroying Null Renderer\n");
177 static const IUnknownVtbl IInner_VTable
=
179 NullRendererInner_QueryInterface
,
180 NullRendererInner_AddRef
,
181 NullRendererInner_Release
184 static HRESULT WINAPI
NullRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
186 NullRendererImpl
*This
= (NullRendererImpl
*)iface
;
188 if (This
->bAggregatable
)
189 This
->bUnkOuterValid
= TRUE
;
193 if (This
->bAggregatable
)
194 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
196 if (IsEqualIID(riid
, &IID_IUnknown
))
200 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
201 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
202 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
203 This
->bAggregatable
= TRUE
;
208 return E_NOINTERFACE
;
211 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
214 static ULONG WINAPI
NullRenderer_AddRef(IBaseFilter
* iface
)
216 NullRendererImpl
*This
= (NullRendererImpl
*)iface
;
218 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
219 return IUnknown_AddRef(This
->pUnkOuter
);
220 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
223 static ULONG WINAPI
NullRenderer_Release(IBaseFilter
* iface
)
225 NullRendererImpl
*This
= (NullRendererImpl
*)iface
;
227 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
228 return IUnknown_Release(This
->pUnkOuter
);
229 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
232 static const IBaseFilterVtbl NullRenderer_Vtbl
=
234 NullRenderer_QueryInterface
,
236 NullRenderer_Release
,
237 BaseFilterImpl_GetClassID
,
238 BaseRendererImpl_Stop
,
239 BaseRendererImpl_Pause
,
240 BaseRendererImpl_Run
,
241 BaseRendererImpl_GetState
,
242 BaseRendererImpl_SetSyncSource
,
243 BaseFilterImpl_GetSyncSource
,
244 BaseFilterImpl_EnumPins
,
245 BaseRendererImpl_FindPin
,
246 BaseFilterImpl_QueryFilterInfo
,
247 BaseFilterImpl_JoinFilterGraph
,
248 BaseFilterImpl_QueryVendorInfo
251 static NullRendererImpl
*from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
) {
252 return (NullRendererImpl
*)((char*)iface
- offsetof(NullRendererImpl
, IAMFilterMiscFlags_vtbl
));
255 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, REFIID riid
, void **ppv
) {
256 NullRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
257 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
260 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
) {
261 NullRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
262 return IUnknown_AddRef((IUnknown
*)This
);
265 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
) {
266 NullRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
267 return IUnknown_Release((IUnknown
*)This
);
270 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
) {
271 return AM_FILTER_MISC_FLAGS_IS_RENDERER
;
274 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
275 AMFilterMiscFlags_QueryInterface
,
276 AMFilterMiscFlags_AddRef
,
277 AMFilterMiscFlags_Release
,
278 AMFilterMiscFlags_GetMiscFlags