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