1 | /*
|
---|
2 | * Copyright 1999 Marcus Meissner
|
---|
3 | */
|
---|
4 | #ifdef __WIN32OS2__
|
---|
5 | #include <os2win.h>
|
---|
6 | #define CINTERFACE
|
---|
7 | #define ICOM_CINTERFACE 1
|
---|
8 | #define INITGUID
|
---|
9 | #endif
|
---|
10 | #include <string.h>
|
---|
11 | #include <stdio.h>
|
---|
12 | #include <assert.h>
|
---|
13 |
|
---|
14 | #include "winbase.h"
|
---|
15 | #include "winnls.h"
|
---|
16 | #include "mmsystem.h"
|
---|
17 | #include "winerror.h"
|
---|
18 | #include "vfw.h"
|
---|
19 | #include "debugtools.h"
|
---|
20 |
|
---|
21 | DEFAULT_DEBUG_CHANNEL(avifile);
|
---|
22 |
|
---|
23 | static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj);
|
---|
24 | static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface);
|
---|
25 | static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface);
|
---|
26 | static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size);
|
---|
27 | static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
|
---|
28 | static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
|
---|
29 | static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size);
|
---|
30 | static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size);
|
---|
31 | static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface);
|
---|
32 | static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam);
|
---|
33 |
|
---|
34 | struct ICOM_VTABLE(IAVIFile) iavift = {
|
---|
35 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
36 | IAVIFile_fnQueryInterface,
|
---|
37 | IAVIFile_fnAddRef,
|
---|
38 | IAVIFile_fnRelease,
|
---|
39 | IAVIFile_fnInfo,
|
---|
40 | IAVIFile_fnGetStream,
|
---|
41 | IAVIFile_fnCreateStream,
|
---|
42 | IAVIFile_fnWriteData,
|
---|
43 | IAVIFile_fnReadData,
|
---|
44 | IAVIFile_fnEndRecord,
|
---|
45 | IAVIFile_fnDeleteStream
|
---|
46 | };
|
---|
47 |
|
---|
48 | static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj);
|
---|
49 | static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface);
|
---|
50 | static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface);
|
---|
51 | static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2);
|
---|
52 | static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size);
|
---|
53 | static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags);
|
---|
54 | static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize);
|
---|
55 | static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize);
|
---|
56 | static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
|
---|
57 | static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
|
---|
58 | static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples);
|
---|
59 | static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread);
|
---|
60 | static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size);
|
---|
61 | static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen);
|
---|
62 |
|
---|
63 | struct ICOM_VTABLE(IAVIStream) iavist = {
|
---|
64 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
65 | IAVIStream_fnQueryInterface,
|
---|
66 | IAVIStream_fnAddRef,
|
---|
67 | IAVIStream_fnRelease,
|
---|
68 | IAVIStream_fnCreate,
|
---|
69 | IAVIStream_fnInfo,
|
---|
70 | IAVIStream_fnFindSample,
|
---|
71 | IAVIStream_fnReadFormat,
|
---|
72 | IAVIStream_fnSetFormat,
|
---|
73 | IAVIStream_fnRead,
|
---|
74 | IAVIStream_fnWrite,
|
---|
75 | IAVIStream_fnDelete,
|
---|
76 | IAVIStream_fnReadData,
|
---|
77 | IAVIStream_fnWriteData,
|
---|
78 | IAVIStream_fnSetInfo
|
---|
79 | };
|
---|
80 |
|
---|
81 | typedef struct IAVIStreamImpl {
|
---|
82 | /* IUnknown stuff */
|
---|
83 | ICOM_VFIELD(IAVIStream);
|
---|
84 | DWORD ref;
|
---|
85 | /* IAVIStream stuff */
|
---|
86 | LPVOID lpInputFormat;
|
---|
87 | DWORD inputformatsize;
|
---|
88 | BOOL iscompressing;
|
---|
89 | DWORD curframe;
|
---|
90 |
|
---|
91 | /* Compressor stuff */
|
---|
92 | HIC hic;
|
---|
93 | LPVOID lpCompressFormat;
|
---|
94 | ICINFO icinfo;
|
---|
95 | DWORD compbufsize;
|
---|
96 | LPVOID compbuffer;
|
---|
97 |
|
---|
98 | DWORD decompbufsize;
|
---|
99 | LPVOID decompbuffer;
|
---|
100 | LPVOID decompformat;
|
---|
101 | AVICOMPRESSOPTIONS aco;
|
---|
102 |
|
---|
103 | LPVOID lpPrev; /* pointer to decompressed frame later */
|
---|
104 | LPVOID lpPrevFormat; /* pointer to decompressed info later */
|
---|
105 | } IAVIStreamImpl;
|
---|
106 |
|
---|
107 | /***********************************************************************
|
---|
108 | * AVIFileInit
|
---|
109 | */
|
---|
110 | void WINAPI
|
---|
111 | AVIFileInit(void) {
|
---|
112 | FIXME("(),stub!\n");
|
---|
113 | }
|
---|
114 |
|
---|
115 | typedef struct IAVIFileImpl {
|
---|
116 | /* IUnknown stuff */
|
---|
117 | ICOM_VFIELD(IAVIFile);
|
---|
118 | DWORD ref;
|
---|
119 | /* IAVIFile stuff... */
|
---|
120 | } IAVIFileImpl;
|
---|
121 |
|
---|
122 | static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
|
---|
123 | ICOM_THIS(IAVIFileImpl,iface);
|
---|
124 |
|
---|
125 | TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
---|
126 | if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
|
---|
127 | !memcmp(&IID_IAVIFile,refiid,sizeof(IID_IAVIFile))
|
---|
128 | ) {
|
---|
129 | *obj = iface;
|
---|
130 | return S_OK;
|
---|
131 | }
|
---|
132 | return OLE_E_ENUM_NOMORE;
|
---|
133 | }
|
---|
134 |
|
---|
135 | static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
|
---|
136 | ICOM_THIS(IAVIFileImpl,iface);
|
---|
137 |
|
---|
138 | FIXME("(%p)->AddRef()\n",iface);
|
---|
139 | return ++(This->ref);
|
---|
140 | }
|
---|
141 |
|
---|
142 | static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
|
---|
143 | ICOM_THIS(IAVIFileImpl,iface);
|
---|
144 |
|
---|
145 | FIXME("(%p)->Release()\n",iface);
|
---|
146 | if (!--(This->ref)) {
|
---|
147 | HeapFree(GetProcessHeap(),0,iface);
|
---|
148 | return 0;
|
---|
149 | }
|
---|
150 | return This->ref;
|
---|
151 | }
|
---|
152 |
|
---|
153 | static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) {
|
---|
154 | FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);
|
---|
155 |
|
---|
156 | /* FIXME: fill out struct? */
|
---|
157 | return E_FAIL;
|
---|
158 | }
|
---|
159 |
|
---|
160 | static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
|
---|
161 | FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);
|
---|
162 | /* FIXME: create interface etc. */
|
---|
163 | return E_FAIL;
|
---|
164 | }
|
---|
165 |
|
---|
166 | static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
|
---|
167 | ICOM_THIS(IAVIStreamImpl,iface);
|
---|
168 | char fcc[5];
|
---|
169 | IAVIStreamImpl *istream;
|
---|
170 |
|
---|
171 | FIXME("(%p,%p,%p)\n",This,avis,asi);
|
---|
172 | istream = (IAVIStreamImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIStreamImpl));
|
---|
173 | istream->ref = 1;
|
---|
174 | ICOM_VTBL(istream) = &iavist;
|
---|
175 | fcc[4]='\0';
|
---|
176 | memcpy(fcc,(char*)&(asi->fccType),4);
|
---|
177 | FIXME("\tfccType '%s'\n",fcc);
|
---|
178 | memcpy(fcc,(char*)&(asi->fccHandler),4);
|
---|
179 | FIXME("\tfccHandler '%s'\n",fcc);
|
---|
180 | FIXME("\tdwFlags 0x%08lx\n",asi->dwFlags);
|
---|
181 | FIXME("\tdwCaps 0x%08lx\n",asi->dwCaps);
|
---|
182 | FIXME("\tname '%s'\n",debugstr_w(asi->szName));
|
---|
183 |
|
---|
184 | istream->curframe = 0;
|
---|
185 | *avis = (PAVISTREAM)istream;
|
---|
186 | return S_OK;
|
---|
187 | }
|
---|
188 |
|
---|
189 | static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size) {
|
---|
190 | FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,ckid,lpData,size);
|
---|
191 | /* FIXME: write data to file */
|
---|
192 | return E_FAIL;
|
---|
193 | }
|
---|
194 |
|
---|
195 | static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size) {
|
---|
196 | FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,ckid,lpData,size);
|
---|
197 | /* FIXME: read at most size bytes from file */
|
---|
198 | return E_FAIL;
|
---|
199 | }
|
---|
200 |
|
---|
201 | static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) {
|
---|
202 | FIXME("(%p)->EndRecord()\n",iface);
|
---|
203 | /* FIXME: end record? */
|
---|
204 | return E_FAIL;
|
---|
205 | }
|
---|
206 |
|
---|
207 | static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam) {
|
---|
208 | FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",iface,fccType,lParam);
|
---|
209 | /* FIXME: delete stream? */
|
---|
210 | return E_FAIL;
|
---|
211 | }
|
---|
212 |
|
---|
213 | /***********************************************************************
|
---|
214 | * AVIFileOpenA
|
---|
215 | */
|
---|
216 | HRESULT WINAPI AVIFileOpenA(
|
---|
217 | PAVIFILE * ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler
|
---|
218 | ) {
|
---|
219 | IAVIFileImpl *iavi;
|
---|
220 |
|
---|
221 | FIXME("(%p,%s,0x%08lx,%s),stub!\n",ppfile,szFile,(DWORD)uMode,debugstr_guid(lpHandler));
|
---|
222 | iavi = (IAVIFileImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIFileImpl));
|
---|
223 | iavi->ref = 1;
|
---|
224 | ICOM_VTBL(iavi) = &iavift;
|
---|
225 | #ifdef __WIN32OS2__
|
---|
226 | *ppfile = (PAVIFILE)iavi;
|
---|
227 | #else
|
---|
228 | *ppfile = (LPVOID)iavi;
|
---|
229 | #endif
|
---|
230 | return S_OK;
|
---|
231 | }
|
---|
232 |
|
---|
233 | static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
|
---|
234 | ICOM_THIS(IAVIStreamImpl,iface);
|
---|
235 |
|
---|
236 | TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
---|
237 | if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
|
---|
238 | !memcmp(&IID_IAVIStream,refiid,sizeof(IID_IAVIStream))
|
---|
239 | ) {
|
---|
240 | *obj = This;
|
---|
241 | return S_OK;
|
---|
242 | }
|
---|
243 | /* can return IGetFrame interface too */
|
---|
244 | return OLE_E_ENUM_NOMORE;
|
---|
245 | }
|
---|
246 |
|
---|
247 | static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
|
---|
248 | ICOM_THIS(IAVIStreamImpl,iface);
|
---|
249 |
|
---|
250 | FIXME("(%p)->AddRef()\n",iface);
|
---|
251 | return ++(This->ref);
|
---|
252 | }
|
---|
253 |
|
---|
254 | static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
|
---|
255 | ICOM_THIS(IAVIStreamImpl,iface);
|
---|
256 |
|
---|
257 | FIXME("(%p)->Release()\n",iface);
|
---|
258 | if (!--(This->ref)) {
|
---|
259 | HeapFree(GetProcessHeap(),0,This);
|
---|
260 | return 0;
|
---|
261 | }
|
---|
262 | return This->ref;
|
---|
263 | }
|
---|
264 |
|
---|
265 | static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2) {
|
---|
266 | FIXME("(%p)->Create(0x%08lx,0x%08lx)\n",iface,lParam1,lParam2);
|
---|
267 | return E_FAIL;
|
---|
268 | }
|
---|
269 |
|
---|
270 | static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size) {
|
---|
271 | FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size);
|
---|
272 | return E_FAIL;
|
---|
273 | }
|
---|
274 |
|
---|
275 | static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags) {
|
---|
276 | FIXME("(%p)->FindSample(%ld,0x%08lx)\n",iface,pos,flags);
|
---|
277 | return E_FAIL;
|
---|
278 | }
|
---|
279 |
|
---|
280 | static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) {
|
---|
281 | FIXME("(%p)->ReadFormat(%ld,%p,%p)\n",iface,pos,format,formatsize);
|
---|
282 | return E_FAIL;
|
---|
283 | }
|
---|
284 |
|
---|
285 | /***********************************************************************
|
---|
286 | * IAVIStream::SetFormat
|
---|
287 | */
|
---|
288 | static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
|
---|
289 | IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
|
---|
290 |
|
---|
291 | FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",iface,pos,format,formatsize);
|
---|
292 | if (as->lpInputFormat) HeapFree(GetProcessHeap(),0,as->lpInputFormat);
|
---|
293 | as->inputformatsize = formatsize;
|
---|
294 | as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize);
|
---|
295 | memcpy(as->lpInputFormat,format,formatsize);
|
---|
296 | if (as->iscompressing) {
|
---|
297 | int xsize;
|
---|
298 | /* Set up the Compressor part */
|
---|
299 | xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat);
|
---|
300 | as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize);
|
---|
301 | ICCompressGetFormat(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
---|
302 | ICCompressBegin(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
---|
303 | as->compbufsize = ICCompressGetSize(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
---|
304 | as->compbuffer = HeapAlloc(GetProcessHeap(),0,as->compbufsize);
|
---|
305 |
|
---|
306 | /* Set up the Decompressor part (for prev frames?) */
|
---|
307 | xsize=ICDecompressGetFormatSize(as->hic,as->lpCompressFormat);
|
---|
308 | as->decompformat = HeapAlloc(GetProcessHeap(),0,xsize);
|
---|
309 | ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
|
---|
310 | as->decompbufsize=((LPBITMAPINFOHEADER)as->decompbuffer)->biSizeImage;
|
---|
311 | as->decompbuffer = HeapReAlloc(GetProcessHeap(),0,as->decompbuffer,as->decompbufsize);
|
---|
312 | memset(as->decompbuffer,0xff,as->decompbufsize);
|
---|
313 | assert(HeapValidate(GetProcessHeap(),0,NULL));
|
---|
314 |
|
---|
315 | ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
|
---|
316 | ICDecompressBegin(as->hic,as->lpCompressFormat,as->decompformat);
|
---|
317 | as->lpPrev = as->lpPrevFormat = NULL;
|
---|
318 | }
|
---|
319 | return S_OK;
|
---|
320 | }
|
---|
321 |
|
---|
322 | static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
|
---|
323 | FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",iface,start,samples,buffer,buffersize,bytesread,samplesread);
|
---|
324 | return E_FAIL;
|
---|
325 | }
|
---|
326 |
|
---|
327 | static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
|
---|
328 | IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
|
---|
329 | DWORD ckid,xflags;
|
---|
330 |
|
---|
331 | FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
|
---|
332 |
|
---|
333 | ICCompress(
|
---|
334 | as->hic,flags,
|
---|
335 | #ifdef __WIN32OS2__
|
---|
336 | (LPBITMAPINFOHEADER)
|
---|
337 | #endif
|
---|
338 | as->lpCompressFormat,
|
---|
339 | as->compbuffer,
|
---|
340 | #ifdef __WIN32OS2__
|
---|
341 | (LPBITMAPINFOHEADER)
|
---|
342 | #endif
|
---|
343 | as->lpInputFormat,buffer,
|
---|
344 | &ckid,&xflags,
|
---|
345 | as->curframe,0xffffff/*framesize*/,as->aco.dwQuality,
|
---|
346 | #ifdef __WIN32OS2__
|
---|
347 | (LPBITMAPINFOHEADER)as->lpPrevFormat,as->lpPrev
|
---|
348 | #else
|
---|
349 | as->lpPrevFormat,as->lpPrev
|
---|
350 | #endif
|
---|
351 | );
|
---|
352 | ICDecompress(
|
---|
353 | as->hic,
|
---|
354 | flags, /* FIXME: check */
|
---|
355 | #ifdef __WIN32OS2__
|
---|
356 | (LPBITMAPINFOHEADER)
|
---|
357 | #endif
|
---|
358 | as->lpCompressFormat,
|
---|
359 | as->compbuffer,
|
---|
360 | #ifdef __WIN32OS2__
|
---|
361 | (LPBITMAPINFOHEADER)
|
---|
362 | #endif
|
---|
363 | as->decompformat,
|
---|
364 | as->decompbuffer
|
---|
365 | );
|
---|
366 | /* We now have a prev format for the next compress ... */
|
---|
367 | as->lpPrevFormat = as->decompformat;
|
---|
368 | as->lpPrev = as->decompbuffer;
|
---|
369 | return S_OK;
|
---|
370 | }
|
---|
371 |
|
---|
372 | static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) {
|
---|
373 | FIXME("(%p)->Delete(%ld,%ld)\n",iface,start,samples);
|
---|
374 | return E_FAIL;
|
---|
375 | }
|
---|
376 | static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) {
|
---|
377 | FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,fcc,lp,lpread);
|
---|
378 | return E_FAIL;
|
---|
379 | }
|
---|
380 |
|
---|
381 | static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) {
|
---|
382 | FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,fcc,lp,size);
|
---|
383 | return E_FAIL;
|
---|
384 | }
|
---|
385 |
|
---|
386 | static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) {
|
---|
387 | FIXME("(%p)->SetInfo(%p,%ld)\n",iface,info,infolen);
|
---|
388 | return E_FAIL;
|
---|
389 | }
|
---|
390 |
|
---|
391 | /***********************************************************************
|
---|
392 | * AVIFileCreateStreamA
|
---|
393 | */
|
---|
394 | HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
|
---|
395 | AVISTREAMINFOW psiw;
|
---|
396 |
|
---|
397 | /* Only the szName at the end is different */
|
---|
398 | memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
|
---|
399 | MultiByteToWideChar( CP_ACP, 0, psi->szName, -1,
|
---|
400 | psiw.szName, sizeof(psiw.szName) / sizeof(WCHAR) );
|
---|
401 | return IAVIFile_CreateStream(iface,ppavi,&psiw);
|
---|
402 | }
|
---|
403 |
|
---|
404 | /***********************************************************************
|
---|
405 | * AVIFileCreateStreamW
|
---|
406 | */
|
---|
407 | HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
|
---|
408 | return IAVIFile_CreateStream(iface,avis,asi);
|
---|
409 | }
|
---|
410 |
|
---|
411 |
|
---|
412 | /***********************************************************************
|
---|
413 | * AVIFileGetStream
|
---|
414 | */
|
---|
415 | HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
|
---|
416 | return IAVIFile_GetStream(iface,avis,fccType,lParam);
|
---|
417 | }
|
---|
418 |
|
---|
419 | /***********************************************************************
|
---|
420 | * AVIFileInfoA
|
---|
421 | */
|
---|
422 | HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
|
---|
423 | AVIFILEINFOW afiw;
|
---|
424 | HRESULT hres;
|
---|
425 |
|
---|
426 | if (size < sizeof(AVIFILEINFOA))
|
---|
427 | return AVIERR_BADSIZE;
|
---|
428 | hres = IAVIFile_Info(iface,&afiw,sizeof(afiw));
|
---|
429 | memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType));
|
---|
430 | WideCharToMultiByte( CP_ACP, 0, afiw.szFileType, -1,
|
---|
431 | afi->szFileType, sizeof(afi->szFileType), NULL, NULL );
|
---|
432 | afi->szFileType[sizeof(afi->szFileType)-1] = 0;
|
---|
433 | return hres;
|
---|
434 | }
|
---|
435 |
|
---|
436 | /***********************************************************************
|
---|
437 | * AVIStreamInfoW
|
---|
438 | */
|
---|
439 | HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
|
---|
440 | size) {
|
---|
441 | return IAVIFile_Info(iface,asi,size);
|
---|
442 | }
|
---|
443 |
|
---|
444 | /***********************************************************************
|
---|
445 | * AVIStreamInfoA
|
---|
446 | */
|
---|
447 | HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
|
---|
448 | size) {
|
---|
449 | AVISTREAMINFOW asiw;
|
---|
450 | HRESULT hres;
|
---|
451 |
|
---|
452 | if (size<sizeof(AVISTREAMINFOA))
|
---|
453 | return AVIERR_BADSIZE;
|
---|
454 | hres = IAVIFile_Info(iface,&asiw,sizeof(asiw));
|
---|
455 | memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName));
|
---|
456 | WideCharToMultiByte( CP_ACP, 0, asiw.szName, -1,
|
---|
457 | asi->szName, sizeof(asi->szName), NULL, NULL );
|
---|
458 | asi->szName[sizeof(asi->szName)-1] = 0;
|
---|
459 | return hres;
|
---|
460 | }
|
---|
461 |
|
---|
462 | /***********************************************************************
|
---|
463 | * AVIFileInfoW
|
---|
464 | */
|
---|
465 | HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
|
---|
466 | return IAVIFile_Info(iface,afi,size);
|
---|
467 | }
|
---|
468 |
|
---|
469 | /***********************************************************************
|
---|
470 | * AVIMakeCompressedStream
|
---|
471 | */
|
---|
472 | HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
|
---|
473 | char fcc[5];
|
---|
474 | IAVIStreamImpl *as;
|
---|
475 | FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
|
---|
476 | fcc[4]='\0';
|
---|
477 | memcpy(fcc,&(aco->fccType),4);
|
---|
478 | FIXME("\tfccType: '%s'\n",fcc);
|
---|
479 | memcpy(fcc,&(aco->fccHandler),4);
|
---|
480 | FIXME("\tfccHandler: '%s'\n",fcc);
|
---|
481 | FIXME("\tdwFlags: 0x%08lx\n",aco->dwFlags);
|
---|
482 |
|
---|
483 | /* we just create a duplicate for now */
|
---|
484 | IAVIStream_AddRef(ppsSource);
|
---|
485 | *ppsCompressed = ppsSource;
|
---|
486 | as = (IAVIStreamImpl*)ppsSource;
|
---|
487 |
|
---|
488 | /* this is where the fun begins. Open a compressor and prepare it. */
|
---|
489 | as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
|
---|
490 |
|
---|
491 | /* May happen. for instance if the codec is not able to compress */
|
---|
492 | if (!as->hic)
|
---|
493 | return AVIERR_UNSUPPORTED;
|
---|
494 |
|
---|
495 | ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));
|
---|
496 | FIXME("Opened compressor: '%s' '%s'\n",debugstr_w(as->icinfo.szName),debugstr_w(as->icinfo.szDescription));
|
---|
497 | as->iscompressing = TRUE;
|
---|
498 | memcpy(&(as->aco),aco,sizeof(*aco));
|
---|
499 | if (as->icinfo.dwFlags & VIDCF_COMPRESSFRAMES) {
|
---|
500 | ICCOMPRESSFRAMES icf;
|
---|
501 |
|
---|
502 | /* now what to fill in there ... Hmm */
|
---|
503 | memset(&icf,0,sizeof(icf));
|
---|
504 | icf.lDataRate = aco->dwBytesPerSecond;
|
---|
505 | icf.lQuality = aco->dwQuality;
|
---|
506 | icf.lKeyRate = aco->dwKeyFrameEvery;
|
---|
507 |
|
---|
508 | #ifdef __WIN32OS2__
|
---|
509 | *(DWORD *)&icf.GetData = 0xdead4242;
|
---|
510 | *(DWORD *)&icf.PutData = 0xdead4243;
|
---|
511 | #else
|
---|
512 | icf.GetData = (void *)0xdead4242;
|
---|
513 | icf.PutData = (void *)0xdead4243;
|
---|
514 | #endif
|
---|
515 | ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf));
|
---|
516 | }
|
---|
517 | return S_OK;
|
---|
518 | }
|
---|
519 |
|
---|
520 | /***********************************************************************
|
---|
521 | * AVIStreamSetFormat
|
---|
522 | */
|
---|
523 | HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
|
---|
524 | return IAVIStream_SetFormat(iface,pos,format,formatsize);
|
---|
525 | }
|
---|
526 |
|
---|
527 | /***********************************************************************
|
---|
528 | * AVIStreamReadFormat
|
---|
529 | */
|
---|
530 | HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
|
---|
531 | return IAVIStream_ReadFormat(iface,pos,format,formatsize);
|
---|
532 | }
|
---|
533 |
|
---|
534 | /***********************************************************************
|
---|
535 | * AVIStreamWrite(
|
---|
536 | */
|
---|
537 | HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
|
---|
538 | return IAVIStream_Write(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
|
---|
539 | }
|
---|
540 |
|
---|
541 | /***********************************************************************
|
---|
542 | * AVIStreamRead
|
---|
543 | */
|
---|
544 | HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
|
---|
545 | return IAVIStream_Read(iface,start,samples,buffer,buffersize,bytesread,samplesread);
|
---|
546 | }
|
---|
547 |
|
---|
548 | /***********************************************************************
|
---|
549 | * AVIStreamWriteData
|
---|
550 | */
|
---|
551 | HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
|
---|
552 | return IAVIStream_WriteData(iface,fcc,lp,size);
|
---|
553 | }
|
---|
554 |
|
---|
555 | /***********************************************************************
|
---|
556 | * AVIStreamReadData
|
---|
557 | */
|
---|
558 | HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
|
---|
559 | return IAVIStream_ReadData(iface,fcc,lp,lpread);
|
---|
560 | }
|
---|
561 |
|
---|
562 | /***********************************************************************
|
---|
563 | * AVIStreamStart
|
---|
564 | */
|
---|
565 | LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
|
---|
566 | AVISTREAMINFOW si;
|
---|
567 |
|
---|
568 | IAVIStream_Info(iface,&si,sizeof(si));
|
---|
569 | return si.dwStart;
|
---|
570 | }
|
---|
571 |
|
---|
572 | /***********************************************************************
|
---|
573 | * AVIStreamLength
|
---|
574 | */
|
---|
575 | LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
|
---|
576 | AVISTREAMINFOW si;
|
---|
577 | HRESULT ret;
|
---|
578 |
|
---|
579 | ret = IAVIStream_Info(iface,&si,sizeof(si));
|
---|
580 | if (ret) /* error */
|
---|
581 | return 1;
|
---|
582 | return si.dwLength;
|
---|
583 | }
|
---|
584 |
|
---|
585 | /***********************************************************************
|
---|
586 | * AVIStreamRelease
|
---|
587 | */
|
---|
588 | ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
|
---|
589 | return IAVIStream_Release(iface);
|
---|
590 | }
|
---|
591 |
|
---|
592 | /***********************************************************************
|
---|
593 | * AVIStreamGetFrameOpen
|
---|
594 | */
|
---|
595 | PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
|
---|
596 | FIXME("(%p)->(%p),stub!\n",iface,bmi);
|
---|
597 | return NULL;
|
---|
598 | }
|
---|
599 |
|
---|
600 | /***********************************************************************
|
---|
601 | * AVIStreamGetFrame
|
---|
602 | */
|
---|
603 | LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
|
---|
604 | return IGetFrame_GetFrame(pg,pos);
|
---|
605 | }
|
---|
606 |
|
---|
607 | /***********************************************************************
|
---|
608 | * AVIStreamGetFrameClose
|
---|
609 | */
|
---|
610 | HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
|
---|
611 | if (pg) IGetFrame_Release(pg);
|
---|
612 | return 0;
|
---|
613 | }
|
---|
614 |
|
---|
615 | /***********************************************************************
|
---|
616 | * AVIFileRelease
|
---|
617 | */
|
---|
618 | ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
|
---|
619 | return IAVIFile_Release(iface);
|
---|
620 | }
|
---|
621 |
|
---|
622 | /***********************************************************************
|
---|
623 | * AVIFileExit
|
---|
624 | */
|
---|
625 | void WINAPI AVIFileExit(void) {
|
---|
626 | FIXME("(), stub.\n");
|
---|
627 | }
|
---|
628 |
|
---|
629 | #ifdef __WIN32OS2__
|
---|
630 | LONG WINAPI AVIStreamTimeToSample (PAVISTREAM pavi, LONG lTime)
|
---|
631 | {
|
---|
632 | return 0;
|
---|
633 | }
|
---|
634 |
|
---|
635 | LONG WINAPI AVIStreamSampleToTime (PAVISTREAM pavi, LONG lSample)
|
---|
636 | {
|
---|
637 | return 0;
|
---|
638 | }
|
---|
639 | #endif
|
---|