편집

다음을 통해 공유


Initializing the ContentInfo Object of a New ASF File

After creating an empty ContentInfo object by calling the MFCreateASFContentInfo function, the application must call IMFASFContentInfo::SetProfile to provide the encoding profile. For information about creating a profile, see Creating an ASF Profile.

Before information can be read from the profile, the SetProfile method must validate the specified profile object by checking the stream identifiers or media types. If the profile passes the validation, various header objects are generated, such as the File Properties Object, the Stream Bitrate Properties Object, the Stream Properties Object, and the Mutual Exclusion Object.

SetProfile computes and sets recommended values for certain properties, such as the preroll value. If this is not already set, the recommended preroll value in milliseconds depends on the maximum buffer window of the leaky bucket specified for the streams in the profile. Similarly, the minimum and maximum data packet sizes are also set. The recommended values might override the packet sizes that are set on the profile through attributes.

Because the file is in the process of being created, the file is categorized as a broadcast type, which is denoted by the Flags field of the File Properties Object. Certain unknown values such as the number of data packets, play duration, and send duration are set to zero. These values are represented by MF_PD_ASF_xxx attributes and must be updated by the application after file creation is complete.

The specified profile object replaces any existing profile associated with the ContentInfo object, removes the referenced header objects, and resets global file properties such as preroll and data packet size.

The SetProfile method also creates the data object that represents the ASF Data Object. If you reuse a ContentInfo object that includes information about any data packets, SetProfile fails and returns the MF_E_ALREADY_INITIALIZED error indicating that it is already associated with an existing ASF Data Object. By default, for a new ContentInfo object, the data packet count is set to zero and the data object size is set to 50 bytes. If you use the multiplexer to generate data packets, the multiplexer updates the ContentInfo object to reflect new values such as the data packet count. For more information about data packet generation, see Generating New ASF Data Packets.

After all the Header Objects are added to the final ASF Header Object, the total header size can be retrieved by calling IMFASFContentInfo::GetHeaderSize. This size includes the initial data object size.

Setting Properties in the ContentInfo Object

Writing an ASF Header Object for a New File