To Write Windows Media Files
- Create an IWMWriter object by calling WMCreateWriter.
- 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.
- 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.
- 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.
- Use QueryInterface to access the IWMHeaderInfo object, and then use SetAttribute to add all the necessary metadata to the header.
- Call WriteSample repeatedly, until finished. To do this, either use AllocateSample, or pass in your own samples.
- 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
© 1999 Microsoft Corporation. All rights reserved.