//close the stream after finishing the task
if (pStream!=NULL)
AVIStreamRelease(pStream);
AVIFileExit();
return TRUE;
}
///The only one function that I must describe more about is: CreateFromPackedDIBPointer(). This function takes a pointer returned from AVIStreamGetFrame() function and creates a bitmap from it. As you know, the AVIStreamGetFrame() returns a pointer to DIB information about the frame. We take this pointer and create a bitmap from it.
BOOL CreateFromPackedDIBPointer(LPBYTE pDIB, int iFrame)
{
ASSERT(pDIB!=NULL);
//Creates a full-color (no palette) DIB from a pointer to a
//full-color memory DIB
//get the BitmapInfoHeader
BITMAPINFOHEADER bih;
RtlMoveMemory(&bih.biSize, pDIB, sizeof(BITMAPINFOHEADER));
//now get the bitmap bits
if (bih.biSizeImage < 1)
{
return FALSE;
}