#include bool AVIGenerator::createAVIFile(const String &pathAVIFile,const FOURCC &fccHandler,Block &pathImageNames) { Compressor compressor; AVIBitmap aviBitmap; MovieData movieData; PAVIFILE pFile; PAVISTREAM pStream; AVISTREAMINFO aviStreamInfo; HRESULT hResult; DWORD elapsedTime; pFile=0; pStream=0; if(!pathImageNames.size())return false; if(!compressor.open(fccHandler))return false; compressor.setQuality(mQuality); ::unlink(pathAVIFile); if(!getImage(pathImageNames[0],aviBitmap,movieData))return false; AVIFileInit(); hResult=AVIFileOpen(&pFile,pathAVIFile,OF_WRITE|OF_CREATE,NULL); if(hResult!=AVIERR_OK)return false; ::memset(&aviStreamInfo,0,sizeof(AVISTREAMINFO)); aviStreamInfo.fccType=streamtypeVIDEO; // aviStreamInfo.fccHandler=0; aviStreamInfo.fccHandler=fccHandler; aviStreamInfo.dwScale=mScale; aviStreamInfo.dwRate=mRate; aviStreamInfo.dwSuggestedBufferSize=aviBitmap.sizeImage(); SetRect(&aviStreamInfo.rcFrame,0,0,aviBitmap.width(),aviBitmap.height()); hResult=AVIFileCreateStream(pFile,&pStream,&aviStreamInfo); if(hResult==AVIERR_OK) { AVIBitmap dstBitmap; if(compressor.compressQuery(aviBitmap)) { // if(!getBestFormat(compressor,aviBitmap,dstBitmap)) compressor.getFormat(aviBitmap,dstBitmap); hResult=AVIStreamSetFormat(pStream,0,&dstBitmap.getBITMAPINFOHEADER(), dstBitmap.getBITMAPINFOHEADER().biSize+(dstBitmap.getBITMAPINFOHEADER().biClrUsed*sizeof(RGBQUAD))); if(hResult==AVIERR_OK) { for(int index=0;index &pathImageNames) { AVIBitmap aviBitmap; MovieData movieData; PAVIFILE pFile; PAVISTREAM pStream; AVISTREAMINFO aviStreamInfo; HRESULT hResult; pFile=0; pStream=0; if(!pathImageNames.size())return false; ::unlink(pathAVIFile); if(!getImage(pathImageNames[0],aviBitmap,movieData))return false; AVIFileInit(); hResult=AVIFileOpen(&pFile,pathAVIFile,OF_WRITE|OF_CREATE,NULL); if(hResult!=AVIERR_OK)return false; ::memset(&aviStreamInfo,0,sizeof(AVISTREAMINFO)); aviStreamInfo.fccType=streamtypeVIDEO; aviStreamInfo.fccHandler=0; aviStreamInfo.dwScale=mScale; // time scale aviStreamInfo.dwRate=mRate; // rate in integer format, dwRate/dwScale = samples per second aviStreamInfo.dwSuggestedBufferSize=aviBitmap.sizeImage(); SetRect(&aviStreamInfo.rcFrame,0,0,aviBitmap.width(),aviBitmap.height()); hResult=AVIFileCreateStream(pFile,&pStream,&aviStreamInfo); if(hResult==AVIERR_OK) { hResult=AVIStreamSetFormat(pStream,0,&aviBitmap.getBITMAPINFOHEADER(), aviBitmap.getBITMAPINFOHEADER().biSize+(aviBitmap.getBITMAPINFOHEADER().biClrUsed*sizeof(RGBQUAD))); if(hResult==AVIERR_OK) { for(int index=0;indexbmiHeader.biSizeImage); ::memcpy(&movieData[0],bitmap.ptrData(),bitmap.getInfoPtr()->bmiHeader.biSizeImage); returnCode=true; } return returnCode; } void AVIGenerator::getImageData(JPGImage &jpgImage,MovieData &movieData) { if(jpgImage.getBitmapInfo().height()<0) { Array &rgbArray=jpgImage.getRGBArray(); Array tmpArray; tmpArray.size(rgbArray.size()); jpgImage.getBitmapInfo().height(-jpgImage.getBitmapInfo().height()); for(int row=0;row &rgbArray=jpgImage.getRGBArray(); movieData.size(rgbArray.size()*3); ::memcpy(&movieData[0],&rgbArray[0],rgbArray.size()*3); } } void AVIGenerator::copyRow(RGB888 *pDstArray,RGB888 *pSrcArray,int length) { // for(unsigned long count=0;count