2 * IPin function declarations to allow inheritance
4 * Copyright 2003 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 /* This function will process incoming samples to the pin.
22 * Any return value valid in IMemInputPin::Receive is allowed here
24 typedef HRESULT (* SAMPLEPROC
)(LPVOID userdata
, IMediaSample
* pSample
);
26 /* This function will determine whether a type is supported or not.
27 * It is allowed to return any error value (within reason), as opposed
28 * to IPin::QueryAccept which is only allowed to return S_OK or S_FALSE.
30 typedef HRESULT (* QUERYACCEPTPROC
)(LPVOID userdata
, const AM_MEDIA_TYPE
* pmt
);
32 /* This function is called prior to finalizing a connection with
33 * another pin and can be used to get things from the other pin
34 * like IMemInput interfaces.
36 typedef HRESULT (* PRECONNECTPROC
)(IPin
* iface
, IPin
* pConnectPin
);
38 typedef struct IPinImpl
40 const struct IPinVtbl
* lpVtbl
;
42 LPCRITICAL_SECTION pCritSec
;
45 AM_MEDIA_TYPE mtCurrent
;
46 ENUMMEDIADETAILS enumMediaDetails
;
47 QUERYACCEPTPROC fnQueryAccept
;
51 typedef struct InputPin
53 /* inheritance C style! */
56 const IMemInputPinVtbl
* lpVtblMemInput
;
57 IMemAllocator
* pAllocator
;
58 SAMPLEPROC fnSampleProc
;
59 REFERENCE_TIME tStart
;
64 typedef struct OutputPin
66 /* inheritance C style! */
69 IMemInputPin
* pMemInputPin
;
70 HRESULT (* pConnectSpecific
)(IPin
* iface
, IPin
* pReceiver
, const AM_MEDIA_TYPE
* pmt
);
71 ALLOCATOR_PROPERTIES allocProps
;
74 typedef struct PullPin
76 /* inheritance C style! */
79 IAsyncReader
* pReader
;
80 IMemAllocator
* pAlloc
;
81 SAMPLEPROC fnSampleProc
;
82 PRECONNECTPROC fnPreConnect
;
84 HANDLE hEventStateChanged
;
85 REFERENCE_TIME rtStart
;
86 REFERENCE_TIME rtStop
;
87 REFERENCE_TIME rtCurrent
;
90 /*** Initializers ***/
91 HRESULT
InputPin_Init(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, InputPin
* pPinImpl
);
92 HRESULT
OutputPin_Init(const PIN_INFO
* pPinInfo
, const ALLOCATOR_PROPERTIES
*props
, LPVOID pUserData
,
93 QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, OutputPin
* pPinImpl
);
94 HRESULT
PullPin_Init(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, PullPin
* pPinImpl
);
96 /*** Constructors ***/
97 HRESULT
InputPin_Construct(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
);
98 HRESULT
OutputPin_Construct(const PIN_INFO
* pPinInfo
, ALLOCATOR_PROPERTIES
*props
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
);
99 HRESULT
PullPin_Construct(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
);
101 /**************************/
102 /*** Pin Implementation ***/
105 ULONG WINAPI
IPinImpl_AddRef(IPin
* iface
);
106 HRESULT WINAPI
IPinImpl_Disconnect(IPin
* iface
);
107 HRESULT WINAPI
IPinImpl_ConnectedTo(IPin
* iface
, IPin
** ppPin
);
108 HRESULT WINAPI
IPinImpl_ConnectionMediaType(IPin
* iface
, AM_MEDIA_TYPE
* pmt
);
109 HRESULT WINAPI
IPinImpl_QueryPinInfo(IPin
* iface
, PIN_INFO
* pInfo
);
110 HRESULT WINAPI
IPinImpl_QueryDirection(IPin
* iface
, PIN_DIRECTION
* pPinDir
);
111 HRESULT WINAPI
IPinImpl_QueryId(IPin
* iface
, LPWSTR
* Id
);
112 HRESULT WINAPI
IPinImpl_QueryAccept(IPin
* iface
, const AM_MEDIA_TYPE
* pmt
);
113 HRESULT WINAPI
IPinImpl_EnumMediaTypes(IPin
* iface
, IEnumMediaTypes
** ppEnum
);
114 HRESULT WINAPI
IPinImpl_QueryInternalConnections(IPin
* iface
, IPin
** apPin
, ULONG
* cPin
);
117 HRESULT WINAPI
InputPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
);
118 ULONG WINAPI
InputPin_Release(IPin
* iface
);
119 HRESULT WINAPI
InputPin_Connect(IPin
* iface
, IPin
* pConnector
, const AM_MEDIA_TYPE
* pmt
);
120 HRESULT WINAPI
InputPin_ReceiveConnection(IPin
* iface
, IPin
* pReceivePin
, const AM_MEDIA_TYPE
* pmt
);
121 HRESULT WINAPI
InputPin_EndOfStream(IPin
* iface
);
122 HRESULT WINAPI
InputPin_BeginFlush(IPin
* iface
);
123 HRESULT WINAPI
InputPin_EndFlush(IPin
* iface
);
124 HRESULT WINAPI
InputPin_NewSegment(IPin
* iface
, REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
127 HRESULT WINAPI
OutputPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
);
128 ULONG WINAPI
OutputPin_Release(IPin
* iface
);
129 HRESULT WINAPI
OutputPin_Connect(IPin
* iface
, IPin
* pReceivePin
, const AM_MEDIA_TYPE
* pmt
);
130 HRESULT WINAPI
OutputPin_Disconnect(IPin
* iface
);
131 HRESULT WINAPI
OutputPin_ReceiveConnection(IPin
* iface
, IPin
* pReceivePin
, const AM_MEDIA_TYPE
* pmt
);
132 HRESULT WINAPI
OutputPin_EndOfStream(IPin
* iface
);
133 HRESULT WINAPI
OutputPin_BeginFlush(IPin
* iface
);
134 HRESULT WINAPI
OutputPin_EndFlush(IPin
* iface
);
135 HRESULT WINAPI
OutputPin_NewSegment(IPin
* iface
, REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
137 HRESULT
OutputPin_CommitAllocator(OutputPin
* This
);
138 HRESULT
OutputPin_GetDeliveryBuffer(OutputPin
* This
, IMediaSample
** ppSample
, REFERENCE_TIME
* tStart
, REFERENCE_TIME
* tStop
, DWORD dwFlags
);
139 HRESULT
OutputPin_SendSample(OutputPin
* This
, IMediaSample
* pSample
);
140 HRESULT
OutputPin_DeliverDisconnect(OutputPin
* This
);
141 HRESULT
OutputPin_DeliverNewSegment(OutputPin
* This
, REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
143 /**********************************/
144 /*** MemInputPin Implementation ***/
146 HRESULT WINAPI
MemInputPin_QueryInterface(IMemInputPin
* iface
, REFIID riid
, LPVOID
* ppv
);
147 ULONG WINAPI
MemInputPin_AddRef(IMemInputPin
* iface
);
148 ULONG WINAPI
MemInputPin_Release(IMemInputPin
* iface
);
149 HRESULT WINAPI
MemInputPin_GetAllocator(IMemInputPin
* iface
, IMemAllocator
** ppAllocator
);
150 HRESULT WINAPI
MemInputPin_NotifyAllocator(IMemInputPin
* iface
, IMemAllocator
* pAllocator
, BOOL bReadOnly
);
151 HRESULT WINAPI
MemInputPin_GetAllocatorRequirements(IMemInputPin
* iface
, ALLOCATOR_PROPERTIES
* pProps
);
152 HRESULT WINAPI
MemInputPin_Receive(IMemInputPin
* iface
, IMediaSample
* pSample
);
153 HRESULT WINAPI
MemInputPin_ReceiveMultiple(IMemInputPin
* iface
, IMediaSample
** pSamples
, long nSamples
, long *nSamplesProcessed
);
154 HRESULT WINAPI
MemInputPin_ReceiveCanBlock(IMemInputPin
* iface
);
157 HRESULT WINAPI
PullPin_ReceiveConnection(IPin
* iface
, IPin
* pReceivePin
, const AM_MEDIA_TYPE
* pmt
);
158 HRESULT WINAPI
PullPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
);
159 ULONG WINAPI
PullPin_Release(IPin
* iface
);
160 HRESULT
PullPin_InitProcessing(PullPin
* This
);
161 HRESULT
PullPin_StartProcessing(PullPin
* This
);
162 HRESULT
PullPin_StopProcessing(PullPin
* This
);
163 HRESULT
PullPin_PauseProcessing(PullPin
* This
);
164 HRESULT
PullPin_Seek(PullPin
* This
, REFERENCE_TIME rtStart
, REFERENCE_TIME rtStop
);
165 HRESULT WINAPI
PullPin_EndOfStream(IPin
* iface
);
166 HRESULT WINAPI
PullPin_BeginFlush(IPin
* iface
);
167 HRESULT WINAPI
PullPin_EndFlush(IPin
* iface
);
168 HRESULT WINAPI
PullPin_NewSegment(IPin
* iface
, REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
169 HRESULT
PullPin_WaitForStateChange(PullPin
* This
, DWORD dwMilliseconds
);