Configuring the WM ASF Writer (QASF)
[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.]
When the WM ASF Writer filter is created, it is configured automatically with the WMProfile_V80_256Video profile as a default. Because this profile uses the Windows Media Audio and Windows Media Video version 8 codecs, it is recommended that you create a custom profile that uses the Windows Media 9 Series codecs, and then pass its IWMProfile pointer to the filter using the IConfigAsfWriter::ConfigureFilterUsingProfile method. The filter must be added to the graph before the filter can be configured, and it must be configured before it can be connected to upstream filters. The filter uses the profile to determine what kind of Windows Media Format file to write, how many input pins to set up, and what media types the pins can accept.
The filter allows profiles to be reset while its input pins are connected, as long as the new profile does not require any additional input pins. For example, if you change the profile from a one-input audio-only profile to a two-input audio and video profile, just the audio pin will be reconnectedAll input data must be time-stamped, and all input pins must be connected before the filter can be run or paused. This means that if you configure the filter with a profile that has an audio stream and a video stream, the filter will create an audio and a video input pin, and both pins must be connected before the filter can be run.
Adding Data Unit Extensions
You can configure a profile stream for data unit extensions, such as SMPTE time codes, either before or after the filter is connected, as long as you follow this order of operations:
- Add one or more data unit extensions to the stream using IWMStreamConfig2::AddDataUnitExtension.
- Call WMProfile::ReconfigStream to update the profile.
- Call IConfigAsfWriter::ConfigureFilterUsingProfile with the updated profile object.
- Find the video input pin, and call its IAMWMBufferPass::SetNotify method to register your application-defined IAMWMBufferPassCallback interface.
When the graph runs, your IAMWMBufferPassCallback::Notify method will be called for each frame, and you will be able to get and set properties on the sample using its INSSBuffer3 interface methods.
Note
In some processor-intensive scenarios such as inverse telecine, the WM ASF Writer may require more output buffers than some downstream filters can support. The DV Decoder, for example, will not accept more than one buffer for its output pin and the same is true for the AVI Decompressor in certain conditions. If you encounter problems when attempting to connect to these filters, or possibly when running the graph, it may be necessary to write an intermediary filter that accepts any number of buffers on its output pin.