strmbase: Move enumpins from quartz to strmbase.

This commit is contained in:
Aric Stewart 2010-10-06 09:48:07 -05:00 committed by Alexandre Julliard
parent 89ea07f7d0
commit bb110c7749
15 changed files with 175 additions and 295 deletions

View File

@ -5,7 +5,6 @@ C_SRCS = \
capturegraph.c \
dllsetup.c \
enummedia.c \
enumpins.c \
pin.c \
qcap_main.c \
v4l.c \

View File

@ -1,186 +0,0 @@
/*
* Implementation of IEnumPins Interface
*
* Copyright 2003 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "wingdi.h"
#include "winuser.h"
#include "dshow.h"
#include "qcap_main.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
typedef struct IEnumPinsImpl
{
const IEnumPinsVtbl * lpVtbl;
LONG refCount;
ENUMPINDETAILS enumPinDetails;
ULONG uIndex;
} IEnumPinsImpl;
static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl;
HRESULT IEnumPinsImpl_Construct(const ENUMPINDETAILS * pDetails, IEnumPins ** ppEnum)
{
IEnumPinsImpl * pEnumPins = CoTaskMemAlloc(sizeof(IEnumPinsImpl));
if (!pEnumPins)
{
*ppEnum = NULL;
return E_OUTOFMEMORY;
}
pEnumPins->lpVtbl = &IEnumPinsImpl_Vtbl;
pEnumPins->refCount = 1;
pEnumPins->uIndex = 0;
pEnumPins->enumPinDetails = *pDetails;
*ppEnum = (IEnumPins *)(&pEnumPins->lpVtbl);
ObjectRefCount(TRUE);
return S_OK;
}
static HRESULT WINAPI IEnumPinsImpl_QueryInterface(IEnumPins * iface, REFIID riid, LPVOID * ppv)
{
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown))
*ppv = iface;
else if (IsEqualIID(riid, &IID_IEnumPins))
*ppv = iface;
if (*ppv)
{
IUnknown_AddRef((IUnknown *)(*ppv));
return S_OK;
}
FIXME("No interface for %s!\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI IEnumPinsImpl_AddRef(IEnumPins * iface)
{
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->refCount);
TRACE("()\n");
return refCount;
}
static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
{
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->refCount);
TRACE("()\n");
if (!refCount)
{
CoTaskMemFree(This);
ObjectRefCount(FALSE);
}
return refCount;
}
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** ppPins, ULONG * pcFetched)
{
ULONG cFetched;
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
cFetched = min(This->enumPinDetails.cPins, This->uIndex + cPins) - This->uIndex;
TRACE("(%u, %p, %p)\n", cPins, ppPins, pcFetched);
if (cFetched > 0)
{
ULONG i;
for (i = 0; i < cFetched; i++) {
IPin_AddRef(This->enumPinDetails.ppPins[This->uIndex + i]);
ppPins[i] = This->enumPinDetails.ppPins[This->uIndex + i];
}
}
if ((cPins != 1) || pcFetched)
*pcFetched = cFetched;
This->uIndex += cFetched;
if (cFetched != cPins)
return S_FALSE;
return S_OK;
}
static HRESULT WINAPI IEnumPinsImpl_Skip(IEnumPins * iface, ULONG cPins)
{
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
TRACE("(%u)\n", cPins);
if (This->uIndex + cPins < This->enumPinDetails.cPins)
{
This->uIndex += cPins;
return S_OK;
}
return S_FALSE;
}
static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins * iface)
{
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
TRACE("IEnumPinsImpl::Reset()\n");
This->uIndex = 0;
return S_OK;
}
static HRESULT WINAPI IEnumPinsImpl_Clone(IEnumPins * iface, IEnumPins ** ppEnum)
{
HRESULT hr;
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
TRACE("(%p)\n", ppEnum);
hr = IEnumPinsImpl_Construct(&This->enumPinDetails, ppEnum);
if (FAILED(hr))
return hr;
return IEnumPins_Skip(*ppEnum, This->uIndex);
}
static const IEnumPinsVtbl IEnumPinsImpl_Vtbl =
{
IEnumPinsImpl_QueryInterface,
IEnumPinsImpl_AddRef,
IEnumPinsImpl_Release,
IEnumPinsImpl_Next,
IEnumPinsImpl_Skip,
IEnumPinsImpl_Reset,
IEnumPinsImpl_Clone
};

View File

@ -37,14 +37,6 @@ extern IUnknown * WINAPI QCAP_createInfinitePinTeeFilter(IUnknown *pUnkOuter, HR
extern IUnknown * WINAPI QCAP_createSmartTeeFilter(IUnknown *pUnkOuter, HRESULT *phr);
extern IUnknown * WINAPI QCAP_createAudioInputMixerPropertyPage(IUnknown *pUnkOuter, HRESULT *phr);
typedef struct tagENUMPINDETAILS
{
ULONG cPins;
IPin ** ppPins;
} ENUMPINDETAILS;
HRESULT IEnumPinsImpl_Construct(const ENUMPINDETAILS * pDetails, IEnumPins ** ppEnum);
BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards);
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt);

View File

@ -281,18 +281,34 @@ VfwCapture_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
}
/** IBaseFilter methods **/
static IPin* WINAPI VfwCapture_GetPin(IBaseFilter *iface, int pos)
{
VfwCapture *This = (VfwCapture *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
}
static LONG WINAPI VfwCapture_GetPinCount(IBaseFilter *iface)
{
return 1;
}
static LONG WINAPI VfwCapture_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI
VfwCapture_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
ENUMPINDETAILS epd;
VfwCapture *This = (VfwCapture *)iface;
TRACE("(%p)\n", ppEnum);
epd.cPins = 1;
epd.ppPins = &This->pOutputPin;
return IEnumPinsImpl_Construct(&epd, ppEnum);
return EnumPins_Construct(iface, VfwCapture_GetPin, VfwCapture_GetPinCount, VfwCapture_GetPinVersion, ppEnum);
}
static HRESULT WINAPI VfwCapture_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -12,7 +12,6 @@ C_SRCS = \
enumfilters.c \
enummedia.c \
enummoniker.c \
enumpins.c \
enumregfilters.c \
filesource.c \
filtergraph.c \

View File

@ -702,19 +702,27 @@ static HRESULT WINAPI DSoundRender_GetSyncSource(IBaseFilter * iface, IReference
/** IBaseFilter implementation **/
static HRESULT DSoundRender_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
static IPin* WINAPI DSoundRender_GetPin(IBaseFilter *iface, int pos)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin*)This->pInputPin);
return (IPin*)This->pInputPin;
}
static LONG WINAPI DSoundRender_GetPinCount(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
*lastsynctick = 0;
return 1;
}
if (pos >= 1)
return S_FALSE;
*pin = (IPin *)This->pInputPin;
IPin_AddRef(*pin);
return S_OK;
static LONG WINAPI DSoundRender_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI DSoundRender_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
@ -723,7 +731,7 @@ static HRESULT WINAPI DSoundRender_EnumPins(IBaseFilter * iface, IEnumPins **ppE
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return IEnumPinsImpl_Construct(ppEnum, DSoundRender_GetPin, iface);
return EnumPins_Construct(iface, DSoundRender_GetPin, DSoundRender_GetPinCount, DSoundRender_GetPinVersion, ppEnum);
}
static HRESULT WINAPI DSoundRender_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -522,19 +522,33 @@ static HRESULT WINAPI AsyncReader_GetSyncSource(IBaseFilter * iface, IReferenceC
/** IBaseFilter methods **/
static HRESULT AsyncReader_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
static IPin* WINAPI AsyncReader_GetPin(IBaseFilter *iface, int pos)
{
AsyncReader *This = (AsyncReader *)iface;
if (pos >= 1 || !This->pOutputPin)
return NULL;
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
}
static LONG WINAPI AsyncReader_GetPinCount(IBaseFilter *iface)
{
AsyncReader *This = (AsyncReader *)iface;
if (!This->pOutputPin)
return 0;
else
return 1;
}
static LONG WINAPI AsyncReader_GetPinVersion(IBaseFilter *iface)
{
AsyncReader *This = (AsyncReader *)iface;
/* Our pins are almost static, not changing so setting static tick count is ok */
*lastsynctick = This->lastpinchange;
if (pos >= 1 || !This->pOutputPin)
return S_FALSE;
*pin = This->pOutputPin;
IPin_AddRef(*pin);
return S_OK;
return This->lastpinchange;
}
static HRESULT WINAPI AsyncReader_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
@ -543,7 +557,7 @@ static HRESULT WINAPI AsyncReader_EnumPins(IBaseFilter * iface, IEnumPins **ppEn
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return IEnumPinsImpl_Construct(ppEnum, AsyncReader_GetPin, iface);
return EnumPins_Construct(iface, AsyncReader_GetPin, AsyncReader_GetPinCount, AsyncReader_GetPinVersion, ppEnum);
}
static HRESULT WINAPI AsyncReader_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -399,19 +399,26 @@ static HRESULT WINAPI NullRenderer_GetSyncSource(IBaseFilter * iface, IReference
/** IBaseFilter implementation **/
static HRESULT NullRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
static IPin* WINAPI NullRenderer_GetPin(IBaseFilter *iface, int pos)
{
NullRendererImpl *This = (NullRendererImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin *)This->pInputPin);
return (IPin *)This->pInputPin;
}
static LONG WINAPI NullRenderer_GetPinCount(IBaseFilter *iface)
{
return 1;
}
static LONG WINAPI NullRenderer_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
*lastsynctick = 0;
if (pos >= 1)
return S_FALSE;
*pin = (IPin *)This->pInputPin;
IPin_AddRef(*pin);
return S_OK;
return 0;
}
static HRESULT WINAPI NullRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
@ -420,7 +427,7 @@ static HRESULT WINAPI NullRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppE
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return IEnumPinsImpl_Construct(ppEnum, NullRenderer_GetPin, iface);
return EnumPins_Construct(iface, NullRenderer_GetPin, NullRenderer_GetPinCount, NullRenderer_GetPinVersion, ppEnum);
}
static HRESULT WINAPI NullRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -395,21 +395,32 @@ HRESULT WINAPI Parser_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClo
/** IBaseFilter implementation **/
/* FIXME: WRONG */
static HRESULT Parser_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
static IPin* WINAPI Parser_GetPin(IBaseFilter *iface, int pos)
{
ParserImpl *This = (ParserImpl *)iface;
*lastsynctick = This->lastpinchange;
TRACE("Asking for pos %x\n", pos);
/* Input pin also has a pin, hence the > and not >= */
if (pos > This->cStreams)
return S_FALSE;
if (pos > This->cStreams || pos < 0)
return NULL;
*pin = This->ppPins[pos];
IPin_AddRef(*pin);
return S_OK;
IPin_AddRef(This->ppPins[pos]);
return This->ppPins[pos];
}
static LONG WINAPI Parser_GetPinCount(IBaseFilter *iface)
{
ParserImpl *This = (ParserImpl *)iface;
return This->cStreams;
}
static LONG WINAPI Parser_GetPinVersion(IBaseFilter *iface)
{
ParserImpl *This = (ParserImpl *)iface;
return This->lastpinchange;
}
HRESULT WINAPI Parser_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
@ -418,7 +429,7 @@ HRESULT WINAPI Parser_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return IEnumPinsImpl_Construct(ppEnum, Parser_GetPin, iface);
return EnumPins_Construct(iface, Parser_GetPin, Parser_GetPinCount, Parser_GetPinVersion, ppEnum);
}
HRESULT WINAPI Parser_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -63,9 +63,6 @@ HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj);
HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum);
typedef HRESULT (* FNOBTAINPIN)(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick);
HRESULT IEnumPinsImpl_Construct(IEnumPins ** ppEnum, FNOBTAINPIN receive_pin, IBaseFilter *base);
HRESULT IEnumRegFiltersImpl_Construct(REGFILTER * pInRegFilters, const ULONG size, IEnumRegFilters ** ppEnum);
HRESULT IEnumFiltersImpl_Construct(IBaseFilter ** ppFilters, ULONG nFilters, IEnumFilters ** ppEnum);

View File

@ -361,19 +361,28 @@ static HRESULT WINAPI TransformFilter_GetSyncSource(IBaseFilter * iface, IRefere
/** IBaseFilter implementation **/
static HRESULT TransformFilter_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
if (pos >= This->npins || pos < 0)
return NULL;
IPin_AddRef(This->ppPins[pos]);
return This->ppPins[pos];
}
static LONG WINAPI TransformFilter_GetPinCount(IBaseFilter *iface)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
return (This->npins+1);
}
static LONG WINAPI TransformFilter_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
*lastsynctick = 0;
if (pos >= This->npins)
return S_FALSE;
*pin = This->ppPins[pos];
IPin_AddRef(*pin);
return S_OK;
return 0;
}
static HRESULT WINAPI TransformFilter_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
@ -382,7 +391,7 @@ static HRESULT WINAPI TransformFilter_EnumPins(IBaseFilter * iface, IEnumPins **
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return IEnumPinsImpl_Construct(ppEnum, TransformFilter_GetPin, iface);
return EnumPins_Construct(iface, TransformFilter_GetPin, TransformFilter_GetPinCount, TransformFilter_GetPinVersion, ppEnum);
}
static HRESULT WINAPI TransformFilter_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -906,19 +906,26 @@ static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenc
/** IBaseFilter implementation **/
static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
static IPin* WINAPI VideoRenderer_GetPin(IBaseFilter *iface, int pos)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin *)This->pInputPin);
return (IPin *)This->pInputPin;
}
static LONG WINAPI VideoRenderer_GetPinCount(IBaseFilter *iface)
{
return 1;
}
static LONG WINAPI VideoRenderer_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
*lastsynctick = 0;
if (pos >= 1)
return S_FALSE;
*pin = (IPin *)This->pInputPin;
IPin_AddRef(*pin);
return S_OK;
return 0;
}
static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
@ -927,7 +934,7 @@ static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **pp
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface);
return EnumPins_Construct(iface, VideoRenderer_GetPin, VideoRenderer_GetPinCount, VideoRenderer_GetPinVersion, ppEnum);
}
static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)

View File

@ -1,6 +1,7 @@
MODULE = strmbase
C_SRCS = \
enumpins.c \
mediatype.c
@MAKE_IMPLIB_RULES@

View File

@ -2,6 +2,7 @@
* Implementation of IEnumPins Interface
*
* Copyright 2003 Robert Shearman
* Copyright 2010 Aric Stewart, CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,11 +19,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "quartz_private.h"
#define COBJMACROS
#include "dshow.h"
#include "wine/strmbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
typedef struct IEnumPinsImpl
{
@ -30,13 +33,15 @@ typedef struct IEnumPinsImpl
LONG refCount;
ULONG uIndex;
IBaseFilter *base;
FNOBTAINPIN receive_pin;
DWORD synctime;
BaseFilter_GetPin receive_pin;
BaseFilter_GetPinCount receive_pincount;
BaseFilter_GetPinVersion receive_version;
DWORD Version;
} IEnumPinsImpl;
static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl;
HRESULT IEnumPinsImpl_Construct(IEnumPins ** ppEnum, FNOBTAINPIN receive_pin, IBaseFilter *base)
HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum)
{
IEnumPinsImpl * pEnumPins;
@ -53,11 +58,12 @@ HRESULT IEnumPinsImpl_Construct(IEnumPins ** ppEnum, FNOBTAINPIN receive_pin, IB
pEnumPins->refCount = 1;
pEnumPins->uIndex = 0;
pEnumPins->receive_pin = receive_pin;
pEnumPins->receive_pincount = receive_pincount;
pEnumPins->receive_version = receive_version;
pEnumPins->base = base;
IBaseFilter_AddRef(base);
*ppEnum = (IEnumPins *)(&pEnumPins->lpVtbl);
receive_pin(base, ~0, NULL, &pEnumPins->synctime);
pEnumPins->Version = receive_version(base);
TRACE("Created new enumerator (%p)\n", *ppEnum);
return S_OK;
@ -65,7 +71,7 @@ HRESULT IEnumPinsImpl_Construct(IEnumPins ** ppEnum, FNOBTAINPIN receive_pin, IB
static HRESULT WINAPI IEnumPinsImpl_QueryInterface(IEnumPins * iface, REFIID riid, LPVOID * ppv)
{
TRACE("(%s, %p)\n", qzdebugstr_guid(riid), ppv);
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
*ppv = NULL;
@ -80,7 +86,7 @@ static HRESULT WINAPI IEnumPinsImpl_QueryInterface(IEnumPins * iface, REFIID rii
return S_OK;
}
FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
FIXME("No interface for %s!\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
@ -115,7 +121,6 @@ static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** ppPins, ULONG * pcFetched)
{
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
DWORD synctime = This->synctime;
HRESULT hr = S_OK;
ULONG i = 0;
@ -130,20 +135,21 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin **
if (pcFetched)
*pcFetched = 0;
if (This->Version != This->receive_version(This->base))
return VFW_E_ENUM_OUT_OF_SYNC;
while (i < cPins && hr == S_OK)
{
hr = This->receive_pin(This->base, This->uIndex + i, &ppPins[i], &synctime);
IPin *pin;
pin = This->receive_pin(This->base, This->uIndex + i);
if (hr == S_OK)
++i;
if (synctime != This->synctime)
break;
if (!pin)
break;
else
ppPins[i] = pin;
++i;
}
if (!i && synctime != This->synctime)
return VFW_E_ENUM_OUT_OF_SYNC;
if (pcFetched)
*pcFetched = i;
This->uIndex += i;
@ -156,23 +162,17 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin **
static HRESULT WINAPI IEnumPinsImpl_Skip(IEnumPins * iface, ULONG cPins)
{
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
DWORD synctime = This->synctime;
HRESULT hr;
IPin *pin = NULL;
TRACE("(%u)\n", cPins);
hr = This->receive_pin(This->base, This->uIndex + cPins, &pin, &synctime);
if (pin)
IPin_Release(pin);
if (synctime != This->synctime)
if (This->Version != This->receive_version(This->base))
return VFW_E_ENUM_OUT_OF_SYNC;
if (hr == S_OK)
This->uIndex += cPins;
if (This->receive_pincount(This->base) >= This->uIndex + cPins)
return S_FALSE;
return hr;
This->uIndex += cPins;
return S_OK;
}
static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins * iface)
@ -180,7 +180,7 @@ static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins * iface)
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
TRACE("IEnumPinsImpl::Reset()\n");
This->receive_pin(This->base, ~0, NULL, &This->synctime);
This->Version = This->receive_version(This->base);
This->uIndex = 0;
return S_OK;
@ -193,7 +193,7 @@ static HRESULT WINAPI IEnumPinsImpl_Clone(IEnumPins * iface, IEnumPins ** ppEnum
TRACE("(%p)\n", ppEnum);
hr = IEnumPinsImpl_Construct(ppEnum, This->receive_pin, This->base);
hr = EnumPins_Construct(This->base, This->receive_pin, This->receive_pincount, This->receive_version, ppEnum);
if (FAILED(hr))
return hr;
return IEnumPins_Skip(*ppEnum, This->uIndex);

View File

@ -27,4 +27,10 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef HRESULT (WINAPI *BasePin_GetMediaType)(IPin* iface, int iPosition, AM_MEDIA_TYPE *amt);
typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(IPin* iface);
typedef IPin* (WINAPI *BaseFilter_GetPin)(IBaseFilter* iface, int iPosition);
typedef LONG (WINAPI *BaseFilter_GetPinCount)(IBaseFilter* iface);
typedef LONG (WINAPI *BaseFilter_GetPinVersion)(IBaseFilter* iface);
HRESULT WINAPI EnumMediaTypes_Construct(IPin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum);
HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum);