push 6fe5edf8439c19d3885814583531c2f2b1495177
[wine/hacks.git] / dlls / quartz / pin.h
blob19c524681927f13e8ff7b7da6ecc442a76e14025
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;
102 /* Any code that touches the thread must hold the thread lock,
103 * lock order: thread_lock and then the filter critical section
105 CRITICAL_SECTION thread_lock;
106 } PullPin;
108 /*** Constructors ***/
109 HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
110 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);
111 HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
113 /**************************/
114 /*** Pin Implementation ***/
116 /* Common */
117 ULONG WINAPI IPinImpl_AddRef(IPin * iface);
118 HRESULT WINAPI IPinImpl_Disconnect(IPin * iface);
119 HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
120 HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
121 HRESULT WINAPI IPinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
122 HRESULT WINAPI IPinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
123 HRESULT WINAPI IPinImpl_QueryId(IPin * iface, LPWSTR * Id);
124 HRESULT WINAPI IPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
125 HRESULT WINAPI IPinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
126 HRESULT WINAPI IPinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
128 /* Input Pin */
129 HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
130 ULONG WINAPI InputPin_Release(IPin * iface);
131 HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
132 HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
133 HRESULT WINAPI InputPin_EndOfStream(IPin * iface);
134 HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
135 HRESULT WINAPI InputPin_EndFlush(IPin * iface);
136 HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
138 /* Output Pin */
139 HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
140 ULONG WINAPI OutputPin_Release(IPin * iface);
141 HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
142 HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
143 HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
144 HRESULT WINAPI OutputPin_EndOfStream(IPin * iface);
145 HRESULT WINAPI OutputPin_BeginFlush(IPin * iface);
146 HRESULT WINAPI OutputPin_EndFlush(IPin * iface);
147 HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
149 HRESULT OutputPin_CommitAllocator(OutputPin * This);
150 HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
151 HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
152 HRESULT OutputPin_DeliverDisconnect(OutputPin * This);
153 HRESULT OutputPin_DeliverNewSegment(OutputPin * This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
155 /**********************************/
156 /*** MemInputPin Implementation ***/
158 HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv);
159 ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface);
160 ULONG WINAPI MemInputPin_Release(IMemInputPin * iface);
161 HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator);
162 HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly);
163 HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps);
164 HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample);
165 HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed);
166 HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface);
168 /* Pull Pin */
169 HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
170 HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
171 ULONG WINAPI PullPin_Release(IPin * iface);
172 HRESULT WINAPI PullPin_EndOfStream(IPin * iface);
173 HRESULT WINAPI PullPin_BeginFlush(IPin * iface);
174 HRESULT WINAPI PullPin_EndFlush(IPin * iface);
175 HRESULT WINAPI PullPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
177 /* Thread interaction functions: Hold the thread_lock before calling them */
178 HRESULT PullPin_InitProcessing(PullPin * This);
179 HRESULT PullPin_StartProcessing(PullPin * This);
180 HRESULT PullPin_StopProcessing(PullPin * This);
181 HRESULT PullPin_PauseProcessing(PullPin * This);
182 HRESULT PullPin_WaitForStateChange(PullPin * This, DWORD dwMilliseconds);