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 #include "quartz_private.h"
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
42 typedef struct NullRendererImpl
44 BaseRenderer renderer
;
45 IUnknown IUnknown_inner
;
46 IAMFilterMiscFlags IAMFilterMiscFlags_iface
;
50 static HRESULT WINAPI
NullRenderer_DoRenderSample(BaseRenderer
*iface
, IMediaSample
*pMediaSample
)
55 static HRESULT WINAPI
NullRenderer_CheckMediaType(BaseRenderer
*iface
, const AM_MEDIA_TYPE
* pmt
)
57 TRACE("Not a stub!\n");
61 static const BaseRendererFuncTable RendererFuncTable
= {
62 NullRenderer_CheckMediaType
,
63 NullRenderer_DoRenderSample
,
83 static inline NullRendererImpl
*impl_from_IUnknown(IUnknown
*iface
)
85 return CONTAINING_RECORD(iface
, NullRendererImpl
, IUnknown_inner
);
88 static HRESULT WINAPI
NullRendererInner_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
90 NullRendererImpl
*This
= impl_from_IUnknown(iface
);
92 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
96 if (IsEqualIID(riid
, &IID_IUnknown
))
97 *ppv
= &This
->IUnknown_inner
;
98 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
99 *ppv
= &This
->IAMFilterMiscFlags_iface
;
103 hr
= BaseRendererImpl_QueryInterface(&This
->renderer
.filter
.IBaseFilter_iface
, riid
, ppv
);
110 IUnknown_AddRef((IUnknown
*)*ppv
);
114 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IVideoWindow
))
115 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
117 return E_NOINTERFACE
;
120 static ULONG WINAPI
NullRendererInner_AddRef(IUnknown
*iface
)
122 NullRendererImpl
*This
= impl_from_IUnknown(iface
);
123 return BaseFilterImpl_AddRef(&This
->renderer
.filter
.IBaseFilter_iface
);
126 static ULONG WINAPI
NullRendererInner_Release(IUnknown
*iface
)
128 NullRendererImpl
*This
= impl_from_IUnknown(iface
);
129 ULONG refCount
= BaseRendererImpl_Release(&This
->renderer
.filter
.IBaseFilter_iface
);
133 TRACE("Destroying Null Renderer\n");
140 static const IUnknownVtbl IInner_VTable
=
142 NullRendererInner_QueryInterface
,
143 NullRendererInner_AddRef
,
144 NullRendererInner_Release
147 static inline NullRendererImpl
*impl_from_IBaseFilter(IBaseFilter
*iface
)
149 return CONTAINING_RECORD(iface
, NullRendererImpl
, renderer
.filter
.IBaseFilter_iface
);
152 static HRESULT WINAPI
NullRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
154 NullRendererImpl
*This
= impl_from_IBaseFilter(iface
);
155 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppv
);
158 static ULONG WINAPI
NullRenderer_AddRef(IBaseFilter
* iface
)
160 NullRendererImpl
*This
= impl_from_IBaseFilter(iface
);
161 return IUnknown_AddRef(This
->outer_unk
);
164 static ULONG WINAPI
NullRenderer_Release(IBaseFilter
* iface
)
166 NullRendererImpl
*This
= impl_from_IBaseFilter(iface
);
167 return IUnknown_Release(This
->outer_unk
);
170 static const IBaseFilterVtbl NullRenderer_Vtbl
=
172 NullRenderer_QueryInterface
,
174 NullRenderer_Release
,
175 BaseFilterImpl_GetClassID
,
176 BaseRendererImpl_Stop
,
177 BaseRendererImpl_Pause
,
178 BaseRendererImpl_Run
,
179 BaseRendererImpl_GetState
,
180 BaseRendererImpl_SetSyncSource
,
181 BaseFilterImpl_GetSyncSource
,
182 BaseFilterImpl_EnumPins
,
183 BaseRendererImpl_FindPin
,
184 BaseFilterImpl_QueryFilterInfo
,
185 BaseFilterImpl_JoinFilterGraph
,
186 BaseFilterImpl_QueryVendorInfo
189 static NullRendererImpl
*impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
)
191 return CONTAINING_RECORD(iface
, NullRendererImpl
, IAMFilterMiscFlags_iface
);
194 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, REFIID riid
,
197 NullRendererImpl
*This
= impl_from_IAMFilterMiscFlags(iface
);
198 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppv
);
201 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
)
203 NullRendererImpl
*This
= impl_from_IAMFilterMiscFlags(iface
);
204 return IUnknown_AddRef(This
->outer_unk
);
207 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
)
209 NullRendererImpl
*This
= impl_from_IAMFilterMiscFlags(iface
);
210 return IUnknown_Release(This
->outer_unk
);
213 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
)
215 return AM_FILTER_MISC_FLAGS_IS_RENDERER
;
218 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
219 AMFilterMiscFlags_QueryInterface
,
220 AMFilterMiscFlags_AddRef
,
221 AMFilterMiscFlags_Release
,
222 AMFilterMiscFlags_GetMiscFlags
225 HRESULT
NullRenderer_create(IUnknown
*pUnkOuter
, void **ppv
)
228 NullRendererImpl
*pNullRenderer
;
230 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
234 pNullRenderer
= CoTaskMemAlloc(sizeof(NullRendererImpl
));
235 pNullRenderer
->IUnknown_inner
.lpVtbl
= &IInner_VTable
;
236 pNullRenderer
->IAMFilterMiscFlags_iface
.lpVtbl
= &IAMFilterMiscFlags_Vtbl
;
239 pNullRenderer
->outer_unk
= pUnkOuter
;
241 pNullRenderer
->outer_unk
= &pNullRenderer
->IUnknown_inner
;
243 hr
= BaseRenderer_Init(&pNullRenderer
->renderer
, &NullRenderer_Vtbl
, pUnkOuter
,
244 &CLSID_NullRenderer
, (DWORD_PTR
)(__FILE__
": NullRendererImpl.csFilter"),
249 BaseRendererImpl_Release(&pNullRenderer
->renderer
.filter
.IBaseFilter_iface
);
250 CoTaskMemFree(pNullRenderer
);
253 *ppv
= &pNullRenderer
->IUnknown_inner
;