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