2 * Header file for Wine's strmbase implementation
4 * Copyright 2003 Robert Shearman
5 * Copyright 2010 Aric Stewart, CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc);
23 void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType);
24 AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc);
25 void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
27 typedef HRESULT (WINAPI *BasePin_GetMediaType)(IPin* iface, int iPosition, AM_MEDIA_TYPE *amt);
28 typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(IPin* iface);
29 typedef HRESULT (WINAPI *BasePin_AttemptConnection)(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
30 typedef HRESULT (WINAPI *BasePin_CheckMediaType)(IPin *iface, const AM_MEDIA_TYPE *pmt);
32 typedef IPin* (WINAPI *BaseFilter_GetPin)(IBaseFilter* iface, int iPosition);
33 typedef LONG (WINAPI *BaseFilter_GetPinCount)(IBaseFilter* iface);
34 typedef LONG (WINAPI *BaseFilter_GetPinVersion)(IBaseFilter* iface);
36 typedef HRESULT (WINAPI *BaseInputPin_Receive)(IPin *This, IMediaSample *pSample);
38 HRESULT WINAPI EnumMediaTypes_Construct(IPin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum);
40 HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum);
44 typedef struct BasePin
46 const struct IPinVtbl * lpVtbl;
48 LPCRITICAL_SECTION pCritSec;
51 AM_MEDIA_TYPE mtCurrent;
54 typedef struct BaseOutputPin
56 /* inheritance C style! */
59 IMemInputPin * pMemInputPin;
60 BasePin_AttemptConnection pAttemptConnection;
61 BOOL custom_allocator;
64 ALLOCATOR_PROPERTIES allocProps;
67 typedef struct BaseInputPin
69 /* inheritance C style! */
72 const IMemInputPinVtbl * lpVtblMemInput;
73 IMemAllocator * pAllocator;
74 BaseInputPin_Receive fnReceive;
75 BasePin_CheckMediaType fnCheckMediaType;
76 REFERENCE_TIME tStart;
79 BOOL flushing, end_of_stream;
80 IMemAllocator *preferred_allocator;
84 HRESULT WINAPI BasePinImpl_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt);
85 LONG WINAPI BasePinImpl_GetMediaTypeVersion(IPin *iface);
86 ULONG WINAPI BasePinImpl_AddRef(IPin * iface);
87 HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface);
88 HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
89 HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
90 HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
91 HRESULT WINAPI BasePinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
92 HRESULT WINAPI BasePinImpl_QueryId(IPin * iface, LPWSTR * Id);
93 HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
94 HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
95 HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
98 HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
99 ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface);
100 HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
101 HRESULT WINAPI BaseOutputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
102 HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface);
103 HRESULT WINAPI BaseOutputPinImpl_EndOfStream(IPin * iface);
104 HRESULT WINAPI BaseOutputPinImpl_BeginFlush(IPin * iface);
105 HRESULT WINAPI BaseOutputPinImpl_EndFlush(IPin * iface);
106 HRESULT WINAPI BaseOutputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
108 HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(BaseOutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
109 HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin * This, IMediaSample * pSample);
110 HRESULT WINAPI BaseOutputPinImpl_BreakConnect(BaseOutputPin * This);
111 HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This);
112 HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This);
113 HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, BasePin_AttemptConnection pConnectProc, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
116 HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
117 ULONG WINAPI BaseInputPinImpl_Release(IPin * iface);
118 HRESULT WINAPI BaseInputPinImpl_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
119 HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
120 HRESULT WINAPI BaseInputPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
121 HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface);
122 HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface);
123 HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface);
124 HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
126 HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, BasePin_CheckMediaType pQueryAccept, BaseInputPin_Receive pSampleProc, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
128 typedef struct BaseFilter
130 const struct IBaseFilterVtbl *lpVtbl;
132 CRITICAL_SECTION csFilter;
135 REFERENCE_TIME rtStreamStart;
136 IReferenceClock * pClock;
137 FILTER_INFO filterInfo;
141 BaseFilter_GetPin pfnGetPin;
142 BaseFilter_GetPinCount pfnGetPinCount;
145 HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
146 ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter * iface);
147 ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface);
148 HRESULT WINAPI BaseFilterImpl_GetClassID(IBaseFilter * iface, CLSID * pClsid);
149 HRESULT WINAPI BaseFilterImpl_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState );
150 HRESULT WINAPI BaseFilterImpl_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock);
151 HRESULT WINAPI BaseFilterImpl_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock);
152 HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum);
153 HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo);
154 HRESULT WINAPI BaseFilterImpl_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName );
155 HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo);
157 LONG WINAPI BaseFilterImpl_GetPinVersion(IBaseFilter* This);
158 VOID WINAPI BaseFilterImpl_IncrementPinVersion(IBaseFilter* This);
160 HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, BaseFilter_GetPin pfGetPin, BaseFilter_GetPinCount pfGetPinCount);
162 /* Transform Filter */
163 typedef struct TransformFilter
171 const struct TransformFilterFuncTable * pFuncsTable;
174 typedef HRESULT (WINAPI *TransformFilter_StartStreaming) (TransformFilter *iface);
175 typedef HRESULT (WINAPI *TransformFilter_StopStreaming) (TransformFilter *iface);
176 typedef HRESULT (WINAPI *TransformFilter_Receive) (TransformFilter* iface, IMediaSample* pIn);
177 typedef HRESULT (WINAPI *TransformFilter_CompleteConnect) (TransformFilter *iface, PIN_DIRECTION dir, IPin *pPin);
178 typedef HRESULT (WINAPI *TransformFilter_BreakConnect) (TransformFilter *iface, PIN_DIRECTION dir);
179 typedef HRESULT (WINAPI *TransformFilter_SetMediaType) (TransformFilter *iface, PIN_DIRECTION dir, const AM_MEDIA_TYPE *pMediaType);
180 typedef HRESULT (WINAPI *TransformFilter_CheckInputType) (TransformFilter *iface, const AM_MEDIA_TYPE *pMediaType);
181 typedef HRESULT (WINAPI *TransformFilter_EndOfStream) (TransformFilter *iface);
182 typedef HRESULT (WINAPI *TransformFilter_BeginFlush) (TransformFilter *iface);
183 typedef HRESULT (WINAPI *TransformFilter_EndFlush) (TransformFilter *iface);
184 typedef HRESULT (WINAPI *TransformFilter_NewSegment) (TransformFilter *iface,
185 REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
187 typedef struct TransformFilterFuncTable {
188 TransformFilter_StartStreaming pfnStartStreaming;
189 TransformFilter_Receive pfnReceive;
190 TransformFilter_StopStreaming pfnStopStreaming;
191 TransformFilter_CheckInputType pfnCheckInputType;
192 TransformFilter_SetMediaType pfnSetMediaType;
193 TransformFilter_CompleteConnect pfnCompleteConnect;
194 TransformFilter_BreakConnect pfnBreakConnect;
195 TransformFilter_EndOfStream pfnEndOfStream;
196 TransformFilter_BeginFlush pfnBeginFlush;
197 TransformFilter_EndFlush pfnEndFlush;
198 TransformFilter_NewSegment pfnNewSegment;
199 } TransformFilterFuncTable;
201 HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
202 ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface);
203 HRESULT WINAPI TransformFilterImpl_Stop(IBaseFilter * iface);
204 HRESULT WINAPI TransformFilterImpl_Pause(IBaseFilter * iface);
205 HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart);
206 HRESULT WINAPI TransformFilterImpl_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin);
208 HRESULT TransformFilter_Construct( const IBaseFilterVtbl *filterVtbl, LONG filter_size, const CLSID* pClsid, const TransformFilterFuncTable* pFuncsTable, IBaseFilter ** ppTransformFilter);
211 typedef HRESULT (WINAPI *SourceSeeking_ChangeRate)(IMediaSeeking *iface);
212 typedef HRESULT (WINAPI *SourceSeeking_ChangeStart)(IMediaSeeking *iface);
213 typedef HRESULT (WINAPI *SourceSeeking_ChangeStop)(IMediaSeeking *iface);
215 typedef struct SourceSeeking
217 const IMediaSeekingVtbl * lpVtbl;
220 SourceSeeking_ChangeStop fnChangeStop;
221 SourceSeeking_ChangeStart fnChangeStart;
222 SourceSeeking_ChangeRate fnChangeRate;
223 DWORD dwCapabilities;
225 LONGLONG llCurrent, llStop, llDuration;
227 PCRITICAL_SECTION crst;
230 HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtbl, SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart, SourceSeeking_ChangeRate fnChangeRate, PCRITICAL_SECTION crit_sect);
232 HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities);
233 HRESULT WINAPI SourceSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities);
234 HRESULT WINAPI SourceSeekingImpl_IsFormatSupported(IMediaSeeking * iface, const GUID * pFormat);
235 HRESULT WINAPI SourceSeekingImpl_QueryPreferredFormat(IMediaSeeking * iface, GUID * pFormat);
236 HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat);
237 HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat);
238 HRESULT WINAPI SourceSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat);
239 HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration);
240 HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop);
241 HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent);
242 HRESULT WINAPI SourceSeekingImpl_ConvertTimeFormat(IMediaSeeking * iface, LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat);
243 HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags);
244 HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop);
245 HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * pEarliest, LONGLONG * pLatest);
246 HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
247 HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
248 HRESULT WINAPI SourceSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll);