Windows Media Format SDK banner art
PreviousNext

To Write Windows Media Files

  1. Create an IWMWriter object by calling WMCreateWriter.

  2. Call SetProfile to define the configuration. There are two options for setting a profile (from a profile object, or identified by a globally unique identifier [GUID]). To set the profile, the profile must be copied into the writer. Further editing of that profile object has no effect unless SetProfile is called again.

  3. Set the outputs. To write a Windows Media file, call SetOutputFilename on the writer. If a network or file sink is required, create it by using WMCreateWriterNetworkSink or WMCreateWriterFileSink, and add the sink to the writer by using IWMWriterAdvanced::AddSink.

  4. Call GetInputCount and GetInputProps for each stream. Get the default input format, and change it if you want.  To change the input format, call SetInputProps.  The writer is now configured.

  5. Use QueryInterface to access the IWMHeaderInfo object, and then use SetAttribute to add all the necessary metadata to the header.

  6. Call WriteSample repeatedly, until finished. To do this, either use AllocateSample, or pass in your own samples.

  7. Call Flush to write any buffered data as output, and update the header and index files.

Note   This writer interface calls QueryInterface to gain access to the IWMHeaderInfo and IWMWriterAdvanced objects.

See Also

PreviousNext


© 1999 Microsoft Corporation. All rights reserved.