共用方式為


IWMHeaderInfo interface (wmsdkidl.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The IWMHeaderInfo interface sets and retrieves information in the header section of an ASF file. You can manipulate three types of header information by using the methods of this interface: metadata attributes, markers, and script commands.

Metadata attributes are name/value pairs that describe or relate to the contents of the file. Typical metadata attributes contain information about the artist, title, and performance details of the content. The Windows Media Format SDK includes a large selection of predefined metadata attributes that you can use in your files. See Attributes for a complete listing of predefined attributes. Additionally, you can create your own attributes.

The methods of IWMHeaderInfo that deal with metadata are somewhat limited. They cannot be used to create or access attributes containing more than 64 kilobytes of data. They are also limited to simple data types. Much more robust metadata support is provided through the IWMHeaderInfo3 interface, which should be used for all new files.

Markers enable you to name specific locations in the file for easy access. Typically, markers are used to create a table of contents for a file, such as a list of scenes in a video file.

Script commands are name/value pairs containing information that your reading application will respond to programmatically. There are no script commands that are directly supported by the reader or the synchronous reader, but there are a few standard script commands supported by Windows Media Player. For more information about script commands, see the Using Script Commands section of this documentation.

The IWMHeaderInfo interface is implemented by the metadata editor object, the writer object, the reader object, and the synchronous reader object. To obtain a pointer to an instance, call the QueryInterface method of any other interface in the desired object.

Inheritance

The IWMHeaderInfo interface inherits from the IUnknown interface. IWMHeaderInfo also has these types of members:

Methods

The IWMHeaderInfo interface has these methods.

 
IWMHeaderInfo::AddMarker

The AddMarker method adds a marker, consisting of a name and a specific time, to the header section of the ASF file.
IWMHeaderInfo::AddScript

The AddScript method adds a script, consisting of type and command strings, and a specific time, to the header section of the ASF file.
IWMHeaderInfo::GetAttributeByIndex

The GetAttributeByIndex method returns a descriptive attribute that is stored in the header section of the ASF file. This method is replaced by IWMHeaderInfo3::GetAttributeByIndexEx and should not be used.
IWMHeaderInfo::GetAttributeByName

The GetAttributeByName method returns a descriptive attribute that is stored in the header section of the ASF file.
IWMHeaderInfo::GetAttributeCount

The GetAttributeCount method returns the number of attributes defined in the header section of the ASF file. This method is replaced by IWMHeaderInfo3::GetAttributeCountEx and IWMHeaderInfo3::GetAttributeIndices, and should no longer be used.
IWMHeaderInfo::GetMarker

The GetMarker method returns the name and time of a marker.
IWMHeaderInfo::GetMarkerCount

The GetMarkerCount method returns the number of markers currently in the header section of the ASF file.
IWMHeaderInfo::GetScript

The GetScript method returns the type and command strings, and the presentation time, of a script.
IWMHeaderInfo::GetScriptCount

The GetScriptCount method returns the number of scripts currently in the header section of the ASF file.
IWMHeaderInfo::RemoveMarker

The RemoveMarker method removes a marker from the header section of the ASF file.
IWMHeaderInfo::RemoveScript

The RemoveScript method enables the object to remove a script from the header section of the ASF file.
IWMHeaderInfo::SetAttribute

The SetAttribute method sets a descriptive attribute that is stored in the header section of the ASF file. This method is replaced by IWMHeaderInfo3::AddAttribute, and should not be used.

Remarks

Although the IWMHeaderInfo interface is accessible from four different objects, not all of the features are available in all cases. The following table summarizes the differences in implementation for the various objects.

Object Description
Metadata editor Full functionality is implemented.
Writer All methods that alter header items (those whose names begin with Add, Set, or Remove) are supported only before the IWMWriter::BeginWriting method is called.All marker methods return E_NOTIMPL.
Reader and synchronous reader All methods that alter header items (those whose names begin with Add, Set, or Remove) return E_NOTIMPL.
 

For information about using the writer for metadata editing, see To Edit Metadata with the Writer.

Requirements

Requirement Value
Target Platform Windows
Header wmsdkidl.h

See also

Attributes

IWMHeaderInfo2 Interface

IWMHeaderInfo3 Interface

Interfaces

Metadata Editor Object

Reader Object

Synchronous Reader Object

Writer Object