ReactOS  0.4.14-dev-614-gbfd8a84
pin.c File Reference
#include "dshow.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/strmbase.h"
#include "uuids.h"
#include "vfwmsgs.h"
#include <assert.h>
Include dependency graph for pin.c:

Go to the source code of this file.

Classes

struct  newsegmentargs
 

Macros

#define COBJMACROS
 

Typedefs

typedef HRESULT(* SendPinFunc) (IPin *to, LPVOID arg)
 
typedef struct newsegmentargs newsegmentargs
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (strmbase)
 
static BasePinimpl_from_IPin (IPin *iface)
 
static HRESULT updatehres (HRESULT original, HRESULT new)
 
static HRESULT SendFurther (IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
 
static void Copy_PinInfo (PIN_INFO *pDest, const PIN_INFO *pSrc)
 
static void dump_AM_MEDIA_TYPE (const AM_MEDIA_TYPE *pmt)
 
static BOOL CompareMediaTypes (const AM_MEDIA_TYPE *pmt1, const AM_MEDIA_TYPE *pmt2, BOOL bWildcards)
 
HRESULT WINAPI BasePinImpl_GetMediaType (BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
 
LONG WINAPI BasePinImpl_GetMediaTypeVersion (BasePin *iface)
 
ULONG WINAPI BasePinImpl_AddRef (IPin *iface)
 
HRESULT WINAPI BasePinImpl_Disconnect (IPin *iface)
 
HRESULT WINAPI BasePinImpl_ConnectedTo (IPin *iface, IPin **ppPin)
 
HRESULT WINAPI BasePinImpl_ConnectionMediaType (IPin *iface, AM_MEDIA_TYPE *pmt)
 
HRESULT WINAPI BasePinImpl_QueryPinInfo (IPin *iface, PIN_INFO *pInfo)
 
HRESULT WINAPI BasePinImpl_QueryDirection (IPin *iface, PIN_DIRECTION *pPinDir)
 
HRESULT WINAPI BasePinImpl_QueryId (IPin *iface, LPWSTR *Id)
 
HRESULT WINAPI BasePinImpl_QueryAccept (IPin *iface, const AM_MEDIA_TYPE *pmt)
 
HRESULT WINAPI BasePinImpl_EnumMediaTypes (IPin *iface, IEnumMediaTypes **ppEnum)
 
HRESULT WINAPI BasePinImpl_QueryInternalConnections (IPin *iface, IPin **apPin, ULONG *cPin)
 
HRESULT WINAPI BasePinImpl_NewSegment (IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
 
static BaseOutputPinimpl_BaseOutputPin_from_IPin (IPin *iface)
 
static BaseOutputPinimpl_BaseOutputPin_from_BasePin (BasePin *iface)
 
HRESULT WINAPI BaseOutputPinImpl_QueryInterface (IPin *iface, REFIID riid, LPVOID *ppv)
 
ULONG WINAPI BaseOutputPinImpl_Release (IPin *iface)
 
HRESULT WINAPI BaseOutputPinImpl_Connect (IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
HRESULT WINAPI BaseOutputPinImpl_ReceiveConnection (IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
HRESULT WINAPI BaseOutputPinImpl_Disconnect (IPin *iface)
 
HRESULT WINAPI BaseOutputPinImpl_EndOfStream (IPin *iface)
 
HRESULT WINAPI BaseOutputPinImpl_BeginFlush (IPin *iface)
 
HRESULT WINAPI BaseOutputPinImpl_EndFlush (IPin *iface)
 
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer (BaseOutputPin *This, IMediaSample **ppSample, REFERENCE_TIME *tStart, REFERENCE_TIME *tStop, DWORD dwFlags)
 
HRESULT WINAPI BaseOutputPinImpl_Deliver (BaseOutputPin *This, IMediaSample *pSample)
 
HRESULT WINAPI BaseOutputPinImpl_Active (BaseOutputPin *This)
 
HRESULT WINAPI BaseOutputPinImpl_Inactive (BaseOutputPin *This)
 
HRESULT WINAPI BaseOutputPinImpl_BreakConnect (BaseOutputPin *This)
 
HRESULT WINAPI BaseOutputPinImpl_InitAllocator (BaseOutputPin *This, IMemAllocator **pMemAlloc)
 
HRESULT WINAPI BaseOutputPinImpl_DecideAllocator (BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc)
 
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection (BasePin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
static HRESULT OutputPin_Init (const IPinVtbl *OutputPin_Vtbl, const PIN_INFO *pPinInfo, const BaseOutputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, BaseOutputPin *pPinImpl)
 
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 BaseOutputPin_Destroy (BaseOutputPin *This)
 
static BaseInputPinimpl_BaseInputPin_from_IPin (IPin *iface)
 
HRESULT WINAPI BaseInputPinImpl_QueryInterface (IPin *iface, REFIID riid, LPVOID *ppv)
 
ULONG WINAPI BaseInputPinImpl_Release (IPin *iface)
 
HRESULT WINAPI BaseInputPinImpl_Connect (IPin *iface, IPin *pConnector, const AM_MEDIA_TYPE *pmt)
 
HRESULT WINAPI BaseInputPinImpl_ReceiveConnection (IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
static HRESULT deliver_endofstream (IPin *pin, LPVOID unused)
 
HRESULT WINAPI BaseInputPinImpl_QueryAccept (IPin *iface, const AM_MEDIA_TYPE *pmt)
 
HRESULT WINAPI BaseInputPinImpl_EndOfStream (IPin *iface)
 
static HRESULT deliver_beginflush (IPin *pin, LPVOID unused)
 
HRESULT WINAPI BaseInputPinImpl_BeginFlush (IPin *iface)
 
static HRESULT deliver_endflush (IPin *pin, LPVOID unused)
 
HRESULT WINAPI BaseInputPinImpl_EndFlush (IPin *iface)
 
static HRESULT deliver_newsegment (IPin *pin, LPVOID data)
 
HRESULT WINAPI BaseInputPinImpl_NewSegment (IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
 
static BaseInputPinimpl_from_IMemInputPin (IMemInputPin *iface)
 
static HRESULT WINAPI MemInputPin_QueryInterface (IMemInputPin *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI MemInputPin_AddRef (IMemInputPin *iface)
 
static ULONG WINAPI MemInputPin_Release (IMemInputPin *iface)
 
static HRESULT WINAPI MemInputPin_GetAllocator (IMemInputPin *iface, IMemAllocator **ppAllocator)
 
static HRESULT WINAPI MemInputPin_NotifyAllocator (IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly)
 
static HRESULT WINAPI MemInputPin_GetAllocatorRequirements (IMemInputPin *iface, ALLOCATOR_PROPERTIES *pProps)
 
static HRESULT WINAPI MemInputPin_Receive (IMemInputPin *iface, IMediaSample *pSample)
 
static HRESULT WINAPI MemInputPin_ReceiveMultiple (IMemInputPin *iface, IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed)
 
static HRESULT WINAPI MemInputPin_ReceiveCanBlock (IMemInputPin *iface)
 
static HRESULT InputPin_Init (const IPinVtbl *InputPin_Vtbl, const PIN_INFO *pPinInfo, const BaseInputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, BaseInputPin *pPinImpl)
 
HRESULT BaseInputPin_Construct (const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO *pPinInfo, const BaseInputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, IPin **ppPin)
 
HRESULT WINAPI BaseInputPin_Destroy (BaseInputPin *This)
 

Variables

static const IMemInputPinVtbl MemInputPin_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file pin.c.

Typedef Documentation

◆ newsegmentargs

◆ SendPinFunc

typedef HRESULT(* SendPinFunc) (IPin *to, LPVOID arg)

Definition at line 36 of file pin.c.

Function Documentation

◆ BaseInputPin_Construct()

HRESULT BaseInputPin_Construct ( const IPinVtbl *  InputPin_Vtbl,
LONG  inputpin_size,
const PIN_INFO pPinInfo,
const BaseInputPinFuncTable vtbl,
LPCRITICAL_SECTION  pCritSec,
IMemAllocator allocator,
IPin **  ppPin 
)

Definition at line 1189 of file pin.c.

1192 {
1193  BaseInputPin * pPinImpl;
1194 
1195  *ppPin = NULL;
1196 
1197  assert(inputpin_size >= sizeof(BaseInputPin));
1198  assert(vtbl->base.pfnCheckMediaType);
1199 
1200  if (pPinInfo->dir != PINDIR_INPUT)
1201  {
1202  ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
1203  return E_INVALIDARG;
1204  }
1205 
1206  pPinImpl = CoTaskMemAlloc(inputpin_size);
1207 
1208  if (!pPinImpl)
1209  return E_OUTOFMEMORY;
1210 
1211  if (SUCCEEDED(InputPin_Init(InputPin_Vtbl, pPinInfo, vtbl, pCritSec, allocator, pPinImpl)))
1212  {
1213  *ppPin = &pPinImpl->pin.IPin_iface;
1214  return S_OK;
1215  }
1216 
1217  CoTaskMemFree(pPinImpl);
1218  return E_FAIL;
1219 }
static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO *pPinInfo, const BaseInputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, BaseInputPin *pPinImpl)
Definition: pin.c:1160
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
BasePinFuncTable base
Definition: strmbase.h:103
IPin IPin_iface
Definition: strmbase.h:35
#define assert(x)
Definition: debug.h:53
BasePin pin
Definition: strmbase.h:90
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BasePin_CheckMediaType pfnCheckMediaType
Definition: strmbase.h:55
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by audiomediastream_create(), BaseRenderer_Init(), ddrawmediastream_create(), and TransformFilter_Init().

◆ BaseInputPin_Destroy()

HRESULT WINAPI BaseInputPin_Destroy ( BaseInputPin This)

Definition at line 1221 of file pin.c.

1222 {
1223  FreeMediaType(&This->pin.mtCurrent);
1224  if (This->pAllocator)
1225  IMemAllocator_Release(This->pAllocator);
1226  This->pAllocator = NULL;
1227  This->pin.IPin_iface.lpVtbl = NULL;
1229  return S_OK;
1230 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: filtergraph.c:692
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

Referenced by AudioMediaStreamImpl_IAMMediaStream_Release(), BaseInputPinImpl_Release(), and DirectDrawMediaStreamImpl_IAMMediaStream_Release().

◆ BaseInputPinImpl_BeginFlush()

HRESULT WINAPI BaseInputPinImpl_BeginFlush ( IPin iface)

Definition at line 968 of file pin.c.

969 {
971  HRESULT hr;
972  TRACE("() semi-stub\n");
973 
974  EnterCriticalSection(This->pin.pCritSec);
975  This->flushing = TRUE;
976 
977  hr = SendFurther( iface, deliver_beginflush, NULL, NULL );
978  LeaveCriticalSection(This->pin.pCritSec);
979 
980  return hr;
981 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT SendFurther(IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
Definition: pin.c:67
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT deliver_beginflush(IPin *pin, LPVOID unused)
Definition: pin.c:963
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

Referenced by BaseRenderer_InputPin_BeginFlush(), and TransformFilter_InputPin_BeginFlush().

◆ BaseInputPinImpl_Connect()

HRESULT WINAPI BaseInputPinImpl_Connect ( IPin iface,
IPin pConnector,
const AM_MEDIA_TYPE pmt 
)

Definition at line 881 of file pin.c.

882 {
883  ERR("Outgoing connection on an input pin! (%p, %p)\n", pConnector, pmt);
884 
885  return E_UNEXPECTED;
886 }
#define ERR(fmt,...)
Definition: debug.h:109
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ BaseInputPinImpl_EndFlush()

HRESULT WINAPI BaseInputPinImpl_EndFlush ( IPin iface)

Definition at line 988 of file pin.c.

989 {
991  HRESULT hr;
992  TRACE("(%p)\n", This);
993 
994  EnterCriticalSection(This->pin.pCritSec);
995  This->flushing = This->end_of_stream = FALSE;
996 
997  hr = SendFurther( iface, deliver_endflush, NULL, NULL );
998  LeaveCriticalSection(This->pin.pCritSec);
999 
1000  return hr;
1001 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT SendFurther(IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
Definition: pin.c:67
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT deliver_endflush(IPin *pin, LPVOID unused)
Definition: pin.c:983
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

Referenced by BaseRenderer_InputPin_EndFlush(), and TransformFilter_InputPin_EndFlush().

◆ BaseInputPinImpl_EndOfStream()

HRESULT WINAPI BaseInputPinImpl_EndOfStream ( IPin iface)

Definition at line 944 of file pin.c.

945 {
946  HRESULT hr = S_OK;
948 
949  TRACE("(%p)\n", This);
950 
951  EnterCriticalSection(This->pin.pCritSec);
952  if (This->flushing)
953  hr = S_FALSE;
954  else
955  This->end_of_stream = TRUE;
956  LeaveCriticalSection(This->pin.pCritSec);
957 
958  if (hr == S_OK)
960  return hr;
961 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT SendFurther(IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
Definition: pin.c:67
#define S_OK
Definition: intsafe.h:59
static HRESULT deliver_endofstream(IPin *pin, LPVOID unused)
Definition: pin.c:930
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

Referenced by BaseRenderer_InputPin_EndOfStream().

◆ BaseInputPinImpl_NewSegment()

HRESULT WINAPI BaseInputPinImpl_NewSegment ( IPin iface,
REFERENCE_TIME  tStart,
REFERENCE_TIME  tStop,
double  dRate 
)

Definition at line 1015 of file pin.c.

1016 {
1019 
1020  TRACE("(%s, %s, %e)\n", wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
1021 
1022  args.tStart = This->pin.tStart = tStart;
1023  args.tStop = This->pin.tStop = tStop;
1024  args.rate = This->pin.dRate = dRate;
1025 
1026  return SendFurther( iface, deliver_newsegment, &args, NULL );
1027 }
Definition: match.c:390
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT SendFurther(IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
Definition: pin.c:67
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
Definition: pin.c:1009
#define args
Definition: format.c:66
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

Referenced by TransformFilter_InputPin_NewSegment().

◆ BaseInputPinImpl_QueryAccept()

HRESULT WINAPI BaseInputPinImpl_QueryAccept ( IPin iface,
const AM_MEDIA_TYPE pmt 
)

Definition at line 935 of file pin.c.

936 {
938 
939  TRACE("(%p/%p)->(%p)\n", This, iface, pmt);
940 
941  return (This->pin.pFuncsTable->pfnCheckMediaType(&This->pin, pmt) == S_OK ? S_OK : S_FALSE);
942 }
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

◆ BaseInputPinImpl_QueryInterface()

HRESULT WINAPI BaseInputPinImpl_QueryInterface ( IPin iface,
REFIID  riid,
LPVOID ppv 
)

Definition at line 838 of file pin.c.

839 {
841 
842  TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
843 
844  *ppv = NULL;
845 
847  *ppv = iface;
848  else if (IsEqualIID(riid, &IID_IPin))
849  *ppv = iface;
850  else if (IsEqualIID(riid, &IID_IMemInputPin))
851  *ppv = &This->IMemInputPin_iface;
852  else if (IsEqualIID(riid, &IID_IMediaSeeking))
853  {
854  return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv);
855  }
856 
857  if (*ppv)
858  {
859  IUnknown_AddRef((IUnknown *)(*ppv));
860  return S_OK;
861  }
862 
863  FIXME("No interface for %s!\n", debugstr_guid(riid));
864 
865  return E_NOINTERFACE;
866 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
const GUID IID_IPin
Definition: pincontrol.cpp:15
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

◆ BaseInputPinImpl_ReceiveConnection()

HRESULT WINAPI BaseInputPinImpl_ReceiveConnection ( IPin iface,
IPin pReceivePin,
const AM_MEDIA_TYPE pmt 
)

Definition at line 889 of file pin.c.

890 {
892  PIN_DIRECTION pindirReceive;
893  HRESULT hr = S_OK;
894 
895  TRACE("(%p, %p)\n", pReceivePin, pmt);
896  dump_AM_MEDIA_TYPE(pmt);
897 
898  EnterCriticalSection(This->pin.pCritSec);
899  {
900  if (This->pin.pConnectedTo)
902 
903  if (SUCCEEDED(hr) && This->pin.pFuncsTable->pfnCheckMediaType(&This->pin, pmt) != S_OK)
904  hr = VFW_E_TYPE_NOT_ACCEPTED; /* FIXME: shouldn't we just map common errors onto
905  * VFW_E_TYPE_NOT_ACCEPTED and pass the value on otherwise? */
906 
907  if (SUCCEEDED(hr))
908  {
909  IPin_QueryDirection(pReceivePin, &pindirReceive);
910 
911  if (pindirReceive != PINDIR_OUTPUT)
912  {
913  ERR("Can't connect from non-output pin\n");
915  }
916  }
917 
918  if (SUCCEEDED(hr))
919  {
920  CopyMediaType(&This->pin.mtCurrent, pmt);
921  This->pin.pConnectedTo = pReceivePin;
922  IPin_AddRef(pReceivePin);
923  }
924  }
925  LeaveCriticalSection(This->pin.pCritSec);
926 
927  return hr;
928 }
static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *pmt)
Definition: pin.c:157
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define VFW_E_ALREADY_CONNECTED
Definition: vfwmsgs.h:43
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: filtergraph.c:706
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
enum _PinDirection PIN_DIRECTION
#define VFW_E_INVALID_DIRECTION
Definition: vfwmsgs.h:47
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

Referenced by BaseRenderer_InputPin_ReceiveConnection(), and TransformFilter_InputPin_ReceiveConnection().

◆ BaseInputPinImpl_Release()

ULONG WINAPI BaseInputPinImpl_Release ( IPin iface)

Definition at line 868 of file pin.c.

869 {
871  ULONG refCount = InterlockedDecrement(&This->pin.refCount);
872 
873  TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
874 
875  if (!refCount)
877 
878  return refCount;
879 }
HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This)
Definition: pin.c:1221
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BaseInputPin * impl_BaseInputPin_from_IPin(IPin *iface)
Definition: pin.c:833

◆ BaseOutputPin_Construct()

HRESULT WINAPI BaseOutputPin_Construct ( const IPinVtbl *  OutputPin_Vtbl,
LONG  outputpin_size,
const PIN_INFO pPinInfo,
const BaseOutputPinFuncTable vtbl,
LPCRITICAL_SECTION  pCritSec,
IPin **  ppPin 
)

Definition at line 791 of file pin.c.

792 {
793  BaseOutputPin * pPinImpl;
794 
795  *ppPin = NULL;
796 
797  if (pPinInfo->dir != PINDIR_OUTPUT)
798  {
799  ERR("Pin direction(%x) != PINDIR_OUTPUT\n", pPinInfo->dir);
800  return E_INVALIDARG;
801  }
802 
803  assert(outputpin_size >= sizeof(BaseOutputPin));
805 
806  pPinImpl = CoTaskMemAlloc(outputpin_size);
807 
808  if (!pPinImpl)
809  return E_OUTOFMEMORY;
810 
811  if (SUCCEEDED(OutputPin_Init(OutputPin_Vtbl, pPinInfo, vtbl, pCritSec, pPinImpl)))
812  {
813  *ppPin = &pPinImpl->pin.IPin_iface;
814  return S_OK;
815  }
816 
817  CoTaskMemFree(pPinImpl);
818  return E_FAIL;
819 }
static HRESULT OutputPin_Init(const IPinVtbl *OutputPin_Vtbl, const PIN_INFO *pPinInfo, const BaseOutputPinFuncTable *vtbl, LPCRITICAL_SECTION pCritSec, BaseOutputPin *pPinImpl)
Definition: pin.c:767
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
IPin IPin_iface
Definition: strmbase.h:35
#define assert(x)
Definition: debug.h:53
#define E_FAIL
Definition: ddrawi.h:102
BasePin_AttemptConnection pfnAttemptConnection
Definition: strmbase.h:57
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
BasePin pin
Definition: strmbase.h:66
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BasePinFuncTable base
Definition: strmbase.h:78
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by FileAsyncReader_Construct(), Parser_AddPin(), and TransformFilter_Init().

◆ BaseOutputPin_Destroy()

HRESULT WINAPI BaseOutputPin_Destroy ( BaseOutputPin This)

Definition at line 821 of file pin.c.

822 {
823  FreeMediaType(&This->pin.mtCurrent);
824  if (This->pAllocator)
825  IMemAllocator_Release(This->pAllocator);
826  This->pAllocator = NULL;
828  return S_OK;
829 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: filtergraph.c:692
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

Referenced by BaseOutputPinImpl_Release(), and FileAsyncReaderPin_Release().

◆ BaseOutputPinImpl_Active()

HRESULT WINAPI BaseOutputPinImpl_Active ( BaseOutputPin This)

Definition at line 614 of file pin.c.

615 {
616  HRESULT hr;
617 
618  TRACE("(%p)->()\n", This);
619 
620  EnterCriticalSection(This->pin.pCritSec);
621  {
622  if (!This->pin.pConnectedTo || !This->pMemInputPin)
624  else
625  hr = IMemAllocator_Commit(This->pAllocator);
626  }
627  LeaveCriticalSection(This->pin.pCritSec);
628 
629  TRACE("--> %08x\n", hr);
630  return hr;
631 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by Parser_Run(), and TransformFilterImpl_Run().

◆ BaseOutputPinImpl_AttemptConnection()

HRESULT WINAPI BaseOutputPinImpl_AttemptConnection ( BasePin iface,
IPin pReceivePin,
const AM_MEDIA_TYPE pmt 
)

Definition at line 712 of file pin.c.

713 {
715  HRESULT hr;
716  IMemAllocator * pMemAlloc = NULL;
717 
718  TRACE("(%p, %p)\n", pReceivePin, pmt);
719  dump_AM_MEDIA_TYPE(pmt);
720 
721  /* FIXME: call queryacceptproc */
722 
723  This->pin.pConnectedTo = pReceivePin;
724  IPin_AddRef(pReceivePin);
725  CopyMediaType(&This->pin.mtCurrent, pmt);
726 
727  hr = IPin_ReceiveConnection(pReceivePin, &iface->IPin_iface, pmt);
728 
729  /* get the IMemInputPin interface we will use to deliver samples to the
730  * connected pin */
731  if (SUCCEEDED(hr))
732  {
733  This->pMemInputPin = NULL;
734  hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (LPVOID)&This->pMemInputPin);
735 
736  if (SUCCEEDED(hr))
737  {
738  hr = This->pFuncsTable->pfnDecideAllocator(This, This->pMemInputPin, &pMemAlloc);
739  if (SUCCEEDED(hr))
740  This->pAllocator = pMemAlloc;
741  else if (pMemAlloc)
742  IMemAllocator_Release(pMemAlloc);
743  }
744 
745  /* break connection if we couldn't get the allocator */
746  if (FAILED(hr))
747  {
748  if (This->pMemInputPin)
749  IMemInputPin_Release(This->pMemInputPin);
750  This->pMemInputPin = NULL;
751 
752  IPin_Disconnect(pReceivePin);
753  }
754  }
755 
756  if (FAILED(hr))
757  {
758  IPin_Release(This->pin.pConnectedTo);
759  This->pin.pConnectedTo = NULL;
760  FreeMediaType(&This->pin.mtCurrent);
761  }
762 
763  TRACE(" -- %x\n", hr);
764  return hr;
765 }
static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *pmt)
Definition: pin.c:157
HRESULT hr
Definition: shlfolder.c:183
IPin IPin_iface
Definition: strmbase.h:35
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: filtergraph.c:692
static BaseOutputPin * impl_BaseOutputPin_from_BasePin(BasePin *iface)
Definition: pin.c:358
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: filtergraph.c:706
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ BaseOutputPinImpl_BeginFlush()

HRESULT WINAPI BaseOutputPinImpl_BeginFlush ( IPin iface)

Definition at line 536 of file pin.c.

537 {
538  TRACE("(%p)->()\n", iface);
539 
540  /* not supposed to do anything in an output pin */
541 
542  return E_UNEXPECTED;
543 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ BaseOutputPinImpl_BreakConnect()

HRESULT WINAPI BaseOutputPinImpl_BreakConnect ( BaseOutputPin This)

Definition at line 654 of file pin.c.

655 {
656  HRESULT hr;
657 
658  TRACE("(%p)->()\n", This);
659 
660  EnterCriticalSection(This->pin.pCritSec);
661  {
662  if (!This->pin.pConnectedTo || !This->pMemInputPin)
664  else
665  {
666  hr = IMemAllocator_Decommit(This->pAllocator);
667 
668  if (SUCCEEDED(hr))
669  hr = IPin_Disconnect(This->pin.pConnectedTo);
670  }
671  IPin_Disconnect(&This->pin.IPin_iface);
672  }
673  LeaveCriticalSection(This->pin.pCritSec);
674 
675  return hr;
676 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ BaseOutputPinImpl_Connect()

HRESULT WINAPI BaseOutputPinImpl_Connect ( IPin iface,
IPin pReceivePin,
const AM_MEDIA_TYPE pmt 
)

Definition at line 405 of file pin.c.

406 {
407  HRESULT hr;
409 
410  TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
411  dump_AM_MEDIA_TYPE(pmt);
412 
413  if (!pReceivePin)
414  return E_POINTER;
415 
416  /* If we try to connect to ourselves, we will definitely deadlock.
417  * There are other cases where we could deadlock too, but this
418  * catches the obvious case */
419  assert(pReceivePin != iface);
420 
421  EnterCriticalSection(This->pin.pCritSec);
422  {
423  /* if we have been a specific type to connect with, then we can either connect
424  * with that or fail. We cannot choose different AM_MEDIA_TYPE */
425  if (pmt && !IsEqualGUID(&pmt->majortype, &GUID_NULL) && !IsEqualGUID(&pmt->subtype, &GUID_NULL))
426  hr = This->pin.pFuncsTable->pfnAttemptConnection(&This->pin, pReceivePin, pmt);
427  else
428  {
429  /* negotiate media type */
430 
431  IEnumMediaTypes * pEnumCandidates;
432  AM_MEDIA_TYPE * pmtCandidate = NULL; /* Candidate media type */
433 
434  if (SUCCEEDED(hr = IPin_EnumMediaTypes(iface, &pEnumCandidates)))
435  {
436  hr = VFW_E_NO_ACCEPTABLE_TYPES; /* Assume the worst, but set to S_OK if connected successfully */
437 
438  /* try this filter's media types first */
439  while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL))
440  {
441  assert(pmtCandidate);
442  dump_AM_MEDIA_TYPE(pmtCandidate);
443  if (!IsEqualGUID(&FORMAT_None, &pmtCandidate->formattype)
444  && !IsEqualGUID(&GUID_NULL, &pmtCandidate->formattype))
445  assert(pmtCandidate->pbFormat);
446  if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) &&
447  (This->pin.pFuncsTable->pfnAttemptConnection(&This->pin, pReceivePin, pmtCandidate) == S_OK))
448  {
449  hr = S_OK;
450  DeleteMediaType(pmtCandidate);
451  break;
452  }
453  DeleteMediaType(pmtCandidate);
454  pmtCandidate = NULL;
455  }
456  IEnumMediaTypes_Release(pEnumCandidates);
457  }
458 
459  /* then try receiver filter's media types */
460  if (hr != S_OK && SUCCEEDED(hr = IPin_EnumMediaTypes(pReceivePin, &pEnumCandidates))) /* if we haven't already connected successfully */
461  {
462  ULONG fetched;
463 
464  hr = VFW_E_NO_ACCEPTABLE_TYPES; /* Assume the worst, but set to S_OK if connected successfully */
465 
466  while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, &fetched))
467  {
468  assert(pmtCandidate);
469  dump_AM_MEDIA_TYPE(pmtCandidate);
470  if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) &&
471  (This->pin.pFuncsTable->pfnAttemptConnection(&This->pin, pReceivePin, pmtCandidate) == S_OK))
472  {
473  hr = S_OK;
474  DeleteMediaType(pmtCandidate);
475  break;
476  }
477  DeleteMediaType(pmtCandidate);
478  pmtCandidate = NULL;
479  } /* while */
480  IEnumMediaTypes_Release(pEnumCandidates);
481  } /* if not found */
482  } /* if negotiate media type */
483  } /* if succeeded */
484  LeaveCriticalSection(This->pin.pCritSec);
485 
486  TRACE(" -- %x\n", hr);
487  return hr;
488 }
static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *pmt)
Definition: pin.c:157
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: filtergraph.c:741
static BaseOutputPin * impl_BaseOutputPin_from_IPin(IPin *iface)
Definition: pin.c:353
smooth NULL
Definition: ftsmooth.c:416
static BOOL CompareMediaTypes(const AM_MEDIA_TYPE *pmt1, const AM_MEDIA_TYPE *pmt2, BOOL bWildcards)
Definition: pin.c:164
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define E_POINTER
Definition: winerror.h:2365
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define VFW_E_NO_ACCEPTABLE_TYPES
Definition: vfwmsgs.h:46

Referenced by Parser_OutputPin_Connect().

◆ BaseOutputPinImpl_DecideAllocator()

HRESULT WINAPI BaseOutputPinImpl_DecideAllocator ( BaseOutputPin This,
IMemInputPin pPin,
IMemAllocator **  pAlloc 
)

Definition at line 683 of file pin.c.

684 {
685  HRESULT hr;
686 
687  hr = IMemInputPin_GetAllocator(pPin, pAlloc);
688 
689  if (hr == VFW_E_NO_ALLOCATOR)
690  /* Input pin provides no allocator, use standard memory allocator */
692 
693  if (SUCCEEDED(hr))
694  {
695  ALLOCATOR_PROPERTIES rProps;
696  ZeroMemory(&rProps, sizeof(ALLOCATOR_PROPERTIES));
697 
698  IMemInputPin_GetAllocatorRequirements(pPin, &rProps);
699  hr = This->pFuncsTable->pfnDecideBufferSize(This, *pAlloc, &rProps);
700  }
701 
702  if (SUCCEEDED(hr))
703  hr = IMemInputPin_NotifyAllocator(pPin, *pAlloc, FALSE);
704 
705  return hr;
706 }
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1642
LONG HRESULT
Definition: typedefs.h:77
#define VFW_E_NO_ALLOCATOR
Definition: vfwmsgs.h:49
HRESULT WINAPI BaseOutputPinImpl_InitAllocator(BaseOutputPin *This, IMemAllocator **pMemAlloc)
Definition: pin.c:678
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ BaseOutputPinImpl_Deliver()

HRESULT WINAPI BaseOutputPinImpl_Deliver ( BaseOutputPin This,
IMediaSample pSample 
)

Definition at line 574 of file pin.c.

575 {
576  IMemInputPin * pMemConnected = NULL;
577  PIN_INFO pinInfo;
578  HRESULT hr;
579 
580  EnterCriticalSection(This->pin.pCritSec);
581  {
582  if (!This->pin.pConnectedTo || !This->pMemInputPin)
584  else
585  {
586  /* we don't have the lock held when using This->pMemInputPin,
587  * so we need to AddRef it to stop it being deleted while we are
588  * using it. Same with its filter. */
589  pMemConnected = This->pMemInputPin;
590  IMemInputPin_AddRef(pMemConnected);
591  hr = IPin_QueryPinInfo(This->pin.pConnectedTo, &pinInfo);
592  }
593  }
594  LeaveCriticalSection(This->pin.pCritSec);
595 
596  if (SUCCEEDED(hr))
597  {
598  /* NOTE: if we are in a critical section when Receive is called
599  * then it causes some problems (most notably with the native Video
600  * Renderer) if we are re-entered for whatever reason */
601  hr = IMemInputPin_Receive(pMemConnected, pSample);
602 
603  /* If the filter's destroyed, tell upstream to stop sending data */
604  if(IBaseFilter_Release(pinInfo.pFilter) == 0 && SUCCEEDED(hr))
605  hr = S_FALSE;
606  }
607  if (pMemConnected)
608  IMemInputPin_Release(pMemConnected);
609 
610  return hr;
611 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
LONG HRESULT
Definition: typedefs.h:77
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by ACMWrapper_Receive(), AVIDec_Receive(), AVISplitter_Receive(), FillBuffer(), and WAVEParser_Sample().

◆ BaseOutputPinImpl_Disconnect()

HRESULT WINAPI BaseOutputPinImpl_Disconnect ( IPin iface)

Definition at line 497 of file pin.c.

498 {
499  HRESULT hr;
501 
502  TRACE("()\n");
503 
504  EnterCriticalSection(This->pin.pCritSec);
505  {
506  if (This->pMemInputPin)
507  {
508  IMemInputPin_Release(This->pMemInputPin);
509  This->pMemInputPin = NULL;
510  }
511  if (This->pin.pConnectedTo)
512  {
513  IPin_Release(This->pin.pConnectedTo);
514  This->pin.pConnectedTo = NULL;
515  FreeMediaType(&This->pin.mtCurrent);
516  ZeroMemory(&This->pin.mtCurrent, sizeof(This->pin.mtCurrent));
517  hr = S_OK;
518  }
519  else
520  hr = S_FALSE;
521  }
522  LeaveCriticalSection(This->pin.pCritSec);
523 
524  return hr;
525 }
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1642
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static BaseOutputPin * impl_BaseOutputPin_from_IPin(IPin *iface)
Definition: pin.c:353
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: filtergraph.c:692
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ BaseOutputPinImpl_EndFlush()

HRESULT WINAPI BaseOutputPinImpl_EndFlush ( IPin iface)

Definition at line 545 of file pin.c.

546 {
547  TRACE("(%p)->()\n", iface);
548 
549  /* not supposed to do anything in an output pin */
550 
551  return E_UNEXPECTED;
552 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ BaseOutputPinImpl_EndOfStream()

HRESULT WINAPI BaseOutputPinImpl_EndOfStream ( IPin iface)

Definition at line 527 of file pin.c.

528 {
529  TRACE("()\n");
530 
531  /* not supposed to do anything in an output pin */
532 
533  return E_UNEXPECTED;
534 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ BaseOutputPinImpl_GetDeliveryBuffer()

HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer ( BaseOutputPin This,
IMediaSample **  ppSample,
REFERENCE_TIME tStart,
REFERENCE_TIME tStop,
DWORD  dwFlags 
)

Definition at line 554 of file pin.c.

555 {
556  HRESULT hr;
557 
558  TRACE("(%p, %p, %p, %x)\n", ppSample, tStart, tStop, dwFlags);
559 
560  if (!This->pin.pConnectedTo)
562  else
563  {
564  hr = IMemAllocator_GetBuffer(This->pAllocator, ppSample, tStart, tStop, dwFlags);
565 
566  if (SUCCEEDED(hr))
567  hr = IMediaSample_SetTime(*ppSample, tStart, tStop);
568  }
569 
570  return hr;
571 }
HRESULT hr
Definition: shlfolder.c:183
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by ACMWrapper_Receive(), and AVIDec_Receive().

◆ BaseOutputPinImpl_Inactive()

HRESULT WINAPI BaseOutputPinImpl_Inactive ( BaseOutputPin This)

Definition at line 634 of file pin.c.

635 {
636  HRESULT hr;
637 
638  TRACE("(%p)->()\n", This);
639 
640  EnterCriticalSection(This->pin.pCritSec);
641  {
642  if (!This->pin.pConnectedTo || !This->pMemInputPin)
644  else
645  hr = IMemAllocator_Decommit(This->pAllocator);
646  }
647  LeaveCriticalSection(This->pin.pCritSec);
648 
649  TRACE("--> %08x\n", hr);
650  return hr;
651 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by Parser_Stop(), and TransformFilterImpl_Stop().

◆ BaseOutputPinImpl_InitAllocator()

HRESULT WINAPI BaseOutputPinImpl_InitAllocator ( BaseOutputPin This,
IMemAllocator **  pMemAlloc 
)

Definition at line 678 of file pin.c.

679 {
680  return CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)pMemAlloc);
681 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325

Referenced by BaseOutputPinImpl_DecideAllocator().

◆ BaseOutputPinImpl_QueryInterface()

HRESULT WINAPI BaseOutputPinImpl_QueryInterface ( IPin iface,
REFIID  riid,
LPVOID ppv 
)

Definition at line 363 of file pin.c.

364 {
366 
367  TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
368 
369  *ppv = NULL;
370 
372  *ppv = iface;
373  else if (IsEqualIID(riid, &IID_IPin))
374  *ppv = iface;
375  else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
376  IsEqualIID(riid, &IID_IQualityControl))
377  {
378  return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, riid, ppv);
379  }
380 
381  if (*ppv)
382  {
383  IUnknown_AddRef((IUnknown *)(*ppv));
384  return S_OK;
385  }
386 
387  FIXME("No interface for %s!\n", debugstr_guid(riid));
388 
389  return E_NOINTERFACE;
390 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BaseOutputPin * impl_BaseOutputPin_from_IPin(IPin *iface)
Definition: pin.c:353
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
const GUID IID_IPin
Definition: pincontrol.cpp:15
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ BaseOutputPinImpl_ReceiveConnection()

HRESULT WINAPI BaseOutputPinImpl_ReceiveConnection ( IPin iface,
IPin pReceivePin,
const AM_MEDIA_TYPE pmt 
)

Definition at line 490 of file pin.c.

491 {
492  ERR("Incoming connection on an output pin! (%p, %p)\n", pReceivePin, pmt);
493 
494  return E_UNEXPECTED;
495 }
#define ERR(fmt,...)
Definition: debug.h:109
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ BaseOutputPinImpl_Release()

ULONG WINAPI BaseOutputPinImpl_Release ( IPin iface)

Definition at line 392 of file pin.c.

393 {
395  ULONG refCount = InterlockedDecrement(&This->pin.refCount);
396 
397  TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
398 
399  if (!refCount)
401 
402  return refCount;
403 }
static BaseOutputPin * impl_BaseOutputPin_from_IPin(IPin *iface)
Definition: pin.c:353
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This)
Definition: pin.c:821
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

◆ BasePinImpl_AddRef()

ULONG WINAPI BasePinImpl_AddRef ( IPin iface)

Definition at line 187 of file pin.c.

188 {
189  BasePin *This = impl_from_IPin(iface);
190  ULONG refCount = InterlockedIncrement(&This->refCount);
191 
192  TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
193 
194  return refCount;
195 }
#define TRACE(s)
Definition: solgame.cpp:4
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ BasePinImpl_ConnectedTo()

HRESULT WINAPI BasePinImpl_ConnectedTo ( IPin iface,
IPin **  ppPin 
)

Definition at line 222 of file pin.c.

223 {
224  HRESULT hr;
225  BasePin *This = impl_from_IPin(iface);
226 
227  TRACE("(%p)\n", ppPin);
228 
229  EnterCriticalSection(This->pCritSec);
230  {
231  if (This->pConnectedTo)
232  {
233  *ppPin = This->pConnectedTo;
234  IPin_AddRef(*ppPin);
235  hr = S_OK;
236  }
237  else
238  {
240  *ppPin = NULL;
241  }
242  }
243  LeaveCriticalSection(This->pCritSec);
244 
245  return hr;
246 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ BasePinImpl_ConnectionMediaType()

HRESULT WINAPI BasePinImpl_ConnectionMediaType ( IPin iface,
AM_MEDIA_TYPE pmt 
)

Definition at line 248 of file pin.c.

249 {
250  HRESULT hr;
251  BasePin *This = impl_from_IPin(iface);
252 
253  TRACE("(%p/%p)->(%p)\n", This, iface, pmt);
254 
255  EnterCriticalSection(This->pCritSec);
256  {
257  if (This->pConnectedTo)
258  {
259  CopyMediaType(pmt, &This->mtCurrent);
260  hr = S_OK;
261  }
262  else
263  {
264  ZeroMemory(pmt, sizeof(*pmt));
266  }
267  }
268  LeaveCriticalSection(This->pCritSec);
269 
270  return hr;
271 }
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1642
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: filtergraph.c:706
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ BasePinImpl_Disconnect()

HRESULT WINAPI BasePinImpl_Disconnect ( IPin iface)

Definition at line 197 of file pin.c.

198 {
199  HRESULT hr;
200  BasePin *This = impl_from_IPin(iface);
201 
202  TRACE("()\n");
203 
204  EnterCriticalSection(This->pCritSec);
205  {
206  if (This->pConnectedTo)
207  {
208  IPin_Release(This->pConnectedTo);
209  This->pConnectedTo = NULL;
210  FreeMediaType(&This->mtCurrent);
211  ZeroMemory(&This->mtCurrent, sizeof(This->mtCurrent));
212  hr = S_OK;
213  }
214  else
215  hr = S_FALSE;
216  }
217  LeaveCriticalSection(This->pCritSec);
218 
219  return hr;
220 }
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1642
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: filtergraph.c:692
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by BaseRenderer_InputPin_Disconnect(), and TransformFilter_InputPin_Disconnect().

◆ BasePinImpl_EnumMediaTypes()

HRESULT WINAPI BasePinImpl_EnumMediaTypes ( IPin iface,
IEnumMediaTypes **  ppEnum 
)

Definition at line 318 of file pin.c.

319 {
320  BasePin *This = impl_from_IPin(iface);
321 
322  TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
323 
324  /* override this method to allow enumeration of your types */
325 
326  return EnumMediaTypes_Construct(This, This->pFuncsTable->pfnGetMediaType, This->pFuncsTable->pfnGetMediaTypeVersion , ppEnum);
327 }
#define TRACE(s)
Definition: solgame.cpp:4
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes **ppEnum)
Definition: mediatype.c:108

◆ BasePinImpl_GetMediaType()

HRESULT WINAPI BasePinImpl_GetMediaType ( BasePin iface,
int  iPosition,
AM_MEDIA_TYPE pmt 
)

Definition at line 175 of file pin.c.

176 {
177  if (iPosition < 0)
178  return E_INVALIDARG;
179  return VFW_S_NO_MORE_ITEMS;
180 }
#define VFW_S_NO_MORE_ITEMS
Definition: vfwmsgs.h:19
#define E_INVALIDARG
Definition: ddrawi.h:101

Referenced by Parser_PullPin_EnumMediaTypes().

◆ BasePinImpl_GetMediaTypeVersion()

LONG WINAPI BasePinImpl_GetMediaTypeVersion ( BasePin iface)

Definition at line 182 of file pin.c.

183 {
184  return 1;
185 }

Referenced by Parser_PullPin_EnumMediaTypes().

◆ BasePinImpl_NewSegment()

HRESULT WINAPI BasePinImpl_NewSegment ( IPin iface,
REFERENCE_TIME  tStart,
REFERENCE_TIME  tStop,
double  dRate 
)

Definition at line 338 of file pin.c.

339 {
340  BasePin *This = impl_from_IPin(iface);
341 
342  TRACE("(%s, %s, %e)\n", wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
343 
344  This->tStart = tStart;
345  This->tStop = tStop;
346  This->dRate = dRate;
347 
348  return S_OK;
349 }
#define TRACE(s)
Definition: solgame.cpp:4
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41

◆ BasePinImpl_QueryAccept()

HRESULT WINAPI BasePinImpl_QueryAccept ( IPin iface,
const AM_MEDIA_TYPE pmt 
)

Definition at line 311 of file pin.c.

312 {
313  TRACE("(%p)->(%p)\n", iface, pmt);
314 
315  return S_OK;
316 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ BasePinImpl_QueryDirection()

HRESULT WINAPI BasePinImpl_QueryDirection ( IPin iface,
PIN_DIRECTION pPinDir 
)

Definition at line 285 of file pin.c.

286 {
287  BasePin *This = impl_from_IPin(iface);
288 
289  TRACE("(%p/%p)->(%p)\n", This, iface, pPinDir);
290 
291  *pPinDir = This->pinInfo.dir;
292 
293  return S_OK;
294 }
#define TRACE(s)
Definition: solgame.cpp:4
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59

◆ BasePinImpl_QueryId()

HRESULT WINAPI BasePinImpl_QueryId ( IPin iface,
LPWSTR Id 
)

Definition at line 296 of file pin.c.

297 {
298  BasePin *This = impl_from_IPin(iface);
299 
300  TRACE("(%p/%p)->(%p)\n", This, iface, Id);
301 
302  *Id = CoTaskMemAlloc((strlenW(This->pinInfo.achName) + 1) * sizeof(WCHAR));
303  if (!*Id)
304  return E_OUTOFMEMORY;
305 
306  strcpyW(*Id, This->pinInfo.achName);
307 
308  return S_OK;
309 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
DWORD Id
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

◆ BasePinImpl_QueryInternalConnections()

HRESULT WINAPI BasePinImpl_QueryInternalConnections ( IPin iface,
IPin **  apPin,
ULONG cPin 
)

Definition at line 329 of file pin.c.

330 {
331  BasePin *This = impl_from_IPin(iface);
332 
333  TRACE("(%p/%p)->(%p, %p)\n", This, iface, apPin, cPin);
334 
335  return E_NOTIMPL; /* to tell caller that all input pins connected to all output pins */
336 }
#define TRACE(s)
Definition: solgame.cpp:4
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BasePinImpl_QueryPinInfo()

HRESULT WINAPI BasePinImpl_QueryPinInfo ( IPin iface,
PIN_INFO pInfo 
)

Definition at line 273 of file pin.c.

274 {
275  BasePin *This = impl_from_IPin(iface);
276 
277  TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
278 
279  Copy_PinInfo(pInfo, &This->pinInfo);
280  IBaseFilter_AddRef(pInfo->pFilter);
281 
282  return S_OK;
283 }
static void Copy_PinInfo(PIN_INFO *pDest, const PIN_INFO *pSrc)
Definition: pin.c:146
#define TRACE(s)
Definition: solgame.cpp:4
static BasePin * impl_from_IPin(IPin *iface)
Definition: pin.c:38
#define S_OK
Definition: intsafe.h:59

◆ CompareMediaTypes()

static BOOL CompareMediaTypes ( const AM_MEDIA_TYPE pmt1,
const AM_MEDIA_TYPE pmt2,
BOOL  bWildcards 
)
static

Definition at line 164 of file pin.c.

165 {
166  TRACE("pmt1: ");
167  dump_AM_MEDIA_TYPE(pmt1);
168  TRACE("pmt2: ");
169  dump_AM_MEDIA_TYPE(pmt2);
170  return (((bWildcards && (IsEqualGUID(&pmt1->majortype, &GUID_NULL) || IsEqualGUID(&pmt2->majortype, &GUID_NULL))) || IsEqualGUID(&pmt1->majortype, &pmt2->majortype)) &&
171  ((bWildcards && (IsEqualGUID(&pmt1->subtype, &GUID_NULL) || IsEqualGUID(&pmt2->subtype, &GUID_NULL))) || IsEqualGUID(&pmt1->subtype, &pmt2->subtype)));
172 }
static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *pmt)
Definition: pin.c:157
#define TRACE(s)
Definition: solgame.cpp:4
#define GUID_NULL
Definition: ks.h:106
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by BaseOutputPinImpl_Connect().

◆ Copy_PinInfo()

static void Copy_PinInfo ( PIN_INFO pDest,
const PIN_INFO pSrc 
)
static

Definition at line 146 of file pin.c.

147 {
148  /* Tempting to just do a memcpy, but the name field is
149  128 characters long! We will probably never exceed 10
150  most of the time, so we are better off copying
151  each field manually */
152  strcpyW(pDest->achName, pSrc->achName);
153  pDest->dir = pSrc->dir;
154  pDest->pFilter = pSrc->pFilter;
155 }
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

Referenced by BasePinImpl_QueryPinInfo(), InputPin_Init(), and OutputPin_Init().

◆ deliver_beginflush()

static HRESULT deliver_beginflush ( IPin pin,
LPVOID  unused 
)
static

Definition at line 963 of file pin.c.

964 {
965  return IPin_BeginFlush( pin );
966 }
Definition: regsvr.c:103

Referenced by BaseInputPinImpl_BeginFlush().

◆ deliver_endflush()

static HRESULT deliver_endflush ( IPin pin,
LPVOID  unused 
)
static

Definition at line 983 of file pin.c.

984 {
985  return IPin_EndFlush( pin );
986 }
Definition: regsvr.c:103

Referenced by BaseInputPinImpl_EndFlush().

◆ deliver_endofstream()

static HRESULT deliver_endofstream ( IPin pin,
LPVOID  unused 
)
static

Definition at line 930 of file pin.c.

931 {
932  return IPin_EndOfStream( pin );
933 }
Definition: regsvr.c:103

Referenced by BaseInputPinImpl_EndOfStream().

◆ deliver_newsegment()

static HRESULT deliver_newsegment ( IPin pin,
LPVOID  data 
)
static

Definition at line 1009 of file pin.c.

1010 {
1012  return IPin_NewSegment(pin, args->tStart, args->tStop, args->rate);
1013 }
Definition: match.c:390
Definition: regsvr.c:103
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by BaseInputPinImpl_NewSegment().

◆ dump_AM_MEDIA_TYPE()

static void dump_AM_MEDIA_TYPE ( const AM_MEDIA_TYPE pmt)
static

Definition at line 157 of file pin.c.

158 {
159  if (!pmt)
160  return;
161  TRACE("\t%s\n\t%s\n\t...\n\t%s\n", debugstr_guid(&pmt->majortype), debugstr_guid(&pmt->subtype), debugstr_guid(&pmt->formattype));
162 }
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by BaseInputPinImpl_ReceiveConnection(), BaseOutputPinImpl_AttemptConnection(), BaseOutputPinImpl_Connect(), CompareMediaTypes(), and PullPin_ReceiveConnection().

◆ impl_BaseInputPin_from_IPin()

static BaseInputPin* impl_BaseInputPin_from_IPin ( IPin iface)
inlinestatic

Definition at line 833 of file pin.c.

834 {
835  return CONTAINING_RECORD(iface, BaseInputPin, pin.IPin_iface);
836 }
Definition: regsvr.c:103
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 BaseInputPinImpl_BeginFlush(), BaseInputPinImpl_EndFlush(), BaseInputPinImpl_EndOfStream(), BaseInputPinImpl_NewSegment(), BaseInputPinImpl_QueryAccept(), BaseInputPinImpl_QueryInterface(), BaseInputPinImpl_ReceiveConnection(), and BaseInputPinImpl_Release().

◆ impl_BaseOutputPin_from_BasePin()

static BaseOutputPin* impl_BaseOutputPin_from_BasePin ( BasePin iface)
inlinestatic

Definition at line 358 of file pin.c.

359 {
360  return CONTAINING_RECORD(iface, BaseOutputPin, pin);
361 }
Definition: regsvr.c:103
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 BaseOutputPinImpl_AttemptConnection().

◆ impl_BaseOutputPin_from_IPin()

static BaseOutputPin* impl_BaseOutputPin_from_IPin ( IPin iface)
inlinestatic

Definition at line 353 of file pin.c.

354 {
355  return CONTAINING_RECORD(iface, BaseOutputPin, pin.IPin_iface);
356 }
Definition: regsvr.c:103
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 BaseOutputPinImpl_Connect(), BaseOutputPinImpl_Disconnect(), BaseOutputPinImpl_QueryInterface(), and BaseOutputPinImpl_Release().

◆ impl_from_IMemInputPin()

static BaseInputPin* impl_from_IMemInputPin ( IMemInputPin iface)
inlinestatic

Definition at line 1031 of file pin.c.

1032 {
1033  return CONTAINING_RECORD(iface, BaseInputPin, IMemInputPin_iface);
1034 }
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 MemInputPin_AddRef(), MemInputPin_GetAllocator(), MemInputPin_GetAllocatorRequirements(), MemInputPin_NotifyAllocator(), MemInputPin_QueryInterface(), MemInputPin_Receive(), MemInputPin_ReceiveCanBlock(), MemInputPin_ReceiveMultiple(), and MemInputPin_Release().

◆ impl_from_IPin()

static BasePin* impl_from_IPin ( IPin iface)
inlinestatic

Definition at line 38 of file pin.c.

39 {
40  return CONTAINING_RECORD(iface, BasePin, IPin_iface);
41 }
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 BasePinImpl_AddRef(), BasePinImpl_ConnectedTo(), BasePinImpl_ConnectionMediaType(), BasePinImpl_Disconnect(), BasePinImpl_EnumMediaTypes(), BasePinImpl_NewSegment(), BasePinImpl_QueryDirection(), BasePinImpl_QueryId(), BasePinImpl_QueryInternalConnections(), and BasePinImpl_QueryPinInfo().

◆ InputPin_Init()

static HRESULT InputPin_Init ( const IPinVtbl *  InputPin_Vtbl,
const PIN_INFO pPinInfo,
const BaseInputPinFuncTable vtbl,
LPCRITICAL_SECTION  pCritSec,
IMemAllocator allocator,
BaseInputPin pPinImpl 
)
static

Definition at line 1160 of file pin.c.

1163 {
1164  TRACE("\n");
1165 
1166  /* Common attributes */
1167  pPinImpl->pin.refCount = 1;
1168  pPinImpl->pin.pConnectedTo = NULL;
1169  pPinImpl->pin.pCritSec = pCritSec;
1170  pPinImpl->pin.tStart = 0;
1171  pPinImpl->pin.tStop = 0;
1172  pPinImpl->pin.dRate = 1.0;
1173  Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
1174  ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
1175  pPinImpl->pin.pFuncsTable = &vtbl->base;
1176 
1177  /* Input pin attributes */
1178  pPinImpl->pFuncsTable = vtbl;
1179  pPinImpl->pAllocator = pPinImpl->preferred_allocator = allocator;
1180  if (pPinImpl->preferred_allocator)
1181  IMemAllocator_AddRef(pPinImpl->preferred_allocator);
1182  pPinImpl->pin.IPin_iface.lpVtbl = InputPin_Vtbl;
1183  pPinImpl->IMemInputPin_iface.lpVtbl = &MemInputPin_Vtbl;
1184  pPinImpl->flushing = pPinImpl->end_of_stream = FALSE;
1185 
1186  return S_OK;
1187 }
const struct BaseInputPinFuncTable * pFuncsTable
Definition: strmbase.h:97
IMemInputPin IMemInputPin_iface
Definition: strmbase.h:92
LONG refCount
Definition: strmbase.h:36
LPCRITICAL_SECTION pCritSec
Definition: strmbase.h:37
BasePinFuncTable base
Definition: strmbase.h:103
IPin IPin_iface
Definition: strmbase.h:35
#define ZeroMemory
Definition: winbase.h:1642
BasePin pin
Definition: strmbase.h:90
smooth NULL
Definition: ftsmooth.c:416
REFERENCE_TIME tStop
Definition: strmbase.h:42
const struct BasePinFuncTable * pFuncsTable
Definition: strmbase.h:45
static void Copy_PinInfo(PIN_INFO *pDest, const PIN_INFO *pSrc)
Definition: pin.c:146
BOOL end_of_stream
Definition: strmbase.h:94
#define TRACE(s)
Definition: solgame.cpp:4
BOOL flushing
Definition: strmbase.h:94
REFERENCE_TIME tStart
Definition: strmbase.h:41
IMemAllocator * preferred_allocator
Definition: strmbase.h:95
IPin * pConnectedTo
Definition: strmbase.h:39
double dRate
Definition: strmbase.h:43
IMemAllocator * pAllocator
Definition: strmbase.h:93
static const IMemInputPinVtbl MemInputPin_Vtbl
Definition: pin.c:34
#define S_OK
Definition: intsafe.h:59
PIN_INFO pinInfo
Definition: strmbase.h:38
AM_MEDIA_TYPE mtCurrent
Definition: strmbase.h:40

Referenced by BaseInputPin_Construct().

◆ MemInputPin_AddRef()

static ULONG WINAPI MemInputPin_AddRef ( IMemInputPin iface)
static

Definition at line 1043 of file pin.c.

1044 {
1046 
1047  return IPin_AddRef(&This->pin.IPin_iface);
1048 }
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031

◆ MemInputPin_GetAllocator()

static HRESULT WINAPI MemInputPin_GetAllocator ( IMemInputPin iface,
IMemAllocator **  ppAllocator 
)
static

Definition at line 1057 of file pin.c.

1058 {
1060 
1061  TRACE("(%p/%p)->(%p)\n", This, iface, ppAllocator);
1062 
1063  *ppAllocator = This->pAllocator;
1064  if (*ppAllocator)
1065  IMemAllocator_AddRef(*ppAllocator);
1066 
1067  return *ppAllocator ? S_OK : VFW_E_NO_ALLOCATOR;
1068 }
#define TRACE(s)
Definition: solgame.cpp:4
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031
#define VFW_E_NO_ALLOCATOR
Definition: vfwmsgs.h:49
#define S_OK
Definition: intsafe.h:59

◆ MemInputPin_GetAllocatorRequirements()

static HRESULT WINAPI MemInputPin_GetAllocatorRequirements ( IMemInputPin iface,
ALLOCATOR_PROPERTIES pProps 
)
static

Definition at line 1098 of file pin.c.

1099 {
1101 
1102  TRACE("(%p/%p)->(%p)\n", This, iface, pProps);
1103 
1104  /* override this method if you have any specific requirements */
1105 
1106  return E_NOTIMPL;
1107 }
#define TRACE(s)
Definition: solgame.cpp:4
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MemInputPin_NotifyAllocator()

static HRESULT WINAPI MemInputPin_NotifyAllocator ( IMemInputPin iface,
IMemAllocator pAllocator,
BOOL  bReadOnly 
)
static

Definition at line 1070 of file pin.c.

1071 {
1073 
1074  TRACE("(%p/%p)->(%p, %d)\n", This, iface, pAllocator, bReadOnly);
1075 
1076  if (bReadOnly)
1077  FIXME("Read only flag not handled yet!\n");
1078 
1079  /* FIXME: Should we release the allocator on disconnection? */
1080  if (!pAllocator)
1081  {
1082  WARN("Null allocator\n");
1083  return E_POINTER;
1084  }
1085 
1086  if (This->preferred_allocator && pAllocator != This->preferred_allocator)
1087  return E_FAIL;
1088 
1089  if (This->pAllocator)
1090  IMemAllocator_Release(This->pAllocator);
1091  This->pAllocator = pAllocator;
1092  if (This->pAllocator)
1093  IMemAllocator_AddRef(This->pAllocator);
1094 
1095  return S_OK;
1096 }
#define WARN(fmt,...)
Definition: debug.h:111
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ MemInputPin_QueryInterface()

static HRESULT WINAPI MemInputPin_QueryInterface ( IMemInputPin iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 1036 of file pin.c.

1037 {
1039 
1040  return IPin_QueryInterface(&This->pin.IPin_iface, riid, ppv);
1041 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031

◆ MemInputPin_Receive()

static HRESULT WINAPI MemInputPin_Receive ( IMemInputPin iface,
IMediaSample pSample 
)
static

Definition at line 1109 of file pin.c.

1110 {
1112  HRESULT hr = S_FALSE;
1113 
1114  /* this trace commented out for performance reasons */
1115  /*TRACE("(%p/%p)->(%p)\n", This, iface, pSample);*/
1116  if (This->pFuncsTable->pfnReceive)
1117  hr = This->pFuncsTable->pfnReceive(This, pSample);
1118  return hr;
1119 }
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:77
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031

◆ MemInputPin_ReceiveCanBlock()

static HRESULT WINAPI MemInputPin_ReceiveCanBlock ( IMemInputPin iface)
static

Definition at line 1138 of file pin.c.

1139 {
1141 
1142  TRACE("(%p/%p)->()\n", This, iface);
1143 
1144  return S_OK;
1145 }
#define TRACE(s)
Definition: solgame.cpp:4
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031
#define S_OK
Definition: intsafe.h:59

◆ MemInputPin_ReceiveMultiple()

static HRESULT WINAPI MemInputPin_ReceiveMultiple ( IMemInputPin iface,
IMediaSample **  pSamples,
LONG  nSamples,
LONG nSamplesProcessed 
)
static

Definition at line 1121 of file pin.c.

1122 {
1123  HRESULT hr = S_OK;
1125 
1126  TRACE("(%p/%p)->(%p, %d, %p)\n", This, iface, pSamples, nSamples, nSamplesProcessed);
1127 
1128  for (*nSamplesProcessed = 0; *nSamplesProcessed < nSamples; (*nSamplesProcessed)++)
1129  {
1130  hr = IMemInputPin_Receive(iface, pSamples[*nSamplesProcessed]);
1131  if (hr != S_OK)
1132  break;
1133  }
1134 
1135  return hr;
1136 }
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031
#define S_OK
Definition: intsafe.h:59

◆ MemInputPin_Release()

static ULONG WINAPI MemInputPin_Release ( IMemInputPin iface)
static

Definition at line 1050 of file pin.c.

1051 {
1053 
1054  return IPin_Release(&This->pin.IPin_iface);
1055 }
static BaseInputPin * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1031

◆ OutputPin_Init()

static HRESULT OutputPin_Init ( const IPinVtbl *  OutputPin_Vtbl,
const PIN_INFO pPinInfo,
const BaseOutputPinFuncTable vtbl,
LPCRITICAL_SECTION  pCritSec,
BaseOutputPin pPinImpl 
)
static

Definition at line 767 of file pin.c.

768 {
769  TRACE("\n");
770 
771  /* Common attributes */
772  pPinImpl->pin.IPin_iface.lpVtbl = OutputPin_Vtbl;
773  pPinImpl->pin.refCount = 1;
774  pPinImpl->pin.pConnectedTo = NULL;
775  pPinImpl->pin.pCritSec = pCritSec;
776  pPinImpl->pin.tStart = 0;
777  pPinImpl->pin.tStop = 0;
778  pPinImpl->pin.dRate = 1.0;
779  Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
780  pPinImpl->pin.pFuncsTable = &vtbl->base;
781  ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
782 
783  /* Output pin attributes */
784  pPinImpl->pMemInputPin = NULL;
785  pPinImpl->pAllocator = NULL;
786  pPinImpl->pFuncsTable = vtbl;
787 
788  return S_OK;
789 }
LONG refCount
Definition: strmbase.h:36
LPCRITICAL_SECTION pCritSec
Definition: strmbase.h:37
IPin IPin_iface
Definition: strmbase.h:35
const struct BaseOutputPinFuncTable * pFuncsTable
Definition: strmbase.h:70
#define ZeroMemory
Definition: winbase.h:1642
smooth NULL
Definition: ftsmooth.c:416
REFERENCE_TIME tStop
Definition: strmbase.h:42
const struct BasePinFuncTable * pFuncsTable
Definition: strmbase.h:45
static void Copy_PinInfo(PIN_INFO *pDest, const PIN_INFO *pSrc)
Definition: pin.c:146
#define TRACE(s)
Definition: solgame.cpp:4
BasePin pin
Definition: strmbase.h:66
REFERENCE_TIME tStart
Definition: strmbase.h:41
IPin * pConnectedTo
Definition: strmbase.h:39
double dRate
Definition: strmbase.h:43
IMemInputPin * pMemInputPin
Definition: strmbase.h:67
#define S_OK
Definition: intsafe.h:59
IMemAllocator * pAllocator
Definition: strmbase.h:68
PIN_INFO pinInfo
Definition: strmbase.h:38
BasePinFuncTable base
Definition: strmbase.h:78
AM_MEDIA_TYPE mtCurrent
Definition: strmbase.h:40

Referenced by BaseOutputPin_Construct().

◆ SendFurther()

static HRESULT SendFurther ( IPin from,
SendPinFunc  fnMiddle,
LPVOID  arg,
SendPinFunc  fnEnd 
)
static

Sends a message from a pin further to other, similar pins fnMiddle is called on each pin found further on the stream. fnEnd (can be NULL) is called when the message can't be sent any further (this is a renderer or source)

If the pin given is an input pin, the message will be sent downstream to other input pins If the pin given is an output pin, the message will be sent upstream to other output pins

Definition at line 67 of file pin.c.

68 {
69  PIN_INFO pin_info;
70  ULONG amount = 0;
71  HRESULT hr = S_OK;
72  HRESULT hr_return = S_OK;
73  IEnumPins *enumpins = NULL;
74  BOOL foundend = TRUE;
75  PIN_DIRECTION from_dir;
76 
77  IPin_QueryDirection( from, &from_dir );
78 
79  hr = IPin_QueryInternalConnections( from, NULL, &amount );
80  if (hr != E_NOTIMPL && amount)
81  FIXME("Use QueryInternalConnections!\n");
82 
83  pin_info.pFilter = NULL;
84  hr = IPin_QueryPinInfo( from, &pin_info );
85  if (FAILED(hr))
86  goto out;
87 
88  hr = IBaseFilter_EnumPins( pin_info.pFilter, &enumpins );
89  if (FAILED(hr))
90  goto out;
91 
92  hr = IEnumPins_Reset( enumpins );
93  while (hr == S_OK) {
94  IPin *pin = NULL;
95  hr = IEnumPins_Next( enumpins, 1, &pin, NULL );
97  {
98  hr = IEnumPins_Reset( enumpins );
99  continue;
100  }
101  if (pin)
102  {
104 
105  IPin_QueryDirection( pin, &dir );
106  if (dir != from_dir)
107  {
108  IPin *connected = NULL;
109 
110  foundend = FALSE;
111  IPin_ConnectedTo( pin, &connected );
112  if (connected)
113  {
114  HRESULT hr_local;
115 
116  hr_local = fnMiddle( connected, arg );
117  hr_return = updatehres( hr_return, hr_local );
118  IPin_Release(connected);
119  }
120  }
121  IPin_Release( pin );
122  }
123  else
124  {
125  hr = S_OK;
126  break;
127  }
128  }
129 
130  if (!foundend)
131  hr = hr_return;
132  else if (fnEnd) {
133  HRESULT hr_local;
134 
135  hr_local = fnEnd( from, arg );
136  hr_return = updatehres( hr_return, hr_local );
137  }
138  IEnumPins_Release(enumpins);
139 
140 out:
141  if (pin_info.pFilter)
142  IBaseFilter_Release( pin_info.pFilter );
143  return hr;
144 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static HRESULT updatehres(HRESULT original, HRESULT new)
Definition: pin.c:49
Definition: regsvr.c:103
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
LONG HRESULT
Definition: typedefs.h:77
static FILE * out
Definition: regtests2xml.c:44
int connected
Definition: main.c:61
#define S_OK
Definition: intsafe.h:59
#define VFW_E_ENUM_OUT_OF_SYNC
Definition: vfwmsgs.h:42
Definition: axcore.idl:91
#define E_NOTIMPL
Definition: ddrawi.h:99
enum _PinDirection PIN_DIRECTION
unsigned int ULONG
Definition: retypes.h:1
CardRegion * from
Definition: spigame.cpp:19

Referenced by BaseInputPinImpl_BeginFlush(), BaseInputPinImpl_EndFlush(), BaseInputPinImpl_EndOfStream(), and BaseInputPinImpl_NewSegment().

◆ updatehres()

static HRESULT updatehres ( HRESULT  original,
HRESULT  new 
)
static

Helper function, there are a lot of places where the error code is inherited The following rules apply:

Return the first received error code (E_NOTIMPL is ignored) If no errors occur: return the first received non-error-code that isn't S_OK

Definition at line 49 of file pin.c.

50 {
51  if (FAILED( original ) || new == E_NOTIMPL)
52  return original;
53 
54  if (FAILED( new ) || original == S_OK)
55  return new;
56 
57  return original;
58 }
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by SendFurther().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( strmbase  )

Variable Documentation

◆ MemInputPin_Vtbl

static const IMemInputPinVtbl MemInputPin_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI MemInputPin_Receive(IMemInputPin *iface, IMediaSample *pSample)
Definition: pin.c:1109
static HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed)
Definition: pin.c:1121
static HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin *iface, REFIID riid, LPVOID *ppv)
Definition: pin.c:1036
static ULONG WINAPI MemInputPin_Release(IMemInputPin *iface)
Definition: pin.c:1050
static HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin *iface)
Definition: pin.c:1138
static ULONG WINAPI MemInputPin_AddRef(IMemInputPin *iface)
Definition: pin.c:1043
static HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin *iface, ALLOCATOR_PROPERTIES *pProps)
Definition: pin.c:1098
static HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly)
Definition: pin.c:1070
static HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin *iface, IMemAllocator **ppAllocator)
Definition: pin.c:1057

Definition at line 34 of file pin.c.

Referenced by InputPin_Init().