|
Compressing Data
The following example compresses image data for use in an AVI file. It assumes
the compressor does not support the VIDCF_CRUNCH or VIDCF_TEMPORAL flags, but
it does support VIDCF_QUALITY. The example uses the ICCompressBegin macro, the ICCompress function, and the ICCompressEnd macro.
DWORD dwCkID;
DWORD dwCompFlags;
DWORD dwQuality;
LONG lNumFrames, lFrameNum;
// Assume dwNumFrames is initialized to the total number of frames.
// Assume dwQuality holds the proper quality value (0-10000).
// Assume lpbiOut, lpOut, lpbiIn, and lpIn are initialized properly.
// If OK to start, compress each frame.
if (ICCompressBegin(hIC, lpbiIn, lpbiOut) == ICERR_OK)
{
for ( lFrameNum = 0; lFrameNum < lNumFrames; lFrameNum++)
{
if (ICCompress(hIC, 0, lpbiOut, lpOut, lpbiIn, lpIn,
&dwCkID, &dwCompFlags, lFrameNum,
0, dwQuality, NULL, NULL) == ICERR_OK)
{
// Write compressed data to the AVI file.
// Set lpIn to the next frame in the sequence.
}
else
{
// Handle compressor error.
}
}
ICCompressEnd(hIC); // terminate compression
}
else
{
// Handle the error identifying the unsupported format.
}
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|