1999-03-13 19:07:44 +01:00
|
|
|
/*
|
|
|
|
* Copyright 1999 Marcus Meissner
|
|
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wine/winestring.h"
|
|
|
|
#include "mmsystem.h"
|
|
|
|
#include "winerror.h"
|
1999-05-02 16:32:27 +02:00
|
|
|
#include "debugtools.h"
|
1999-03-13 19:07:44 +01:00
|
|
|
|
2000-08-03 06:22:35 +02:00
|
|
|
#include "initguid.h"
|
|
|
|
#include "vfw.h"
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
DEFAULT_DEBUG_CHANNEL(avifile);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj);
|
|
|
|
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface);
|
|
|
|
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface);
|
|
|
|
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam);
|
|
|
|
|
|
|
|
struct ICOM_VTABLE(IAVIFile) iavift = {
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
IAVIFile_fnQueryInterface,
|
|
|
|
IAVIFile_fnAddRef,
|
|
|
|
IAVIFile_fnRelease,
|
|
|
|
IAVIFile_fnInfo,
|
|
|
|
IAVIFile_fnGetStream,
|
|
|
|
IAVIFile_fnCreateStream,
|
|
|
|
IAVIFile_fnWriteData,
|
|
|
|
IAVIFile_fnReadData,
|
|
|
|
IAVIFile_fnEndRecord,
|
|
|
|
IAVIFile_fnDeleteStream
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj);
|
|
|
|
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface);
|
|
|
|
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size);
|
|
|
|
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size);
|
|
|
|
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen);
|
|
|
|
|
|
|
|
struct ICOM_VTABLE(IAVIStream) iavist = {
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
IAVIStream_fnQueryInterface,
|
|
|
|
IAVIStream_fnAddRef,
|
|
|
|
IAVIStream_fnRelease,
|
|
|
|
IAVIStream_fnCreate,
|
|
|
|
IAVIStream_fnInfo,
|
|
|
|
IAVIStream_fnFindSample,
|
|
|
|
IAVIStream_fnReadFormat,
|
|
|
|
IAVIStream_fnSetFormat,
|
|
|
|
IAVIStream_fnRead,
|
|
|
|
IAVIStream_fnWrite,
|
|
|
|
IAVIStream_fnDelete,
|
|
|
|
IAVIStream_fnReadData,
|
|
|
|
IAVIStream_fnWriteData,
|
|
|
|
IAVIStream_fnSetInfo
|
|
|
|
};
|
|
|
|
|
1999-03-13 19:07:44 +01:00
|
|
|
typedef struct IAVIStreamImpl {
|
|
|
|
/* IUnknown stuff */
|
1999-10-31 02:59:23 +01:00
|
|
|
ICOM_VFIELD(IAVIStream);
|
1999-03-13 19:07:44 +01:00
|
|
|
DWORD ref;
|
|
|
|
/* IAVIStream stuff */
|
|
|
|
LPVOID lpInputFormat;
|
|
|
|
DWORD inputformatsize;
|
|
|
|
BOOL iscompressing;
|
|
|
|
DWORD curframe;
|
|
|
|
|
|
|
|
/* Compressor stuff */
|
|
|
|
HIC hic;
|
|
|
|
LPVOID lpCompressFormat;
|
|
|
|
ICINFO icinfo;
|
|
|
|
DWORD compbufsize;
|
|
|
|
LPVOID compbuffer;
|
|
|
|
|
|
|
|
DWORD decompbufsize;
|
|
|
|
LPVOID decompbuffer;
|
|
|
|
LPVOID decompformat;
|
|
|
|
AVICOMPRESSOPTIONS aco;
|
|
|
|
|
|
|
|
LPVOID lpPrev; /* pointer to decompressed frame later */
|
|
|
|
LPVOID lpPrevFormat; /* pointer to decompressed info later */
|
|
|
|
} IAVIStreamImpl;
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileInit
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
void WINAPI
|
|
|
|
AVIFileInit(void) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(),stub!\n");
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct IAVIFileImpl {
|
|
|
|
/* IUnknown stuff */
|
1999-10-31 02:59:23 +01:00
|
|
|
ICOM_VFIELD(IAVIFile);
|
1999-03-13 19:07:44 +01:00
|
|
|
DWORD ref;
|
|
|
|
/* IAVIFile stuff... */
|
|
|
|
} IAVIFileImpl;
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
|
|
|
|
ICOM_THIS(IAVIFileImpl,iface);
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
1999-03-13 19:07:44 +01:00
|
|
|
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
|
|
|
|
!memcmp(&IID_IAVIFile,refiid,sizeof(IID_IAVIFile))
|
|
|
|
) {
|
|
|
|
*obj = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
return OLE_E_ENUM_NOMORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
|
|
|
|
ICOM_THIS(IAVIFileImpl,iface);
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%p)->AddRef()\n",iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
|
|
|
|
ICOM_THIS(IAVIFileImpl,iface);
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%p)->Release()\n",iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
if (!--(This->ref)) {
|
|
|
|
HeapFree(GetProcessHeap(),0,iface);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return This->ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
|
|
|
|
/* FIXME: fill out struct? */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);
|
1999-03-13 19:07:44 +01:00
|
|
|
/* FIXME: create interface etc. */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
|
|
|
|
ICOM_THIS(IAVIStreamImpl,iface);
|
|
|
|
char fcc[5];
|
|
|
|
IAVIStreamImpl *istream;
|
|
|
|
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p,%p,%p)\n",This,avis,asi);
|
1999-03-13 19:07:44 +01:00
|
|
|
istream = (IAVIStreamImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIStreamImpl));
|
|
|
|
istream->ref = 1;
|
1999-10-31 02:59:23 +01:00
|
|
|
ICOM_VTBL(istream) = &iavist;
|
1999-03-13 19:07:44 +01:00
|
|
|
fcc[4]='\0';
|
|
|
|
memcpy(fcc,(char*)&(asi->fccType),4);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("\tfccType '%s'\n",fcc);
|
1999-03-13 19:07:44 +01:00
|
|
|
memcpy(fcc,(char*)&(asi->fccHandler),4);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("\tfccHandler '%s'\n",fcc);
|
|
|
|
FIXME("\tdwFlags 0x%08lx\n",asi->dwFlags);
|
|
|
|
FIXME("\tdwCaps 0x%08lx\n",asi->dwCaps);
|
|
|
|
FIXME("\tname '%s'\n",debugstr_w(asi->szName));
|
1999-03-13 19:07:44 +01:00
|
|
|
|
|
|
|
istream->curframe = 0;
|
|
|
|
*avis = (PAVISTREAM)istream;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,ckid,lpData,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
/* FIXME: write data to file */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,ckid,lpData,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
/* FIXME: read at most size bytes from file */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->EndRecord()\n",iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
/* FIXME: end record? */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",iface,fccType,lParam);
|
1999-03-13 19:07:44 +01:00
|
|
|
/* FIXME: delete stream? */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileOpenA
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIFileOpenA(
|
|
|
|
PAVIFILE * ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler
|
|
|
|
) {
|
|
|
|
IAVIFileImpl *iavi;
|
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
FIXME("(%p,%s,0x%08lx,%s),stub!\n",ppfile,szFile,(DWORD)uMode,debugstr_guid(lpHandler));
|
1999-03-13 19:07:44 +01:00
|
|
|
iavi = (IAVIFileImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIFileImpl));
|
|
|
|
iavi->ref = 1;
|
1999-10-31 02:59:23 +01:00
|
|
|
ICOM_VTBL(iavi) = &iavift;
|
1999-03-13 19:07:44 +01:00
|
|
|
*ppfile = (LPVOID)iavi;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
|
|
|
|
ICOM_THIS(IAVIStreamImpl,iface);
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
1999-03-13 19:07:44 +01:00
|
|
|
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
|
|
|
|
!memcmp(&IID_IAVIStream,refiid,sizeof(IID_IAVIStream))
|
|
|
|
) {
|
|
|
|
*obj = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
/* can return IGetFrame interface too */
|
|
|
|
return OLE_E_ENUM_NOMORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
|
|
|
|
ICOM_THIS(IAVIStreamImpl,iface);
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%p)->AddRef()\n",iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
|
|
|
|
ICOM_THIS(IAVIStreamImpl,iface);
|
|
|
|
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%p)->Release()\n",iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
if (!--(This->ref)) {
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return This->ref;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->Create(0x%08lx,0x%08lx)\n",iface,lParam1,lParam2);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->FindSample(%ld,0x%08lx)\n",iface,pos,flags);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->ReadFormat(%ld,%p,%p)\n",iface,pos,format,formatsize);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* IAVIStream::SetFormat
|
1999-03-13 19:07:44 +01:00
|
|
|
*/
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
|
1999-03-13 19:07:44 +01:00
|
|
|
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
|
|
|
|
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",iface,pos,format,formatsize);
|
1999-03-13 19:07:44 +01:00
|
|
|
if (as->lpInputFormat) HeapFree(GetProcessHeap(),0,as->lpInputFormat);
|
|
|
|
as->inputformatsize = formatsize;
|
|
|
|
as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize);
|
|
|
|
memcpy(as->lpInputFormat,format,formatsize);
|
|
|
|
if (as->iscompressing) {
|
|
|
|
int xsize;
|
|
|
|
/* Set up the Compressor part */
|
|
|
|
xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat);
|
|
|
|
as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize);
|
|
|
|
ICCompressGetFormat(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
|
|
|
ICCompressBegin(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
|
|
|
as->compbufsize = ICCompressGetSize(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
|
|
|
as->compbuffer = HeapAlloc(GetProcessHeap(),0,as->compbufsize);
|
|
|
|
|
|
|
|
/* Set up the Decompressor part (for prev frames?) */
|
|
|
|
xsize=ICDecompressGetFormatSize(as->hic,as->lpCompressFormat);
|
|
|
|
as->decompformat = HeapAlloc(GetProcessHeap(),0,xsize);
|
|
|
|
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
|
|
|
|
as->decompbufsize=((LPBITMAPINFOHEADER)as->decompbuffer)->biSizeImage;
|
|
|
|
as->decompbuffer = HeapReAlloc(GetProcessHeap(),0,as->decompbuffer,as->decompbufsize);
|
|
|
|
memset(as->decompbuffer,0xff,as->decompbufsize);
|
|
|
|
assert(HeapValidate(GetProcessHeap(),0,NULL));
|
|
|
|
|
|
|
|
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
|
|
|
|
ICDecompressBegin(as->hic,as->lpCompressFormat,as->decompformat);
|
|
|
|
as->lpPrev = as->lpPrevFormat = NULL;
|
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",iface,start,samples,buffer,buffersize,bytesread,samplesread);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
|
1999-03-13 19:07:44 +01:00
|
|
|
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
|
|
|
|
DWORD ckid,xflags;
|
|
|
|
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
|
1999-03-13 19:07:44 +01:00
|
|
|
|
|
|
|
ICCompress(
|
|
|
|
as->hic,flags,
|
|
|
|
as->lpCompressFormat,
|
|
|
|
as->compbuffer,
|
|
|
|
as->lpInputFormat,buffer,
|
|
|
|
&ckid,&xflags,
|
|
|
|
as->curframe,0xffffff/*framesize*/,as->aco.dwQuality,
|
|
|
|
as->lpPrevFormat,as->lpPrev
|
|
|
|
);
|
|
|
|
ICDecompress(
|
|
|
|
as->hic,
|
|
|
|
flags, /* FIXME: check */
|
|
|
|
as->lpCompressFormat,
|
|
|
|
as->compbuffer,
|
|
|
|
as->decompformat,
|
|
|
|
as->decompbuffer
|
|
|
|
);
|
|
|
|
/* We now have a prev format for the next compress ... */
|
|
|
|
as->lpPrevFormat = as->decompformat;
|
|
|
|
as->lpPrev = as->decompbuffer;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->Delete(%ld,%ld)\n",iface,start,samples);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,fcc,lp,lpread);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,fcc,lp,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p)->SetInfo(%p,%ld)\n",iface,info,infolen);
|
1999-03-13 19:07:44 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileCreateStreamA
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
|
|
|
|
AVISTREAMINFOW psiw;
|
|
|
|
|
|
|
|
/* Only the szName at the end is different */
|
|
|
|
memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
|
|
|
|
lstrcpynAtoW(psiw.szName,psi->szName,sizeof(psi->szName));
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIFile_CreateStream(iface,ppavi,&psiw);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileCreateStreamW
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIFile_CreateStream(iface,avis,asi);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileGetStream
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIFile_GetStream(iface,avis,fccType,lParam);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileInfoA
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
|
|
|
|
AVIFILEINFOW afiw;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if (size < sizeof(AVIFILEINFOA))
|
|
|
|
return AVIERR_BADSIZE;
|
1999-10-13 16:01:40 +02:00
|
|
|
hres = IAVIFile_Info(iface,&afiw,sizeof(afiw));
|
1999-03-13 19:07:44 +01:00
|
|
|
memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType));
|
|
|
|
lstrcpynWtoA(afi->szFileType,afiw.szFileType,sizeof(afi->szFileType));
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamInfoW
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
|
|
|
|
size) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIFile_Info(iface,asi,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamInfoA
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
|
|
|
|
size) {
|
|
|
|
AVISTREAMINFOW asiw;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if (size<sizeof(AVISTREAMINFOA))
|
|
|
|
return AVIERR_BADSIZE;
|
1999-10-13 16:01:40 +02:00
|
|
|
hres = IAVIFile_Info(iface,&asiw,sizeof(asiw));
|
1999-03-13 19:07:44 +01:00
|
|
|
memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName));
|
|
|
|
lstrcpynWtoA(asi->szName,asiw.szName,sizeof(asi->szName));
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileInfoW
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIFile_Info(iface,afi,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIMakeCompressedStream
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
|
|
|
|
char fcc[5];
|
|
|
|
IAVIStreamImpl *as;
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
|
1999-03-13 19:07:44 +01:00
|
|
|
fcc[4]='\0';
|
|
|
|
memcpy(fcc,&(aco->fccType),4);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("\tfccType: '%s'\n",fcc);
|
1999-03-13 19:07:44 +01:00
|
|
|
memcpy(fcc,&(aco->fccHandler),4);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("\tfccHandler: '%s'\n",fcc);
|
|
|
|
FIXME("\tdwFlags: 0x%08lx\n",aco->dwFlags);
|
1999-03-13 19:07:44 +01:00
|
|
|
|
|
|
|
/* we just create a duplicate for now */
|
1999-10-13 16:01:40 +02:00
|
|
|
IAVIStream_AddRef(ppsSource);
|
1999-03-13 19:07:44 +01:00
|
|
|
*ppsCompressed = ppsSource;
|
|
|
|
as = (IAVIStreamImpl*)ppsSource;
|
|
|
|
|
|
|
|
/* this is where the fun begins. Open a compressor and prepare it. */
|
|
|
|
as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
|
|
|
|
|
|
|
|
/* May happen. for instance if the codec is not able to compress */
|
|
|
|
if (!as->hic)
|
|
|
|
return AVIERR_UNSUPPORTED;
|
|
|
|
|
|
|
|
ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("Opened compressor: '%s' '%s'\n",debugstr_w(as->icinfo.szName),debugstr_w(as->icinfo.szDescription));
|
1999-03-13 19:07:44 +01:00
|
|
|
as->iscompressing = TRUE;
|
|
|
|
memcpy(&(as->aco),aco,sizeof(*aco));
|
|
|
|
if (as->icinfo.dwFlags & VIDCF_COMPRESSFRAMES) {
|
|
|
|
ICCOMPRESSFRAMES icf;
|
|
|
|
|
|
|
|
/* now what to fill in there ... Hmm */
|
|
|
|
memset(&icf,0,sizeof(icf));
|
|
|
|
icf.lDataRate = aco->dwBytesPerSecond;
|
|
|
|
icf.lQuality = aco->dwQuality;
|
|
|
|
icf.lKeyRate = aco->dwKeyFrameEvery;
|
|
|
|
|
2000-08-14 16:42:41 +02:00
|
|
|
icf.GetData = (void *)0xdead4242;
|
|
|
|
icf.PutData = (void *)0xdead4243;
|
1999-03-13 19:07:44 +01:00
|
|
|
ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf));
|
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamSetFormat
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_SetFormat(iface,pos,format,formatsize);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamReadFormat
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_ReadFormat(iface,pos,format,formatsize);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamWrite(
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_Write(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamRead
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_Read(iface,start,samples,buffer,buffersize,bytesread,samplesread);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamWriteData
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_WriteData(iface,fcc,lp,size);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamReadData
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_ReadData(iface,fcc,lp,lpread);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamStart
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
|
|
|
|
AVISTREAMINFOW si;
|
|
|
|
|
1999-10-13 16:01:40 +02:00
|
|
|
IAVIStream_Info(iface,&si,sizeof(si));
|
1999-03-13 19:07:44 +01:00
|
|
|
return si.dwStart;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamLength
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
|
|
|
|
AVISTREAMINFOW si;
|
|
|
|
HRESULT ret;
|
|
|
|
|
1999-10-13 16:01:40 +02:00
|
|
|
ret = IAVIStream_Info(iface,&si,sizeof(si));
|
1999-03-13 19:07:44 +01:00
|
|
|
if (ret) /* error */
|
|
|
|
return 1;
|
|
|
|
return si.dwLength;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamRelease
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIStream_Release(iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamGetFrameOpen
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%p)->(%p),stub!\n",iface,bmi);
|
1999-03-13 19:07:44 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamGetFrame
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IGetFrame_GetFrame(pg,pos);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIStreamGetFrameClose
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
|
1999-10-13 16:01:40 +02:00
|
|
|
if (pg) IGetFrame_Release(pg);
|
1999-03-13 19:07:44 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileRelease
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
|
1999-10-13 16:01:40 +02:00
|
|
|
return IAVIFile_Release(iface);
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AVIFileExit
|
|
|
|
*/
|
1999-03-13 19:07:44 +01:00
|
|
|
void WINAPI AVIFileExit(void) {
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(), stub.\n");
|
1999-03-13 19:07:44 +01:00
|
|
|
}
|