2 * Implements MPEG Video Decoder(CLSID_CMpegVideoCodec)
4 * FIXME - what library can we use? SMPEG??
8 * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
41 #include "quartz_private.h"
45 static const WCHAR CMPEGVideoDecoderImpl_FilterName[] =
46 {'M','P','E','G',' ','V','i','d','e','o',' ','D','e','c','o','d','e','r',0};
49 typedef struct CMPEGVideoDecoderImpl
54 } CMPEGVideoDecoderImpl;
57 /*****************************************************************************
59 * codec-dependent stuffs - no codec
65 static void Codec_OnConstruct(CMPEGVideoDecoderImpl* This)
69 static void Codec_OnCleanup(CMPEGVideoDecoderImpl* This)
73 static HRESULT Codec_BeginTransform(CTransformBaseImpl* pImpl,CMPEGVideoDecoderImpl* This)
79 static HRESULT Codec_ProcessReceive(CTransformBaseImpl* pImpl,CMPEGVideoDecoderImpl* This,IMediaSample* pSampIn)
85 static HRESULT Codec_EndTransform(CTransformBaseImpl* pImpl,CMPEGVideoDecoderImpl* This)
93 /***************************************************************************
95 * CMPEGVideoDecoderImpl methods
99 static void CMPEGVideoDecoderImpl_CleanupOutTypes(CMPEGVideoDecoderImpl* This)
103 if ( This->pmt != NULL )
105 for ( i = 0; i < This->cmt; i++ )
107 QUARTZ_MediaType_Free(&This->pmt[i]);
109 QUARTZ_FreeMem(This->pmt);
115 static HRESULT CMPEGVideoDecoderImpl_Init( CTransformBaseImpl* pImpl )
117 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
119 TRACE("(%p)\n",This);
124 This = (CMPEGVideoDecoderImpl*)QUARTZ_AllocMem( sizeof(CMPEGVideoDecoderImpl) );
126 return E_OUTOFMEMORY;
127 ZeroMemory( This, sizeof(CMPEGVideoDecoderImpl) );
128 pImpl->m_pUserData = This;
133 Codec_OnConstruct(This);
138 static HRESULT CMPEGVideoDecoderImpl_Cleanup( CTransformBaseImpl* pImpl )
140 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
142 TRACE("(%p)\n",This);
148 Codec_OnCleanup(This);
149 CMPEGVideoDecoderImpl_CleanupOutTypes(This);
151 QUARTZ_FreeMem( This );
152 pImpl->m_pUserData = NULL;
157 static HRESULT CMPEGVideoDecoderImpl_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
159 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
161 TRACE("(%p)\n",This);
168 WARN("no codec implementation\n");
175 static HRESULT CMPEGVideoDecoderImpl_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
177 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
180 FIXME("(%p)\n",This);
184 hr = CMPEGVideoDecoderImpl_CheckMediaType( pImpl, pmtIn, NULL );
188 CMPEGVideoDecoderImpl_CleanupOutTypes(This);
193 static HRESULT CMPEGVideoDecoderImpl_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
195 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
198 FIXME("(%p)\n",This);
202 hr = CMPEGVideoDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
209 static HRESULT CMPEGVideoDecoderImpl_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
211 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
214 FIXME("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
218 hr = CMPEGVideoDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
222 return Codec_BeginTransform(pImpl,This);
225 static HRESULT CMPEGVideoDecoderImpl_ProcessReceive( CTransformBaseImpl* pImpl, IMediaSample* pSampIn )
227 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
229 FIXME("(%p)\n",This);
233 return Codec_ProcessReceive(pImpl,This,pSampIn);
236 static HRESULT CMPEGVideoDecoderImpl_EndTransform( CTransformBaseImpl* pImpl )
238 CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
241 FIXME("(%p)\n",This);
245 hr = Codec_EndTransform(pImpl,This);
252 static const TransformBaseHandlers transhandlers =
254 CMPEGVideoDecoderImpl_Init,
255 CMPEGVideoDecoderImpl_Cleanup,
256 CMPEGVideoDecoderImpl_CheckMediaType,
257 CMPEGVideoDecoderImpl_GetOutputTypes,
258 CMPEGVideoDecoderImpl_GetAllocProp,
259 CMPEGVideoDecoderImpl_BeginTransform,
260 CMPEGVideoDecoderImpl_ProcessReceive,
262 CMPEGVideoDecoderImpl_EndTransform,
265 HRESULT QUARTZ_CreateCMpegVideoCodec(IUnknown* punkOuter,void** ppobj)
267 return QUARTZ_CreateTransformBase(
269 &CLSID_CMpegVideoCodec,
270 CMPEGVideoDecoderImpl_FilterName,