ReactOS  0.4.14-dev-358-gbef841c
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)
217  IReferenceClock_Release(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 }
smooth NULL
Definition: ftsmooth.c:416
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define S_OK
Definition: intsafe.h:59
#define IReferenceClock_Release(p)
Definition: dmusicc.h:752

Referenced by AsyncReader_Release(), BaseFilterImpl_Release(), BaseRendererImpl_Release(), MediaStreamFilterImpl_Release(), Parser_Destroy(), and TransformFilterImpl_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;
200  InitializeCriticalSection(&This->csFilter);
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 }
#define ZeroMemory
Definition: winbase.h:1642
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

Referenced by AsyncReader_create(), BaseRenderer_Init(), MediaStreamFilter_create(), Parser_Create(), 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 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

Referenced by AMDirectSound_AddRef(), Basicaudio_AddRef(), MediaStreamFilterImpl_AddRef(), NullRendererInner_AddRef(), Parser_AddRef(), ReferenceClock_AddRef(), SampleGrabber_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 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI EnumPins_Construct(BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins **ppEnum)
Definition: enumpins.c:49
LONG WINAPI BaseFilterImpl_GetPinVersion(BaseFilter *This)
Definition: filter.c:184

Referenced by 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 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

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 }
#define TRACE(s)
Definition: solgame.cpp:4

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 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(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)
128  IReferenceClock_AddRef(This->pClock);
129  }
130  LeaveCriticalSection(&This->csFilter);
131 
132  return S_OK;
133 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define IReferenceClock_AddRef(p)
Definition: dmusicc.h:751
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

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 }
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

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 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static LPSTR pName
Definition: security.c:75
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

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 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

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_IBaseFilter
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IPersist
Definition: proxy.cpp:14
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

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 TRACE(s)
Definition: solgame.cpp:4
#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 }
HRESULT WINAPI BaseFilter_Destroy(BaseFilter *This)
Definition: filter.c:214
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

Referenced by Parser_Create(), SampleGrabber_Release(), and TransformFilter_Init().

◆ 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)
109  IReferenceClock_Release(This->pClock);
110  This->pClock = pClock;
111  if (This->pClock)
112  IReferenceClock_AddRef(This->pClock);
113  }
114  LeaveCriticalSection(&This->csFilter);
115 
116  return S_OK;
117 }
static BaseFilter * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: filter.c:32
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define IReferenceClock_Release(p)
Definition: dmusicc.h:752
#define IReferenceClock_AddRef(p)
Definition: dmusicc.h:751
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

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

◆ impl_from_IBaseFilter()

static BaseFilter* impl_from_IBaseFilter ( IBaseFilter iface)
inlinestatic

Definition at line 32 of file filter.c.

33 {
34  return CONTAINING_RECORD(iface, BaseFilter, IBaseFilter_iface);
35 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by BaseFilterImpl_AddRef(), BaseFilterImpl_EnumPins(), BaseFilterImpl_GetClassID(), BaseFilterImpl_GetState(), BaseFilterImpl_GetSyncSource(), BaseFilterImpl_JoinFilterGraph(), BaseFilterImpl_QueryFilterInfo(), BaseFilterImpl_Release(), and BaseFilterImpl_SetSyncSource().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( strmbase  )