When including 'wine/port.h', include it first.
[wine] / dlls / quartz / basefilt.h
1 #ifndef WINE_DSHOW_BASEFILT_H
2 #define WINE_DSHOW_BASEFILT_H
3
4 /*
5  * The following interfaces must be used as a part of aggregation.
6  * The punkControl must not be NULL since all IUnknown methods are
7  * implemented only for aggregation.
8  */
9
10 /*
11  * implements IBaseFilter (internal)
12  *
13  * a base class for implementing IBaseFilter.
14  */
15
16 #include "complist.h"
17 #include "mtype.h"
18
19 typedef struct CBaseFilterHandlers      CBaseFilterHandlers;
20 typedef struct CBasePinHandlers CBasePinHandlers;
21
22 typedef struct CBaseFilterImpl
23 {
24         /* IPersist - IMediaFilter - IBaseFilter */
25         ICOM_VFIELD(IBaseFilter);
26
27         /* IUnknown fields */
28         IUnknown*       punkControl;
29         /* IBaseFilter fields */
30         const CBaseFilterHandlers*      pHandlers;
31         CRITICAL_SECTION        csFilter;
32         const CLSID*    pclsidFilter;
33         QUARTZ_CompList*        pInPins;        /* a list of IPin-s. */
34         QUARTZ_CompList*        pOutPins;       /* a list of IPin-s. */
35         IFilterGraph*   pfg;
36         DWORD   cbNameGraph;
37         WCHAR*  pwszNameGraph;
38         IReferenceClock*        pClock;
39         REFERENCE_TIME  rtStart;
40         FILTER_STATE    fstate;
41 } CBaseFilterImpl;
42
43 struct CBaseFilterHandlers
44 {
45         HRESULT (*pOnActive)( CBaseFilterImpl* pImpl );
46         HRESULT (*pOnInactive)( CBaseFilterImpl* pImpl );
47         HRESULT (*pOnStop)( CBaseFilterImpl* pImpl );
48 };
49
50
51 HRESULT CBaseFilterImpl_InitIBaseFilter(
52         CBaseFilterImpl* This, IUnknown* punkControl,
53         const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
54         const CBaseFilterHandlers* pHandlers );
55 void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This );
56
57
58 HRESULT CBaseFilterImpl_MediaEventNotify(
59         CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2);
60
61
62 /*
63  * Implements IPin, IMemInputPin, and IQualityControl. (internal)
64  *
65  * a base class for implementing IPin.
66  */
67
68 typedef struct OutputPinAsyncImpl OutputPinAsyncImpl;
69
70 typedef struct CPinBaseImpl
71 {
72         /* IPin */
73         ICOM_VFIELD(IPin);
74
75         /* IUnknown fields */
76         IUnknown*       punkControl;
77         /* IPin fields */
78         const CBasePinHandlers* pHandlers;
79         DWORD   cbIdLen;
80         WCHAR*  pwszId;
81         BOOL    bOutput;
82
83         /* you can change AcceptTypes while pcsPin has been hold */
84         const AM_MEDIA_TYPE*    pmtAcceptTypes;
85         ULONG   cAcceptTypes;
86
87         CRITICAL_SECTION*       pcsPin;
88         CBaseFilterImpl*        pFilter;
89         IPin*   pPinConnectedTo;
90         IMemInputPin*   pMemInputPinConnectedTo;
91         AM_MEDIA_TYPE*  pmtConn;
92         OutputPinAsyncImpl* pAsyncOut; /* for asynchronous output */
93 } CPinBaseImpl;
94
95 typedef struct CMemInputPinBaseImpl
96 {
97         /* IMemInputPin */
98         ICOM_VFIELD(IMemInputPin);
99
100         /* IUnknown fields */
101         IUnknown*       punkControl;
102         /* IMemInputPin fields */
103         CPinBaseImpl*   pPin;
104         IMemAllocator*  pAllocator;
105         BOOL    bReadonly;
106 } CMemInputPinBaseImpl;
107
108 typedef struct CQualityControlPassThruImpl
109 {
110         /* IQualityControl */
111         ICOM_VFIELD(IQualityControl);
112
113         /* IUnknown fields */
114         IUnknown*       punkControl;
115         /* IQualityControl fields */
116         CPinBaseImpl*   pPin;
117         IQualityControl*        pControl;
118 } CQualityControlPassThruImpl;
119
120
121 struct CBasePinHandlers
122 {
123         HRESULT (*pOnPreConnect)( CPinBaseImpl* pImpl, IPin* pPin );
124         HRESULT (*pOnPostConnect)( CPinBaseImpl* pImpl, IPin* pPin );
125         HRESULT (*pOnDisconnect)( CPinBaseImpl* pImpl );
126         HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
127         HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
128         HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
129         HRESULT (*pReceiveCanBlock)( CPinBaseImpl* pImpl );
130         HRESULT (*pEndOfStream)( CPinBaseImpl* pImpl );
131         HRESULT (*pBeginFlush)( CPinBaseImpl* pImpl );
132         HRESULT (*pEndFlush)( CPinBaseImpl* pImpl );
133         HRESULT (*pNewSegment)( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
134 };
135
136
137
138 HRESULT CPinBaseImpl_InitIPin(
139         CPinBaseImpl* This, IUnknown* punkControl,
140         CRITICAL_SECTION* pcsPin,
141         CBaseFilterImpl* pFilter, LPCWSTR pwszId,
142         BOOL bOutput,
143         const CBasePinHandlers* pHandlers );
144 void CPinBaseImpl_UninitIPin( CPinBaseImpl* This );
145
146
147 HRESULT CMemInputPinBaseImpl_InitIMemInputPin(
148         CMemInputPinBaseImpl* This, IUnknown* punkControl,
149         CPinBaseImpl* pPin );
150 void CMemInputPinBaseImpl_UninitIMemInputPin(
151         CMemInputPinBaseImpl* This );
152
153
154 HRESULT CQualityControlPassThruImpl_InitIQualityControl(
155         CQualityControlPassThruImpl* This, IUnknown* punkControl,
156         CPinBaseImpl* pPin );
157 void CQualityControlPassThruImpl_UninitIQualityControl(
158         CQualityControlPassThruImpl* This );
159
160
161 HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample );
162 HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This );
163 HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This );
164 HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This );
165 HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
166
167
168 /***************************************************************************
169  *
170  *      handlers for output pins.
171  *
172  */
173
174 HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
175 HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl );
176 HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl );
177 HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl );
178 HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl );
179 HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
180
181 /***************************************************************************
182  *
183  *      handlers for output pins (async).
184  *
185  */
186
187 HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl );
188 HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl );
189 HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
190 HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl );
191 HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl );
192 HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl );
193 HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl );
194 HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
195
196
197
198 #endif  /* WINE_DSHOW_BASEFILT_H */