4 * hidenori@a2.ctktv.ne.jp
7 #ifndef WINE_DSHOW_PARSER_H
8 #define WINE_DSHOW_PARSER_H
13 typedef struct CParserImpl CParserImpl;
14 typedef struct CParserInPinImpl CParserInPinImpl;
15 typedef struct CParserOutPinImpl CParserOutPinImpl;
16 typedef struct ParserHandlers ParserHandlers;
18 /* {D51BD5A1-7548-11CF-A520-0080C77EF58A} */
19 DEFINE_GUID(CLSID_quartzWaveParser,
20 0xD51BD5A1,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
25 CBaseFilterImpl basefilter;
27 CParserInPinImpl* m_pInPin;
29 CParserOutPinImpl** m_ppOutPins;
31 CRITICAL_SECTION m_csParser;
32 IAsyncReader* m_pReader;
33 IMemAllocator* m_pAllocator;
34 ALLOCATOR_PROPERTIES m_propAlloc;
40 const ParserHandlers* m_pHandler;
44 struct CParserInPinImpl
48 CMemInputPinBaseImpl meminput;
53 struct CParserOutPinImpl
57 CQualityControlPassThruImpl qcontrol;
58 struct { ICOM_VFIELD(IMediaSeeking); } mediaseeking;
59 struct { ICOM_VFIELD(IMediaPosition); } mediaposition;
64 AM_MEDIA_TYPE m_mtOut;
65 IMemAllocator* m_pOutPinAllocator;
70 IMediaSample* m_pReqSample;
71 LONGLONG m_llReqStart;
73 REFERENCE_TIME m_rtReqStart;
74 REFERENCE_TIME m_rtReqStop;
81 HRESULT (*pInitParser)( CParserImpl* pImpl, ULONG* pcStreams );
82 HRESULT (*pUninitParser)( CParserImpl* pImpl );
83 LPCWSTR (*pGetOutPinName)( CParserImpl* pImpl, ULONG nStreamIndex );
84 HRESULT (*pGetStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt );
85 HRESULT (*pCheckStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt );
86 HRESULT (*pGetAllocProp)( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp );
87 /* S_OK - ok, S_FALSE - end of stream */
88 HRESULT (*pGetNextRequest)( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop );
89 HRESULT (*pProcessSample)( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample );
91 /* for IQualityControl */
92 HRESULT (*pQualityNotify)( CParserImpl* pImpl, ULONG nStreamIndex, Quality q );
95 HRESULT (*pGetSeekingCaps)( CParserImpl* pImpl, DWORD* pdwCaps );
96 HRESULT (*pIsTimeFormatSupported)( CParserImpl* pImpl, const GUID* pTimeFormat );
97 HRESULT (*pGetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
98 HRESULT (*pSetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
99 HRESULT (*pGetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllDuration );
100 HRESULT (*pSetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llDuration );
101 HRESULT (*pGetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
102 HRESULT (*pSetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
103 HRESULT (*pGetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPreroll );
104 HRESULT (*pSetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPreroll );
107 #define CParserImpl_THIS(iface,member) CParserImpl* This = ((CParserImpl*)(((char*)iface)-offsetof(CParserImpl,member)))
108 #define CParserInPinImpl_THIS(iface,member) CParserInPinImpl* This = ((CParserInPinImpl*)(((char*)iface)-offsetof(CParserInPinImpl,member)))
109 #define CParserOutPinImpl_THIS(iface,member) CParserOutPinImpl* This = ((CParserOutPinImpl*)(((char*)iface)-offsetof(CParserOutPinImpl,member)))
112 #define CParserOutPinImpl_IMediaSeeking(th) ((IMediaSeeking*)&((th)->mediaseeking))
113 #define CParserOutPinImpl_IMediaPosition(th) ((IMediaPosition*)&((th)->mediaposition))
115 HRESULT QUARTZ_CreateParser(
116 IUnknown* punkOuter,void** ppobj,
117 const CLSID* pclsidParser,
118 LPCWSTR pwszParserName,
119 LPCWSTR pwszInPinName,
120 const ParserHandlers* pHandler );
121 HRESULT QUARTZ_CreateParserInPin(
122 CParserImpl* pFilter,
123 CRITICAL_SECTION* pcsPin,
124 CParserInPinImpl** ppPin,
125 LPCWSTR pwszPinName );
126 HRESULT QUARTZ_CreateParserOutPin(
127 CParserImpl* pFilter,
128 CRITICAL_SECTION* pcsPin,
129 CParserOutPinImpl** ppPin,
131 LPCWSTR pwszPinName );
134 #define PARSER_POLL_INTERVAL 100
136 #define PARSER_RIFF_OfsFirst 12
137 #define PARSER_WAVE mmioFOURCC('W','A','V','E')
138 #define PARSER_AVI mmioFOURCC('A','V','I',' ')
139 #define PARSER_AVIX mmioFOURCC('A','V','I','X')
141 #define PARSER_fmt mmioFOURCC('f','m','t',' ')
142 #define PARSER_fact mmioFOURCC('f','a','c','t')
143 #define PARSER_data mmioFOURCC('d','a','t','a')
145 #define PARSER_LIST mmioFOURCC('L','I','S','T')
147 #define PARSER_hdrl mmioFOURCC('h','d','r','l')
148 #define PARSER_avih mmioFOURCC('a','v','i','h')
149 #define PARSER_strl mmioFOURCC('s','t','r','l')
150 #define PARSER_strh mmioFOURCC('s','t','r','h')
151 #define PARSER_strf mmioFOURCC('s','t','r','f')
152 #define PARSER_idx1 mmioFOURCC('i','d','x','1')
153 #define PARSER_indx mmioFOURCC('i','n','d','x')
154 #define PARSER_movi mmioFOURCC('m','o','v','i')
155 #define PARSER_JUNK mmioFOURCC('J','U','N','K')
157 #define PARSER_vids mmioFOURCC('v','i','d','s')
158 #define PARSER_auds mmioFOURCC('a','u','d','s')
159 #define PARSER_mids mmioFOURCC('m','i','d','s')
160 #define PARSER_txts mmioFOURCC('t','x','t','s')
162 #define PARSER_LE_UINT16(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8))
163 #define PARSER_LE_UINT32(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8)|((DWORD)(ptr)[2]<<16)|((DWORD)(ptr)[3]<<24))
164 #define PARSER_BE_UINT16(ptr) (((DWORD)(ptr)[0]<<8)|((DWORD)(ptr)[1]))
165 #define PARSER_BE_UINT32(ptr) (((DWORD)(ptr)[0]<<24)|((DWORD)(ptr)[1]<<16)|((DWORD)(ptr)[2]<<8)|((DWORD)(ptr)[3]))
167 HRESULT QUARTZ_CreateWaveParser(IUnknown* punkOuter,void** ppobj);
168 HRESULT QUARTZ_CreateAVISplitter(IUnknown* punkOuter,void** ppobj);
171 HRESULT RIFF_GetNext(
172 CParserImpl* pImpl, LONGLONG llOfs,
173 DWORD* pdwCode, DWORD* pdwLength );
174 HRESULT RIFF_SearchChunk(
176 DWORD dwSearchLengthMax,
177 LONGLONG llOfs, DWORD dwChunk,
178 LONGLONG* pllOfs, DWORD* pdwChunkLength );
179 HRESULT RIFF_SearchList(
181 DWORD dwSearchLengthMax,
182 LONGLONG llOfs, DWORD dwListChunk,
183 LONGLONG* pllOfs, DWORD* pdwChunkLength );
186 #endif /* WINE_DSHOW_PARSER_H */