ReactOS  0.4.15-dev-1397-g19779b3
enumfilters.c File Reference
#include "quartz_private.h"
#include "wine/debug.h"
Include dependency graph for enumfilters.c:

Go to the source code of this file.

Classes

struct  IEnumFiltersImpl
 

Typedefs

typedef struct IEnumFiltersImpl IEnumFiltersImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static IEnumFiltersImplimpl_from_IEnumFilters (IEnumFilters *iface)
 
HRESULT IEnumFiltersImpl_Construct (IGraphVersion *pVersionSource, IBaseFilter ***pppFilters, ULONG *pNumFilters, IEnumFilters **ppEnum)
 
static HRESULT WINAPI IEnumFiltersImpl_QueryInterface (IEnumFilters *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI IEnumFiltersImpl_AddRef (IEnumFilters *iface)
 
static ULONG WINAPI IEnumFiltersImpl_Release (IEnumFilters *iface)
 
static HRESULT WINAPI IEnumFiltersImpl_Next (IEnumFilters *iface, ULONG cFilters, IBaseFilter **ppFilters, ULONG *pcFetched)
 
static HRESULT WINAPI IEnumFiltersImpl_Skip (IEnumFilters *iface, ULONG cFilters)
 
static HRESULT WINAPI IEnumFiltersImpl_Reset (IEnumFilters *iface)
 
static HRESULT WINAPI IEnumFiltersImpl_Clone (IEnumFilters *iface, IEnumFilters **ppEnum)
 

Variables

static const struct IEnumFiltersVtbl IEnumFiltersImpl_Vtbl
 

Typedef Documentation

◆ IEnumFiltersImpl

Function Documentation

◆ IEnumFiltersImpl_AddRef()

static ULONG WINAPI IEnumFiltersImpl_AddRef ( IEnumFilters iface)
static

Definition at line 100 of file enumfilters.c.

101 {
103  ULONG refCount = InterlockedIncrement(&This->refCount);
104 
105  TRACE("(%p)->()\n", iface);
106 
107  return refCount;
108 }
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IEnumFiltersImpl_Clone()

static HRESULT WINAPI IEnumFiltersImpl_Clone ( IEnumFilters iface,
IEnumFilters **  ppEnum 
)
static

Definition at line 193 of file enumfilters.c.

194 {
195  HRESULT hr;
197 
198  TRACE("(%p)->(%p)\n", iface, ppEnum);
199 
200  hr = IEnumFiltersImpl_Construct(This->pVersionSource, This->pppFilters, This->pNumFilters, ppEnum);
201  if (FAILED(hr))
202  return hr;
203  return IEnumFilters_Skip(*ppEnum, This->uIndex);
204 }
HRESULT hr
Definition: shlfolder.c:183
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
HRESULT IEnumFiltersImpl_Construct(IGraphVersion *pVersionSource, IBaseFilter ***pppFilters, ULONG *pNumFilters, IEnumFilters **ppEnum)
Definition: enumfilters.c:45
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79

◆ IEnumFiltersImpl_Construct()

HRESULT IEnumFiltersImpl_Construct ( IGraphVersion pVersionSource,
IBaseFilter ***  pppFilters,
ULONG pNumFilters,
IEnumFilters **  ppEnum 
)

Definition at line 45 of file enumfilters.c.

46 {
47  /* Note: The incoming IBaseFilter interfaces are not AddRef'd here as in Windows,
48  * they should have been previously AddRef'd. */
49  IEnumFiltersImpl * pEnumFilters = CoTaskMemAlloc(sizeof(IEnumFiltersImpl));
50  HRESULT hr;
51  LONG currentVersion;
52 
53  TRACE("(%p, %p, %p)\n", pppFilters, pNumFilters, ppEnum);
54 
55  *ppEnum = NULL;
56 
57  if (!pEnumFilters)
58  {
59  return E_OUTOFMEMORY;
60  }
61 
62  pEnumFilters->IEnumFilters_iface.lpVtbl = &IEnumFiltersImpl_Vtbl;
63  pEnumFilters->refCount = 1;
64  pEnumFilters->uIndex = 0;
65  pEnumFilters->pNumFilters = pNumFilters;
66  pEnumFilters->pppFilters = pppFilters;
67  IGraphVersion_AddRef(pVersionSource);
68  pEnumFilters->pVersionSource = pVersionSource;
69 
70  /* Store the current version of the graph */
71  hr = IGraphVersion_QueryVersion(pVersionSource, &currentVersion);
72  pEnumFilters->Version = (hr==S_OK) ? currentVersion : 0;
73 
74  *ppEnum = &pEnumFilters->IEnumFilters_iface;
75  return S_OK;
76 }
IEnumFilters IEnumFilters_iface
Definition: enumfilters.c:29
HRESULT hr
Definition: shlfolder.c:183
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
ULONG * pNumFilters
Definition: enumfilters.c:34
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
IGraphVersion * pVersionSource
Definition: enumfilters.c:31
static const struct IEnumFiltersVtbl IEnumFiltersImpl_Vtbl
Definition: enumfilters.c:38
IBaseFilter *** pppFilters
Definition: enumfilters.c:33
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

Referenced by FilterGraph2_EnumFilters(), and IEnumFiltersImpl_Clone().

◆ IEnumFiltersImpl_Next()

static HRESULT WINAPI IEnumFiltersImpl_Next ( IEnumFilters iface,
ULONG  cFilters,
IBaseFilter **  ppFilters,
ULONG pcFetched 
)
static

Definition at line 127 of file enumfilters.c.

128 {
129  ULONG cFetched;
130  ULONG i;
131  LONG currentVersion;
133  HRESULT hr;
134 
135  cFetched = min(*This->pNumFilters, This->uIndex + cFilters) - This->uIndex;
136 
137  TRACE("(%p)->(%u, %p, %p)\n", iface, cFilters, ppFilters, pcFetched);
138 
139  /* First of all check if the graph has changed */
140  hr = IGraphVersion_QueryVersion(This->pVersionSource, &currentVersion);
141  if (hr==S_OK && This->Version != currentVersion)
142  return VFW_E_ENUM_OUT_OF_SYNC;
143 
144 
145  if (!ppFilters)
146  return E_POINTER;
147 
148  for (i = 0; i < cFetched; i++)
149  {
150  ppFilters[i] = (*This->pppFilters)[This->uIndex + i];
151  IBaseFilter_AddRef(ppFilters[i]);
152  }
153 
154  This->uIndex += cFetched;
155 
156  if (pcFetched)
157  *pcFetched = cFetched;
158 
159  if (cFetched != cFilters)
160  return S_FALSE;
161  return S_OK;
162 }
HRESULT hr
Definition: shlfolder.c:183
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
long LONG
Definition: pedump.c:60
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define VFW_E_ENUM_OUT_OF_SYNC
Definition: vfwmsgs.h:42
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
#define E_POINTER
Definition: winerror.h:2365

◆ IEnumFiltersImpl_QueryInterface()

static HRESULT WINAPI IEnumFiltersImpl_QueryInterface ( IEnumFilters iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 78 of file enumfilters.c.

79 {
80  TRACE("(%p)->(%s, %p)\n", iface, qzdebugstr_guid(riid), ppv);
81 
82  *ppv = NULL;
83 
85  *ppv = iface;
86  else if (IsEqualIID(riid, &IID_IEnumFilters))
87  *ppv = iface;
88 
89  if (*ppv)
90  {
91  IUnknown_AddRef((IUnknown *)(*ppv));
92  return S_OK;
93  }
94 
95  FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
96 
97  return E_NOINTERFACE;
98 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const char * qzdebugstr_guid(const GUID *id)
Definition: main.c:279
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ IEnumFiltersImpl_Release()

static ULONG WINAPI IEnumFiltersImpl_Release ( IEnumFilters iface)
static

Definition at line 110 of file enumfilters.c.

111 {
113  ULONG refCount = InterlockedDecrement(&This->refCount);
114 
115  TRACE("(%p)->()\n", iface);
116 
117  if (!refCount)
118  {
119  IGraphVersion_Release(This->pVersionSource);
121  return 0;
122  }
123  else
124  return refCount;
125 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

◆ IEnumFiltersImpl_Reset()

static HRESULT WINAPI IEnumFiltersImpl_Reset ( IEnumFilters iface)
static

Definition at line 178 of file enumfilters.c.

179 {
181  HRESULT hr;
182  LONG currentVersion;
183 
184  TRACE("(%p)->()\n", iface);
185 
186  This->uIndex = 0;
187  hr = IGraphVersion_QueryVersion(This->pVersionSource, &currentVersion);
188  if (hr == S_OK)
189  This->Version = currentVersion;
190  return S_OK;
191 }
HRESULT hr
Definition: shlfolder.c:183
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51

◆ IEnumFiltersImpl_Skip()

static HRESULT WINAPI IEnumFiltersImpl_Skip ( IEnumFilters iface,
ULONG  cFilters 
)
static

Definition at line 164 of file enumfilters.c.

165 {
167 
168  TRACE("(%p)->(%u)\n", iface, cFilters);
169 
170  if (This->uIndex + cFilters < *This->pNumFilters)
171  {
172  This->uIndex += cFilters;
173  return S_OK;
174  }
175  return S_FALSE;
176 }
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ impl_from_IEnumFilters()

static IEnumFiltersImpl* impl_from_IEnumFilters ( IEnumFilters iface)
inlinestatic

Definition at line 40 of file enumfilters.c.

41 {
42  return CONTAINING_RECORD(iface, IEnumFiltersImpl, IEnumFilters_iface);
43 }
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 IEnumFiltersImpl_AddRef(), IEnumFiltersImpl_Clone(), IEnumFiltersImpl_Next(), IEnumFiltersImpl_Release(), IEnumFiltersImpl_Reset(), and IEnumFiltersImpl_Skip().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ IEnumFiltersImpl_Vtbl

static const IEnumFiltersVtbl IEnumFiltersImpl_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IEnumFiltersImpl_Next(IEnumFilters *iface, ULONG cFilters, IBaseFilter **ppFilters, ULONG *pcFetched)
Definition: enumfilters.c:127
static HRESULT WINAPI IEnumFiltersImpl_Clone(IEnumFilters *iface, IEnumFilters **ppEnum)
Definition: enumfilters.c:193
static ULONG WINAPI IEnumFiltersImpl_Release(IEnumFilters *iface)
Definition: enumfilters.c:110
static HRESULT WINAPI IEnumFiltersImpl_Skip(IEnumFilters *iface, ULONG cFilters)
Definition: enumfilters.c:164
static ULONG WINAPI IEnumFiltersImpl_AddRef(IEnumFilters *iface)
Definition: enumfilters.c:100
static HRESULT WINAPI IEnumFiltersImpl_Reset(IEnumFilters *iface)
Definition: enumfilters.c:178
static HRESULT WINAPI IEnumFiltersImpl_QueryInterface(IEnumFilters *iface, REFIID riid, LPVOID *ppv)
Definition: enumfilters.c:78

Definition at line 38 of file enumfilters.c.

Referenced by IEnumFiltersImpl_Construct().