ReactOS 0.4.16-dev-92-g0c2cdca
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}
#define InterlockedIncrement
Definition: armddk.h:53
static IEnumFiltersImpl * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: enumfilters.c:40
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t ULONG
Definition: typedefs.h:59

◆ 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 IEnumFiltersImpl_Construct(IGraphVersion *pVersionSource, IBaseFilter ***pppFilters, ULONG *pNumFilters, IEnumFilters **ppEnum)
Definition: enumfilters.c:45
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183

◆ 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}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
static const struct IEnumFiltersVtbl IEnumFiltersImpl_Vtbl
Definition: enumfilters.c:38
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
long LONG
Definition: pedump.c:60
IEnumFilters IEnumFilters_iface
Definition: enumfilters.c:29
ULONG * pNumFilters
Definition: enumfilters.c:34
IBaseFilter *** pppFilters
Definition: enumfilters.c:33
IGraphVersion * pVersionSource
Definition: enumfilters.c:31

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)
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}
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 min(a, b)
Definition: monoChain.cc:55
#define VFW_E_ENUM_OUT_OF_SYNC
Definition: vfwmsgs.h:42
#define S_FALSE
Definition: winerror.h:2357
#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 FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
const char * qzdebugstr_guid(const GUID *id)
Definition: main.c:279
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ 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}
#define InterlockedDecrement
Definition: armddk.h:52
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442

◆ 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}

◆ 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}

◆ 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}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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 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_Clone(IEnumFilters *iface, IEnumFilters **ppEnum)
Definition: enumfilters.c:193
static ULONG WINAPI IEnumFiltersImpl_Release(IEnumFilters *iface)
Definition: enumfilters.c:110
static HRESULT WINAPI IEnumFiltersImpl_Next(IEnumFilters *iface, ULONG cFilters, IBaseFilter **ppFilters, ULONG *pcFetched)
Definition: enumfilters.c:127
static HRESULT WINAPI IEnumFiltersImpl_QueryInterface(IEnumFilters *iface, REFIID riid, LPVOID *ppv)
Definition: enumfilters.c:78
static HRESULT WINAPI IEnumFiltersImpl_Skip(IEnumFilters *iface, ULONG cFilters)
Definition: enumfilters.c:164

Definition at line 38 of file enumfilters.c.

Referenced by IEnumFiltersImpl_Construct().