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;
59 BOOL bIntermediateState; /* if set, fstate is ignored. */
62 struct CBaseFilterHandlers
64 HRESULT (*pOnActive)( CBaseFilterImpl* pImpl );
65 HRESULT (*pOnInactive)( CBaseFilterImpl* pImpl );
66 HRESULT (*pOnStop)( CBaseFilterImpl* pImpl );
70 HRESULT CBaseFilterImpl_InitIBaseFilter(
71 CBaseFilterImpl* This, IUnknown* punkControl,
72 const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
73 const CBaseFilterHandlers* pHandlers );
74 void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This );
77 HRESULT CBaseFilterImpl_MediaEventNotify(
78 CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2);
82 * Implements IPin, IMemInputPin, and IQualityControl. (internal)
84 * a base class for implementing IPin.
87 typedef struct OutputPinAsyncImpl OutputPinAsyncImpl;
89 typedef struct CPinBaseImpl
95 IUnknown* punkControl;
97 const CBasePinHandlers* pHandlers;
102 /* you can change AcceptTypes while pcsPin has been hold */
103 const AM_MEDIA_TYPE* pmtAcceptTypes;
106 CRITICAL_SECTION* pcsPin;
107 CRITICAL_SECTION* pcsPinReceive;
108 CBaseFilterImpl* pFilter;
109 IPin* pPinConnectedTo;
110 IMemInputPin* pMemInputPinConnectedTo;
111 AM_MEDIA_TYPE* pmtConn;
112 OutputPinAsyncImpl* pAsyncOut; /* for asynchronous output */
115 typedef struct CMemInputPinBaseImpl
118 ICOM_VFIELD(IMemInputPin);
120 /* IUnknown fields */
121 IUnknown* punkControl;
122 /* IMemInputPin fields */
124 IMemAllocator* pAllocator;
126 } CMemInputPinBaseImpl;
128 typedef struct CQualityControlPassThruImpl
130 /* IQualityControl */
131 ICOM_VFIELD(IQualityControl);
133 /* IUnknown fields */
134 IUnknown* punkControl;
135 /* IQualityControl fields */
137 IQualityControl* pControl;
138 } CQualityControlPassThruImpl;
141 struct CBasePinHandlers
143 HRESULT (*pOnPreConnect)( CPinBaseImpl* pImpl, IPin* pPin );
144 HRESULT (*pOnPostConnect)( CPinBaseImpl* pImpl, IPin* pPin );
145 HRESULT (*pOnDisconnect)( CPinBaseImpl* pImpl );
146 HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
147 HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
148 HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
149 HRESULT (*pReceiveCanBlock)( CPinBaseImpl* pImpl );
150 HRESULT (*pEndOfStream)( CPinBaseImpl* pImpl );
151 HRESULT (*pBeginFlush)( CPinBaseImpl* pImpl );
152 HRESULT (*pEndFlush)( CPinBaseImpl* pImpl );
153 HRESULT (*pNewSegment)( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
158 HRESULT CPinBaseImpl_InitIPin(
159 CPinBaseImpl* This, IUnknown* punkControl,
160 CRITICAL_SECTION* pcsPin,
161 CRITICAL_SECTION* pcsPinReceive,
162 CBaseFilterImpl* pFilter, LPCWSTR pwszId,
164 const CBasePinHandlers* pHandlers );
165 void CPinBaseImpl_UninitIPin( CPinBaseImpl* This );
168 HRESULT CMemInputPinBaseImpl_InitIMemInputPin(
169 CMemInputPinBaseImpl* This, IUnknown* punkControl,
170 CPinBaseImpl* pPin );
171 void CMemInputPinBaseImpl_UninitIMemInputPin(
172 CMemInputPinBaseImpl* This );
175 HRESULT CQualityControlPassThruImpl_InitIQualityControl(
176 CQualityControlPassThruImpl* This, IUnknown* punkControl,
177 CPinBaseImpl* pPin );
178 void CQualityControlPassThruImpl_UninitIQualityControl(
179 CQualityControlPassThruImpl* This );
182 HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample );
183 HRESULT CPinBaseImpl_SendReceiveCanBlock( CPinBaseImpl* This );
184 HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This );
185 HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This );
186 HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This );
187 HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
190 /***************************************************************************
192 * handlers for output pins.
196 HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
197 HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl );
198 HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl );
199 HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl );
200 HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl );
201 HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
203 /***************************************************************************
205 * handlers for output pins (async).
209 HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl );
210 HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl );
211 HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
212 HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl );
213 HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl );
214 HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl );
215 HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl );
216 HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
220 #endif /* WINE_DSHOW_BASEFILT_H */