Added a framework for testing CreateProcess and a few tests.
[wine] / dlls / quartz / qtdec.c
1 /*
2  * Implements QuickTime Video Decompressor.
3  *
4  *      FIXME - stub
5  *
6  * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
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 "winerror.h"
31 #include "vfw.h"
32 #include "strmif.h"
33 #include "control.h"
34 #include "amvideo.h"
35 #include "vfwmsgs.h"
36 #include "uuids.h"
37
38 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
40
41 #include "quartz_private.h"
42 #include "xform.h"
43
44 static const WCHAR QTDec_FilterName[] =
45 {'Q','u','i','c','k','T','i','m','e',' ','D','e','c','o','m','p','r','e','s','s','o','r',0};
46
47 typedef struct CQTDecImpl
48 {
49         AM_MEDIA_TYPE*  m_pmtConv;
50         DWORD   m_cConv;
51 } CQTDecImpl;
52
53 /***************************************************************************
54  *
55  *      CQTDecImpl methods
56  *
57  */
58
59 static void QTDec_FreeOutTypes(CQTDecImpl* This)
60 {
61         DWORD   i;
62
63         if ( This->m_pmtConv == NULL )
64                 return;
65
66         TRACE("cConv = %lu\n",This->m_cConv);
67         for ( i = 0; i < This->m_cConv; i++ )
68         {
69                 QUARTZ_MediaType_Free(&This->m_pmtConv[i]);
70         }
71         QUARTZ_FreeMem(This->m_pmtConv);
72         This->m_pmtConv = NULL;
73         This->m_cConv = 0;
74 }
75
76
77 static HRESULT QTDec_Init( CTransformBaseImpl* pImpl )
78 {
79         CQTDecImpl*     This = pImpl->m_pUserData;
80
81         if ( This != NULL )
82                 return NOERROR;
83
84         This = (CQTDecImpl*)QUARTZ_AllocMem( sizeof(CQTDecImpl) );
85         if ( This == NULL )
86                 return E_OUTOFMEMORY;
87         ZeroMemory( This, sizeof(CQTDecImpl) );
88         pImpl->m_pUserData = This;
89         /* construct */
90         This->m_pmtConv = NULL;
91         This->m_cConv = 0;
92
93         return NOERROR;
94 }
95
96 static HRESULT QTDec_Cleanup( CTransformBaseImpl* pImpl )
97 {
98         CQTDecImpl*     This = pImpl->m_pUserData;
99
100         if ( This == NULL )
101                 return NOERROR;
102         /* destruct */
103         QTDec_FreeOutTypes(This);
104
105         QUARTZ_FreeMem( This );
106         pImpl->m_pUserData = NULL;
107
108         return NOERROR;
109 }
110
111 static HRESULT QTDec_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
112 {
113         CQTDecImpl*     This = pImpl->m_pUserData;
114
115         WARN("(%p) stub\n",This);
116
117         if ( This == NULL )
118                 return E_UNEXPECTED;
119
120         return E_NOTIMPL;
121 }
122
123 static HRESULT QTDec_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
124 {
125         CQTDecImpl*     This = pImpl->m_pUserData;
126         HRESULT hr;
127
128         FIXME("(%p)\n",This);
129
130         if ( This == NULL )
131                 return E_UNEXPECTED;
132
133         hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
134         if ( FAILED(hr) )
135                 return hr;
136
137         QTDec_FreeOutTypes(This);
138
139         *ppmtAcceptTypes = This->m_pmtConv;
140         *pcAcceptTypes = This->m_cConv;
141
142         return E_NOTIMPL;
143 }
144
145 static HRESULT QTDec_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
146 {
147         CQTDecImpl*     This = pImpl->m_pUserData;
148         HRESULT hr;
149
150         FIXME("(%p)\n",This);
151
152         if ( This == NULL )
153                 return E_UNEXPECTED;
154
155         hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
156         if ( FAILED(hr) )
157                 return hr;
158
159         return E_NOTIMPL;
160 }
161
162 static HRESULT QTDec_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
163 {
164         CQTDecImpl*     This = pImpl->m_pUserData;
165         HRESULT hr;
166
167         FIXME("(%p)\n",This);
168
169         if ( This == NULL )
170                 return E_UNEXPECTED;
171
172         hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
173         if ( FAILED(hr) )
174                 return hr;
175
176         return E_NOTIMPL;
177 }
178
179 static HRESULT QTDec_Transform( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut )
180 {
181         CQTDecImpl*     This = pImpl->m_pUserData;
182         BYTE*   pDataIn = NULL;
183         BYTE*   pDataOut = NULL;
184         HRESULT hr;
185
186         FIXME("(%p)\n",This);
187
188         if ( This == NULL )
189                 return E_UNEXPECTED;
190
191         hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
192         if ( FAILED(hr) )
193                 return hr;
194         hr = IMediaSample_GetPointer( pSampOut, &pDataOut );
195         if ( FAILED(hr) )
196                 return hr;
197
198         return E_NOTIMPL;
199 }
200
201 static HRESULT QTDec_EndTransform( CTransformBaseImpl* pImpl )
202 {
203         CQTDecImpl*     This = pImpl->m_pUserData;
204
205         if ( This == NULL )
206                 return E_UNEXPECTED;
207
208         return E_NOTIMPL;
209 }
210
211
212 static const TransformBaseHandlers transhandlers =
213 {
214         QTDec_Init,
215         QTDec_Cleanup,
216         QTDec_CheckMediaType,
217         QTDec_GetOutputTypes,
218         QTDec_GetAllocProp,
219         QTDec_BeginTransform,
220         NULL,
221         QTDec_Transform,
222         QTDec_EndTransform,
223 };
224
225 HRESULT QUARTZ_CreateQuickTimeDecompressor(IUnknown* punkOuter,void** ppobj)
226 {
227         return QUARTZ_CreateTransformBase(
228                 punkOuter,ppobj,
229                 &CLSID_quartzQuickTimeDecompressor,
230                 QTDec_FilterName,
231                 NULL, NULL,
232                 &transhandlers );
233 }
234