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