Fixed some bugs.
[wine/multimedia.git] / dlls / quartz / qtdec.c
blob33d7897cabe5b49c08f652f649f6c5b10c25da84
1 /*
2 * Implements QuickTime Video Decompressor.
4 * FIXME - stub
6 * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
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.
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.
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
24 #include "config.h"
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"
38 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
41 #include "quartz_private.h"
42 #include "xform.h"
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};
47 typedef struct CQTDecImpl
49 AM_MEDIA_TYPE* m_pmtConv;
50 DWORD m_cConv;
51 } CQTDecImpl;
53 /***************************************************************************
55 * CQTDecImpl methods
59 static void QTDec_FreeOutTypes(CQTDecImpl* This)
61 DWORD i;
63 if ( This->m_pmtConv == NULL )
64 return;
66 TRACE("cConv = %lu\n",This->m_cConv);
67 for ( i = 0; i < This->m_cConv; i++ )
69 QUARTZ_MediaType_Free(&This->m_pmtConv[i]);
71 QUARTZ_FreeMem(This->m_pmtConv);
72 This->m_pmtConv = NULL;
73 This->m_cConv = 0;
77 static HRESULT QTDec_Init( CTransformBaseImpl* pImpl )
79 CQTDecImpl* This = pImpl->m_pUserData;
81 if ( This != NULL )
82 return NOERROR;
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;
93 return NOERROR;
96 static HRESULT QTDec_Cleanup( CTransformBaseImpl* pImpl )
98 CQTDecImpl* This = pImpl->m_pUserData;
100 if ( This == NULL )
101 return NOERROR;
102 /* destruct */
103 QTDec_FreeOutTypes(This);
105 QUARTZ_FreeMem( This );
106 pImpl->m_pUserData = NULL;
108 return NOERROR;
111 static HRESULT QTDec_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
113 CQTDecImpl* This = pImpl->m_pUserData;
115 WARN("(%p) stub\n",This);
117 if ( This == NULL )
118 return E_UNEXPECTED;
120 return E_NOTIMPL;
123 static HRESULT QTDec_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
125 CQTDecImpl* This = pImpl->m_pUserData;
126 HRESULT hr;
128 FIXME("(%p)\n",This);
130 if ( This == NULL )
131 return E_UNEXPECTED;
133 hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
134 if ( FAILED(hr) )
135 return hr;
137 QTDec_FreeOutTypes(This);
139 *ppmtAcceptTypes = This->m_pmtConv;
140 *pcAcceptTypes = This->m_cConv;
142 return E_NOTIMPL;
145 static HRESULT QTDec_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
147 CQTDecImpl* This = pImpl->m_pUserData;
148 HRESULT hr;
150 FIXME("(%p)\n",This);
152 if ( This == NULL )
153 return E_UNEXPECTED;
155 hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
156 if ( FAILED(hr) )
157 return hr;
159 return E_NOTIMPL;
162 static HRESULT QTDec_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
164 CQTDecImpl* This = pImpl->m_pUserData;
165 HRESULT hr;
167 FIXME("(%p)\n",This);
169 if ( This == NULL )
170 return E_UNEXPECTED;
172 hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
173 if ( FAILED(hr) )
174 return hr;
176 return E_NOTIMPL;
179 static HRESULT QTDec_Transform( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut )
181 CQTDecImpl* This = pImpl->m_pUserData;
182 BYTE* pDataIn = NULL;
183 BYTE* pDataOut = NULL;
184 HRESULT hr;
186 FIXME("(%p)\n",This);
188 if ( This == NULL )
189 return E_UNEXPECTED;
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;
198 return E_NOTIMPL;
201 static HRESULT QTDec_EndTransform( CTransformBaseImpl* pImpl )
203 CQTDecImpl* This = pImpl->m_pUserData;
205 if ( This == NULL )
206 return E_UNEXPECTED;
208 return E_NOTIMPL;
212 static const TransformBaseHandlers transhandlers =
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,
225 HRESULT QUARTZ_CreateQuickTimeDecompressor(IUnknown* punkOuter,void** ppobj)
227 return QUARTZ_CreateTransformBase(
228 punkOuter,ppobj,
229 &CLSID_quartzQuickTimeDecompressor,
230 QTDec_FilterName,
231 NULL, NULL,
232 &transhandlers );