wininet: Add tests for passing invalid parameters into InternetTimeFromSystemTimeA/W.
[wine/hacks.git] / dlls / quartz / pin.h
blob3a9719cd2240d860ca9739ff2e7b3c4f7e3f9e20
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 * Cookie is the cookie that was set when requesting the buffer, if you don't
25 * implement custom requesting, you can safely ignore this
27 typedef HRESULT (* SAMPLEPROC_PUSH)(LPVOID userdata, IMediaSample * pSample);
28 typedef HRESULT (* SAMPLEPROC_PULL)(LPVOID userdata, IMediaSample * pSample, DWORD_PTR cookie);
30 /* This function will determine whether a type is supported or not.
31 * It is allowed to return any error value (within reason), as opposed
32 * to IPin::QueryAccept which is only allowed to return S_OK or S_FALSE.
34 typedef HRESULT (* QUERYACCEPTPROC)(LPVOID userdata, const AM_MEDIA_TYPE * pmt);
36 /* This function is called prior to finalizing a connection with
37 * another pin and can be used to get things from the other pin
38 * like IMemInput interfaces.
40 * props contains some defaults, but you can safely override them to your liking
42 typedef HRESULT (* PRECONNECTPROC)(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props);
44 /* This function is called whenever a cleanup operation has to occur,
45 * this is usually after a flush, seek, or end of stream notification.
46 * This code may even be repeated multiple times, so build your code to
47 * tolerate this behavior. Return value is ignored and should be S_OK.
49 typedef HRESULT (* CLEANUPPROC) (LPVOID userdata);
51 /* This function is called whenever a request for a new sample is made,
52 * If you implement it (it can be NULL for default behavior), you have to
53 * call IMemAllocator_GetBuffer and IMemAllocator_RequestBuffer
54 * This is useful if you want to request more than 1 buffer at simultaneously
56 * This will also cause the Sample Proc to be called with empty buffers to indicate
57 * failure in retrieving the sample.
59 typedef HRESULT (* REQUESTPROC) (LPVOID userdata);
61 /* This function is called after processing is done (for whatever reason that is caused)
62 * This is useful if you create processing threads that need to die
64 typedef HRESULT (* STOPPROCESSPROC) (LPVOID userdata);
66 #define ALIGNDOWN(value,boundary) ((value)/(boundary)*(boundary))
67 #define ALIGNUP(value,boundary) (ALIGNDOWN((value)+(boundary)-1, (boundary)))
69 typedef struct IPinImpl
71 const struct IPinVtbl * lpVtbl;
72 LONG refCount;
73 LPCRITICAL_SECTION pCritSec;
74 PIN_INFO pinInfo;
75 IPin * pConnectedTo;
76 AM_MEDIA_TYPE mtCurrent;
77 ENUMMEDIADETAILS enumMediaDetails;
78 QUERYACCEPTPROC fnQueryAccept;
79 LPVOID pUserData;
80 } IPinImpl;
82 typedef struct InputPin
84 /* inheritance C style! */
85 IPinImpl pin;
87 const IMemInputPinVtbl * lpVtblMemInput;
88 IMemAllocator * pAllocator;
89 SAMPLEPROC_PUSH fnSampleProc;
90 CLEANUPPROC fnCleanProc;
91 REFERENCE_TIME tStart;
92 REFERENCE_TIME tStop;
93 double dRate;
94 BOOL flushing, end_of_stream;
95 IMemAllocator *preferred_allocator;
96 } InputPin;
98 typedef struct OutputPin
100 /* inheritance C style! */
101 IPinImpl pin;
103 IMemInputPin * pMemInputPin;
104 HRESULT (* pConnectSpecific)(IPin * iface, IPin * pReceiver, const AM_MEDIA_TYPE * pmt);
105 BOOL custom_allocator;
106 IMemAllocator *alloc;
107 BOOL readonly;
108 ALLOCATOR_PROPERTIES allocProps;
109 } OutputPin;
111 typedef struct PullPin
113 /* inheritance C style! */
114 IPinImpl pin;
116 REFERENCE_TIME rtStart, rtCurrent, rtNext, rtStop;
117 IAsyncReader * pReader;
118 IMemAllocator * pAlloc;
119 SAMPLEPROC_PULL fnSampleProc;
120 PRECONNECTPROC fnPreConnect;
121 REQUESTPROC fnCustomRequest;
122 CLEANUPPROC fnCleanProc;
123 STOPPROCESSPROC fnDone;
124 double dRate;
125 BOOL stop_playback;
126 DWORD cbAlign;
128 /* Any code that touches the thread must hold the thread lock,
129 * lock order: thread_lock and then the filter critical section
130 * also signal thread_sleepy so the thread knows to wake up
132 CRITICAL_SECTION thread_lock;
133 HANDLE hThread;
134 DWORD requested_state;
135 HANDLE hEventStateChanged, thread_sleepy;
136 DWORD state;
137 } PullPin;
139 #define Req_Sleepy 0
140 #define Req_Die 1
141 #define Req_Run 2
142 #define Req_Pause 3
144 /*** Constructors ***/
145 HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PUSH pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
146 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);
147 HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, STOPPROCESSPROC, REQUESTPROC pCustomRequest, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
149 /**************************/
150 /*** Pin Implementation ***/
152 /* Common */
153 ULONG WINAPI IPinImpl_AddRef(IPin * iface);
154 HRESULT WINAPI IPinImpl_Disconnect(IPin * iface);
155 HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
156 HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
157 HRESULT WINAPI IPinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
158 HRESULT WINAPI IPinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
159 HRESULT WINAPI IPinImpl_QueryId(IPin * iface, LPWSTR * Id);
160 HRESULT WINAPI IPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
161 HRESULT WINAPI IPinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
162 HRESULT WINAPI IPinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
164 /* Input Pin */
165 HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
166 ULONG WINAPI InputPin_Release(IPin * iface);
167 HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
168 HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
169 HRESULT WINAPI InputPin_EndOfStream(IPin * iface);
170 HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
171 HRESULT WINAPI InputPin_EndFlush(IPin * iface);
172 HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
174 /* Output Pin */
175 HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
176 ULONG WINAPI OutputPin_Release(IPin * iface);
177 HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
178 HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
179 HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
180 HRESULT WINAPI OutputPin_EndOfStream(IPin * iface);
181 HRESULT WINAPI OutputPin_BeginFlush(IPin * iface);
182 HRESULT WINAPI OutputPin_EndFlush(IPin * iface);
183 HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
185 HRESULT OutputPin_CommitAllocator(OutputPin * This);
186 HRESULT OutputPin_DecommitAllocator(OutputPin * This);
187 HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
188 HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
189 HRESULT OutputPin_DeliverDisconnect(OutputPin * This);
190 HRESULT OutputPin_DeliverNewSegment(OutputPin * This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
192 /**********************************/
193 /*** MemInputPin Implementation ***/
195 HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv);
196 ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface);
197 ULONG WINAPI MemInputPin_Release(IMemInputPin * iface);
198 HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator);
199 HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly);
200 HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps);
201 HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample);
202 HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed);
203 HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface);
205 /* Pull Pin */
206 HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
207 HRESULT WINAPI PullPin_Disconnect(IPin * iface);
208 HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
209 ULONG WINAPI PullPin_Release(IPin * iface);
210 HRESULT WINAPI PullPin_EndOfStream(IPin * iface);
211 HRESULT WINAPI PullPin_BeginFlush(IPin * iface);
212 HRESULT WINAPI PullPin_EndFlush(IPin * iface);
213 HRESULT WINAPI PullPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
215 /* Thread interaction functions: Hold the thread_lock before calling them */
216 HRESULT PullPin_StartProcessing(PullPin * This);
217 HRESULT PullPin_PauseProcessing(PullPin * This);
218 HRESULT PullPin_WaitForStateChange(PullPin * This, DWORD dwMilliseconds);