quartz: Handle flushing and end of stream notifications for input pins.
[wine/wine-kai.git] / dlls / quartz / pin.h
blobf97a33dce20f0761252625a846357e848411ceb4
1 /*
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 /* This function is called whenever a cleanup operation has to occur,
39 * this is usually after a flush, seek, or end of stream notification.
40 * This code may even be repeated multiple times, so build your code to
41 * tolerate this behavior. Return value is ignored and should be S_OK.
43 typedef HRESULT (* CLEANUPPROC) (LPVOID userdata);
45 typedef struct IPinImpl
47 const struct IPinVtbl * lpVtbl;
48 LONG refCount;
49 LPCRITICAL_SECTION pCritSec;
50 PIN_INFO pinInfo;
51 IPin * pConnectedTo;
52 AM_MEDIA_TYPE mtCurrent;
53 ENUMMEDIADETAILS enumMediaDetails;
54 QUERYACCEPTPROC fnQueryAccept;
55 LPVOID pUserData;
56 } IPinImpl;
58 typedef struct InputPin
60 /* inheritance C style! */
61 IPinImpl pin;
63 const IMemInputPinVtbl * lpVtblMemInput;
64 IMemAllocator * pAllocator;
65 SAMPLEPROC fnSampleProc;
66 CLEANUPPROC fnCleanProc;
67 REFERENCE_TIME tStart;
68 REFERENCE_TIME tStop;
69 double dRate;
70 BOOL flushing, end_of_stream;
71 } InputPin;
73 typedef struct OutputPin
75 /* inheritance C style! */
76 IPinImpl pin;
78 IMemInputPin * pMemInputPin;
79 HRESULT (* pConnectSpecific)(IPin * iface, IPin * pReceiver, const AM_MEDIA_TYPE * pmt);
80 ALLOCATOR_PROPERTIES allocProps;
81 } OutputPin;
83 typedef struct PullPin
85 /* inheritance C style! */
86 IPinImpl pin;
88 IAsyncReader * pReader;
89 IMemAllocator * pAlloc;
90 SAMPLEPROC fnSampleProc;
91 PRECONNECTPROC fnPreConnect;
92 HANDLE hThread;
93 HANDLE hEventStateChanged;
94 CLEANUPPROC fnCleanProc;
95 REFERENCE_TIME rtStart;
96 REFERENCE_TIME rtStop;
97 REFERENCE_TIME rtCurrent;
98 double dRate;
99 FILTER_STATE state;
100 BOOL stop_playback;
101 } PullPin;
103 /*** Constructors ***/
104 HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
105 HRESULT OutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, long outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
106 HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
108 /**************************/
109 /*** Pin Implementation ***/
111 /* Common */
112 ULONG WINAPI IPinImpl_AddRef(IPin * iface);
113 HRESULT WINAPI IPinImpl_Disconnect(IPin * iface);
114 HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
115 HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
116 HRESULT WINAPI IPinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
117 HRESULT WINAPI IPinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
118 HRESULT WINAPI IPinImpl_QueryId(IPin * iface, LPWSTR * Id);
119 HRESULT WINAPI IPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
120 HRESULT WINAPI IPinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
121 HRESULT WINAPI IPinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
123 /* Input Pin */
124 HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
125 ULONG WINAPI InputPin_Release(IPin * iface);
126 HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
127 HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
128 HRESULT WINAPI InputPin_EndOfStream(IPin * iface);
129 HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
130 HRESULT WINAPI InputPin_EndFlush(IPin * iface);
131 HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
133 /* Output Pin */
134 HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
135 ULONG WINAPI OutputPin_Release(IPin * iface);
136 HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
137 HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
138 HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
139 HRESULT WINAPI OutputPin_EndOfStream(IPin * iface);
140 HRESULT WINAPI OutputPin_BeginFlush(IPin * iface);
141 HRESULT WINAPI OutputPin_EndFlush(IPin * iface);
142 HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
144 HRESULT OutputPin_CommitAllocator(OutputPin * This);
145 HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
146 HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
147 HRESULT OutputPin_DeliverDisconnect(OutputPin * This);
148 HRESULT OutputPin_DeliverNewSegment(OutputPin * This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
150 /**********************************/
151 /*** MemInputPin Implementation ***/
153 HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv);
154 ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface);
155 ULONG WINAPI MemInputPin_Release(IMemInputPin * iface);
156 HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator);
157 HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly);
158 HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps);
159 HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample);
160 HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed);
161 HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface);
163 /* Pull Pin */
164 HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
165 HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
166 ULONG WINAPI PullPin_Release(IPin * iface);
167 HRESULT PullPin_InitProcessing(PullPin * This);
168 HRESULT PullPin_StartProcessing(PullPin * This);
169 HRESULT PullPin_StopProcessing(PullPin * This);
170 HRESULT PullPin_PauseProcessing(PullPin * This);
171 HRESULT WINAPI PullPin_EndOfStream(IPin * iface);
172 HRESULT WINAPI PullPin_BeginFlush(IPin * iface);
173 HRESULT WINAPI PullPin_EndFlush(IPin * iface);
174 HRESULT WINAPI PullPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
175 HRESULT PullPin_WaitForStateChange(PullPin * This, DWORD dwMilliseconds);