Reading from One Stream and Writing to Another
The following example reads data from a stream, compresses it into a new stream, and writes the compressed data into a stream of a new file. // SaveSmall - copies a stream of data from one file, compresses // the stream, and writes the compressed stream to a new file. // // ps stream interface pointer // lpFilename - new AVI file to build //- oid SaveSmall(PAVISTREAM ps, LPSTR lpFilename)
+ 31)&~31) / 8) * biNew.biHeight; SetRect(&strhdr.rcFrame, 0, 0, (int) biNew.biWidth,
(int) biNew.biHeight); // Create a stream using AVIFileCreateStream. hr = AVIFileCreateStream(pf, &psSmall, &strhdr); if (hr != 0) { //Stream created OK? If not, close file. AVIFileRelease(pf); return; } // Set format of new stream using AVIStreamSetFormat. hr = AVIStreamSetFormat(psSmall, 0, &biNew, sizeof(biNew)); if (hr != 0) { AVIStreamRelease(psSmall); AVIFileRelease(pf); return; } // Allocate memory for the bitmaps. lpOld = GlobalAllocPtr(GMEM_MOVEABLE, bi.biSizeImage); lpNew = GlobalAllocPtr(GMEM_MOVEABLE, biNew.biSizeImage); // Read the stream data using AVIStreamRead. for (lStreamSize = AVIStreamStart(ps); lStreamSize <
AVIStreamEnd(ps); lStreamSize++) { hr = AVIStreamRead(ps, lStreamSize, 1, lpOld, bi.biSizeImage,
NULL, NULL); // // Place error check here. // // Compress the data. CompressDIB(&bi, lpOld, &biNew, lpNew); // Save the compressed data using AVIStreamWrite. hr = AVIStreamWrite(psSmall, lStreamSize, 1, lpNew,
biNew.biSizeImage, AVIIF_KEYFRAME, NULL, NULL); } // Close the stream and file. AVIStreamRelease(psSmall); AVIFileRelease(pf); }
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers - More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples - Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database