The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Opening and Closing Streams

Opening data streams is similar to opening files. You can open a stream by using the AVIFileGetStream function. This function creates a stream interface, places a handle of the stream in the interface, and returns a pointer to the interface. AVIFileGetStream also maintains a reference count of the applications that have opened a stream, but not of those that have closed it.

If you want to access a single stream in a file, you can open the file and the stream by using the AVIStreamOpenFromFile function. This function combines the operations and function arguments of the AVIFileOpen and AVIFileGetStream functions.

To access more than one stream in a file, use AVIFileOpen once followed by multiple calls to AVIFileGetStream.

You can increment the reference count of a stream by using the AVIStreamAddRef function to keep a stream open when using a function that would normally close the stream.

You can close a stream by using the AVIStreamRelease function. This function decrements the reference count of the stream and closes it when the reference count reaches zero. Your applications should balance the reference count by including a call to AVIStreamRelease for each use of the AVIFileGetStream, AVIFileCreateStream, AVIStreamAddRef, or AVIStreamOpenFromFile function. When you release a stream that has been opened by using AVIStreamOpenFromFile, AVIFile closes the file containing the stream. If your application releases a file that has open data streams, AVIFile will not close the streams until all of the streams are released.



Community Additions

© 2014 Microsoft