ReactOS 0.4.16-dev-92-g0c2cdca
nullrenderer.c
Go to the documentation of this file.
1/*
2 * Null Renderer (Promiscuous, not rendering anything at all!)
3 *
4 * Copyright 2004 Christian Costa
5 * Copyright 2008 Maarten Lankhorst
6 *
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.
11 *
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.
16 *
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
20 */
21
22#include "config.h"
23
24#include "quartz_private.h"
25#include "pin.h"
26
27#include "uuids.h"
28#include "vfwmsgs.h"
29#include "amvideo.h"
30#include "windef.h"
31#include "winbase.h"
32#include "dshow.h"
33#include "evcode.h"
34#include "strmif.h"
35#include "ddraw.h"
36
37#include "wine/unicode.h"
38#include "wine/debug.h"
39
41
42typedef struct NullRendererImpl
43{
49
51{
52 return S_OK;
53}
54
56{
57 TRACE("Not a stub!\n");
58 return S_OK;
59}
60
64
65 NULL,
66 NULL,
67 NULL,
68 NULL,
69 NULL,
70 NULL,
71 NULL,
72 NULL,
73 NULL,
74 NULL,
75
76 NULL,
77 NULL,
78 NULL,
79 NULL,
80 NULL,
81};
82
84{
85 return CONTAINING_RECORD(iface, NullRendererImpl, IUnknown_inner);
86}
87
89{
91
92 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
93
94 *ppv = NULL;
95
97 *ppv = &This->IUnknown_inner;
98 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
99 *ppv = &This->IAMFilterMiscFlags_iface;
100 else
101 {
102 HRESULT hr;
103 hr = BaseRendererImpl_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv);
104 if (SUCCEEDED(hr))
105 return hr;
106 }
107
108 if (*ppv)
109 {
110 IUnknown_AddRef((IUnknown *)*ppv);
111 return S_OK;
112 }
113
114 if (!IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow))
115 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
116
117 return E_NOINTERFACE;
118}
119
121{
123 return BaseFilterImpl_AddRef(&This->renderer.filter.IBaseFilter_iface);
124}
125
127{
129 ULONG refCount = BaseRendererImpl_Release(&This->renderer.filter.IBaseFilter_iface);
130
131 if (!refCount)
132 {
133 TRACE("Destroying Null Renderer\n");
135 }
136
137 return refCount;
138}
139
140static const IUnknownVtbl IInner_VTable =
141{
145};
146
148{
149 return CONTAINING_RECORD(iface, NullRendererImpl, renderer.filter.IBaseFilter_iface);
150}
151
153{
155 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
156}
157
159{
161 return IUnknown_AddRef(This->outer_unk);
162}
163
165{
167 return IUnknown_Release(This->outer_unk);
168}
169
170static const IBaseFilterVtbl NullRenderer_Vtbl =
171{
187};
188
190{
191 return CONTAINING_RECORD(iface, NullRendererImpl, IAMFilterMiscFlags_iface);
192}
193
195 void **ppv)
196{
198 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
199}
200
202{
204 return IUnknown_AddRef(This->outer_unk);
205}
206
208{
210 return IUnknown_Release(This->outer_unk);
211}
212
214{
216}
217
218static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
223};
224
226{
227 HRESULT hr;
228 NullRendererImpl *pNullRenderer;
229
230 TRACE("(%p, %p)\n", pUnkOuter, ppv);
231
232 *ppv = NULL;
233
234 pNullRenderer = CoTaskMemAlloc(sizeof(NullRendererImpl));
235 pNullRenderer->IUnknown_inner.lpVtbl = &IInner_VTable;
236 pNullRenderer->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl;
237
238 if (pUnkOuter)
239 pNullRenderer->outer_unk = pUnkOuter;
240 else
241 pNullRenderer->outer_unk = &pNullRenderer->IUnknown_inner;
242
243 hr = BaseRenderer_Init(&pNullRenderer->renderer, &NullRenderer_Vtbl, pUnkOuter,
244 &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"),
246
247 if (FAILED(hr))
248 {
250 CoTaskMemFree(pNullRenderer);
251 }
252 else
253 *ppv = &pNullRenderer->IUnknown_inner;
254
255 return S_OK;
256}
@ AM_FILTER_MISC_FLAGS_IS_RENDERER
Definition: axextend.idl:1239
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
#define NULL
Definition: types.h:112
const char * qzdebugstr_guid(const GUID *id)
Definition: main.c:279
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static NullRendererImpl * impl_from_IUnknown(IUnknown *iface)
Definition: nullrenderer.c:83
static const IBaseFilterVtbl NullRenderer_Vtbl
Definition: nullrenderer.c:170
static ULONG WINAPI NullRenderer_Release(IBaseFilter *iface)
Definition: nullrenderer.c:164
static HRESULT WINAPI NullRenderer_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID *ppv)
Definition: nullrenderer.c:152
static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface)
Definition: nullrenderer.c:207
static HRESULT WINAPI NullRenderer_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TYPE *pmt)
Definition: nullrenderer.c:55
static ULONG WINAPI NullRendererInner_AddRef(IUnknown *iface)
Definition: nullrenderer.c:120
HRESULT NullRenderer_create(IUnknown *pUnkOuter, void **ppv)
Definition: nullrenderer.c:225
static NullRendererImpl * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: nullrenderer.c:147
static HRESULT WINAPI NullRendererInner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: nullrenderer.c:88
static ULONG WINAPI NullRenderer_AddRef(IBaseFilter *iface)
Definition: nullrenderer.c:158
static const BaseRendererFuncTable RendererFuncTable
Definition: nullrenderer.c:61
static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv)
Definition: nullrenderer.c:194
static ULONG WINAPI NullRendererInner_Release(IUnknown *iface)
Definition: nullrenderer.c:126
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
Definition: nullrenderer.c:218
static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface)
Definition: nullrenderer.c:213
static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface)
Definition: nullrenderer.c:201
static NullRendererImpl * impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface)
Definition: nullrenderer.c:189
static const IUnknownVtbl IInner_VTable
Definition: nullrenderer.c:140
static HRESULT WINAPI NullRenderer_DoRenderSample(BaseRenderer *iface, IMediaSample *pMediaSample)
Definition: nullrenderer.c:50
const GUID IID_IPin
Definition: pincontrol.cpp:15
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI BaseRendererImpl_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
Definition: renderer.c:537
HRESULT WINAPI BaseFilterImpl_GetClassID(IBaseFilter *iface, CLSID *pClsid)
Definition: filter.c:77
ULONG WINAPI BaseRendererImpl_Release(IBaseFilter *iface)
Definition: renderer.c:296
HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *pInfo)
Definition: filter.c:145
HRESULT WINAPI BaseRendererImpl_Stop(IBaseFilter *iface)
Definition: renderer.c:440
HRESULT WINAPI BaseRendererImpl_FindPin(IBaseFilter *iface, LPCWSTR Id, IPin **ppPin)
Definition: renderer.c:421
HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
Definition: renderer.c:461
ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter *iface)
Definition: filter.c:54
HRESULT WINAPI BaseFilterImpl_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *pGraph, LPCWSTR pName)
Definition: filter.c:159
HRESULT WINAPI BaseRendererImpl_Pause(IBaseFilter *iface)
Definition: renderer.c:506
HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter *iface, LPWSTR *pVendorInfo)
Definition: filter.c:178
HRESULT WINAPI BaseFilterImpl_GetSyncSource(IBaseFilter *iface, IReferenceClock **ppClock)
Definition: filter.c:119
HRESULT WINAPI BaseRendererImpl_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
Definition: renderer.c:550
HRESULT WINAPI BaseRendererImpl_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID *ppv)
Definition: renderer.c:280
HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter *iface, IEnumPins **ppEnum)
Definition: filter.c:135
HRESULT WINAPI BaseRenderer_Init(BaseRenderer *This, const IBaseFilterVtbl *Vtbl, IUnknown *pUnkOuter, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseRendererFuncTable *pBaseFuncsTable)
Definition: renderer.c:241
IBaseFilter IBaseFilter_iface
Definition: strmbase.h:163
BaseFilter filter
Definition: strmbase.h:580
IAMFilterMiscFlags IAMFilterMiscFlags_iface
Definition: nullrenderer.c:46
IUnknown * outer_unk
Definition: nullrenderer.c:47
BaseRenderer renderer
Definition: nullrenderer.c:44
IUnknown IUnknown_inner
Definition: nullrenderer.c:45
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364