Click to Rate and Give Feedback
MSDN
MSDN Library
Audio and Video

  Switch on low bandwidth view
Media Foundation Architecture

This section describes the general design of Microsoft Media Foundation. For information about using Media Foundation for specific programming tasks, see Media Foundation Programming Guide.

This section contains the following topics.

TopicDescription
Initializing Media FoundationHow to initialize the Media Foundation platform.
Media Foundation Primitives

Describes some basic interfaces that are used throughout Media Foundation.

Almost all Media Foundation applications will use these interfaces.

Media Foundation Platform APIs

Describes interfaces that implement some core Media Foundation functions, such as asynchronous callbacks and work queues.

Some applications might use platform-level interfaces. Also, custom plug-ins (sources, sinks, and transforms) typically use these interfaces.

Media SourcesMedia sources generate media data, typically from a file, capture device, or network stream.
Media Foundation TransformsMedia Foundation transforms (MFTs) manipulate or process media data.
Media SinksMedia sinks consume media data.
Media SessionThe media session manages data flow in the Media Foundation pipeline.
Sequencer SourceThe sequencer source can be used to create playlists with seamless transitions and other advanced playback scenarios.
Protected Media PathThe protected media path (PMP) provides a protected environment for playing premium video content. It is not necessary to use the PMP when writing a Media Foundation application.

 

The following diagram shows a high-level view of the Media Foundation architecture:

 

Diagram showing a high-level view of the Media Foundation architecture.

 

Media Foundation provides two distinct programming models. The first model, shown on the left side of the diagram, uses an end-to-end pipeline for media data. The application initializes the pipeline—for example, by providing the URL of a file to play—and then calls methods to control streaming. In the second model, shown on the right side of the diagram, the application either pulls data from a source, or pushes it to a destination (or both). This model is particularly useful if you need to process the data, because the application has direct access to the data stream.

Primitives and Platform

Starting from the bottom of the diagram, the primitives are helper objects used throughout the Media Foundation API:

  • Attributes are a generic way to store information inside an object, as a list of key/value pairs.
  • Media Types describe the format of a media data stream.
  • Media Buffers hold chunks of media data, such as video frames and audio samples, and are used to transport data between objects.
  • Media Samples are containers for media buffers. They also contain metadata about the buffers, such as time stamps.

The Media Foundation Platform APIs provide some core functionality that is used by the Media Foundation pipeline, such as asynchronous callbacks and work queues. Certain applications might need to call these APIs directly; also, you will need them if you implement a custom source, transform, or sink for Media Foundation.

Media Pipeline

The media pipeline contains three types of object that generate or process media data:

  • Media Sources introduce data into the pipeline. A media source might get data from a local file, such as a video file; from a network stream; or from a hardware capture device.
  • Media Foundation Transforms (MFTs) process data from a stream. Encoders and decoders are implemented as MFTs.
  • Media Sinks consume the data; for example, by showing video on the display, playing audio, or writing the data to a media file.

Third parties can implement their own custom sources, sinks, and MFTs; for example, to support new media file formats.

The Media Session controls the flow of data through the pipeline, and handles tasks such as quality control, audio/video synchronization, and responding to format changes.

MFPlay

The MFPlay API is designed for audio and video playback applications, and provides a much simpler interface than the media session. For more information about MFPlay, see Using MFPlay for Audio/Video Playback.

Note  MFPlay is available in Windows 7. Applications written for Windows Vista or Windows Server 2008 must use the media session directly.

Currently, MFPlay uses the media session for its streaming pipeline. However, this is an implementation detail and could change in future releases. The MFPlay application interfaces do not depend on the media session interfaces in any way.

Source Reader and Sink Writer

The Source Reader and sink writer provide an alternative way to use the basic Media Foundation components (media sources, transforms, and media sinks). The source reader hosts a media source and zero or more decoders, while the sink writer hosts a media sink and zero or more encoders. You can use the source reader to get compressed or uncompressed data from a media source, and use the sink writer to encode data and send the data to a media sink.

Note  The source reader and sink writer are available in Windows 7.

This programming model gives the application more control over the flow of data, and also gives the application direct access to the data from the source.

See Also

About the Media Foundation SDK
Media Foundation Programming Guide

Send comments about this topic to Microsoft

Build date: 6/23/2009

Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker