Correctly fill parent pid, module size and module name in process and
[wine] / dlls / quartz / acmwrap.c
1 /*
2  * Implements ACM Wrapper(CLSID_ACMWrapper).
3  *
4  *      FIXME - stub
5  *
6  * Copyright (C) 2002 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 "msacm.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
45 static const WCHAR ACMWrapper_FilterName[] =
46 {'A','C','M',' ','W','r','a','p','p','e','r',0};
47
48
49 typedef struct CACMWrapperImpl
50 {
51         HACMSTREAM      has;
52 } CACMWrapperImpl;
53
54 /***************************************************************************
55  *
56  *      CACMWrapperImpl methods
57  *
58  */
59
60 static void ACMWrapper_Close( CACMWrapperImpl* This )
61 {
62         if ( This->has != (HACMSTREAM)NULL )
63         {
64                 acmStreamReset( This->has, 0 );
65                 acmStreamClose( This->has, 0 );
66                 This->has = (HACMSTREAM)NULL;
67         }
68 }
69
70 static HRESULT ACMWrapper_Init( CTransformBaseImpl* pImpl )
71 {
72         CACMWrapperImpl*        This = pImpl->m_pUserData;
73
74         TRACE("(%p)\n",This);
75
76         if ( This != NULL )
77                 return NOERROR;
78
79         This = (CACMWrapperImpl*)QUARTZ_AllocMem( sizeof(CACMWrapperImpl) );
80         if ( This == NULL )
81                 return E_OUTOFMEMORY;
82         ZeroMemory( This, sizeof(CACMWrapperImpl) );
83         pImpl->m_pUserData = This;
84
85         /* construct */
86         This->has = (HACMSTREAM)NULL;
87
88         return E_NOTIMPL;
89 }
90
91 static HRESULT ACMWrapper_Cleanup( CTransformBaseImpl* pImpl )
92 {
93         CACMWrapperImpl*        This = pImpl->m_pUserData;
94
95         TRACE("(%p)\n",This);
96
97         if ( This == NULL )
98                 return NOERROR;
99
100         /* destruct */
101         ACMWrapper_Close( This );
102
103         QUARTZ_FreeMem( This );
104         pImpl->m_pUserData = NULL;
105
106         return S_OK;
107 }
108
109 static HRESULT ACMWrapper_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
110 {
111         CACMWrapperImpl*        This = pImpl->m_pUserData;
112
113         FIXME("(%p)\n",This);
114         if ( This == NULL )
115                 return E_UNEXPECTED;
116
117         return E_NOTIMPL;
118 }
119
120 static HRESULT ACMWrapper_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
121 {
122         CACMWrapperImpl*        This = pImpl->m_pUserData;
123         HRESULT hr;
124
125         FIXME("(%p)\n",This);
126         hr = ACMWrapper_CheckMediaType( pImpl, pmtIn, NULL );
127         if ( FAILED(hr) )
128                 return hr;
129
130         return E_NOTIMPL;
131 }
132
133 static HRESULT ACMWrapper_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
134 {
135         CACMWrapperImpl*        This = pImpl->m_pUserData;
136         HRESULT hr;
137
138         FIXME("(%p)\n",This);
139
140         if ( This == NULL )
141                 return E_UNEXPECTED;
142
143         hr = ACMWrapper_CheckMediaType( pImpl, pmtIn, pmtOut );
144         if ( FAILED(hr) )
145                 return hr;
146
147         *pbTransInPlace = FALSE;
148         *pbTryToReuseSample = FALSE;
149
150         return E_NOTIMPL;
151 }
152
153 static HRESULT ACMWrapper_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
154 {
155         CACMWrapperImpl*        This = pImpl->m_pUserData;
156
157         FIXME("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
158
159         if ( This == NULL )
160                 return E_UNEXPECTED;
161
162         return E_NOTIMPL;
163 }
164
165 static HRESULT ACMWrapper_ProcessReceive( CTransformBaseImpl* pImpl, IMediaSample* pSampIn )
166 {
167         CACMWrapperImpl*        This = pImpl->m_pUserData;
168         BYTE*   pDataIn = NULL;
169         LONG    lDataInLen;
170         HRESULT hr;
171
172         FIXME("(%p)\n",This);
173
174         if ( This == NULL )
175                 return E_UNEXPECTED;
176
177         hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
178         if ( FAILED(hr) )
179                 return hr;
180         lDataInLen = IMediaSample_GetActualDataLength( pSampIn );
181
182         return E_NOTIMPL;
183 }
184
185 static HRESULT ACMWrapper_EndTransform( CTransformBaseImpl* pImpl )
186 {
187         CACMWrapperImpl*        This = pImpl->m_pUserData;
188
189         TRACE("(%p)\n",This);
190
191         if ( This == NULL )
192                 return E_UNEXPECTED;
193
194         ACMWrapper_Close( This );
195
196         return S_OK;
197 }
198
199 static const TransformBaseHandlers transhandlers =
200 {
201         ACMWrapper_Init,
202         ACMWrapper_Cleanup,
203         ACMWrapper_CheckMediaType,
204         ACMWrapper_GetOutputTypes,
205         ACMWrapper_GetAllocProp,
206         ACMWrapper_BeginTransform,
207         ACMWrapper_ProcessReceive,
208         NULL,
209         ACMWrapper_EndTransform,
210 };
211
212 HRESULT QUARTZ_CreateACMWrapper(IUnknown* punkOuter,void** ppobj)
213 {
214         return QUARTZ_CreateTransformBase(
215                 punkOuter,ppobj,
216                 &CLSID_ACMWrapper,
217                 ACMWrapper_FilterName,
218                 NULL, NULL,
219                 &transhandlers );
220 }
221
222