Avoid going past the end of the relocation section. Skip sanity checks
[wine/multimedia.git] / dlls / avifil32 / avifile.c
blob41265e8d3037f4295eb29cb95e45f38a413d74d4
1 /*
2 * Copyright 1999 Marcus Meissner
3 */
4 #include <string.h>
5 #include <stdio.h>
6 #include <assert.h>
8 #include "winbase.h"
9 #include "wine/winestring.h"
10 #include "mmsystem.h"
11 #include "winerror.h"
12 #include "debugtools.h"
14 #include "initguid.h"
15 #include "vfw.h"
17 DEFAULT_DEBUG_CHANNEL(avifile);
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);
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
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);
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
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;
87 /* Compressor stuff */
88 HIC hic;
89 LPVOID lpCompressFormat;
90 ICINFO icinfo;
91 DWORD compbufsize;
92 LPVOID compbuffer;
94 DWORD decompbufsize;
95 LPVOID decompbuffer;
96 LPVOID decompformat;
97 AVICOMPRESSOPTIONS aco;
99 LPVOID lpPrev; /* pointer to decompressed frame later */
100 LPVOID lpPrevFormat; /* pointer to decompressed info later */
101 } IAVIStreamImpl;
103 /***********************************************************************
104 * AVIFileInit
106 void WINAPI
107 AVIFileInit(void) {
108 FIXME("(),stub!\n");
111 typedef struct IAVIFileImpl {
112 /* IUnknown stuff */
113 ICOM_VFIELD(IAVIFile);
114 DWORD ref;
115 /* IAVIFile stuff... */
116 } IAVIFileImpl;
118 static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
119 ICOM_THIS(IAVIFileImpl,iface);
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))
125 *obj = iface;
126 return S_OK;
128 return OLE_E_ENUM_NOMORE;
131 static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
132 ICOM_THIS(IAVIFileImpl,iface);
134 FIXME("(%p)->AddRef()\n",iface);
135 return ++(This->ref);
138 static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
139 ICOM_THIS(IAVIFileImpl,iface);
141 FIXME("(%p)->Release()\n",iface);
142 if (!--(This->ref)) {
143 HeapFree(GetProcessHeap(),0,iface);
144 return 0;
146 return This->ref;
149 static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) {
150 FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);
152 /* FIXME: fill out struct? */
153 return E_FAIL;
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;
162 static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
163 ICOM_THIS(IAVIStreamImpl,iface);
164 char fcc[5];
165 IAVIStreamImpl *istream;
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));
180 istream->curframe = 0;
181 *avis = (PAVISTREAM)istream;
182 return S_OK;
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;
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;
197 static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) {
198 FIXME("(%p)->EndRecord()\n",iface);
199 /* FIXME: end record? */
200 return E_FAIL;
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;
209 /***********************************************************************
210 * AVIFileOpenA
212 HRESULT WINAPI AVIFileOpenA(
213 PAVIFILE * ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler
215 IAVIFileImpl *iavi;
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;
225 static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
226 ICOM_THIS(IAVIStreamImpl,iface);
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))
232 *obj = This;
233 return S_OK;
235 /* can return IGetFrame interface too */
236 return OLE_E_ENUM_NOMORE;
239 static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
240 ICOM_THIS(IAVIStreamImpl,iface);
242 FIXME("(%p)->AddRef()\n",iface);
243 return ++(This->ref);
246 static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
247 ICOM_THIS(IAVIStreamImpl,iface);
249 FIXME("(%p)->Release()\n",iface);
250 if (!--(This->ref)) {
251 HeapFree(GetProcessHeap(),0,This);
252 return 0;
254 return This->ref;
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;
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;
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;
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;
277 /***********************************************************************
278 * IAVIStream::SetFormat
280 static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
281 IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
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);
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));
307 ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
308 ICDecompressBegin(as->hic,as->lpCompressFormat,as->decompformat);
309 as->lpPrev = as->lpPrevFormat = NULL;
311 return S_OK;
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;
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;
323 FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
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
334 ICDecompress(
335 as->hic,
336 flags, /* FIXME: check */
337 as->lpCompressFormat,
338 as->compbuffer,
339 as->decompformat,
340 as->decompbuffer
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;
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;
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;
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;
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;
367 /***********************************************************************
368 * AVIFileCreateStreamA
370 HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
371 AVISTREAMINFOW psiw;
373 /* Only the szName at the end is different */
374 memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
375 lstrcpynAtoW(psiw.szName,psi->szName,sizeof(psi->szName));
376 return IAVIFile_CreateStream(iface,ppavi,&psiw);
379 /***********************************************************************
380 * AVIFileCreateStreamW
382 HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
383 return IAVIFile_CreateStream(iface,avis,asi);
387 /***********************************************************************
388 * AVIFileGetStream
390 HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
391 return IAVIFile_GetStream(iface,avis,fccType,lParam);
394 /***********************************************************************
395 * AVIFileInfoA
397 HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
398 AVIFILEINFOW afiw;
399 HRESULT hres;
401 if (size < sizeof(AVIFILEINFOA))
402 return AVIERR_BADSIZE;
403 hres = IAVIFile_Info(iface,&afiw,sizeof(afiw));
404 memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType));
405 lstrcpynWtoA(afi->szFileType,afiw.szFileType,sizeof(afi->szFileType));
406 return hres;
409 /***********************************************************************
410 * AVIStreamInfoW
412 HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
413 size) {
414 return IAVIFile_Info(iface,asi,size);
417 /***********************************************************************
418 * AVIStreamInfoA
420 HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
421 size) {
422 AVISTREAMINFOW asiw;
423 HRESULT hres;
425 if (size<sizeof(AVISTREAMINFOA))
426 return AVIERR_BADSIZE;
427 hres = IAVIFile_Info(iface,&asiw,sizeof(asiw));
428 memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName));
429 lstrcpynWtoA(asi->szName,asiw.szName,sizeof(asi->szName));
430 return hres;
433 /***********************************************************************
434 * AVIFileInfoW
436 HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
437 return IAVIFile_Info(iface,afi,size);
440 /***********************************************************************
441 * AVIMakeCompressedStream
443 HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
444 char fcc[5];
445 IAVIStreamImpl *as;
446 FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
447 fcc[4]='\0';
448 memcpy(fcc,&(aco->fccType),4);
449 FIXME("\tfccType: '%s'\n",fcc);
450 memcpy(fcc,&(aco->fccHandler),4);
451 FIXME("\tfccHandler: '%s'\n",fcc);
452 FIXME("\tdwFlags: 0x%08lx\n",aco->dwFlags);
454 /* we just create a duplicate for now */
455 IAVIStream_AddRef(ppsSource);
456 *ppsCompressed = ppsSource;
457 as = (IAVIStreamImpl*)ppsSource;
459 /* this is where the fun begins. Open a compressor and prepare it. */
460 as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
462 /* May happen. for instance if the codec is not able to compress */
463 if (!as->hic)
464 return AVIERR_UNSUPPORTED;
466 ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));
467 FIXME("Opened compressor: '%s' '%s'\n",debugstr_w(as->icinfo.szName),debugstr_w(as->icinfo.szDescription));
468 as->iscompressing = TRUE;
469 memcpy(&(as->aco),aco,sizeof(*aco));
470 if (as->icinfo.dwFlags & VIDCF_COMPRESSFRAMES) {
471 ICCOMPRESSFRAMES icf;
473 /* now what to fill in there ... Hmm */
474 memset(&icf,0,sizeof(icf));
475 icf.lDataRate = aco->dwBytesPerSecond;
476 icf.lQuality = aco->dwQuality;
477 icf.lKeyRate = aco->dwKeyFrameEvery;
479 icf.GetData = (void *)0xdead4242;
480 icf.PutData = (void *)0xdead4243;
481 ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf));
483 return S_OK;
486 /***********************************************************************
487 * AVIStreamSetFormat
489 HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
490 return IAVIStream_SetFormat(iface,pos,format,formatsize);
493 /***********************************************************************
494 * AVIStreamReadFormat
496 HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
497 return IAVIStream_ReadFormat(iface,pos,format,formatsize);
500 /***********************************************************************
501 * AVIStreamWrite(
503 HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
504 return IAVIStream_Write(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
507 /***********************************************************************
508 * AVIStreamRead
510 HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
511 return IAVIStream_Read(iface,start,samples,buffer,buffersize,bytesread,samplesread);
514 /***********************************************************************
515 * AVIStreamWriteData
517 HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
518 return IAVIStream_WriteData(iface,fcc,lp,size);
521 /***********************************************************************
522 * AVIStreamReadData
524 HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
525 return IAVIStream_ReadData(iface,fcc,lp,lpread);
528 /***********************************************************************
529 * AVIStreamStart
531 LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
532 AVISTREAMINFOW si;
534 IAVIStream_Info(iface,&si,sizeof(si));
535 return si.dwStart;
538 /***********************************************************************
539 * AVIStreamLength
541 LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
542 AVISTREAMINFOW si;
543 HRESULT ret;
545 ret = IAVIStream_Info(iface,&si,sizeof(si));
546 if (ret) /* error */
547 return 1;
548 return si.dwLength;
551 /***********************************************************************
552 * AVIStreamRelease
554 ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
555 return IAVIStream_Release(iface);
558 /***********************************************************************
559 * AVIStreamGetFrameOpen
561 PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
562 FIXME("(%p)->(%p),stub!\n",iface,bmi);
563 return NULL;
566 /***********************************************************************
567 * AVIStreamGetFrame
569 LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
570 return IGetFrame_GetFrame(pg,pos);
573 /***********************************************************************
574 * AVIStreamGetFrameClose
576 HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
577 if (pg) IGetFrame_Release(pg);
578 return 0;
581 /***********************************************************************
582 * AVIFileRelease
584 ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
585 return IAVIFile_Release(iface);
588 /***********************************************************************
589 * AVIFileExit
591 void WINAPI AVIFileExit(void) {
592 FIXME("(), stub.\n");