ASF Media Sinks

The ASF media sink is the final component in the encoding pipeline that enables an application to write an ASF file.

Media Foundation provides two types of ASF media sinks:

  • ASF file sink is used to archive ASF media data to a file.
  • ASF streaming sink is used to write ASF content in a byte stream that can be streamed across the network.

ASF media sinks contain one or more stream sinks, which represents the data to write for each stream in the output ASF file. For encoding applications that run on Windows Vista, you must manually configure the encoding topology by creating and configuring the ASF media sink and then adding it to the topology. In Windows 7, if you are using the fast transcode objects to create the topology, you do not have create the media sink directly and the application does not call any methods on the media sink or any of the stream sinks. The fast transcode objects instantiate the required media sinks and add it to the topology before returning a reference to the caller application. However for fast transcode objects, there are some restrictions that apply depending on the type of encoding.

ASF Media Sink Object Model

ASF media sinks implement the IMFMediaSink interface and exposes the following interfaces. An application can get a reference to these interfaces by calling QueryInterface on the ASF media sink it is using for generating output samples.

Interface Description
IMFMediaSink Required for all media sinks.
IMFFinalizableMediaSink Implemented by the ASF file sink that writes the generated media content to a file. You can use the methods on this interface to flush data and update the ASF Header Object of the final output file.
IMFClockStateSink Receives state-change notifications from the presentation clock.
IMFASFContentInfo The ASF ContentInfo object is a WMContainer level object that mainly stores ASF Header Object information. This is used to create ASF media sinks.
IMFMetadata Used to describe the metadata for the ASF file.
IMFMetadataProvider Retrieves a collection of metadata, either for an entire presentation, or for one stream in the presentation.

 

ASF File Sink

The ASF file sink is an implementation of IMFMediaSink provided by Media Foundation that an application can use to archive ASF media data to a file.

You need to create, configure, and call methods on the file sink or any of its stream sinks if you are using the pipeline layer objects to write a new ASF file. After configuring the file sink you can then add it to the encoding pipeline.

Here are the general steps for using the ASF file sink:

  1. Create the file sink in-process or out-of-process.
  2. Configure the file sink with all the streams, encoding properties, and metadata information.
  3. Associate the file sink with the output topology node either by enumerating the stream sinks or by keeping track of the stream numbers with in the sink.

The following topics contain detailed information about working with the ASF file sink:

Pipeline Layer ASF Components

ASF Support in Media Foundation