2 * Copyright (C) Hidenori TAKESHIMA
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef WINE_DSHOW_BASEFILT_H
20 #define WINE_DSHOW_BASEFILT_H
23 * The following interfaces must be used as a part of aggregation.
24 * The punkControl must not be NULL since all IUnknown methods are
25 * implemented only for aggregation.
29 * implements IBaseFilter (internal)
31 * a base class for implementing IBaseFilter.
37 typedef struct CBaseFilterHandlers CBaseFilterHandlers;
38 typedef struct CBasePinHandlers CBasePinHandlers;
40 typedef struct CBaseFilterImpl
42 /* IPersist - IMediaFilter - IBaseFilter */
43 ICOM_VFIELD(IBaseFilter);
46 IUnknown* punkControl;
47 /* IBaseFilter fields */
48 const CBaseFilterHandlers* pHandlers;
49 CRITICAL_SECTION csFilter;
50 const CLSID* pclsidFilter;
51 QUARTZ_CompList* pInPins; /* a list of IPin-s. */
52 QUARTZ_CompList* pOutPins; /* a list of IPin-s. */
56 IReferenceClock* pClock;
57 REFERENCE_TIME rtStart;
61 struct CBaseFilterHandlers
63 HRESULT (*pOnActive)( CBaseFilterImpl* pImpl );
64 HRESULT (*pOnInactive)( CBaseFilterImpl* pImpl );
65 HRESULT (*pOnStop)( CBaseFilterImpl* pImpl );
69 HRESULT CBaseFilterImpl_InitIBaseFilter(
70 CBaseFilterImpl* This, IUnknown* punkControl,
71 const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
72 const CBaseFilterHandlers* pHandlers );
73 void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This );
76 HRESULT CBaseFilterImpl_MediaEventNotify(
77 CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2);
81 * Implements IPin, IMemInputPin, and IQualityControl. (internal)
83 * a base class for implementing IPin.
86 typedef struct OutputPinAsyncImpl OutputPinAsyncImpl;
88 typedef struct CPinBaseImpl
94 IUnknown* punkControl;
96 const CBasePinHandlers* pHandlers;
101 /* you can change AcceptTypes while pcsPin has been hold */
102 const AM_MEDIA_TYPE* pmtAcceptTypes;
105 CRITICAL_SECTION* pcsPin;
106 CRITICAL_SECTION* pcsPinReceive;
107 CBaseFilterImpl* pFilter;
108 IPin* pPinConnectedTo;
109 IMemInputPin* pMemInputPinConnectedTo;
110 AM_MEDIA_TYPE* pmtConn;
111 OutputPinAsyncImpl* pAsyncOut; /* for asynchronous output */
114 typedef struct CMemInputPinBaseImpl
117 ICOM_VFIELD(IMemInputPin);
119 /* IUnknown fields */
120 IUnknown* punkControl;
121 /* IMemInputPin fields */
123 IMemAllocator* pAllocator;
125 } CMemInputPinBaseImpl;
127 typedef struct CQualityControlPassThruImpl
129 /* IQualityControl */
130 ICOM_VFIELD(IQualityControl);
132 /* IUnknown fields */
133 IUnknown* punkControl;
134 /* IQualityControl fields */
136 IQualityControl* pControl;
137 } CQualityControlPassThruImpl;
140 struct CBasePinHandlers
142 HRESULT (*pOnPreConnect)( CPinBaseImpl* pImpl, IPin* pPin );
143 HRESULT (*pOnPostConnect)( CPinBaseImpl* pImpl, IPin* pPin );
144 HRESULT (*pOnDisconnect)( CPinBaseImpl* pImpl );
145 HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
146 HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
147 HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
148 HRESULT (*pReceiveCanBlock)( CPinBaseImpl* pImpl );
149 HRESULT (*pEndOfStream)( CPinBaseImpl* pImpl );
150 HRESULT (*pBeginFlush)( CPinBaseImpl* pImpl );
151 HRESULT (*pEndFlush)( CPinBaseImpl* pImpl );
152 HRESULT (*pNewSegment)( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
157 HRESULT CPinBaseImpl_InitIPin(
158 CPinBaseImpl* This, IUnknown* punkControl,
159 CRITICAL_SECTION* pcsPin,
160 CRITICAL_SECTION* pcsPinReceive,
161 CBaseFilterImpl* pFilter, LPCWSTR pwszId,
163 const CBasePinHandlers* pHandlers );
164 void CPinBaseImpl_UninitIPin( CPinBaseImpl* This );
167 HRESULT CMemInputPinBaseImpl_InitIMemInputPin(
168 CMemInputPinBaseImpl* This, IUnknown* punkControl,
169 CPinBaseImpl* pPin );
170 void CMemInputPinBaseImpl_UninitIMemInputPin(
171 CMemInputPinBaseImpl* This );
174 HRESULT CQualityControlPassThruImpl_InitIQualityControl(
175 CQualityControlPassThruImpl* This, IUnknown* punkControl,
176 CPinBaseImpl* pPin );
177 void CQualityControlPassThruImpl_UninitIQualityControl(
178 CQualityControlPassThruImpl* This );
181 HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample );
182 HRESULT CPinBaseImpl_SendReceiveCanBlock( CPinBaseImpl* This );
183 HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This );
184 HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This );
185 HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This );
186 HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
189 /***************************************************************************
191 * handlers for output pins.
195 HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
196 HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl );
197 HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl );
198 HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl );
199 HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl );
200 HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
202 /***************************************************************************
204 * handlers for output pins (async).
208 HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl );
209 HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl );
210 HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
211 HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl );
212 HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl );
213 HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl );
214 HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl );
215 HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
219 #endif /* WINE_DSHOW_BASEFILT_H */