Configuring Streams

The only thing that is required in a profile is at least one stream. The other options provide access to more advanced features, but with the minimum of one stream you can make an ASF file. It is essential that you understand how to configure streams before creating complex profiles.

For the purpose of profiles, streams can be divided into two types: those that are compressed with Windows Media codecs and arbitrary streams that are not processed with any codecs. Audio streams and video streams are the types that use the Windows Media codecs. Of course, streams can contain audio or video compressed with a third-party codec, but the process of configuring such a stream is a special case. For more information, see To Create ASF Files Using Third-Party Codecs.

The following list summarizes the process of configuring a stream.

  1. Obtain a stream configuration object for the stream.
    • If you are creating a stream using one of the Windows Media codecs, you must obtain the stream configuration object as a codec format using the methods of IWMCodecInfo3.
    • If the stream is an arbitrary type, get an empty stream configuration object using IWMProfile::CreateNewStream.
  2. Configure the stream to meet your needs.
    • Streams of all types should be assigned a name, connection name, and stream number.
    • Streams using Windows Media codecs should be altered only in predefined ways from the codec format. For audio streams, only variable bit rate (VBR) settings for two-pass VBR should be changed. Video streams need to be configured with the desired frame properties.
    • Arbitrary streams have varying configuration requirements by type. All require a bit rate and buffer window.
  3. Add the stream to the profile by calling IWMProfile::AddStream.

All streams are defined using stream configuration objects. The main interface for a stream configuration object is IWMStreamConfig, which provides methods for setting the basic settings of a stream, such as the stream number, bit rate, and so on. IWMStreamConfig is inherited by the newer interfaces, IWMStreamConfig2 and IWMStreamConfig3. As with all numbered interface revisions, you should always retrieve the most recent version using the QueryInterface method.

Most settings in a stream are accessed through IWMMediaProps. These settings are encapsulated in a WM_MEDIA_TYPE structure. For audio and video, the WM_MEDIA_TYPE structure points to another structure with further information specific to the type of media. This secondary structure is typically WAVEFORMATEX for audio and WMVIDEOINFOHEADER for video. In addition, video streams have a tertiary structure, BITMAPINFOHEADER, which describes the characteristics of an individual frame of video. BITMAPINFOHEADER is a common structure and can be found in the Graphics Device Interface (GDI) section of the Platform SDK.

The following sections describe how to configure streams.

Section Description
Configuration Common to All Streams Describes the basic stream configuration common to all types of streams.
Getting Stream Configuration Information from Codecs Describes how to get stream configuration information from the codecs to ensure proper configuration of streams using the Windows Media Audio and Video codecs.
Configuring Audio Streams Describes how to configure audio streams.
Configuring Video Streams Describes how to configure video streams.
Configuring Video Streams for Seeking Performance Describes how to configure video streams for which efficient seeking is important.
Configuring Screen Capture Streams Describes how to configure video streams for screen capture.
Configuring Image Streams Describes how to configure image streams.
Using Uncompressed Audio and Video Streams Describes how to set up an uncompressed audio or video stream.
Configuring Arbitrary Stream Types Describes how to configure streams to use the predefined arbitrary stream types.
Configuring VBR Streams Describes how to configure streams to use variable bit rate encoding (VBR).
Configuring Data Unit Extensions Describes how to configure a stream so that data unit extensions can be attached when the file is written.
Reusing Stream Configurations Describes the ways in which you can use stream configuration objects from existing profiles to make new profiles.


Inputs, Streams and Outputs

Working with Profiles