Creating Temporary Streams

[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.]

Temporary streams can be beneficial in several ways. You can use a temporary stream as a work stream, for example, when changing the stream format. Or you can create a temporary stream to hold portions of other streams that have been copied.

You can create a stream in memory that is not associated with any file by using the AVIStreamCreate function. This function returns the address of the interface to the new stream in a specified location and is used internally by other functions that create temporary streams.

You can create a compressed stream from an uncompressed stream by using the AVIMakeCompressedStream function. You identify the stream to compress, the compression method and compression options, and the handler for the new stream.

When you finish using a stream created with AVIStreamCreate or AVIMakeCompressedStream, close the stream by using the AVIStreamRelease function. AVIStreamRelease frees the resources the temporary stream used.