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