ReactOS 0.4.16-dev-125-g798ea90
enumpins.c File Reference
#include "dshow.h"
#include "wine/strmbase.h"
#include "wine/debug.h"
Include dependency graph for enumpins.c:

Go to the source code of this file.

Classes

struct  IEnumPinsImpl
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct IEnumPinsImpl IEnumPinsImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (strmbase)
 
static IEnumPinsImplimpl_from_IEnumPins (IEnumPins *iface)
 
HRESULT WINAPI EnumPins_Construct (BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins **ppEnum)
 
static HRESULT WINAPI IEnumPinsImpl_QueryInterface (IEnumPins *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI IEnumPinsImpl_AddRef (IEnumPins *iface)
 
static ULONG WINAPI IEnumPinsImpl_Release (IEnumPins *iface)
 
static HRESULT WINAPI IEnumPinsImpl_Next (IEnumPins *iface, ULONG cPins, IPin **ppPins, ULONG *pcFetched)
 
static HRESULT WINAPI IEnumPinsImpl_Skip (IEnumPins *iface, ULONG cPins)
 
static HRESULT WINAPI IEnumPinsImpl_Reset (IEnumPins *iface)
 
static HRESULT WINAPI IEnumPinsImpl_Clone (IEnumPins *iface, IEnumPins **ppEnum)
 

Variables

static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file enumpins.c.

Typedef Documentation

◆ IEnumPinsImpl

Function Documentation

◆ EnumPins_Construct()

HRESULT WINAPI EnumPins_Construct ( BaseFilter base,
BaseFilter_GetPin  receive_pin,
BaseFilter_GetPinCount  receive_pincount,
BaseFilter_GetPinVersion  receive_version,
IEnumPins **  ppEnum 
)

Definition at line 49 of file enumpins.c.

50{
51 IEnumPinsImpl * pEnumPins;
52
53 if (!ppEnum)
54 return E_POINTER;
55
56 pEnumPins = CoTaskMemAlloc(sizeof(IEnumPinsImpl));
57 if (!pEnumPins)
58 {
59 *ppEnum = NULL;
60 return E_OUTOFMEMORY;
61 }
62 pEnumPins->IEnumPins_iface.lpVtbl = &IEnumPinsImpl_Vtbl;
63 pEnumPins->refCount = 1;
64 pEnumPins->uIndex = 0;
65 pEnumPins->receive_pin = receive_pin;
66 pEnumPins->receive_pincount = receive_pincount;
67 pEnumPins->receive_version = receive_version;
68 pEnumPins->base = base;
69 IBaseFilter_AddRef(&base->IBaseFilter_iface);
70 *ppEnum = &pEnumPins->IEnumPins_iface;
71 pEnumPins->Version = receive_version(base);
72
73 TRACE("Created new enumerator (%p)\n", *ppEnum);
74 return S_OK;
75}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl
Definition: enumpins.c:47
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4
BaseFilter_GetPinVersion receive_version
Definition: enumpins.c:38
TestFilterImpl * base
Definition: filtergraph.c:1273
BaseFilter_GetPinCount receive_pincount
Definition: enumpins.c:37
FNOBTAINPIN receive_pin
Definition: filtergraph.c:1274
IEnumPins IEnumPins_iface
Definition: filtergraph.c:1270
DWORD Version
Definition: enumpins.c:39
#define E_POINTER
Definition: winerror.h:2365

Referenced by BaseFilterImpl_EnumPins(), and IEnumPinsImpl_Clone().

◆ IEnumPinsImpl_AddRef()

static ULONG WINAPI IEnumPinsImpl_AddRef ( IEnumPins iface)
static

Definition at line 99 of file enumpins.c.

100{
102 ULONG ref = InterlockedIncrement(&This->refCount);
103
104 TRACE("(%p)->(): new ref = %u\n", iface, ref);
105
106 return ref;
107}
#define InterlockedIncrement
Definition: armddk.h:53
static IEnumPinsImpl * impl_from_IEnumPins(IEnumPins *iface)
Definition: enumpins.c:42
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ IEnumPinsImpl_Clone()

static HRESULT WINAPI IEnumPinsImpl_Clone ( IEnumPins iface,
IEnumPins **  ppEnum 
)
static

Definition at line 193 of file enumpins.c.

194{
195 HRESULT hr;
197
198 TRACE("(%p)->(%p)\n", iface, ppEnum);
199
200 hr = EnumPins_Construct(This->base, This->receive_pin, This->receive_pincount, This->receive_version, ppEnum);
201 if (FAILED(hr))
202 return hr;
203 return IEnumPins_Skip(*ppEnum, This->uIndex);
204}
HRESULT WINAPI EnumPins_Construct(BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins **ppEnum)
Definition: enumpins.c:49
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183

◆ IEnumPinsImpl_Next()

static HRESULT WINAPI IEnumPinsImpl_Next ( IEnumPins iface,
ULONG  cPins,
IPin **  ppPins,
ULONG pcFetched 
)
static

Definition at line 125 of file enumpins.c.

126{
128 ULONG i = 0;
129
130 TRACE("(%p)->(%u, %p, %p)\n", iface, cPins, ppPins, pcFetched);
131
132 if (!ppPins)
133 return E_POINTER;
134
135 if (cPins > 1 && !pcFetched)
136 return E_INVALIDARG;
137
138 if (pcFetched)
139 *pcFetched = 0;
140
141 if (This->Version != This->receive_version(This->base))
143
144 while (i < cPins)
145 {
146 IPin *pin;
147 pin = This->receive_pin(This->base, This->uIndex + i);
148
149 if (!pin)
150 break;
151 else
152 ppPins[i] = pin;
153 ++i;
154 }
155
156 if (pcFetched)
157 *pcFetched = i;
158 This->uIndex += i;
159
160 if (i < cPins)
161 return S_FALSE;
162 return S_OK;
163}
#define E_INVALIDARG
Definition: ddrawi.h:101
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
Definition: axcore.idl:92
Definition: regsvr.c:104
#define VFW_E_ENUM_OUT_OF_SYNC
Definition: vfwmsgs.h:42
#define S_FALSE
Definition: winerror.h:2357

◆ IEnumPinsImpl_QueryInterface()

static HRESULT WINAPI IEnumPinsImpl_QueryInterface ( IEnumPins iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 77 of file enumpins.c.

78{
79 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
80
81 *ppv = NULL;
82
84 *ppv = iface;
85 else if (IsEqualIID(riid, &IID_IEnumPins))
86 *ppv = iface;
87
88 if (*ppv)
89 {
90 IUnknown_AddRef((IUnknown *)(*ppv));
91 return S_OK;
92 }
93
94 FIXME("No interface for %s!\n", debugstr_guid(riid));
95
96 return E_NOINTERFACE;
97}
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IEnumPinsImpl_Release()

static ULONG WINAPI IEnumPinsImpl_Release ( IEnumPins iface)
static

Definition at line 109 of file enumpins.c.

110{
112 ULONG ref = InterlockedDecrement(&This->refCount);
113
114 TRACE("(%p)->(): new ref = %u\n", iface, ref);
115
116 if (!ref)
117 {
118 IBaseFilter_Release(&This->base->IBaseFilter_iface);
120 }
121
122 return ref;
123}
#define InterlockedDecrement
Definition: armddk.h:52
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442

◆ IEnumPinsImpl_Reset()

static HRESULT WINAPI IEnumPinsImpl_Reset ( IEnumPins iface)
static

Definition at line 181 of file enumpins.c.

182{
184
185 TRACE("(%p)->()\n", iface);
186
187 This->Version = This->receive_version(This->base);
188
189 This->uIndex = 0;
190 return S_OK;
191}

◆ IEnumPinsImpl_Skip()

static HRESULT WINAPI IEnumPinsImpl_Skip ( IEnumPins iface,
ULONG  cPins 
)
static

Definition at line 165 of file enumpins.c.

166{
168
169 TRACE("(%p)->(%u)\n", iface, cPins);
170
171 if (This->Version != This->receive_version(This->base))
173
174 if (This->receive_pincount(This->base) >= This->uIndex + cPins)
175 return S_FALSE;
176
177 This->uIndex += cPins;
178 return S_OK;
179}

◆ impl_from_IEnumPins()

static IEnumPinsImpl * impl_from_IEnumPins ( IEnumPins iface)
inlinestatic

Definition at line 42 of file enumpins.c.

43{
44 return CONTAINING_RECORD(iface, IEnumPinsImpl, IEnumPins_iface);
45}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IEnumPinsImpl_AddRef(), IEnumPinsImpl_Clone(), IEnumPinsImpl_Next(), IEnumPinsImpl_Release(), IEnumPinsImpl_Reset(), and IEnumPinsImpl_Skip().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( strmbase  )

Variable Documentation

◆ IEnumPinsImpl_Vtbl

static const IEnumPinsVtbl IEnumPinsImpl_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI IEnumPinsImpl_AddRef(IEnumPins *iface)
Definition: enumpins.c:99
static HRESULT WINAPI IEnumPinsImpl_Clone(IEnumPins *iface, IEnumPins **ppEnum)
Definition: enumpins.c:193
static HRESULT WINAPI IEnumPinsImpl_QueryInterface(IEnumPins *iface, REFIID riid, LPVOID *ppv)
Definition: enumpins.c:77
static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins *iface)
Definition: enumpins.c:109
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins *iface, ULONG cPins, IPin **ppPins, ULONG *pcFetched)
Definition: enumpins.c:125
static HRESULT WINAPI IEnumPinsImpl_Skip(IEnumPins *iface, ULONG cPins)
Definition: enumpins.c:165
static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins *iface)
Definition: enumpins.c:181

Definition at line 47 of file enumpins.c.

Referenced by EnumPins_Construct().