4 * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef WINE_DSHOW_PARSER_H
22 #define WINE_DSHOW_PARSER_H
27 typedef struct CParserImpl CParserImpl;
28 typedef struct CParserInPinImpl CParserInPinImpl;
29 typedef struct CParserOutPinImpl CParserOutPinImpl;
30 typedef struct ParserHandlers ParserHandlers;
32 /* {D51BD5A1-7548-11CF-A520-0080C77EF58A} */
33 DEFINE_GUID(CLSID_quartzWaveParser,
34 0xD51BD5A1,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
39 CBaseFilterImpl basefilter;
41 CParserInPinImpl* m_pInPin;
43 CParserOutPinImpl** m_ppOutPins;
44 GUID m_guidTimeFormat;
46 CRITICAL_SECTION m_csParser;
47 IAsyncReader* m_pReader;
48 IMemAllocator* m_pAllocator;
49 ALLOCATOR_PROPERTIES m_propAlloc;
55 const ParserHandlers* m_pHandler;
59 struct CParserInPinImpl
63 CMemInputPinBaseImpl meminput;
68 struct CParserOutPinImpl
72 CQualityControlPassThruImpl qcontrol;
73 struct { ICOM_VFIELD(IMediaSeeking); } mediaseeking;
74 struct { ICOM_VFIELD(IMediaPosition); } mediaposition;
79 AM_MEDIA_TYPE m_mtOut;
80 IMemAllocator* m_pOutPinAllocator;
85 IMediaSample* m_pReqSample;
86 LONGLONG m_llReqStart;
88 REFERENCE_TIME m_rtReqStart;
89 REFERENCE_TIME m_rtReqStop;
90 DWORD m_dwSampleFlags;
97 HRESULT (*pInitParser)( CParserImpl* pImpl, ULONG* pcStreams );
98 HRESULT (*pUninitParser)( CParserImpl* pImpl );
99 LPCWSTR (*pGetOutPinName)( CParserImpl* pImpl, ULONG nStreamIndex );
100 HRESULT (*pGetStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt );
101 HRESULT (*pCheckStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt );
102 HRESULT (*pGetAllocProp)( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp );
103 /* S_OK - ok, S_FALSE - end of stream */
104 HRESULT (*pGetNextRequest)( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags );
105 HRESULT (*pProcessSample)( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample );
107 /* for IQualityControl */
108 HRESULT (*pQualityNotify)( CParserImpl* pImpl, ULONG nStreamIndex, Quality q );
111 HRESULT (*pGetSeekingCaps)( CParserImpl* pImpl, DWORD* pdwCaps );
112 HRESULT (*pIsTimeFormatSupported)( CParserImpl* pImpl, const GUID* pTimeFormat );
113 HRESULT (*pGetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
114 HRESULT (*pSetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
115 HRESULT (*pGetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllDuration );
116 HRESULT (*pGetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
117 HRESULT (*pSetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
118 HRESULT (*pGetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPreroll );
121 #define CParserImpl_THIS(iface,member) CParserImpl* This = ((CParserImpl*)(((char*)iface)-offsetof(CParserImpl,member)))
122 #define CParserInPinImpl_THIS(iface,member) CParserInPinImpl* This = ((CParserInPinImpl*)(((char*)iface)-offsetof(CParserInPinImpl,member)))
123 #define CParserOutPinImpl_THIS(iface,member) CParserOutPinImpl* This = ((CParserOutPinImpl*)(((char*)iface)-offsetof(CParserOutPinImpl,member)))
126 #define CParserOutPinImpl_IMediaSeeking(th) ((IMediaSeeking*)&((th)->mediaseeking))
127 #define CParserOutPinImpl_IMediaPosition(th) ((IMediaPosition*)&((th)->mediaposition))
129 HRESULT QUARTZ_CreateParser(
130 IUnknown* punkOuter,void** ppobj,
131 const CLSID* pclsidParser,
132 LPCWSTR pwszParserName,
133 LPCWSTR pwszInPinName,
134 const ParserHandlers* pHandler );
135 HRESULT QUARTZ_CreateParserInPin(
136 CParserImpl* pFilter,
137 CRITICAL_SECTION* pcsPin,
138 CParserInPinImpl** ppPin,
139 LPCWSTR pwszPinName );
140 HRESULT QUARTZ_CreateParserOutPin(
141 CParserImpl* pFilter,
142 CRITICAL_SECTION* pcsPin,
143 CParserOutPinImpl** ppPin,
145 LPCWSTR pwszPinName );
148 #define PARSER_POLL_INTERVAL 100
150 #define PARSER_RIFF_OfsFirst 12
151 #define PARSER_WAVE mmioFOURCC('W','A','V','E')
152 #define PARSER_AVI mmioFOURCC('A','V','I',' ')
153 #define PARSER_AVIX mmioFOURCC('A','V','I','X')
155 #define PARSER_fmt mmioFOURCC('f','m','t',' ')
156 #define PARSER_fact mmioFOURCC('f','a','c','t')
157 #define PARSER_data mmioFOURCC('d','a','t','a')
159 #define PARSER_LIST mmioFOURCC('L','I','S','T')
161 #define PARSER_hdrl mmioFOURCC('h','d','r','l')
162 #define PARSER_avih mmioFOURCC('a','v','i','h')
163 #define PARSER_strl mmioFOURCC('s','t','r','l')
164 #define PARSER_strh mmioFOURCC('s','t','r','h')
165 #define PARSER_strf mmioFOURCC('s','t','r','f')
166 #define PARSER_idx1 mmioFOURCC('i','d','x','1')
167 #define PARSER_indx mmioFOURCC('i','n','d','x')
168 #define PARSER_movi mmioFOURCC('m','o','v','i')
169 #define PARSER_JUNK mmioFOURCC('J','U','N','K')
171 #define PARSER_vids mmioFOURCC('v','i','d','s')
172 #define PARSER_auds mmioFOURCC('a','u','d','s')
173 #define PARSER_mids mmioFOURCC('m','i','d','s')
174 #define PARSER_txts mmioFOURCC('t','x','t','s')
176 #define PARSER_LE_UINT16(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8))
177 #define PARSER_LE_UINT32(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8)|((DWORD)(ptr)[2]<<16)|((DWORD)(ptr)[3]<<24))
178 #define PARSER_BE_UINT16(ptr) (((DWORD)(ptr)[0]<<8)|((DWORD)(ptr)[1]))
179 #define PARSER_BE_UINT32(ptr) (((DWORD)(ptr)[0]<<24)|((DWORD)(ptr)[1]<<16)|((DWORD)(ptr)[2]<<8)|((DWORD)(ptr)[3]))
181 HRESULT QUARTZ_CreateWaveParser(IUnknown* punkOuter,void** ppobj);
182 HRESULT QUARTZ_CreateAVISplitter(IUnknown* punkOuter,void** ppobj);
183 HRESULT QUARTZ_CreateMPEG1Splitter(IUnknown* punkOuter,void** ppobj);
186 HRESULT RIFF_GetNext(
187 CParserImpl* pImpl, LONGLONG llOfs,
188 DWORD* pdwCode, DWORD* pdwLength );
189 HRESULT RIFF_SearchChunk(
191 DWORD dwSearchLengthMax,
192 LONGLONG llOfs, DWORD dwChunk,
193 LONGLONG* pllOfs, DWORD* pdwChunkLength );
194 HRESULT RIFF_SearchList(
196 DWORD dwSearchLengthMax,
197 LONGLONG llOfs, DWORD dwListChunk,
198 LONGLONG* pllOfs, DWORD* pdwChunkLength );
201 #endif /* WINE_DSHOW_PARSER_H */