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 typedef struct NullRendererImpl
46 BaseRenderer renderer
;
47 IUnknown IUnknown_inner
;
48 IAMFilterMiscFlags IAMFilterMiscFlags_iface
;
52 static HRESULT WINAPI
NullRenderer_DoRenderSample(BaseRenderer
*iface
, IMediaSample
*pMediaSample
)
57 static HRESULT WINAPI
NullRenderer_CheckMediaType(BaseRenderer
*iface
, const AM_MEDIA_TYPE
* pmt
)
59 TRACE("Not a stub!\n");
63 static const BaseRendererFuncTable RendererFuncTable
= {
64 NullRenderer_CheckMediaType
,
65 NullRenderer_DoRenderSample
,
85 static inline NullRendererImpl
*impl_from_IUnknown(IUnknown
*iface
)
87 return CONTAINING_RECORD(iface
, NullRendererImpl
, IUnknown_inner
);
90 static HRESULT WINAPI
NullRendererInner_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
92 NullRendererImpl
*This
= impl_from_IUnknown(iface
);
94 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
98 if (IsEqualIID(riid
, &IID_IUnknown
))
99 *ppv
= &This
->IUnknown_inner
;
100 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
101 *ppv
= &This
->IAMFilterMiscFlags_iface
;
105 hr
= BaseRendererImpl_QueryInterface(&This
->renderer
.filter
.IBaseFilter_iface
, riid
, ppv
);
112 IUnknown_AddRef((IUnknown
*)*ppv
);
116 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IVideoWindow
))
117 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
119 return E_NOINTERFACE
;
122 static ULONG WINAPI
NullRendererInner_AddRef(IUnknown
*iface
)
124 NullRendererImpl
*This
= impl_from_IUnknown(iface
);
125 return BaseFilterImpl_AddRef(&This
->renderer
.filter
.IBaseFilter_iface
);
128 static ULONG WINAPI
NullRendererInner_Release(IUnknown
*iface
)
130 NullRendererImpl
*This
= impl_from_IUnknown(iface
);
131 ULONG refCount
= BaseFilterImpl_Release(&This
->renderer
.filter
.IBaseFilter_iface
);
135 TRACE("Destroying Null Renderer\n");
142 static const IUnknownVtbl IInner_VTable
=
144 NullRendererInner_QueryInterface
,
145 NullRendererInner_AddRef
,
146 NullRendererInner_Release
149 static inline NullRendererImpl
*impl_from_IBaseFilter(IBaseFilter
*iface
)
151 return CONTAINING_RECORD(iface
, NullRendererImpl
, renderer
.filter
.IBaseFilter_iface
);
154 static HRESULT WINAPI
NullRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
156 NullRendererImpl
*This
= impl_from_IBaseFilter(iface
);
157 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppv
);
160 static ULONG WINAPI
NullRenderer_AddRef(IBaseFilter
* iface
)
162 NullRendererImpl
*This
= impl_from_IBaseFilter(iface
);
163 return IUnknown_AddRef(This
->outer_unk
);
166 static ULONG WINAPI
NullRenderer_Release(IBaseFilter
* iface
)
168 NullRendererImpl
*This
= impl_from_IBaseFilter(iface
);
169 return IUnknown_Release(This
->outer_unk
);
172 static const IBaseFilterVtbl NullRenderer_Vtbl
=
174 NullRenderer_QueryInterface
,
176 NullRenderer_Release
,
177 BaseFilterImpl_GetClassID
,
178 BaseRendererImpl_Stop
,
179 BaseRendererImpl_Pause
,
180 BaseRendererImpl_Run
,
181 BaseRendererImpl_GetState
,
182 BaseRendererImpl_SetSyncSource
,
183 BaseFilterImpl_GetSyncSource
,
184 BaseFilterImpl_EnumPins
,
185 BaseRendererImpl_FindPin
,
186 BaseFilterImpl_QueryFilterInfo
,
187 BaseFilterImpl_JoinFilterGraph
,
188 BaseFilterImpl_QueryVendorInfo
191 static NullRendererImpl
*impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
)
193 return CONTAINING_RECORD(iface
, NullRendererImpl
, IAMFilterMiscFlags_iface
);
196 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, REFIID riid
,
199 NullRendererImpl
*This
= impl_from_IAMFilterMiscFlags(iface
);
200 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppv
);
203 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
)
205 NullRendererImpl
*This
= impl_from_IAMFilterMiscFlags(iface
);
206 return IUnknown_AddRef(This
->outer_unk
);
209 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
)
211 NullRendererImpl
*This
= impl_from_IAMFilterMiscFlags(iface
);
212 return IUnknown_Release(This
->outer_unk
);
215 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
)
217 return AM_FILTER_MISC_FLAGS_IS_RENDERER
;
220 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
221 AMFilterMiscFlags_QueryInterface
,
222 AMFilterMiscFlags_AddRef
,
223 AMFilterMiscFlags_Release
,
224 AMFilterMiscFlags_GetMiscFlags
227 HRESULT
NullRenderer_create(IUnknown
*pUnkOuter
, void **ppv
)
230 NullRendererImpl
*pNullRenderer
;
232 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
236 pNullRenderer
= CoTaskMemAlloc(sizeof(NullRendererImpl
));
237 pNullRenderer
->IUnknown_inner
.lpVtbl
= &IInner_VTable
;
238 pNullRenderer
->IAMFilterMiscFlags_iface
.lpVtbl
= &IAMFilterMiscFlags_Vtbl
;
241 pNullRenderer
->outer_unk
= pUnkOuter
;
243 pNullRenderer
->outer_unk
= &pNullRenderer
->IUnknown_inner
;
245 hr
= BaseRenderer_Init(&pNullRenderer
->renderer
, &NullRenderer_Vtbl
, pUnkOuter
,
246 &CLSID_NullRenderer
, (DWORD_PTR
)(__FILE__
": NullRendererImpl.csFilter"),
251 BaseRendererImpl_Release(&pNullRenderer
->renderer
.filter
.IBaseFilter_iface
);
252 CoTaskMemFree(pNullRenderer
);
255 *ppv
= &pNullRenderer
->IUnknown_inner
;