Added a framework for testing CreateProcess and a few tests.
[wine] / dlls / quartz / qtparse.c
1 /*
2  * Implements QuickTime Parser(Splitter).
3  *
4  *      FIXME - stub
5  *      FIXME - no seeking
6  *
7  * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include "config.h"
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "mmsystem.h"
31 #include "vfw.h"
32 #include "winerror.h"
33 #include "strmif.h"
34 #include "control.h"
35 #include "vfwmsgs.h"
36 #include "amvideo.h"
37 #include "uuids.h"
38
39
40 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
42
43 #include "quartz_private.h"
44 #include "parser.h"
45 #include "mtype.h"
46
47
48
49 static const WCHAR QUARTZ_QTParser_Name[] =
50 { 'Q','u','i','c','k','T','i','m','e',' ','M','o','v','i','e',' ','P','a','r','s','e','r',0 };
51 static const WCHAR QUARTZ_QTParserInPin_Name[] =
52 { 'I','n',0 };
53 static const WCHAR QUARTZ_QTParserOutPin_Basename[] =
54 { 'S','t','r','e','a','m',0 };
55
56 #define WINE_QUARTZ_QTPINNAME_MAX       64
57
58 /****************************************************************************
59  *
60  *      CQTParseImpl
61  */
62
63
64 typedef struct CQTParseImpl CQTParseImpl;
65 typedef struct CQTParseStream CQTParseStream;
66
67 struct CQTParseImpl
68 {
69         CQTParseStream* pStreamsBuf;
70         DWORD   cIndexEntries;
71         WCHAR   wchWork[ WINE_QUARTZ_QTPINNAME_MAX ];
72 };
73
74 struct CQTParseStream
75 {
76         int     dummy;
77 };
78
79
80 static HRESULT CQTParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
81 {
82         WARN("(%p,%p) stub\n",pImpl,pcStreams);
83
84         return E_NOTIMPL;
85 }
86
87 static HRESULT CQTParseImpl_UninitParser( CParserImpl* pImpl )
88 {
89         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
90
91         TRACE("(%p)\n",This);
92
93         if ( This == NULL )
94                 return NOERROR;
95
96         /* destruct */
97
98         QUARTZ_FreeMem( This );
99         pImpl->m_pUserData = NULL;
100
101         return NOERROR;
102 }
103
104 static LPCWSTR CQTParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
105 {
106         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
107         int wlen;
108
109         TRACE("(%p,%lu)\n",This,nStreamIndex);
110
111         if ( This == NULL /*|| nStreamIndex >= This->avih.dwStreams*/ )
112                 return NULL;
113
114         wlen = lstrlenW(QUARTZ_QTParserOutPin_Basename);
115         memcpy( This->wchWork, QUARTZ_QTParserOutPin_Basename, sizeof(WCHAR)*wlen );
116         This->wchWork[ wlen ] = (nStreamIndex/10) + '0';
117         This->wchWork[ wlen+1 ] = (nStreamIndex%10) + '0';
118         This->wchWork[ wlen+2 ] = 0;
119
120         return This->wchWork;
121 }
122
123 static HRESULT CQTParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
124 {
125         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
126
127         FIXME("(%p) stub\n",This);
128
129         return E_NOTIMPL;
130 }
131
132 static HRESULT CQTParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
133 {
134         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
135
136         FIXME("(%p) stub\n",This);
137
138         return E_NOTIMPL;
139 }
140
141 static HRESULT CQTParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
142 {
143         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
144
145         FIXME("(%p,%p) stub\n",This,pReqProp);
146         if ( This == NULL )
147                 return E_UNEXPECTED;
148
149         return E_NOTIMPL;
150 }
151
152 static HRESULT CQTParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
153 {
154         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
155
156         FIXME("(%p) stub\n",This);
157
158         if ( This == NULL )
159                 return E_UNEXPECTED;
160
161         return E_NOTIMPL;
162 }
163
164 static HRESULT CQTParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
165 {
166         CQTParseImpl*   This = (CQTParseImpl*)pImpl->m_pUserData;
167
168         FIXME("(%p,%lu,%ld,%ld,%p)\n",This,nStreamIndex,(long)llStart,lLength,pSample);
169
170         if ( This == NULL )
171                 return E_UNEXPECTED;
172
173         return E_NOTIMPL;
174 }
175
176 static const struct ParserHandlers CQTParseImpl_Handlers =
177 {
178         CQTParseImpl_InitParser,
179         CQTParseImpl_UninitParser,
180         CQTParseImpl_GetOutPinName,
181         CQTParseImpl_GetStreamType,
182         CQTParseImpl_CheckStreamType,
183         CQTParseImpl_GetAllocProp,
184         CQTParseImpl_GetNextRequest,
185         CQTParseImpl_ProcessSample,
186
187         /* for IQualityControl */
188         NULL, /* pQualityNotify */
189
190         /* for seeking */
191         NULL, /* pGetSeekingCaps */
192         NULL, /* pIsTimeFormatSupported */
193         NULL, /* pGetCurPos */
194         NULL, /* pSetCurPos */
195         NULL, /* pGetDuration */
196         NULL, /* pGetStopPos */
197         NULL, /* pSetStopPos */
198         NULL, /* pGetPreroll */
199 };
200
201 HRESULT QUARTZ_CreateQuickTimeMovieParser(IUnknown* punkOuter,void** ppobj)
202 {
203         return QUARTZ_CreateParser(
204                 punkOuter,ppobj,
205                 &CLSID_quartzQuickTimeMovieParser,
206                 QUARTZ_QTParser_Name,
207                 QUARTZ_QTParserInPin_Name,
208                 &CQTParseImpl_Handlers );
209 }
210
211