ReactOS 0.4.16-dev-297-gc569aee
filter.c File Reference
#include "dshow.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/strmbase.h"
#include "uuids.h"
#include <assert.h>
Include dependency graph for filter.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (strmbase)
 
static BaseFilterimpl_from_IBaseFilter (IBaseFilter *iface)
 
HRESULT WINAPI BaseFilterImpl_QueryInterface (IBaseFilter *iface, REFIID riid, LPVOID *ppv)
 
ULONG WINAPI BaseFilterImpl_AddRef (IBaseFilter *iface)
 
ULONG WINAPI BaseFilterImpl_Release (IBaseFilter *iface)
 
HRESULT WINAPI BaseFilterImpl_GetClassID (IBaseFilter *iface, CLSID *pClsid)
 
HRESULT WINAPI BaseFilterImpl_GetState (IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
 
HRESULT WINAPI BaseFilterImpl_SetSyncSource (IBaseFilter *iface, IReferenceClock *pClock)
 
HRESULT WINAPI BaseFilterImpl_GetSyncSource (IBaseFilter *iface, IReferenceClock **ppClock)
 
HRESULT WINAPI BaseFilterImpl_EnumPins (IBaseFilter *iface, IEnumPins **ppEnum)
 
HRESULT WINAPI BaseFilterImpl_QueryFilterInfo (IBaseFilter *iface, FILTER_INFO *pInfo)
 
HRESULT WINAPI BaseFilterImpl_JoinFilterGraph (IBaseFilter *iface, IFilterGraph *pGraph, LPCWSTR pName)
 
HRESULT WINAPI BaseFilterImpl_QueryVendorInfo (IBaseFilter *iface, LPWSTR *pVendorInfo)
 
LONG WINAPI BaseFilterImpl_GetPinVersion (BaseFilter *This)
 
VOID WINAPI BaseFilterImpl_IncrementPinVersion (BaseFilter *This)
 
HRESULT WINAPI BaseFilter_Init (BaseFilter *This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseFilterFuncTable *pBaseFuncsTable)
 
HRESULT WINAPI BaseFilter_Destroy (BaseFilter *This)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file filter.c.

Function Documentation

◆ BaseFilter_Destroy()

HRESULT WINAPI BaseFilter_Destroy ( BaseFilter This)

Definition at line 214 of file filter.c.

215{
216 if (This->pClock)
218
219 This->IBaseFilter_iface.lpVtbl = NULL;
220 This->csFilter.DebugInfo->Spare[0] = 0;
221 DeleteCriticalSection(&This->csFilter);
222
223 return S_OK;
224}
#define NULL
Definition: types.h:112
#define IReferenceClock_Release(p)
Definition: dmusicc.h:752
#define S_OK
Definition: intsafe.h:52
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by AsyncReader_Release(), BaseFilterImpl_Release(), BaseRendererImpl_Release(), MediaStreamFilterImpl_Release(), Parser_Destroy(), TransformFilterImpl_Release(), and unknown_inner_Release().

◆ BaseFilter_Init()

HRESULT WINAPI BaseFilter_Init ( BaseFilter This,
const IBaseFilterVtbl *  Vtbl,
const CLSID pClsid,
DWORD_PTR  DebugInfo,
const BaseFilterFuncTable pBaseFuncsTable 
)

Definition at line 196 of file filter.c.

197{
198 This->IBaseFilter_iface.lpVtbl = Vtbl;
199 This->refCount = 1;
201 This->state = State_Stopped;
202 This->rtStreamStart = 0;
203 This->pClock = NULL;
204 ZeroMemory(&This->filterInfo, sizeof(FILTER_INFO));
205 This->clsid = *pClsid;
206 This->csFilter.DebugInfo->Spare[0] = DebugInfo;
207 This->pinVersion = 1;
208
209 This->pFuncsTable = pBaseFuncsTable;
210
211 return S_OK;
212}
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define ZeroMemory
Definition: winbase.h:1737

Referenced by AsyncReader_create(), BaseRenderer_Init(), MediaStreamFilter_create(), Parser_Create(), QCAP_createAudioCaptureFilter(), QCAP_createAVICompressor(), QCAP_createAVIMux(), QCAP_createSmartTeeFilter(), QCAP_createVFWCaptureFilter(), SampleGrabber_create(), and TransformFilter_Init().

◆ BaseFilterImpl_AddRef()

ULONG WINAPI BaseFilterImpl_AddRef ( IBaseFilter iface)

Definition at line 54 of file filter.c.

55{
57 ULONG refCount = InterlockedIncrement(&This->refCount);
58
59 TRACE("(%p)->() AddRef from %d\n", This, refCount - 1);
60
61 return refCount;
62}
#define InterlockedIncrement
Definition: armddk.h:53
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t ULONG
Definition: typedefs.h:59

Referenced by AMDirectSound_AddRef(), Basicaudio_AddRef(), MediaStreamFilterImpl_AddRef(), NullRendererInner_AddRef(), Parser_AddRef(), ReferenceClock_AddRef(), SampleGrabber_AddRef(), Unknown_AddRef(), unknown_inner_AddRef(), VideoRendererInner_AddRef(), and VMR9Inner_AddRef().

◆ BaseFilterImpl_EnumPins()

HRESULT WINAPI BaseFilterImpl_EnumPins ( IBaseFilter iface,
IEnumPins **  ppEnum 
)

Definition at line 135 of file filter.c.

136{
138
139 TRACE("(%p)->(%p)\n", iface, ppEnum);
140
141 return EnumPins_Construct(This, This->pFuncsTable->pfnGetPin, This->pFuncsTable->pfnGetPinCount, BaseFilterImpl_GetPinVersion, ppEnum);
142}
LONG WINAPI BaseFilterImpl_GetPinVersion(BaseFilter *This)
Definition: filter.c:184
HRESULT WINAPI EnumPins_Construct(BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins **ppEnum)
Definition: enumpins.c:49

Referenced by AviMux_EnumPins(), MediaStreamFilterImpl_EnumPins(), and Parser_EnumPins().

◆ BaseFilterImpl_GetClassID()

HRESULT WINAPI BaseFilterImpl_GetClassID ( IBaseFilter iface,
CLSID pClsid 
)

Definition at line 77 of file filter.c.

78{
80 TRACE("(%p)->(%p)\n", This, pClsid);
81
82 *pClsid = This->clsid;
83
84 return S_OK;
85}

Referenced by MediaStreamFilterImpl_GetClassID().

◆ BaseFilterImpl_GetPinVersion()

LONG WINAPI BaseFilterImpl_GetPinVersion ( BaseFilter This)

Definition at line 184 of file filter.c.

185{
186 TRACE("(%p)\n", This);
187 return This->pinVersion;
188}

Referenced by BaseFilterImpl_EnumPins().

◆ BaseFilterImpl_GetState()

HRESULT WINAPI BaseFilterImpl_GetState ( IBaseFilter iface,
DWORD  dwMilliSecsTimeout,
FILTER_STATE *  pState 
)

Definition at line 87 of file filter.c.

88{
90 TRACE("(%p)->(%d, %p)\n", This, dwMilliSecsTimeout, pState);
91
92 EnterCriticalSection(&This->csFilter);
93 {
94 *pState = This->state;
95 }
96 LeaveCriticalSection(&This->csFilter);
97
98 return S_OK;
99}
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by BaseRendererImpl_GetState(), and MediaStreamFilterImpl_GetState().

◆ BaseFilterImpl_GetSyncSource()

HRESULT WINAPI BaseFilterImpl_GetSyncSource ( IBaseFilter iface,
IReferenceClock **  ppClock 
)

Definition at line 119 of file filter.c.

120{
122 TRACE("(%p)->(%p)\n", This, ppClock);
123
124 EnterCriticalSection(&This->csFilter);
125 {
126 *ppClock = This->pClock;
127 if (This->pClock)
129 }
130 LeaveCriticalSection(&This->csFilter);
131
132 return S_OK;
133}
#define IReferenceClock_AddRef(p)
Definition: dmusicc.h:751

Referenced by MediaStreamFilterImpl_GetSyncSource(), and Parser_GetSyncSource().

◆ BaseFilterImpl_IncrementPinVersion()

VOID WINAPI BaseFilterImpl_IncrementPinVersion ( BaseFilter This)

Definition at line 190 of file filter.c.

191{
192 InterlockedIncrement(&This->pinVersion);
193 TRACE("(%p) -> New pinVersion %i\n", This,This->pinVersion);
194}

Referenced by FileSource_Load(), Parser_AddPin(), and Parser_RemoveOutputPins().

◆ BaseFilterImpl_JoinFilterGraph()

HRESULT WINAPI BaseFilterImpl_JoinFilterGraph ( IBaseFilter iface,
IFilterGraph pGraph,
LPCWSTR  pName 
)

Definition at line 159 of file filter.c.

160{
162
163 TRACE("(%p)->(%p, %s)\n", This, pGraph, debugstr_w(pName));
164
165 EnterCriticalSection(&This->csFilter);
166 {
167 if (pName)
168 strcpyW(This->filterInfo.achName, pName);
169 else
170 *This->filterInfo.achName = '\0';
171 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
172 }
173 LeaveCriticalSection(&This->csFilter);
174
175 return S_OK;
176}
#define debugstr_w
Definition: kernel32.h:32
static LPSTR pName
Definition: security.c:75
#define strcpyW(d, s)
Definition: unicode.h:35

Referenced by MediaStreamFilterImpl_JoinFilterGraph(), Parser_JoinFilterGraph(), and SampleGrabber_IBaseFilter_JoinFilterGraph().

◆ BaseFilterImpl_QueryFilterInfo()

HRESULT WINAPI BaseFilterImpl_QueryFilterInfo ( IBaseFilter iface,
FILTER_INFO *  pInfo 
)

Definition at line 145 of file filter.c.

146{
148 TRACE("(%p)->(%p)\n", This, pInfo);
149
150 strcpyW(pInfo->achName, This->filterInfo.achName);
151 pInfo->pGraph = This->filterInfo.pGraph;
152
153 if (pInfo->pGraph)
154 IFilterGraph_AddRef(pInfo->pGraph);
155
156 return S_OK;
157}

Referenced by MediaStreamFilterImpl_QueryFilterInfo(), and Parser_QueryFilterInfo().

◆ BaseFilterImpl_QueryInterface()

HRESULT WINAPI BaseFilterImpl_QueryInterface ( IBaseFilter iface,
REFIID  riid,
LPVOID ppv 
)

Definition at line 37 of file filter.c.

38{
39 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
40
41 *ppv = NULL;
42
44 IsEqualIID(riid, &IID_IMediaFilter) || IsEqualIID(riid, &IID_IBaseFilter))
45 {
46 *ppv = iface;
47 IBaseFilter_AddRef(iface);
48 return S_OK;
49 }
50
51 return E_NOINTERFACE;
52}
const GUID IID_IUnknown
const GUID IID_IBaseFilter
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IPersist
Definition: proxy.cpp:14
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by BaseRendererImpl_QueryInterface(), and TransformFilterImpl_QueryInterface().

◆ BaseFilterImpl_QueryVendorInfo()

HRESULT WINAPI BaseFilterImpl_QueryVendorInfo ( IBaseFilter iface,
LPWSTR pVendorInfo 
)

Definition at line 178 of file filter.c.

179{
180 TRACE("(%p)->(%p)\n", iface, pVendorInfo);
181 return E_NOTIMPL;
182}
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by MediaStreamFilterImpl_QueryVendorInfo(), and Parser_QueryVendorInfo().

◆ BaseFilterImpl_Release()

ULONG WINAPI BaseFilterImpl_Release ( IBaseFilter iface)

Definition at line 64 of file filter.c.

65{
67 ULONG refCount = InterlockedDecrement(&This->refCount);
68
69 TRACE("(%p)->() Release from %d\n", This, refCount + 1);
70
71 if (!refCount)
73
74 return refCount;
75}
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT WINAPI BaseFilter_Destroy(BaseFilter *This)
Definition: filter.c:214

Referenced by AVICompressor_Release(), AviMux_Release(), Parser_Create(), QCAP_createAVIMux(), SampleGrabber_Release(), TransformFilter_Init(), and Unknown_Release().

◆ BaseFilterImpl_SetSyncSource()

HRESULT WINAPI BaseFilterImpl_SetSyncSource ( IBaseFilter iface,
IReferenceClock pClock 
)

Definition at line 101 of file filter.c.

102{
104 TRACE("(%p)->(%p)\n", This, pClock);
105
106 EnterCriticalSection(&This->csFilter);
107 {
108 if (This->pClock)
110 This->pClock = pClock;
111 if (This->pClock)
113 }
114 LeaveCriticalSection(&This->csFilter);
115
116 return S_OK;
117}

Referenced by BaseRendererImpl_SetSyncSource(), MediaStreamFilterImpl_SetSyncSource(), and Parser_SetSyncSource().

◆ impl_from_IBaseFilter()

static BaseFilter * impl_from_IBaseFilter ( IBaseFilter iface)
inlinestatic

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( strmbase  )