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
;
45 CRITICAL_SECTION m_csParser
;
46 IAsyncReader
* m_pReader
;
47 IMemAllocator
* m_pAllocator
;
48 ALLOCATOR_PROPERTIES m_propAlloc
;
54 const ParserHandlers
* m_pHandler
;
58 struct CParserInPinImpl
62 CMemInputPinBaseImpl meminput
;
67 struct CParserOutPinImpl
71 CQualityControlPassThruImpl qcontrol
;
72 struct { ICOM_VFIELD(IMediaSeeking
); } mediaseeking
;
73 struct { ICOM_VFIELD(IMediaPosition
); } mediaposition
;
78 AM_MEDIA_TYPE m_mtOut
;
79 IMemAllocator
* m_pOutPinAllocator
;
84 IMediaSample
* m_pReqSample
;
85 LONGLONG m_llReqStart
;
87 REFERENCE_TIME m_rtReqStart
;
88 REFERENCE_TIME m_rtReqStop
;
95 HRESULT (*pInitParser
)( CParserImpl
* pImpl
, ULONG
* pcStreams
);
96 HRESULT (*pUninitParser
)( CParserImpl
* pImpl
);
97 LPCWSTR (*pGetOutPinName
)( CParserImpl
* pImpl
, ULONG nStreamIndex
);
98 HRESULT (*pGetStreamType
)( CParserImpl
* pImpl
, ULONG nStreamIndex
, AM_MEDIA_TYPE
* pmt
);
99 HRESULT (*pCheckStreamType
)( CParserImpl
* pImpl
, ULONG nStreamIndex
, const AM_MEDIA_TYPE
* pmt
);
100 HRESULT (*pGetAllocProp
)( CParserImpl
* pImpl
, ALLOCATOR_PROPERTIES
* pReqProp
);
101 /* S_OK - ok, S_FALSE - end of stream */
102 HRESULT (*pGetNextRequest
)( CParserImpl
* pImpl
, ULONG
* pnStreamIndex
, LONGLONG
* pllStart
, LONG
* plLength
, REFERENCE_TIME
* prtStart
, REFERENCE_TIME
* prtStop
);
103 HRESULT (*pProcessSample
)( CParserImpl
* pImpl
, ULONG nStreamIndex
, LONGLONG llStart
, LONG lLength
, IMediaSample
* pSample
);
105 /* for IQualityControl */
106 HRESULT (*pQualityNotify
)( CParserImpl
* pImpl
, ULONG nStreamIndex
, Quality q
);
109 HRESULT (*pGetSeekingCaps
)( CParserImpl
* pImpl
, DWORD
* pdwCaps
);
110 HRESULT (*pIsTimeFormatSupported
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
);
111 HRESULT (*pGetCurPos
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG
* pllPos
);
112 HRESULT (*pSetCurPos
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG llPos
);
113 HRESULT (*pGetDuration
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG
* pllDuration
);
114 HRESULT (*pSetDuration
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG llDuration
);
115 HRESULT (*pGetStopPos
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG
* pllPos
);
116 HRESULT (*pSetStopPos
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG llPos
);
117 HRESULT (*pGetPreroll
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG
* pllPreroll
);
118 HRESULT (*pSetPreroll
)( CParserImpl
* pImpl
, const GUID
* pTimeFormat
, DWORD nStreamIndex
, LONGLONG llPreroll
);
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
);
185 HRESULT
RIFF_GetNext(
186 CParserImpl
* pImpl
, LONGLONG llOfs
,
187 DWORD
* pdwCode
, DWORD
* pdwLength
);
188 HRESULT
RIFF_SearchChunk(
190 DWORD dwSearchLengthMax
,
191 LONGLONG llOfs
, DWORD dwChunk
,
192 LONGLONG
* pllOfs
, DWORD
* pdwChunkLength
);
193 HRESULT
RIFF_SearchList(
195 DWORD dwSearchLengthMax
,
196 LONGLONG llOfs
, DWORD dwListChunk
,
197 LONGLONG
* pllOfs
, DWORD
* pdwChunkLength
);
200 #endif /* WINE_DSHOW_PARSER_H */