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 /* {D51BD5A0-7548-11CF-A520-0080C77EF58A} */
33 DEFINE_GUID(CLSID_quartzQuickTimeMovieParser,
34 0xD51BD5A0,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
35 /* {D51BD5A1-7548-11CF-A520-0080C77EF58A} */
36 DEFINE_GUID(CLSID_quartzWaveParser,
37 0xD51BD5A1,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
38 /* {D51BD5A2-7548-11CF-A520-0080C77EF58A} */
39 DEFINE_GUID(CLSID_quartzMIDIParser,
40 0xD51BD5A2,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
41 /* {D51BD5A3-7548-11CF-A520-0080C77EF58A} */
42 DEFINE_GUID(CLSID_quartzMultifileParser,
43 0xD51BD5A3,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
50 CBaseFilterImpl basefilter;
52 CParserInPinImpl* m_pInPin;
54 CParserOutPinImpl** m_ppOutPins;
55 GUID m_guidTimeFormat;
57 CRITICAL_SECTION m_csParser;
58 IAsyncReader* m_pReader;
59 IMemAllocator* m_pAllocator;
60 ALLOCATOR_PROPERTIES m_propAlloc;
67 const ParserHandlers* m_pHandler;
71 struct CParserInPinImpl
75 CMemInputPinBaseImpl meminput;
80 struct CParserOutPinImpl
84 CQualityControlPassThruImpl qcontrol;
85 struct { ICOM_VFIELD(IMediaSeeking); } mediaseeking;
86 struct { ICOM_VFIELD(IMediaPosition); } mediaposition;
91 AM_MEDIA_TYPE m_mtOut;
92 IMemAllocator* m_pOutPinAllocator;
97 IMediaSample* m_pReqSample;
98 LONGLONG m_llReqStart;
100 REFERENCE_TIME m_rtReqStart;
101 REFERENCE_TIME m_rtReqStop;
102 DWORD m_dwSampleFlags;
107 struct ParserHandlers
109 HRESULT (*pInitParser)( CParserImpl* pImpl, ULONG* pcStreams );
110 HRESULT (*pUninitParser)( CParserImpl* pImpl );
111 LPCWSTR (*pGetOutPinName)( CParserImpl* pImpl, ULONG nStreamIndex );
112 HRESULT (*pGetStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt );
113 HRESULT (*pCheckStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt );
114 HRESULT (*pGetAllocProp)( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp );
115 /* S_OK - ok, S_FALSE - end of stream */
116 HRESULT (*pGetNextRequest)( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags );
117 HRESULT (*pProcessSample)( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample );
119 /* for IQualityControl */
120 HRESULT (*pQualityNotify)( CParserImpl* pImpl, ULONG nStreamIndex, Quality q );
123 HRESULT (*pGetSeekingCaps)( CParserImpl* pImpl, DWORD* pdwCaps );
124 HRESULT (*pIsTimeFormatSupported)( CParserImpl* pImpl, const GUID* pTimeFormat );
125 HRESULT (*pGetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
126 HRESULT (*pSetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
127 HRESULT (*pGetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllDuration );
128 HRESULT (*pGetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
129 HRESULT (*pSetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
130 HRESULT (*pGetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPreroll );
133 #define CParserImpl_THIS(iface,member) CParserImpl* This = ((CParserImpl*)(((char*)iface)-offsetof(CParserImpl,member)))
134 #define CParserInPinImpl_THIS(iface,member) CParserInPinImpl* This = ((CParserInPinImpl*)(((char*)iface)-offsetof(CParserInPinImpl,member)))
135 #define CParserOutPinImpl_THIS(iface,member) CParserOutPinImpl* This = ((CParserOutPinImpl*)(((char*)iface)-offsetof(CParserOutPinImpl,member)))
138 #define CParserOutPinImpl_IMediaSeeking(th) ((IMediaSeeking*)&((th)->mediaseeking))
139 #define CParserOutPinImpl_IMediaPosition(th) ((IMediaPosition*)&((th)->mediaposition))
141 HRESULT QUARTZ_CreateParser(
142 IUnknown* punkOuter,void** ppobj,
143 const CLSID* pclsidParser,
144 LPCWSTR pwszParserName,
145 LPCWSTR pwszInPinName,
146 const ParserHandlers* pHandler );
147 HRESULT QUARTZ_CreateParserInPin(
148 CParserImpl* pFilter,
149 CRITICAL_SECTION* pcsPin,
150 CParserInPinImpl** ppPin,
151 LPCWSTR pwszPinName );
152 HRESULT QUARTZ_CreateParserOutPin(
153 CParserImpl* pFilter,
154 CRITICAL_SECTION* pcsPin,
155 CParserOutPinImpl** ppPin,
157 LPCWSTR pwszPinName );
160 #define PARSER_POLL_INTERVAL 100
162 #define PARSER_RIFF_OfsFirst 12
163 #define PARSER_WAVE mmioFOURCC('W','A','V','E')
164 #define PARSER_AVI mmioFOURCC('A','V','I',' ')
165 #define PARSER_AVIX mmioFOURCC('A','V','I','X')
167 #define PARSER_fmt mmioFOURCC('f','m','t',' ')
168 #define PARSER_fact mmioFOURCC('f','a','c','t')
169 #define PARSER_data mmioFOURCC('d','a','t','a')
171 #define PARSER_LIST mmioFOURCC('L','I','S','T')
173 #define PARSER_hdrl mmioFOURCC('h','d','r','l')
174 #define PARSER_avih mmioFOURCC('a','v','i','h')
175 #define PARSER_strl mmioFOURCC('s','t','r','l')
176 #define PARSER_strh mmioFOURCC('s','t','r','h')
177 #define PARSER_strf mmioFOURCC('s','t','r','f')
178 #define PARSER_idx1 mmioFOURCC('i','d','x','1')
179 #define PARSER_indx mmioFOURCC('i','n','d','x')
180 #define PARSER_movi mmioFOURCC('m','o','v','i')
181 #define PARSER_JUNK mmioFOURCC('J','U','N','K')
183 #define PARSER_vids mmioFOURCC('v','i','d','s')
184 #define PARSER_auds mmioFOURCC('a','u','d','s')
185 #define PARSER_mids mmioFOURCC('m','i','d','s')
186 #define PARSER_txts mmioFOURCC('t','x','t','s')
188 #define PARSER_LE_UINT16(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8))
189 #define PARSER_LE_UINT32(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8)|((DWORD)(ptr)[2]<<16)|((DWORD)(ptr)[3]<<24))
190 #define PARSER_BE_UINT16(ptr) (((DWORD)(ptr)[0]<<8)|((DWORD)(ptr)[1]))
191 #define PARSER_BE_UINT32(ptr) (((DWORD)(ptr)[0]<<24)|((DWORD)(ptr)[1]<<16)|((DWORD)(ptr)[2]<<8)|((DWORD)(ptr)[3]))
193 HRESULT QUARTZ_CreateWaveParser(IUnknown* punkOuter,void** ppobj);
194 HRESULT QUARTZ_CreateAVISplitter(IUnknown* punkOuter,void** ppobj);
195 HRESULT QUARTZ_CreateMPEG1Splitter(IUnknown* punkOuter,void** ppobj);
196 HRESULT QUARTZ_CreateQuickTimeMovieParser(IUnknown* punkOuter,void** ppobj);
197 HRESULT QUARTZ_CreateMIDIParser(IUnknown* punkOuter,void** ppobj);
200 HRESULT RIFF_GetNext(
201 CParserImpl* pImpl, LONGLONG llOfs,
202 DWORD* pdwCode, DWORD* pdwLength );
203 HRESULT RIFF_SearchChunk(
205 DWORD dwSearchLengthMax,
206 LONGLONG llOfs, DWORD dwChunk,
207 LONGLONG* pllOfs, DWORD* pdwChunkLength );
208 HRESULT RIFF_SearchList(
210 DWORD dwSearchLengthMax,
211 LONGLONG llOfs, DWORD dwListChunk,
212 LONGLONG* pllOfs, DWORD* pdwChunkLength );
215 #endif /* WINE_DSHOW_PARSER_H */