Various cosmetic changes.
[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         CRITICAL_SECTION*       pcsPinReceive;
89         CBaseFilterImpl*        pFilter;
90         IPin*   pPinConnectedTo;
91         IMemInputPin*   pMemInputPinConnectedTo;
92         AM_MEDIA_TYPE*  pmtConn;
93         OutputPinAsyncImpl* pAsyncOut; /* for asynchronous output */
94 } CPinBaseImpl;
95
96 typedef struct CMemInputPinBaseImpl
97 {
98         /* IMemInputPin */
99         ICOM_VFIELD(IMemInputPin);
100
101         /* IUnknown fields */
102         IUnknown*       punkControl;
103         /* IMemInputPin fields */
104         CPinBaseImpl*   pPin;
105         IMemAllocator*  pAllocator;
106         BOOL    bReadonly;
107 } CMemInputPinBaseImpl;
108
109 typedef struct CQualityControlPassThruImpl
110 {
111         /* IQualityControl */
112         ICOM_VFIELD(IQualityControl);
113
114         /* IUnknown fields */
115         IUnknown*       punkControl;
116         /* IQualityControl fields */
117         CPinBaseImpl*   pPin;
118         IQualityControl*        pControl;
119 } CQualityControlPassThruImpl;
120
121
122 struct CBasePinHandlers
123 {
124         HRESULT (*pOnPreConnect)( CPinBaseImpl* pImpl, IPin* pPin );
125         HRESULT (*pOnPostConnect)( CPinBaseImpl* pImpl, IPin* pPin );
126         HRESULT (*pOnDisconnect)( CPinBaseImpl* pImpl );
127         HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
128         HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
129         HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
130         HRESULT (*pReceiveCanBlock)( CPinBaseImpl* pImpl );
131         HRESULT (*pEndOfStream)( CPinBaseImpl* pImpl );
132         HRESULT (*pBeginFlush)( CPinBaseImpl* pImpl );
133         HRESULT (*pEndFlush)( CPinBaseImpl* pImpl );
134         HRESULT (*pNewSegment)( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
135 };
136
137
138
139 HRESULT CPinBaseImpl_InitIPin(
140         CPinBaseImpl* This, IUnknown* punkControl,
141         CRITICAL_SECTION* pcsPin,
142         CRITICAL_SECTION* pcsPinReceive,
143         CBaseFilterImpl* pFilter, LPCWSTR pwszId,
144         BOOL bOutput,
145         const CBasePinHandlers* pHandlers );
146 void CPinBaseImpl_UninitIPin( CPinBaseImpl* This );
147
148
149 HRESULT CMemInputPinBaseImpl_InitIMemInputPin(
150         CMemInputPinBaseImpl* This, IUnknown* punkControl,
151         CPinBaseImpl* pPin );
152 void CMemInputPinBaseImpl_UninitIMemInputPin(
153         CMemInputPinBaseImpl* This );
154
155
156 HRESULT CQualityControlPassThruImpl_InitIQualityControl(
157         CQualityControlPassThruImpl* This, IUnknown* punkControl,
158         CPinBaseImpl* pPin );
159 void CQualityControlPassThruImpl_UninitIQualityControl(
160         CQualityControlPassThruImpl* This );
161
162
163 HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample );
164 HRESULT CPinBaseImpl_SendReceiveCanBlock( CPinBaseImpl* This );
165 HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This );
166 HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This );
167 HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This );
168 HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
169
170
171 /***************************************************************************
172  *
173  *      handlers for output pins.
174  *
175  */
176
177 HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
178 HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl );
179 HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl );
180 HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl );
181 HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl );
182 HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
183
184 /***************************************************************************
185  *
186  *      handlers for output pins (async).
187  *
188  */
189
190 HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl );
191 HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl );
192 HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
193 HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl );
194 HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl );
195 HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl );
196 HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl );
197 HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
198
199
200
201 #endif  /* WINE_DSHOW_BASEFILT_H */