quartz: Store the current reference time with the PullPin.
[wine] / dlls / quartz / pin.h
1 /*
2  * IPin function declarations to allow inheritance
3  *
4  * Copyright 2003 Robert Shearman
5  *
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.
10  *
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.
15  *
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
19  */
20
21 /* This function will process incoming samples to the pin.
22  * Any return value valid in IMemInputPin::Receive is allowed here
23  */
24 typedef HRESULT (* SAMPLEPROC)(LPVOID userdata, IMediaSample * pSample);
25
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.
29  */
30 typedef HRESULT (* QUERYACCEPTPROC)(LPVOID userdata, const AM_MEDIA_TYPE * pmt);
31
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.
35  */
36 typedef HRESULT (* PRECONNECTPROC)(IPin * iface, IPin * pConnectPin);
37
38 typedef struct IPinImpl
39 {
40         const struct IPinVtbl * lpVtbl;
41         LONG refCount;
42         LPCRITICAL_SECTION pCritSec;
43         PIN_INFO pinInfo;
44         IPin * pConnectedTo;
45         AM_MEDIA_TYPE mtCurrent;
46         ENUMMEDIADETAILS enumMediaDetails;
47         QUERYACCEPTPROC fnQueryAccept;
48         LPVOID pUserData;
49 } IPinImpl;
50
51 typedef struct InputPin
52 {
53         /* inheritance C style! */
54         IPinImpl pin;
55
56         const IMemInputPinVtbl * lpVtblMemInput;
57         IMemAllocator * pAllocator;
58         SAMPLEPROC fnSampleProc;
59         REFERENCE_TIME tStart;
60         REFERENCE_TIME tStop;
61         double dRate;
62 } InputPin;
63
64 typedef struct OutputPin
65 {
66         /* inheritance C style! */
67         IPinImpl pin;
68
69         IMemInputPin * pMemInputPin;
70         HRESULT (* pConnectSpecific)(IPin * iface, IPin * pReceiver, const AM_MEDIA_TYPE * pmt);
71         ALLOCATOR_PROPERTIES allocProps;
72 } OutputPin;
73
74 typedef struct PullPin
75 {
76         /* inheritance C style! */
77         IPinImpl pin;
78
79         IAsyncReader * pReader;
80         IMemAllocator * pAlloc;
81         SAMPLEPROC fnSampleProc;
82         PRECONNECTPROC fnPreConnect;
83         HANDLE hThread;
84         HANDLE hEventStateChanged;
85         REFERENCE_TIME rtStart;
86         REFERENCE_TIME rtStop;
87         REFERENCE_TIME rtCurrent;
88 } PullPin;
89
90 /*** Initializers ***/
91 HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, InputPin * pPinImpl);
92 HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, OutputPin * pPinImpl);
93 HRESULT PullPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, PullPin * pPinImpl);
94
95 /*** Constructors ***/
96 HRESULT InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
97 HRESULT OutputPin_Construct(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
98 HRESULT PullPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
99
100 /**************************/
101 /*** Pin Implementation ***/
102
103 /* Common */
104 ULONG   WINAPI IPinImpl_AddRef(IPin * iface);
105 HRESULT WINAPI IPinImpl_Disconnect(IPin * iface);
106 HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
107 HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
108 HRESULT WINAPI IPinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
109 HRESULT WINAPI IPinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
110 HRESULT WINAPI IPinImpl_QueryId(IPin * iface, LPWSTR * Id);
111 HRESULT WINAPI IPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
112 HRESULT WINAPI IPinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
113 HRESULT WINAPI IPinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
114
115 /* Input Pin */
116 HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
117 ULONG   WINAPI InputPin_Release(IPin * iface);
118 HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
119 HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
120 HRESULT WINAPI InputPin_EndOfStream(IPin * iface);
121 HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
122 HRESULT WINAPI InputPin_EndFlush(IPin * iface);
123 HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
124
125 /* Output Pin */
126 HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
127 ULONG   WINAPI OutputPin_Release(IPin * iface);
128 HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
129 HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
130 HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
131 HRESULT WINAPI OutputPin_EndOfStream(IPin * iface);
132 HRESULT WINAPI OutputPin_BeginFlush(IPin * iface);
133 HRESULT WINAPI OutputPin_EndFlush(IPin * iface);
134 HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
135
136 HRESULT OutputPin_CommitAllocator(OutputPin * This);
137 HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
138 HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
139 HRESULT OutputPin_DeliverDisconnect(OutputPin * This);
140 HRESULT OutputPin_DeliverNewSegment(OutputPin * This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
141
142 /**********************************/
143 /*** MemInputPin Implementation ***/
144
145 HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv);
146 ULONG   WINAPI MemInputPin_AddRef(IMemInputPin * iface);
147 ULONG   WINAPI MemInputPin_Release(IMemInputPin * iface);
148 HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator);
149 HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly);
150 HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps);
151 HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample);
152 HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed);
153 HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface);
154
155 /* Pull Pin */
156 HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
157 HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
158 ULONG   WINAPI PullPin_Release(IPin * iface);
159 HRESULT PullPin_InitProcessing(PullPin * This);
160 HRESULT PullPin_StartProcessing(PullPin * This);
161 HRESULT PullPin_StopProcessing(PullPin * This);
162 HRESULT PullPin_PauseProcessing(PullPin * This);
163 HRESULT PullPin_Seek(PullPin * This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
164 HRESULT WINAPI PullPin_EndOfStream(IPin * iface);
165 HRESULT WINAPI PullPin_BeginFlush(IPin * iface);
166 HRESULT WINAPI PullPin_EndFlush(IPin * iface);
167 HRESULT WINAPI PullPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
168 HRESULT PullPin_WaitForStateChange(PullPin * This, DWORD dwMilliseconds);