Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[The feature associated with this page, AVIFile Functions and Macros, is a legacy feature. It has been superseded by Source Reader. Source Reader has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader instead of AVIFile Functions and Macros, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
AVIFile provides several ways for you to access compressed video streams.
If you want to display one or more frames of a compressed video stream, you can retrieve the frames by using the AVIStreamRead function and forwarding the compressed frame data to DrawDib functions to display them. DrawDib functions can display images of several image depths and automatically dither images for displays that cannot handle certain types of device-independent bitmaps (DIBs). These functions work with uncompressed and compressed images. For more information about DrawDib functions, see DrawDib Functions.
AVIFile provides functions for decompressing a single video frame. To allocate resources, use the AVIStreamGetFrameOpen function. This function creates a buffer for the decompressed data.
You can decompress a single video frame by using the AVIStreamGetFrame function. This function decompresses the frame and retrieves a complete frame of image data, returning the address of the DIB in the BITMAPINFOHEADER structure. Your application can display the DIB by using standard drawing functions or by using the DrawDib functions.
If your application makes successive calls to AVIStreamGetFrame, the function overwrites its buffer with each retrieved frame.
When you finish using AVIStreamGetFrame and the decompressed DIB is in its buffer, you can release the allocated resources by using the AVIStreamGetFrameClose function.
For more information about decompressing images, see Video Compression Manager.