ReactOS 0.4.17-dev-966-gf06eace
pin.c File Reference
#include "strmbase_private.h"
Include dependency graph for pin.c:

Go to the source code of this file.

Classes

struct  enum_media_types
 
struct  newsegmentargs
 

Typedefs

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

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static HRESULT enum_media_types_create (struct strmbase_pin *pin, IEnumMediaTypes **out)
 
static struct enum_media_types * impl_from_IEnumMediaTypes (IEnumMediaTypes *iface)
 
static HRESULT WINAPI enum_media_types_QueryInterface (IEnumMediaTypes *iface, REFIID iid, void **out)
 
static ULONG WINAPI enum_media_types_AddRef (IEnumMediaTypes *iface)
 
static ULONG WINAPI enum_media_types_Release (IEnumMediaTypes *iface)
 
static HRESULT WINAPI enum_media_types_Next (IEnumMediaTypes *iface, ULONG count, AM_MEDIA_TYPE **mts, ULONG *ret_count)
 
static HRESULT WINAPI enum_media_types_Skip (IEnumMediaTypes *iface, ULONG count)
 
static HRESULT WINAPI enum_media_types_Reset (IEnumMediaTypes *iface)
 
static HRESULT WINAPI enum_media_types_Clone (IEnumMediaTypes *iface, IEnumMediaTypes **out)
 
static struct strmbase_pin * impl_from_IPin (IPin *iface)
 
static HRESULT updatehres (HRESULT original, HRESULT new)
 
static HRESULT SendFurther (struct strmbase_sink *sink, SendPinFunc func, void *arg)
 
static HRESULT WINAPI pin_QueryInterface (IPin *iface, REFIID iid, void **out)
 
static ULONG WINAPI pin_AddRef (IPin *iface)
 
static ULONG WINAPI pin_Release (IPin *iface)
 
static HRESULT WINAPI pin_ConnectedTo (IPin *iface, IPin **ppPin)
 
static HRESULT WINAPI pin_ConnectionMediaType (IPin *iface, AM_MEDIA_TYPE *pmt)
 
static HRESULT WINAPI pin_QueryPinInfo (IPin *iface, PIN_INFO *info)
 
static HRESULT WINAPI pin_QueryDirection (IPin *iface, PIN_DIRECTION *dir)
 
static HRESULT WINAPI pin_QueryId (IPin *iface, WCHAR **id)
 
static BOOL query_accept (struct strmbase_pin *pin, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI pin_QueryAccept (IPin *iface, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI pin_EnumMediaTypes (IPin *iface, IEnumMediaTypes **enum_media_types)
 
static HRESULT WINAPI pin_QueryInternalConnections (IPin *iface, IPin **pins, ULONG *count)
 
static struct strmbase_source * impl_source_from_IPin (IPin *iface)
 
static BOOL compare_media_types (const AM_MEDIA_TYPE *req_mt, const AM_MEDIA_TYPE *pin_mt)
 
static HRESULT WINAPI source_Connect (IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI source_ReceiveConnection (IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI source_Disconnect (IPin *iface)
 
static HRESULT WINAPI source_EndOfStream (IPin *iface)
 
static HRESULT WINAPI source_BeginFlush (IPin *iface)
 
static HRESULT WINAPI source_EndFlush (IPin *iface)
 
static HRESULT WINAPI source_NewSegment (IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
 
HRESULT WINAPI BaseOutputPinImpl_DecideAllocator (struct strmbase_source *This, IMemInputPin *pPin, IMemAllocator **pAlloc)
 
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection (struct strmbase_source *This, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
void strmbase_source_init (struct strmbase_source *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_source_ops *func_table)
 
void strmbase_source_cleanup (struct strmbase_source *pin)
 
static struct strmbase_sink * impl_sink_from_IPin (IPin *iface)
 
static HRESULT WINAPI sink_Connect (IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI sink_ReceiveConnection (IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
static HRESULT WINAPI sink_Disconnect (IPin *iface)
 
static HRESULT deliver_endofstream (IPin *pin, LPVOID unused)
 
static HRESULT WINAPI sink_EndOfStream (IPin *iface)
 
static HRESULT deliver_beginflush (IPin *pin, LPVOID unused)
 
static HRESULT WINAPI sink_BeginFlush (IPin *iface)
 
static HRESULT deliver_endflush (IPin *pin, LPVOID unused)
 
static HRESULT WINAPI sink_EndFlush (IPin *iface)
 
static HRESULT deliver_newsegment (IPin *pin, LPVOID data)
 
static HRESULT WINAPI sink_NewSegment (IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
 
static struct strmbase_sink * impl_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 *props)
 
static HRESULT WINAPI MemInputPin_Receive (IMemInputPin *iface, IMediaSample *sample)
 
static HRESULT WINAPI MemInputPin_ReceiveMultiple (IMemInputPin *iface, IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed)
 
static HRESULT WINAPI MemInputPin_ReceiveCanBlock (IMemInputPin *iface)
 
void strmbase_sink_init (struct strmbase_sink *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_sink_ops *func_table, IMemAllocator *allocator)
 
void strmbase_sink_cleanup (struct strmbase_sink *pin)
 

Variables

static const IMemInputPinVtbl MemInputPin_Vtbl
 
static const IEnumMediaTypesVtbl enum_media_types_vtbl
 
static const IPinVtbl source_vtbl
 
static const IPinVtbl sink_vtbl
 

Typedef Documentation

◆ newsegmentargs

◆ SendPinFunc

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

Definition at line 28 of file pin.c.

Function Documentation

◆ BaseOutputPinImpl_AttemptConnection()

HRESULT WINAPI BaseOutputPinImpl_AttemptConnection ( struct strmbase_source *  This,
IPin *  pReceivePin,
const AM_MEDIA_TYPE *  pmt 
)

Definition at line 710 of file pin.c.

712{
713 HRESULT hr;
714 IMemAllocator * pMemAlloc = NULL;
715
716 TRACE("(%p)->(%p, %p)\n", This, pReceivePin, pmt);
717
718 if (!query_accept(&This->pin, pmt))
720
721 This->pin.peer = pReceivePin;
722 IPin_AddRef(pReceivePin);
723 CopyMediaType(&This->pin.mt, pmt);
724
725 hr = IPin_ReceiveConnection(pReceivePin, &This->pin.IPin_iface, pmt);
726
727 /* get the IMemInputPin interface we will use to deliver samples to the
728 * connected pin */
729 if (SUCCEEDED(hr))
730 {
731 This->pMemInputPin = NULL;
732 hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (LPVOID)&This->pMemInputPin);
733
734 if (SUCCEEDED(hr))
735 {
736 hr = This->pFuncsTable->pfnDecideAllocator(This, This->pMemInputPin, &pMemAlloc);
737 if (SUCCEEDED(hr))
738 This->pAllocator = pMemAlloc;
739 else if (pMemAlloc)
740 IMemAllocator_Release(pMemAlloc);
741 }
742
743 /* break connection if we couldn't get the allocator */
744 if (FAILED(hr))
745 {
746 if (This->pMemInputPin)
747 IMemInputPin_Release(This->pMemInputPin);
748 This->pMemInputPin = NULL;
749
750 IPin_Disconnect(pReceivePin);
751 }
752 }
753
754 if (FAILED(hr))
755 {
756 IPin_Release(This->pin.peer);
757 This->pin.peer = NULL;
758 FreeMediaType(&This->pin.mt);
759 }
760
761 TRACE("Returning %#lx.\n", hr);
762 return hr;
763}
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static BOOL query_accept(struct strmbase_pin *pin, const AM_MEDIA_TYPE *mt)
Definition: pin.c:394
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: mediatype.c:150
void WINAPI FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:165
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81

Referenced by AviMuxOut_AttemptConnection().

◆ BaseOutputPinImpl_DecideAllocator()

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

Definition at line 680 of file pin.c.

682{
683 HRESULT hr;
684
685 hr = IMemInputPin_GetAllocator(pPin, pAlloc);
686
687 if (hr == VFW_E_NO_ALLOCATOR)
688 hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL,
689 CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (void **)pAlloc);
690
691 if (SUCCEEDED(hr))
692 {
694 ZeroMemory(&rProps, sizeof(ALLOCATOR_PROPERTIES));
695
696 IMemInputPin_GetAllocatorRequirements(pPin, &rProps);
697 hr = This->pFuncsTable->pfnDecideBufferSize(This, *pAlloc, &rProps);
698 }
699
700 if (SUCCEEDED(hr))
701 hr = IMemInputPin_NotifyAllocator(pPin, *pAlloc, FALSE);
702
703 return hr;
704}
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define ZeroMemory
Definition: minwinbase.h:31
#define VFW_E_NO_ALLOCATOR
Definition: vfwmsgs.h:49

Referenced by AVICompressorOut_DecideAllocator().

◆ compare_media_types()

static BOOL compare_media_types ( const AM_MEDIA_TYPE *  req_mt,
const AM_MEDIA_TYPE *  pin_mt 
)
static

Definition at line 448 of file pin.c.

449{
450 if (!req_mt)
451 return TRUE;
452
453 if (!IsEqualGUID(&req_mt->majortype, &pin_mt->majortype)
454 && !IsEqualGUID(&req_mt->majortype, &GUID_NULL))
455 return FALSE;
456
457 if (!IsEqualGUID(&req_mt->subtype, &pin_mt->subtype)
458 && !IsEqualGUID(&req_mt->subtype, &GUID_NULL))
459 return FALSE;
460
461 if (!IsEqualGUID(&req_mt->formattype, &pin_mt->formattype)
462 && !IsEqualGUID(&req_mt->formattype, &GUID_NULL))
463 return FALSE;
464
465 return TRUE;
466}
#define TRUE
Definition: types.h:120
#define GUID_NULL
Definition: ks.h:106
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

Referenced by source_Connect().

◆ deliver_beginflush()

static HRESULT deliver_beginflush ( IPin *  pin,
LPVOID  unused 
)
static

Definition at line 928 of file pin.c.

929{
930 return IPin_BeginFlush( pin );
931}

Referenced by sink_BeginFlush().

◆ deliver_endflush()

static HRESULT deliver_endflush ( IPin *  pin,
LPVOID  unused 
)
static

Definition at line 954 of file pin.c.

955{
956 return IPin_EndFlush( pin );
957}

Referenced by sink_EndFlush().

◆ deliver_endofstream()

static HRESULT deliver_endofstream ( IPin *  pin,
LPVOID  unused 
)
static

Definition at line 898 of file pin.c.

899{
900 return IPin_EndOfStream( pin );
901}

Referenced by sink_EndOfStream().

◆ deliver_newsegment()

static HRESULT deliver_newsegment ( IPin *  pin,
LPVOID  data 
)
static

Definition at line 986 of file pin.c.

987{
989 return IPin_NewSegment(pin, args->tStart, args->tStop, args->rate);
990}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: match.c:390

Referenced by sink_NewSegment().

◆ enum_media_types_AddRef()

static ULONG WINAPI enum_media_types_AddRef ( IEnumMediaTypes *  iface)
static

Definition at line 96 of file pin.c.

97{
98 struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
100 TRACE("%p increasing refcount to %lu.\n", enummt, refcount);
101 return refcount;
102}
#define InterlockedIncrement
Definition: armddk.h:53
static struct enum_media_types * impl_from_IEnumMediaTypes(IEnumMediaTypes *iface)
Definition: pin.c:75
uint32_t ULONG
Definition: typedefs.h:59

◆ enum_media_types_Clone()

static HRESULT WINAPI enum_media_types_Clone ( IEnumMediaTypes *  iface,
IEnumMediaTypes **  out 
)
static

Definition at line 201 of file pin.c.

202{
203 struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
204 HRESULT hr;
205
206 TRACE("enummt %p, out %p.\n", enummt, out);
207
208 if (FAILED(hr = enum_media_types_create(enummt->pin, out)))
209 return hr;
210 return IEnumMediaTypes_Skip(*out, enummt->index);
211}
static HRESULT enum_media_types_create(struct strmbase_pin *pin, IEnumMediaTypes **out)
Definition: pin.c:41
unsigned int index
Definition: audiostream.c:792
struct strmbase_pin * pin
Definition: pin.c:36
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ enum_media_types_create()

static HRESULT enum_media_types_create ( struct strmbase_pin *  pin,
IEnumMediaTypes **  out 
)
static

Definition at line 41 of file pin.c.

42{
45
46 if (!out)
47 return E_POINTER;
48
49 if (!(object = heap_alloc_zero(sizeof(*object))))
50 {
51 *out = NULL;
52 return E_OUTOFMEMORY;
53 }
54
55 object->IEnumMediaTypes_iface.lpVtbl = &enum_media_types_vtbl;
56 object->refcount = 1;
57 object->pin = pin;
58 IPin_AddRef(&pin->IPin_iface);
59
60 if (pin->ops->pin_get_media_type)
61 {
62 while (pin->ops->pin_get_media_type(pin, object->count, &mt) == S_OK)
63 {
64 FreeMediaType(&mt);
65 ++object->count;
66 }
67 }
68
69 TRACE("Created enumerator %p.\n", object);
70 *out = &object->IEnumMediaTypes_iface;
71
72 return S_OK;
73}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
static const IEnumMediaTypesVtbl enum_media_types_vtbl
Definition: pin.c:39
#define E_POINTER
Definition: winerror.h:3480

Referenced by enum_media_types_Clone(), and pin_EnumMediaTypes().

◆ enum_media_types_Next()

static HRESULT WINAPI enum_media_types_Next ( IEnumMediaTypes *  iface,
ULONG  count,
AM_MEDIA_TYPE **  mts,
ULONG *  ret_count 
)
static

Definition at line 118 of file pin.c.

120{
121 struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
122 AM_MEDIA_TYPE mt;
123 unsigned int i;
124 HRESULT hr;
125
126 TRACE("enummt %p, count %lu, mts %p, ret_count %p.\n", enummt, count, mts, ret_count);
127
128 if (!enummt->pin->ops->pin_get_media_type)
129 {
130 if (ret_count)
131 *ret_count = 0;
132 return count ? S_FALSE : S_OK;
133 }
134
135 for (i = 0; i < count; ++i)
136 {
137 hr = enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->index + i, &mt);
138 if (hr == S_OK)
139 {
140 if ((mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
141 *mts[i] = mt;
142 else
144 }
145 if (FAILED(hr))
146 {
147 while (i--)
148 DeleteMediaType(mts[i]);
149 *ret_count = 0;
150 return E_OUTOFMEMORY;
151 }
152 else if (hr != S_OK)
153 break;
154
155 if (TRACE_ON(quartz))
156 {
157 TRACE("Returning media type %u:\n", enummt->index + i);
159 }
160 }
161
162 if (count != 1 || ret_count)
163 *ret_count = i;
164 enummt->index += i;
165 return i == count ? S_OK : S_FALSE;
166}
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define TRACE_ON(x)
Definition: compat.h:75
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt)
Definition: mediatype.c:58
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:193
#define S_FALSE
Definition: winerror.h:3451

◆ enum_media_types_QueryInterface()

static HRESULT WINAPI enum_media_types_QueryInterface ( IEnumMediaTypes *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 80 of file pin.c.

81{
82 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
83
84 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IEnumMediaTypes))
85 {
86 IEnumMediaTypes_AddRef(iface);
87 *out = iface;
88 return S_OK;
89 }
90
91 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
92 *out = NULL;
93 return E_NOINTERFACE;
94}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define debugstr_guid
Definition: kernel32.h:35
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ enum_media_types_Release()

static ULONG WINAPI enum_media_types_Release ( IEnumMediaTypes *  iface)
static

Definition at line 104 of file pin.c.

105{
106 struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
108
109 TRACE("%p decreasing refcount to %lu.\n", enummt, refcount);
110 if (!refcount)
111 {
112 IPin_Release(&enummt->pin->IPin_iface);
113 heap_free(enummt);
114 }
115 return refcount;
116}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52

◆ enum_media_types_Reset()

static HRESULT WINAPI enum_media_types_Reset ( IEnumMediaTypes *  iface)
static

Definition at line 179 of file pin.c.

180{
181 struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
182 AM_MEDIA_TYPE mt;
183
184 TRACE("enummt %p.\n", enummt);
185
186 enummt->count = 0;
187 if (enummt->pin->ops->pin_get_media_type)
188 {
189 while (enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->count, &mt) == S_OK)
190 {
191 FreeMediaType(&mt);
192 ++enummt->count;
193 }
194 }
195
196 enummt->index = 0;
197
198 return S_OK;
199}
unsigned int count
Definition: pin.c:35

◆ enum_media_types_Skip()

static HRESULT WINAPI enum_media_types_Skip ( IEnumMediaTypes *  iface,
ULONG  count 
)
static

Definition at line 168 of file pin.c.

169{
170 struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
171
172 TRACE("enummt %p, count %lu.\n", enummt, count);
173
174 enummt->index += count;
175
176 return enummt->index > enummt->count ? S_FALSE : S_OK;
177}

◆ impl_from_IEnumMediaTypes()

static struct enum_media_types * impl_from_IEnumMediaTypes ( IEnumMediaTypes *  iface)
static

Definition at line 75 of file pin.c.

76{
77 return CONTAINING_RECORD(iface, struct enum_media_types, IEnumMediaTypes_iface);
78}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by enum_media_types_AddRef(), enum_media_types_Clone(), enum_media_types_Next(), enum_media_types_Release(), enum_media_types_Reset(), and enum_media_types_Skip().

◆ impl_from_IMemInputPin()

◆ impl_from_IPin()

◆ impl_sink_from_IPin()

static struct strmbase_sink * impl_sink_from_IPin ( IPin *  iface)
static

Definition at line 786 of file pin.c.

787{
788 return CONTAINING_RECORD(iface, struct strmbase_sink, pin.IPin_iface);
789}

Referenced by sink_BeginFlush(), sink_Connect(), sink_Disconnect(), sink_EndFlush(), sink_EndOfStream(), sink_NewSegment(), and sink_ReceiveConnection().

◆ impl_source_from_IPin()

static struct strmbase_source * impl_source_from_IPin ( IPin *  iface)
inlinestatic

◆ MemInputPin_AddRef()

static ULONG WINAPI MemInputPin_AddRef ( IMemInputPin *  iface)
static

Definition at line 1046 of file pin.c.

1047{
1048 struct strmbase_sink *This = impl_from_IMemInputPin(iface);
1049
1050 return IPin_AddRef(&This->pin.IPin_iface);
1051}
static struct strmbase_sink * impl_from_IMemInputPin(IMemInputPin *iface)
Definition: pin.c:1034

◆ MemInputPin_GetAllocator()

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

Definition at line 1060 of file pin.c.

1061{
1062 struct strmbase_sink *This = impl_from_IMemInputPin(iface);
1063
1064 TRACE("pin %p %s:%s, allocator %p.\n", This, debugstr_w(This->pin.filter->name),
1065 debugstr_w(This->pin.name), ppAllocator);
1066
1067 *ppAllocator = This->pAllocator;
1068 if (*ppAllocator)
1069 IMemAllocator_AddRef(*ppAllocator);
1070
1071 return *ppAllocator ? S_OK : VFW_E_NO_ALLOCATOR;
1072}
#define debugstr_w
Definition: kernel32.h:32

◆ MemInputPin_GetAllocatorRequirements()

static HRESULT WINAPI MemInputPin_GetAllocatorRequirements ( IMemInputPin *  iface,
ALLOCATOR_PROPERTIES *  props 
)
static

Definition at line 1103 of file pin.c.

1104{
1105 struct strmbase_sink *pin = impl_from_IMemInputPin(iface);
1106
1107 TRACE("pin %p %s:%s, props %p.\n", pin, debugstr_w(pin->pin.filter->name),
1108 debugstr_w(pin->pin.name), props);
1109
1110 /* override this method if you have any specific requirements */
1111
1112 return E_NOTIMPL;
1113}
#define E_NOTIMPL
Definition: ddrawi.h:99
struct strmbase_pin pin
Definition: strmbase.h:106
static const WCHAR props[]
Definition: wbemdisp.c:288

◆ MemInputPin_NotifyAllocator()

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

Definition at line 1074 of file pin.c.

1075{
1076 struct strmbase_sink *This = impl_from_IMemInputPin(iface);
1077
1078 TRACE("pin %p %s:%s, allocator %p, read_only %d.\n", This, debugstr_w(This->pin.filter->name),
1079 debugstr_w(This->pin.name), pAllocator, bReadOnly);
1080
1081 if (bReadOnly)
1082 FIXME("Read only flag not handled yet!\n");
1083
1084 /* FIXME: Should we release the allocator on disconnection? */
1085 if (!pAllocator)
1086 {
1087 WARN("Null allocator\n");
1088 return E_POINTER;
1089 }
1090
1091 if (This->preferred_allocator && pAllocator != This->preferred_allocator)
1092 return E_FAIL;
1093
1094 if (This->pAllocator)
1095 IMemAllocator_Release(This->pAllocator);
1096 This->pAllocator = pAllocator;
1097 if (This->pAllocator)
1098 IMemAllocator_AddRef(This->pAllocator);
1099
1100 return S_OK;
1101}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_FAIL
Definition: ddrawi.h:102
IMemAllocator * pAllocator
Definition: strmbase.h:109

◆ MemInputPin_QueryInterface()

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

Definition at line 1039 of file pin.c.

1040{
1041 struct strmbase_sink *This = impl_from_IMemInputPin(iface);
1042
1043 return IPin_QueryInterface(&This->pin.IPin_iface, riid, ppv);
1044}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ MemInputPin_Receive()

static HRESULT WINAPI MemInputPin_Receive ( IMemInputPin *  iface,
IMediaSample *  sample 
)
static

Definition at line 1115 of file pin.c.

1116{
1117 struct strmbase_sink *pin = impl_from_IMemInputPin(iface);
1118 HRESULT hr = S_FALSE;
1119
1120 TRACE("pin %p %s:%s, sample %p.\n", pin, debugstr_w(pin->pin.filter->name),
1121 debugstr_w(pin->pin.name), sample);
1122
1123 if (pin->pFuncsTable->pfnReceive)
1124 {
1125 EnterCriticalSection(&pin->pin.filter->stream_cs);
1126 hr = pin->pFuncsTable->pfnReceive(pin, sample);
1127 LeaveCriticalSection(&pin->pin.filter->stream_cs);
1128 }
1129 return hr;
1130}
Definition: wave.c:25
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ MemInputPin_ReceiveCanBlock()

static HRESULT WINAPI MemInputPin_ReceiveCanBlock ( IMemInputPin *  iface)
static

Definition at line 1146 of file pin.c.

1147{
1148 struct strmbase_sink *pin = impl_from_IMemInputPin(iface);
1149
1150 TRACE("pin %p %s:%s.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
1151
1152 return S_OK;
1153}

◆ MemInputPin_ReceiveMultiple()

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

Definition at line 1132 of file pin.c.

1133{
1134 HRESULT hr = S_OK;
1135
1136 for (*nSamplesProcessed = 0; *nSamplesProcessed < nSamples; (*nSamplesProcessed)++)
1137 {
1138 hr = IMemInputPin_Receive(iface, pSamples[*nSamplesProcessed]);
1139 if (hr != S_OK)
1140 break;
1141 }
1142
1143 return hr;
1144}

◆ MemInputPin_Release()

static ULONG WINAPI MemInputPin_Release ( IMemInputPin *  iface)
static

Definition at line 1053 of file pin.c.

1054{
1055 struct strmbase_sink *This = impl_from_IMemInputPin(iface);
1056
1057 return IPin_Release(&This->pin.IPin_iface);
1058}

◆ pin_AddRef()

static ULONG WINAPI pin_AddRef ( IPin *  iface)
static

Definition at line 292 of file pin.c.

293{
294 struct strmbase_pin *pin = impl_from_IPin(iface);
295 return IBaseFilter_AddRef(&pin->filter->IBaseFilter_iface);
296}
static struct strmbase_pin * impl_from_IPin(IPin *iface)
Definition: pin.c:224
struct strmbase_filter * filter
Definition: strmbase.h:58

◆ pin_ConnectedTo()

static HRESULT WINAPI pin_ConnectedTo ( IPin *  iface,
IPin **  ppPin 
)
static

Definition at line 304 of file pin.c.

305{
306 struct strmbase_pin *This = impl_from_IPin(iface);
307 HRESULT hr;
308
309 TRACE("pin %p %s:%s, peer %p.\n", This, debugstr_w(This->filter->name), debugstr_w(This->name), ppPin);
310
311 EnterCriticalSection(&This->filter->filter_cs);
312 {
313 if (This->peer)
314 {
315 *ppPin = This->peer;
316 IPin_AddRef(*ppPin);
317 hr = S_OK;
318 }
319 else
320 {
322 *ppPin = NULL;
323 }
324 }
325 LeaveCriticalSection(&This->filter->filter_cs);
326
327 return hr;
328}
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48

◆ pin_ConnectionMediaType()

static HRESULT WINAPI pin_ConnectionMediaType ( IPin *  iface,
AM_MEDIA_TYPE *  pmt 
)
static

Definition at line 330 of file pin.c.

331{
332 struct strmbase_pin *This = impl_from_IPin(iface);
333 HRESULT hr;
334
335 TRACE("pin %p %s:%s, pmt %p.\n", This, debugstr_w(This->filter->name), debugstr_w(This->name), pmt);
336
337 EnterCriticalSection(&This->filter->filter_cs);
338 {
339 if (This->peer)
340 {
341 CopyMediaType(pmt, &This->mt);
343 hr = S_OK;
344 }
345 else
346 {
347 ZeroMemory(pmt, sizeof(*pmt));
349 }
350 }
351 LeaveCriticalSection(&This->filter->filter_cs);
352
353 return hr;
354}

◆ pin_EnumMediaTypes()

static HRESULT WINAPI pin_EnumMediaTypes ( IPin *  iface,
IEnumMediaTypes **  enum_media_types 
)
static

Definition at line 411 of file pin.c.

412{
413 struct strmbase_pin *pin = impl_from_IPin(iface);
415 HRESULT hr;
416
417 TRACE("pin %p %s:%s, enum_media_types %p.\n", pin, debugstr_w(pin->filter->name),
419
420 if (pin->ops->pin_get_media_type)
421 {
422 if (FAILED(hr = pin->ops->pin_get_media_type(pin, 0, &mt)))
423 return hr;
424 if (hr == S_OK)
426 }
427
429}
WCHAR name[128]
Definition: strmbase.h:60
const struct strmbase_pin_ops * ops
Definition: strmbase.h:65
AM_MEDIA_TYPE mt
Definition: strmbase.h:63

◆ pin_QueryAccept()

static HRESULT WINAPI pin_QueryAccept ( IPin *  iface,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 401 of file pin.c.

402{
403 struct strmbase_pin *pin = impl_from_IPin(iface);
404
405 TRACE("pin %p %s:%s, mt %p.\n", pin, debugstr_w(pin->filter->name), debugstr_w(pin->name), mt);
407
408 return query_accept(pin, mt) ? S_OK : S_FALSE;
409}

◆ pin_QueryDirection()

static HRESULT WINAPI pin_QueryDirection ( IPin *  iface,
PIN_DIRECTION *  dir 
)
static

Definition at line 369 of file pin.c.

370{
371 struct strmbase_pin *pin = impl_from_IPin(iface);
372
373 TRACE("pin %p %s:%s, dir %p.\n", pin, debugstr_w(pin->filter->name), debugstr_w(pin->name), dir);
374
375 *dir = pin->dir;
376
377 return S_OK;
378}
unsigned int dir
Definition: maze.c:112
PIN_DIRECTION dir
Definition: strmbase.h:59

◆ pin_QueryId()

static HRESULT WINAPI pin_QueryId ( IPin *  iface,
WCHAR **  id 
)
static

Definition at line 380 of file pin.c.

381{
382 struct strmbase_pin *pin = impl_from_IPin(iface);
383
384 TRACE("pin %p %s:%s, id %p.\n", pin, debugstr_w(pin->filter->name), debugstr_w(pin->name), id);
385
386 if (!(*id = CoTaskMemAlloc((lstrlenW(pin->id) + 1) * sizeof(WCHAR))))
387 return E_OUTOFMEMORY;
388
389 lstrcpyW(*id, pin->id);
390
391 return S_OK;
392}
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
short WCHAR
Definition: pedump.c:58
WCHAR id[128]
Definition: strmbase.h:61

◆ pin_QueryInterface()

static HRESULT WINAPI pin_QueryInterface ( IPin *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 268 of file pin.c.

269{
270 struct strmbase_pin *pin = impl_from_IPin(iface);
271 HRESULT hr;
272
273 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
274
275 *out = NULL;
276
277 if (pin->ops->pin_query_interface && SUCCEEDED(hr = pin->ops->pin_query_interface(pin, iid, out)))
278 return hr;
279
280 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IPin))
281 *out = iface;
282 else
283 {
284 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
285 return E_NOINTERFACE;
286 }
287
288 IUnknown_AddRef((IUnknown *)*out);
289 return S_OK;
290}
const GUID IID_IPin
Definition: pincontrol.cpp:15
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ pin_QueryInternalConnections()

static HRESULT WINAPI pin_QueryInternalConnections ( IPin *  iface,
IPin **  pins,
ULONG *  count 
)
static

Definition at line 431 of file pin.c.

432{
433 struct strmbase_pin *pin = impl_from_IPin(iface);
434
435 TRACE("pin %p %s:%s, pins %p, count %p.\n", pin, debugstr_w(pin->filter->name),
436 debugstr_w(pin->name), pins, count);
437
438 return E_NOTIMPL; /* to tell caller that all input pins connected to all output pins */
439}

◆ pin_QueryPinInfo()

static HRESULT WINAPI pin_QueryPinInfo ( IPin *  iface,
PIN_INFO *  info 
)
static

Definition at line 356 of file pin.c.

357{
358 struct strmbase_pin *pin = impl_from_IPin(iface);
359
360 TRACE("pin %p %s:%s, info %p.\n", pin, debugstr_w(pin->filter->name), debugstr_w(pin->name), info);
361
362 info->dir = pin->dir;
363 IBaseFilter_AddRef(info->pFilter = &pin->filter->IBaseFilter_iface);
364 lstrcpyW(info->achName, pin->name);
365
366 return S_OK;
367}

◆ pin_Release()

static ULONG WINAPI pin_Release ( IPin *  iface)
static

Definition at line 298 of file pin.c.

299{
300 struct strmbase_pin *pin = impl_from_IPin(iface);
301 return IBaseFilter_Release(&pin->filter->IBaseFilter_iface);
302}

◆ query_accept()

static BOOL query_accept ( struct strmbase_pin *  pin,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 394 of file pin.c.

395{
396 if (pin->ops->pin_query_accept && pin->ops->pin_query_accept(pin, mt) != S_OK)
397 return FALSE;
398 return TRUE;
399}

Referenced by BaseOutputPinImpl_AttemptConnection(), pin_QueryAccept(), and sink_ReceiveConnection().

◆ SendFurther()

static HRESULT SendFurther ( struct strmbase_sink *  sink,
SendPinFunc  func,
void *  arg 
)
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 253 of file pin.c.

254{
255 struct strmbase_pin *pin;
256 HRESULT hr = S_OK;
257 unsigned int i;
258
259 for (i = 0; (pin = sink->pin.filter->ops->filter_get_pin(sink->pin.filter, i)); ++i)
260 {
261 if (pin->dir == PINDIR_OUTPUT && pin->peer)
262 hr = updatehres(hr, func(pin->peer, arg));
263 }
264
265 return hr;
266}
@ PINDIR_OUTPUT
Definition: axcore.idl:42
GLenum func
Definition: glext.h:6028
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
static HRESULT updatehres(HRESULT original, HRESULT new)
Definition: pin.c:235
IPin * peer
Definition: strmbase.h:62

Referenced by sink_BeginFlush(), sink_EndFlush(), sink_EndOfStream(), and sink_NewSegment().

◆ sink_BeginFlush()

static HRESULT WINAPI sink_BeginFlush ( IPin *  iface)
static

Definition at line 933 of file pin.c.

934{
935 struct strmbase_sink *pin = impl_sink_from_IPin(iface);
936 HRESULT hr;
937
938 TRACE("pin %p %s:%s.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
939
940 EnterCriticalSection(&pin->pin.filter->filter_cs);
941
942 pin->flushing = TRUE;
943
944 if (pin->pFuncsTable->sink_begin_flush)
945 hr = pin->pFuncsTable->sink_begin_flush(pin);
946 else
948
949 LeaveCriticalSection(&pin->pin.filter->filter_cs);
950
951 return hr;
952}
static HRESULT deliver_beginflush(IPin *pin, LPVOID unused)
Definition: pin.c:928
static struct strmbase_sink * impl_sink_from_IPin(IPin *iface)
Definition: pin.c:786
static HRESULT SendFurther(struct strmbase_sink *sink, SendPinFunc func, void *arg)
Definition: pin.c:253

◆ sink_Connect()

static HRESULT WINAPI sink_Connect ( IPin *  iface,
IPin *  peer,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 791 of file pin.c.

792{
793 struct strmbase_sink *pin = impl_sink_from_IPin(iface);
794
795 WARN("pin %p %s:%s, peer %p, mt %p, unexpected call.\n", pin, debugstr_w(pin->pin.name),
796 debugstr_w(pin->pin.filter->name), peer, mt);
797
798 return E_UNEXPECTED;
799}
#define E_UNEXPECTED
Definition: winerror.h:3528

◆ sink_Disconnect()

static HRESULT WINAPI sink_Disconnect ( IPin *  iface)
static

Definition at line 857 of file pin.c.

858{
859 struct strmbase_sink *pin = impl_sink_from_IPin(iface);
860 HRESULT hr;
861
862 TRACE("pin %p %s:%s.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
863
864 EnterCriticalSection(&pin->pin.filter->filter_cs);
865
866 if (pin->pin.filter->state != State_Stopped)
867 {
868 LeaveCriticalSection(&pin->pin.filter->filter_cs);
869 WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
870 return VFW_E_NOT_STOPPED;
871 }
872
873 if (pin->pin.peer)
874 {
875 if (pin->pFuncsTable->sink_disconnect)
876 pin->pFuncsTable->sink_disconnect(pin);
877
878 if (pin->pAllocator)
879 {
880 IMemAllocator_Release(pin->pAllocator);
881 pin->pAllocator = NULL;
882 }
883
884 IPin_Release(pin->pin.peer);
885 pin->pin.peer = NULL;
886 FreeMediaType(&pin->pin.mt);
887 memset(&pin->pin.mt, 0, sizeof(AM_MEDIA_TYPE));
888 hr = S_OK;
889 }
890 else
891 hr = S_FALSE;
892
893 LeaveCriticalSection(&pin->pin.filter->filter_cs);
894
895 return hr;
896}
#define memset(x, y, z)
Definition: compat.h:39
#define VFW_E_NOT_STOPPED
Definition: vfwmsgs.h:75

◆ sink_EndFlush()

static HRESULT WINAPI sink_EndFlush ( IPin *  iface)
static

Definition at line 959 of file pin.c.

960{
961 struct strmbase_sink *pin = impl_sink_from_IPin(iface);
962 HRESULT hr;
963
964 TRACE("pin %p %s:%s.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
965
966 EnterCriticalSection(&pin->pin.filter->filter_cs);
967
968 pin->flushing = FALSE;
969
970 if (pin->pFuncsTable->sink_end_flush)
971 hr = pin->pFuncsTable->sink_end_flush(pin);
972 else
974
975 LeaveCriticalSection(&pin->pin.filter->filter_cs);
976
977 return hr;
978}
static HRESULT deliver_endflush(IPin *pin, LPVOID unused)
Definition: pin.c:954

◆ sink_EndOfStream()

static HRESULT WINAPI sink_EndOfStream ( IPin *  iface)
static

Definition at line 903 of file pin.c.

904{
905 struct strmbase_sink *pin = impl_sink_from_IPin(iface);
906 HRESULT hr = S_OK;
907
908 TRACE("pin %p %s:%s.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
909
910 if (pin->pFuncsTable->sink_eos)
911 {
912 EnterCriticalSection(&pin->pin.filter->stream_cs);
913 hr = pin->pFuncsTable->sink_eos(pin);
914 LeaveCriticalSection(&pin->pin.filter->stream_cs);
915 return hr;
916 }
917
918 EnterCriticalSection(&pin->pin.filter->filter_cs);
919 if (pin->flushing)
920 hr = S_FALSE;
921 LeaveCriticalSection(&pin->pin.filter->filter_cs);
922
923 if (hr == S_OK)
925 return hr;
926}
static HRESULT deliver_endofstream(IPin *pin, LPVOID unused)
Definition: pin.c:898

◆ sink_NewSegment()

static HRESULT WINAPI sink_NewSegment ( IPin *  iface,
REFERENCE_TIME  start,
REFERENCE_TIME  stop,
double  rate 
)
static

Definition at line 992 of file pin.c.

993{
994 struct strmbase_sink *pin = impl_sink_from_IPin(iface);
996
997 TRACE("pin %p %s:%s, start %s, stop %s, rate %.16e.\n", pin, debugstr_w(pin->pin.filter->name),
998 debugstr_w(pin->pin.name), debugstr_time(start), debugstr_time(stop), rate);
999
1000 if (pin->pFuncsTable->sink_new_segment)
1001 return pin->pFuncsTable->sink_new_segment(pin, start, stop, rate);
1002
1003 args.tStart = start;
1004 args.tStop = stop;
1005 args.rate = rate;
1006
1008}
unsigned int rate
Definition: audiorecord.c:87
GLuint start
Definition: gl.h:1545
static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
Definition: pin.c:986
#define args
Definition: format.c:66
static const char * debugstr_time(REFERENCE_TIME time)
Definition: strmbase.h:32

◆ sink_ReceiveConnection()

static HRESULT WINAPI sink_ReceiveConnection ( IPin *  iface,
IPin *  pReceivePin,
const AM_MEDIA_TYPE *  pmt 
)
static

Definition at line 802 of file pin.c.

803{
804 struct strmbase_sink *This = impl_sink_from_IPin(iface);
805 PIN_DIRECTION pindirReceive;
806 HRESULT hr = S_OK;
807
808 TRACE("pin %p %s:%s, peer %p, mt %p.\n", This, debugstr_w(This->pin.filter->name),
809 debugstr_w(This->pin.name), pReceivePin, pmt);
811
812 if (!pmt)
813 return E_POINTER;
814
815 EnterCriticalSection(&This->pin.filter->filter_cs);
816 {
817 if (This->pin.filter->state != State_Stopped)
818 {
819 LeaveCriticalSection(&This->pin.filter->filter_cs);
820 WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
821 return VFW_E_NOT_STOPPED;
822 }
823
824 if (This->pin.peer)
826
827 if (SUCCEEDED(hr) && !query_accept(&This->pin, pmt))
828 hr = VFW_E_TYPE_NOT_ACCEPTED; /* FIXME: shouldn't we just map common errors onto
829 * VFW_E_TYPE_NOT_ACCEPTED and pass the value on otherwise? */
830
831 if (SUCCEEDED(hr))
832 {
833 IPin_QueryDirection(pReceivePin, &pindirReceive);
834
835 if (pindirReceive != PINDIR_OUTPUT)
836 {
837 ERR("Can't connect from non-output pin\n");
839 }
840 }
841
842 if (SUCCEEDED(hr) && This->pFuncsTable->sink_connect)
843 hr = This->pFuncsTable->sink_connect(This, pReceivePin, pmt);
844
845 if (SUCCEEDED(hr))
846 {
847 CopyMediaType(&This->pin.mt, pmt);
848 This->pin.peer = pReceivePin;
849 IPin_AddRef(pReceivePin);
850 }
851 }
852 LeaveCriticalSection(&This->pin.filter->filter_cs);
853
854 return hr;
855}
enum _PinDirection PIN_DIRECTION
#define ERR(fmt,...)
Definition: precomp.h:57
#define VFW_E_ALREADY_CONNECTED
Definition: vfwmsgs.h:43
#define VFW_E_INVALID_DIRECTION
Definition: vfwmsgs.h:47

◆ source_BeginFlush()

static HRESULT WINAPI source_BeginFlush ( IPin *  iface)
static

Definition at line 626 of file pin.c.

627{
629
630 WARN("pin %p %s:%s, unexpected call.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
631
632 /* not supposed to do anything in an output pin */
633
634 return E_UNEXPECTED;
635}
static struct strmbase_source * impl_source_from_IPin(IPin *iface)
Definition: pin.c:443
struct strmbase_pin pin
Definition: strmbase.h:79

◆ source_Connect()

static HRESULT WINAPI source_Connect ( IPin *  iface,
IPin *  peer,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 468 of file pin.c.

469{
471 AM_MEDIA_TYPE candidate, *candidate_ptr;
472 IEnumMediaTypes *enummt;
474 unsigned int i;
475 ULONG count;
476 HRESULT hr;
477
478 TRACE("pin %p %s:%s, peer %p, mt %p.\n", pin, debugstr_w(pin->pin.filter->name),
479 debugstr_w(pin->pin.name), peer, mt);
481
482 if (!peer)
483 return E_POINTER;
484
485 IPin_QueryDirection(peer, &dir);
486 if (dir != PINDIR_INPUT)
487 {
488 WARN("Attempt to connect to another source pin, returning VFW_E_INVALID_DIRECTION.\n");
490 }
491
492 EnterCriticalSection(&pin->pin.filter->filter_cs);
493
494 if (pin->pin.peer)
495 {
496 LeaveCriticalSection(&pin->pin.filter->filter_cs);
497 WARN("Pin is already connected, returning VFW_E_ALREADY_CONNECTED.\n");
499 }
500
501 if (pin->pin.filter->state != State_Stopped)
502 {
503 LeaveCriticalSection(&pin->pin.filter->filter_cs);
504 WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
505 return VFW_E_NOT_STOPPED;
506 }
507
508 /* We don't check the subtype here. The rationale (as given by the DirectX
509 * documentation) is that the format type is supposed to provide at least
510 * as much information as the subtype. */
511 if (mt && !IsEqualGUID(&mt->majortype, &GUID_NULL)
512 && !IsEqualGUID(&mt->formattype, &GUID_NULL))
513 {
514 hr = pin->pFuncsTable->pfnAttemptConnection(pin, peer, mt);
515 LeaveCriticalSection(&pin->pin.filter->filter_cs);
516 return hr;
517 }
518
519 if (SUCCEEDED(IPin_EnumMediaTypes(peer, &enummt)))
520 {
521 while (IEnumMediaTypes_Next(enummt, 1, &candidate_ptr, &count) == S_OK)
522 {
523 if (compare_media_types(mt, candidate_ptr)
524 && pin->pFuncsTable->pfnAttemptConnection(pin, peer, candidate_ptr) == S_OK)
525 {
526 LeaveCriticalSection(&pin->pin.filter->filter_cs);
527 DeleteMediaType(candidate_ptr);
528 IEnumMediaTypes_Release(enummt);
529 return S_OK;
530 }
531 DeleteMediaType(candidate_ptr);
532 }
533
534 IEnumMediaTypes_Release(enummt);
535 }
536
537 if (pin->pFuncsTable->base.pin_get_media_type)
538 {
539 for (i = 0; pin->pFuncsTable->base.pin_get_media_type(&pin->pin, i, &candidate) == S_OK; ++i)
540 {
541 strmbase_dump_media_type(&candidate);
542 if (compare_media_types(mt, &candidate)
543 && pin->pFuncsTable->pfnAttemptConnection(pin, peer, &candidate) == S_OK)
544 {
545 LeaveCriticalSection(&pin->pin.filter->filter_cs);
546 FreeMediaType(&candidate);
547 return S_OK;
548 }
549 FreeMediaType(&candidate);
550 }
551 }
552
553 LeaveCriticalSection(&pin->pin.filter->filter_cs);
554
556}
@ PINDIR_INPUT
Definition: axcore.idl:41
static BOOL compare_media_types(const AM_MEDIA_TYPE *req_mt, const AM_MEDIA_TYPE *pin_mt)
Definition: pin.c:448
#define VFW_E_NO_ACCEPTABLE_TYPES
Definition: vfwmsgs.h:46

◆ source_Disconnect()

static HRESULT WINAPI source_Disconnect ( IPin *  iface)
static

Definition at line 568 of file pin.c.

569{
570 HRESULT hr;
572
573 TRACE("pin %p %s:%s.\n", This, debugstr_w(This->pin.filter->name), debugstr_w(This->pin.name));
574
575 EnterCriticalSection(&This->pin.filter->filter_cs);
576 {
577 if (This->pin.filter->state != State_Stopped)
578 {
579 LeaveCriticalSection(&This->pin.filter->filter_cs);
580 WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
581 return VFW_E_NOT_STOPPED;
582 }
583
584 if (This->pFuncsTable->source_disconnect)
585 This->pFuncsTable->source_disconnect(This);
586
587 if (This->pMemInputPin)
588 {
589 IMemInputPin_Release(This->pMemInputPin);
590 This->pMemInputPin = NULL;
591 }
592
593 if (This->pAllocator)
594 {
595 IMemAllocator_Release(This->pAllocator);
596 This->pAllocator = NULL;
597 }
598
599 if (This->pin.peer)
600 {
601 IPin_Release(This->pin.peer);
602 This->pin.peer = NULL;
603 FreeMediaType(&This->pin.mt);
604 ZeroMemory(&This->pin.mt, sizeof(This->pin.mt));
605 hr = S_OK;
606 }
607 else
608 hr = S_FALSE;
609 }
610 LeaveCriticalSection(&This->pin.filter->filter_cs);
611
612 return hr;
613}

◆ source_EndFlush()

static HRESULT WINAPI source_EndFlush ( IPin *  iface)
static

Definition at line 637 of file pin.c.

638{
640
641 WARN("pin %p %s:%s, unexpected call.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
642
643 /* not supposed to do anything in an output pin */
644
645 return E_UNEXPECTED;
646}

◆ source_EndOfStream()

static HRESULT WINAPI source_EndOfStream ( IPin *  iface)
static

Definition at line 615 of file pin.c.

616{
618
619 WARN("pin %p %s:%s, unexpected call.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
620
621 /* not supposed to do anything in an output pin */
622
623 return E_UNEXPECTED;
624}

◆ source_NewSegment()

static HRESULT WINAPI source_NewSegment ( IPin *  iface,
REFERENCE_TIME  start,
REFERENCE_TIME  stop,
double  rate 
)
static

Definition at line 648 of file pin.c.

649{
651
652 TRACE("pin %p %s:%s, start %s, stop %s, rate %.16e.\n", pin, debugstr_w(pin->pin.filter->name),
653 debugstr_w(pin->pin.name), debugstr_time(start), debugstr_time(stop), rate);
654
655 return S_OK;
656}

◆ source_ReceiveConnection()

static HRESULT WINAPI source_ReceiveConnection ( IPin *  iface,
IPin *  peer,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 558 of file pin.c.

559{
561
562 WARN("pin %p %s:%s, peer %p, mt %p, unexpected call.\n", pin,
563 debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name), peer, mt);
564
565 return E_UNEXPECTED;
566}

◆ strmbase_sink_cleanup()

void strmbase_sink_cleanup ( struct strmbase_sink *  pin)

◆ strmbase_sink_init()

void strmbase_sink_init ( struct strmbase_sink *  pin,
struct strmbase_filter *  filter,
const WCHAR *  name,
const struct strmbase_sink_ops *  func_table,
IMemAllocator *  allocator 
)

Definition at line 1168 of file pin.c.

1170{
1171 memset(pin, 0, sizeof(*pin));
1172 pin->pin.IPin_iface.lpVtbl = &sink_vtbl;
1173 pin->pin.filter = filter;
1174 pin->pin.dir = PINDIR_INPUT;
1175 lstrcpyW(pin->pin.name, name);
1176 lstrcpyW(pin->pin.id, name);
1177 pin->pin.ops = &func_table->base;
1178 pin->pFuncsTable = func_table;
1180 if (pin->preferred_allocator)
1181 IMemAllocator_AddRef(pin->preferred_allocator);
1182 pin->IMemInputPin_iface.lpVtbl = &MemInputPin_Vtbl;
1183}
static const IPinVtbl sink_vtbl
Definition: pin.c:1010
static const IMemInputPinVtbl MemInputPin_Vtbl
Definition: pin.c:26
Definition: filter.c:165
Definition: name.c:39
struct strmbase_pin_ops base
Definition: strmbase.h:120
const struct strmbase_sink_ops * pFuncsTable
Definition: strmbase.h:113
IMemAllocator * preferred_allocator
Definition: strmbase.h:111
IMemInputPin IMemInputPin_iface
Definition: strmbase.h:108

Referenced by acm_wrapper_create(), avi_compressor_create(), avi_dec_create(), create_input_pin(), dsound_render_create(), file_writer_create(), sample_grabber_create(), smart_tee_create(), strmbase_renderer_init(), testfilter_init(), and testsink_init().

◆ strmbase_source_cleanup()

void strmbase_source_cleanup ( struct strmbase_source *  pin)

◆ strmbase_source_init()

void strmbase_source_init ( struct strmbase_source *  pin,
struct strmbase_filter *  filter,
const WCHAR *  name,
const struct strmbase_source_ops *  func_table 
)

Definition at line 765 of file pin.c.

767{
768 memset(pin, 0, sizeof(*pin));
769 pin->pin.IPin_iface.lpVtbl = &source_vtbl;
770 pin->pin.filter = filter;
771 pin->pin.dir = PINDIR_OUTPUT;
772 lstrcpyW(pin->pin.name, name);
773 lstrcpyW(pin->pin.id, name);
774 pin->pin.ops = &func_table->base;
775 pin->pFuncsTable = func_table;
776}
static const IPinVtbl source_vtbl
Definition: pin.c:658
struct strmbase_pin_ops base
Definition: strmbase.h:92
const struct strmbase_source_ops * pFuncsTable
Definition: strmbase.h:83

Referenced by acm_wrapper_create(), audio_record_create(), avi_compressor_create(), avi_dec_create(), avi_mux_create(), FileSource_Load(), sample_grabber_create(), smart_tee_create(), testfilter_init(), and vfw_capture_create().

◆ 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 235 of file pin.c.

236{
237 if (FAILED( original ) || new == E_NOTIMPL)
238 return original;
239
240 if (FAILED( new ) || original == S_OK)
241 return new;
242
243 return original;
244}

Referenced by SendFurther().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ enum_media_types_vtbl

static const IEnumMediaTypesVtbl enum_media_types_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI enum_media_types_Release(IEnumMediaTypes *iface)
Definition: pin.c:104
static HRESULT WINAPI enum_media_types_QueryInterface(IEnumMediaTypes *iface, REFIID iid, void **out)
Definition: pin.c:80
static HRESULT WINAPI enum_media_types_Reset(IEnumMediaTypes *iface)
Definition: pin.c:179
static ULONG WINAPI enum_media_types_AddRef(IEnumMediaTypes *iface)
Definition: pin.c:96
static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count, AM_MEDIA_TYPE **mts, ULONG *ret_count)
Definition: pin.c:118
static HRESULT WINAPI enum_media_types_Clone(IEnumMediaTypes *iface, IEnumMediaTypes **out)
Definition: pin.c:201
static HRESULT WINAPI enum_media_types_Skip(IEnumMediaTypes *iface, ULONG count)
Definition: pin.c:168

Definition at line 39 of file pin.c.

Referenced by enum_media_types_create().

◆ MemInputPin_Vtbl

static const IMemInputPinVtbl MemInputPin_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin *iface)
Definition: pin.c:1146
static HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed)
Definition: pin.c:1132
static ULONG WINAPI MemInputPin_AddRef(IMemInputPin *iface)
Definition: pin.c:1046
static HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin *iface, REFIID riid, LPVOID *ppv)
Definition: pin.c:1039
static ULONG WINAPI MemInputPin_Release(IMemInputPin *iface)
Definition: pin.c:1053
static HRESULT WINAPI MemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
Definition: pin.c:1115
static HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly)
Definition: pin.c:1074
static HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin *iface, IMemAllocator **ppAllocator)
Definition: pin.c:1060
static HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin *iface, ALLOCATOR_PROPERTIES *props)
Definition: pin.c:1103

Definition at line 26 of file pin.c.

Referenced by strmbase_sink_init().

◆ sink_vtbl

const IPinVtbl sink_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI pin_Release(IPin *iface)
Definition: pin.c:298
static HRESULT WINAPI pin_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
Definition: pin.c:369
static HRESULT WINAPI pin_QueryInterface(IPin *iface, REFIID iid, void **out)
Definition: pin.c:268
static HRESULT WINAPI pin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *count)
Definition: pin.c:431
static HRESULT WINAPI sink_BeginFlush(IPin *iface)
Definition: pin.c:933
static HRESULT WINAPI pin_ConnectionMediaType(IPin *iface, AM_MEDIA_TYPE *pmt)
Definition: pin.c:330
static HRESULT WINAPI sink_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:791
static ULONG WINAPI pin_AddRef(IPin *iface)
Definition: pin.c:292
static HRESULT WINAPI sink_Disconnect(IPin *iface)
Definition: pin.c:857
static HRESULT WINAPI pin_QueryPinInfo(IPin *iface, PIN_INFO *info)
Definition: pin.c:356
static HRESULT WINAPI pin_ConnectedTo(IPin *iface, IPin **ppPin)
Definition: pin.c:304
static HRESULT WINAPI pin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *mt)
Definition: pin.c:401
static HRESULT WINAPI sink_NewSegment(IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
Definition: pin.c:992
static HRESULT WINAPI pin_QueryId(IPin *iface, WCHAR **id)
Definition: pin.c:380
static HRESULT WINAPI sink_EndOfStream(IPin *iface)
Definition: pin.c:903
static HRESULT WINAPI sink_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
Definition: pin.c:802
static HRESULT WINAPI sink_EndFlush(IPin *iface)
Definition: pin.c:959
static HRESULT WINAPI pin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_media_types)
Definition: pin.c:411

Definition at line 1010 of file pin.c.

Referenced by strmbase_sink_init().

◆ source_vtbl

const IPinVtbl source_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI source_NewSegment(IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
Definition: pin.c:648
static HRESULT WINAPI source_EndFlush(IPin *iface)
Definition: pin.c:637
static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:468
static HRESULT WINAPI source_Disconnect(IPin *iface)
Definition: pin.c:568
static HRESULT WINAPI source_ReceiveConnection(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:558
static HRESULT WINAPI source_BeginFlush(IPin *iface)
Definition: pin.c:626
static HRESULT WINAPI source_EndOfStream(IPin *iface)
Definition: pin.c:615

Definition at line 658 of file pin.c.

Referenced by strmbase_source_init().