26#include "wine/unicode.h"
77 IPin_QueryDirection(
from, &from_dir );
79 hr = IPin_QueryInternalConnections(
from,
NULL, &amount );
81 FIXME(
"Use QueryInternalConnections!\n");
83 pin_info.pFilter =
NULL;
84 hr = IPin_QueryPinInfo(
from, &pin_info );
88 hr = IBaseFilter_EnumPins( pin_info.pFilter, &enumpins );
92 hr = IEnumPins_Reset( enumpins );
95 hr = IEnumPins_Next( enumpins, 1, &
pin,
NULL );
98 hr = IEnumPins_Reset( enumpins );
105 IPin_QueryDirection(
pin, &
dir );
117 hr_return =
updatehres( hr_return, hr_local );
136 hr_return =
updatehres( hr_return, hr_local );
138 IEnumPins_Release(enumpins);
141 if (pin_info.pFilter)
142 IBaseFilter_Release( pin_info.pFilter );
152 strcpyW(pDest->achName, pSrc->achName);
153 pDest->dir = pSrc->dir;
154 pDest->pFilter = pSrc->pFilter;
192 TRACE(
"(%p)->() AddRef from %d\n", iface, refCount - 1);
206 if (
This->pConnectedTo)
208 IPin_Release(
This->pConnectedTo);
227 TRACE(
"(%p)\n", ppPin);
231 if (
This->pConnectedTo)
233 *ppPin =
This->pConnectedTo;
253 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pmt);
257 if (
This->pConnectedTo)
277 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pInfo);
280 IBaseFilter_AddRef(pInfo->pFilter);
289 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pPinDir);
291 *pPinDir =
This->pinInfo.dir;
313 TRACE(
"(%p)->(%p)\n", iface, pmt);
322 TRACE(
"(%p/%p)->(%p)\n",
This, iface, ppEnum);
333 TRACE(
"(%p/%p)->(%p, %p)\n",
This, iface, apPin, cPin);
344 This->tStart = tStart;
378 return IBaseFilter_QueryInterface(
This->pin.pinInfo.pFilter,
riid,
ppv);
397 TRACE(
"(%p)->() Release from %d\n", iface, refCount + 1);
410 TRACE(
"(%p/%p)->(%p, %p)\n",
This, iface, pReceivePin, pmt);
419 assert(pReceivePin != iface);
426 hr =
This->pin.pFuncsTable->pfnAttemptConnection(&
This->pin, pReceivePin, pmt);
434 if (
SUCCEEDED(
hr = IPin_EnumMediaTypes(iface, &pEnumCandidates)))
439 while (
S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate,
NULL))
443 if (!
IsEqualGUID(&FORMAT_None, &pmtCandidate->formattype)
445 assert(pmtCandidate->pbFormat);
447 (
This->pin.pFuncsTable->pfnAttemptConnection(&
This->pin, pReceivePin, pmtCandidate) ==
S_OK))
456 IEnumMediaTypes_Release(pEnumCandidates);
460 if (
hr !=
S_OK &&
SUCCEEDED(
hr = IPin_EnumMediaTypes(pReceivePin, &pEnumCandidates)))
466 while (
S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, &fetched))
471 (
This->pin.pFuncsTable->pfnAttemptConnection(&
This->pin, pReceivePin, pmtCandidate) ==
S_OK))
480 IEnumMediaTypes_Release(pEnumCandidates);
492 ERR(
"Incoming connection on an output pin! (%p, %p)\n", pReceivePin, pmt);
506 if (
This->pMemInputPin)
508 IMemInputPin_Release(
This->pMemInputPin);
511 if (
This->pin.pConnectedTo)
513 IPin_Release(
This->pin.pConnectedTo);
538 TRACE(
"(%p)->()\n", iface);
547 TRACE(
"(%p)->()\n", iface);
558 TRACE(
"(%p, %p, %p, %x)\n", ppSample, tStart, tStop,
dwFlags);
560 if (!
This->pin.pConnectedTo)
564 hr = IMemAllocator_GetBuffer(
This->pAllocator, ppSample, tStart, tStop,
dwFlags);
567 hr = IMediaSample_SetTime(*ppSample, tStart, tStop);
582 if (!
This->pin.pConnectedTo || !
This->pMemInputPin)
589 pMemConnected =
This->pMemInputPin;
590 IMemInputPin_AddRef(pMemConnected);
591 hr = IPin_QueryPinInfo(
This->pin.pConnectedTo, &pinInfo);
601 hr = IMemInputPin_Receive(pMemConnected, pSample);
604 if(IBaseFilter_Release(pinInfo.pFilter) == 0 &&
SUCCEEDED(
hr))
608 IMemInputPin_Release(pMemConnected);
622 if (!
This->pin.pConnectedTo || !
This->pMemInputPin)
625 hr = IMemAllocator_Commit(
This->pAllocator);
642 if (!
This->pin.pConnectedTo || !
This->pMemInputPin)
645 hr = IMemAllocator_Decommit(
This->pAllocator);
662 if (!
This->pin.pConnectedTo || !
This->pMemInputPin)
666 hr = IMemAllocator_Decommit(
This->pAllocator);
669 hr = IPin_Disconnect(
This->pin.pConnectedTo);
671 IPin_Disconnect(&
This->pin.IPin_iface);
687 hr = IMemInputPin_GetAllocator(pPin, pAlloc);
698 IMemInputPin_GetAllocatorRequirements(pPin, &rProps);
699 hr =
This->pFuncsTable->pfnDecideBufferSize(
This, *pAlloc, &rProps);
703 hr = IMemInputPin_NotifyAllocator(pPin, *pAlloc,
FALSE);
718 TRACE(
"(%p, %p)\n", pReceivePin, pmt);
723 This->pin.pConnectedTo = pReceivePin;
724 IPin_AddRef(pReceivePin);
727 hr = IPin_ReceiveConnection(pReceivePin, &iface->
IPin_iface, pmt);
734 hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (
LPVOID)&
This->pMemInputPin);
738 hr =
This->pFuncsTable->pfnDecideAllocator(
This,
This->pMemInputPin, &pMemAlloc);
740 This->pAllocator = pMemAlloc;
742 IMemAllocator_Release(pMemAlloc);
748 if (
This->pMemInputPin)
749 IMemInputPin_Release(
This->pMemInputPin);
752 IPin_Disconnect(pReceivePin);
758 IPin_Release(
This->pin.pConnectedTo);
799 ERR(
"Pin direction(%x) != PINDIR_OUTPUT\n", pPinInfo->dir);
824 if (
This->pAllocator)
825 IMemAllocator_Release(
This->pAllocator);
851 *
ppv = &
This->IMemInputPin_iface;
854 return IBaseFilter_QueryInterface(
This->pin.pinInfo.pFilter, &IID_IMediaSeeking,
ppv);
873 TRACE(
"(%p)->() Release from %d\n", iface, refCount + 1);
883 ERR(
"Outgoing connection on an input pin! (%p, %p)\n", pConnector, pmt);
895 TRACE(
"(%p, %p)\n", pReceivePin, pmt);
900 if (
This->pin.pConnectedTo)
909 IPin_QueryDirection(pReceivePin, &pindirReceive);
913 ERR(
"Can't connect from non-output pin\n");
921 This->pin.pConnectedTo = pReceivePin;
922 IPin_AddRef(pReceivePin);
932 return IPin_EndOfStream(
pin );
939 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pmt);
965 return IPin_BeginFlush(
pin );
972 TRACE(
"() semi-stub\n");
985 return IPin_EndFlush(
pin );
1022 args.tStart =
This->pin.tStart = tStart;
1023 args.tStop =
This->pin.tStop = tStop;
1024 args.rate =
This->pin.dRate = dRate;
1040 return IPin_QueryInterface(&
This->pin.IPin_iface,
riid,
ppv);
1047 return IPin_AddRef(&
This->pin.IPin_iface);
1054 return IPin_Release(&
This->pin.IPin_iface);
1061 TRACE(
"(%p/%p)->(%p)\n",
This, iface, ppAllocator);
1063 *ppAllocator =
This->pAllocator;
1065 IMemAllocator_AddRef(*ppAllocator);
1074 TRACE(
"(%p/%p)->(%p, %d)\n",
This, iface, pAllocator, bReadOnly);
1077 FIXME(
"Read only flag not handled yet!\n");
1082 WARN(
"Null allocator\n");
1086 if (
This->preferred_allocator && pAllocator !=
This->preferred_allocator)
1089 if (
This->pAllocator)
1090 IMemAllocator_Release(
This->pAllocator);
1091 This->pAllocator = pAllocator;
1092 if (
This->pAllocator)
1093 IMemAllocator_AddRef(
This->pAllocator);
1102 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pProps);
1116 if (
This->pFuncsTable->pfnReceive)
1117 hr =
This->pFuncsTable->pfnReceive(
This, pSample);
1126 TRACE(
"(%p/%p)->(%p, %d, %p)\n",
This, iface, pSamples, nSamples, nSamplesProcessed);
1128 for (*nSamplesProcessed = 0; *nSamplesProcessed < nSamples; (*nSamplesProcessed)++)
1130 hr = IMemInputPin_Receive(iface, pSamples[*nSamplesProcessed]);
1202 ERR(
"Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
1224 if (
This->pAllocator)
1225 IMemAllocator_Release(
This->pAllocator);
1227 This->pin.IPin_iface.lpVtbl =
NULL;
#define InterlockedIncrement
#define InterlockedDecrement
enum _PinDirection PIN_DIRECTION
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static HRESULT deliver_beginflush(IPin *pin, LPVOID unused)
static HRESULT SendFurther(IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
HRESULT(* SendPinFunc)(IPin *to, LPVOID arg)
static HRESULT deliver_endofstream(IPin *pin, LPVOID unused)
static void Copy_PinInfo(PIN_INFO *pDest, const PIN_INFO *pSrc)
struct newsegmentargs newsegmentargs
static HRESULT deliver_endflush(IPin *pin, LPVOID unused)
static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
static HRESULT updatehres(HRESULT original, HRESULT new)
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
static void DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin *iface, AM_MEDIA_TYPE *pmt)
static BaseOutputPin * impl_BaseOutputPin_from_IPin(IPin *iface)
HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin *iface)
static HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin *iface)
ULONG WINAPI BaseInputPinImpl_Release(IPin *iface)
HRESULT WINAPI BaseOutputPinImpl_InitAllocator(BaseOutputPin *This, IMemAllocator **pMemAlloc)
HRESULT WINAPI BaseInputPinImpl_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin *iface, IPin **apPin, ULONG *cPin)
HRESULT WINAPI BaseOutputPinImpl_EndFlush(IPin *iface)
HRESULT WINAPI BasePinImpl_ConnectedTo(IPin *iface, IPin **ppPin)
HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
static BOOL CompareMediaTypes(const AM_MEDIA_TYPE *pmt1, const AM_MEDIA_TYPE *pmt2, BOOL bWildcards)
HRESULT WINAPI BasePinImpl_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *iface)
static HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed)
HRESULT WINAPI BasePinImpl_QueryId(IPin *iface, LPWSTR *Id)
HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin *iface, PIN_INFO *pInfo)
HRESULT WINAPI BasePinImpl_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
static ULONG WINAPI MemInputPin_AddRef(IMemInputPin *iface)
HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin *This)
HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO *pPinInfo, const BaseOutputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, IPin **ppPin)
HRESULT WINAPI BaseOutputPinImpl_EndOfStream(IPin *iface)
static HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin *iface, REFIID riid, LPVOID *ppv)
HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin *iface, REFIID riid, LPVOID *ppv)
static ULONG WINAPI MemInputPin_Release(IMemInputPin *iface)
HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample *pSample)
HRESULT WINAPI BaseOutputPinImpl_BeginFlush(IPin *iface)
HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc)
HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This)
HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin *iface, REFIID riid, LPVOID *ppv)
ULONG WINAPI BaseOutputPinImpl_Release(IPin *iface)
HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This)
HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin *iface, IEnumMediaTypes **ppEnum)
HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin *iface)
HRESULT WINAPI BaseOutputPinImpl_BreakConnect(BaseOutputPin *This)
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO *pPinInfo, const BaseInputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, BaseInputPin *pPinImpl)
HRESULT WINAPI BaseOutputPinImpl_Connect(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
static HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly)
static BaseOutputPin * impl_BaseOutputPin_from_BasePin(BasePin *iface)
static HRESULT WINAPI MemInputPin_Receive(IMemInputPin *iface, IMediaSample *pSample)
static HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin *iface, IMemAllocator **ppAllocator)
HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO *pPinInfo, const BaseInputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, IPin **ppPin)
static HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin *iface, ALLOCATOR_PROPERTIES *pProps)
HRESULT WINAPI BasePinImpl_Disconnect(IPin *iface)
HRESULT WINAPI BasePinImpl_QueryDirection(IPin *iface, PIN_DIRECTION *pPinDir)
HRESULT WINAPI BasePinImpl_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
HRESULT WINAPI BaseOutputPinImpl_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
static HRESULT OutputPin_Init(const IPinVtbl *OutputPin_Vtbl, const PIN_INFO *pPinInfo, const BaseOutputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, BaseOutputPin *pPinImpl)
HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin *iface)
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(BaseOutputPin *This, IMediaSample **ppSample, REFERENCE_TIME *tStart, REFERENCE_TIME *tStop, DWORD dwFlags)
HRESULT WINAPI BaseInputPinImpl_Connect(IPin *iface, IPin *pConnector, const AM_MEDIA_TYPE *pmt)
static const IMemInputPinVtbl MemInputPin_Vtbl
HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin *iface)
static BasePin * impl_from_IPin(IPin *iface)
HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin *This)
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
ULONG WINAPI BasePinImpl_AddRef(IPin *iface)
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes **ppEnum)
IMemInputPin * pMemInputPin
IMemAllocator * pAllocator
const struct BaseOutputPinFuncTable * pFuncsTable
BasePin_AttemptConnection pfnAttemptConnection
BasePin_CheckMediaType pfnCheckMediaType
const struct BasePinFuncTable * pFuncsTable
LPCRITICAL_SECTION pCritSec
#define CONTAINING_RECORD(address, type, field)
#define VFW_E_ALREADY_CONNECTED
#define VFW_E_TYPE_NOT_ACCEPTED
#define VFW_E_INVALID_DIRECTION
#define VFW_E_NO_ACCEPTABLE_TYPES
#define VFW_E_NO_ALLOCATOR
#define VFW_S_NO_MORE_ITEMS
#define VFW_E_ENUM_OUT_OF_SYNC
#define VFW_E_NOT_CONNECTED
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags