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;
93 /*** Initializers ***/
94 HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, InputPin * pPinImpl);
95 HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, const ALLOCATOR_PROPERTIES *props, LPVOID pUserData,
96 QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, OutputPin * pPinImpl);
97 HRESULT PullPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, PullPin * pPinImpl);
99 /*** Constructors ***/
100 HRESULT InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
101 HRESULT OutputPin_Construct(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
102 HRESULT PullPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
104 /**************************/
105 /*** Pin Implementation ***/
108 ULONG WINAPI IPinImpl_AddRef(IPin * iface);
109 HRESULT WINAPI IPinImpl_Disconnect(IPin * iface);
110 HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
111 HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
112 HRESULT WINAPI IPinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
113 HRESULT WINAPI IPinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
114 HRESULT WINAPI IPinImpl_QueryId(IPin * iface, LPWSTR * Id);
115 HRESULT WINAPI IPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
116 HRESULT WINAPI IPinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
117 HRESULT WINAPI IPinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
120 HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
121 ULONG WINAPI InputPin_Release(IPin * iface);
122 HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
123 HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
124 HRESULT WINAPI InputPin_EndOfStream(IPin * iface);
125 HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
126 HRESULT WINAPI InputPin_EndFlush(IPin * iface);
127 HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
130 HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
131 ULONG WINAPI OutputPin_Release(IPin * iface);
132 HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
133 HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
134 HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
135 HRESULT WINAPI OutputPin_EndOfStream(IPin * iface);
136 HRESULT WINAPI OutputPin_BeginFlush(IPin * iface);
137 HRESULT WINAPI OutputPin_EndFlush(IPin * iface);
138 HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
140 HRESULT OutputPin_CommitAllocator(OutputPin * This);
141 HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
142 HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
143 HRESULT OutputPin_DeliverDisconnect(OutputPin * This);
144 HRESULT OutputPin_DeliverNewSegment(OutputPin * This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
146 /**********************************/
147 /*** MemInputPin Implementation ***/
149 HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv);
150 ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface);
151 ULONG WINAPI MemInputPin_Release(IMemInputPin * iface);
152 HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator);
153 HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly);
154 HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps);
155 HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample);
156 HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed);
157 HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface);
160 HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
161 HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
162 ULONG WINAPI PullPin_Release(IPin * iface);
163 HRESULT PullPin_InitProcessing(PullPin * This);
164 HRESULT PullPin_StartProcessing(PullPin * This);
165 HRESULT PullPin_StopProcessing(PullPin * This);
166 HRESULT PullPin_PauseProcessing(PullPin * This);
167 HRESULT WINAPI PullPin_EndOfStream(IPin * iface);
168 HRESULT WINAPI PullPin_BeginFlush(IPin * iface);
169 HRESULT WINAPI PullPin_EndFlush(IPin * iface);
170 HRESULT WINAPI PullPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
171 HRESULT PullPin_WaitForStateChange(PullPin * This, DWORD dwMilliseconds);