Migrating from DirectShow to Media Foundation
Comparing Media Foundation with DirectShow
Migration Paths
The basic infrastructure is in place for Media Foundation to be expanded into a complete digital media platform. In the meantime, existing digital media APIs, including DirectShow, will continue to be used in applications written for Windows Vista. Your migration path depends on the type of application you are writing, whether you are writing a new application or maintaining an existing application, and whether you want to provide features that are specific to Windows Vista.
It is not expected that every digital media application will adopt Media Foundation immediately. The typical migration path will be to use existing SDKs, such as DirectShow and the Windows Media Format SDK, and incorporate Media Foundation as needed. However, the sooner you begin building with Media Foundation, the better positioned you will be to capitalize on the wave of next-generation premium content.
The following new features in DirectShow and Media Foundation will simplify the migration path to Media Foundation:
- Media Foundation uses a new model for video and audio transforms. Media Foundation Transforms (MFTs) are an evolution from DirectX Media Objects (DMOs), which were introduced in the DirectX 8.0 SDK. Compared with DMOs, the required behaviors of MFTs are more clearly specified, which makes it easier to write a correct implementation. In addition, MFTs can support hardware-accelerated video transforms.
- Media Foundation provides a new video renderer, called the Enhanced Video Renderer (EVR). The EVR uses the next version of DirectX Video Acceleration (DXVA 2.0) for more efficient video rendering, and it has a simpler API for creating custom video presenters. To make EVR adoption easier, DirectShow provides an EVR filter in Windows Vista. Internally, the DirectShow EVR and the Media Foundation EVR use the same mixer and presenter objects. If you write a custom presenter, it can be used with either Direct Show or Media Foundation. DirectShow applications that use the EVR filter for advanced video rendering will be well placed to convert to a Media Foundation implementation in the future.
- With DXVA 2.0, video acceleration is now available directly to user-mode components without needing to communicate with the DirectShow video renderer. Previously, DXVA was accessible only through the video renderer. Decoders can now take advantage of DXVA 2.0 to provide fast video decoding without any dependency on DirectShow. Applications can also use DXVA 2.0 to perform video processing operations, such as contrast and gamma adjustment.
Video Capture
For video capture, continue to use DirectShow.
Custom Plug-in Components
If you create custom filters for DirectShow, such as encoders or decoders, you should consider writing an MFT instead. Writing an MFT gives you the inherent advantages of the MFT model over filters or DMOs, lets you take advantage of DXVA 2.0, and positions your product to work within the Media Foundation pipeline as well as DirectShow. The choice of whether to write an MFT depends on several factors:
- If you have an existing DMO, converting it to an MFT is typically a straightforward process, because the basic design of the two APIs is similar.
- If you have already written a custom DirectShow filter, and the filter is meant to be used only within your own DirectShow application, there is probably no benefit to rewriting it as an MFT.
- Source and sink filters should generally not be written as MFTs.
Video Editing
Video editing is not the primary focus of this release of Media Foundation. If your application is written using DirectShow or DirectShow Editing Services, you should continue to use those. ㅡㅡ;
Media Foundation is the digital multimedia platform for Windows Vista and beyond. On Windows Vista, the primary focus of Media Foundation is premium content playback. Media Foundation does not yet completely replace DirectShow; for many applications, the best approach will be to use a blend of technologies. For premium content, Media Foundation today gives you the advantages of content protection and enhanced audio-video quality in the pipeline. Applications that incorporate Media Foundation are well positioned to take advantage of the next generation of digital media content.
The following table compares the features of Media Foundation with those of DirectShow.
Feature group |
Feature | Media Foundation |
DirectShow |
Basic functionality | Audio and video rendering | Yes | Yes |
Event notification | Yes | Yes | |
Device enumeration | No | Yes | |
Component enumeration | Yes | Yes | |
Synchronization to reference clock | Yes | Yes | |
Seeking | Yes | Yes | |
Improved stress resilience | Yes | No | |
Content protection | Component validation | Yes | No |
Content protection policy negotiation | Yes | No | |
Interoperability between content protection technologies | Yes | No | |
Protection against kernel-mode and user-mode threats | Yes | No | |
Component revocation and renewal | Yes | No | |
Video output protection management | Yes | Yes | |
Media tasks | Audio capture | No | Yes |
Video capture | No | Yes | |
Video editing | No | Yes | |
DVD playback and navigation | No | Yes | |
MPEG-2 support | No | Yes | |
ASF support | No | Yes | |
TV technologies | No | Yes | |
Stream buffer engine | No | Yes | |
Encoder API | No | Yes | |
Video renderer | Substream mixing using per-pixel or planar alpha blending | Yes | Yes |
Customizable video composition | No | Yes | |
Support for custom presenters | Yes | Yes | |
Windowless rendering | Yes | Yes | |
Multimonitor support | Yes | Yes | |
DXVA | Yes | Yes | |
DirectDraw exclusive mode | Yes | Yes | |
Backward compatibility with existing applications | Yes | Yes | |
Accurate frame stepping | Yes | Yes | |
Alpha blending of image data | Yes | Yes | |
Glitch resilience | Yes | No | |
Enhanced video fidelity | Yes | No | |
Enhanced content protection robustness | Yes | No | |
Standalone use | Yes | No | |
Standalone mixing component | Yes | No | |
Transforms (MFT or DMO) | Synchronous data processing | Yes | Yes |
Simple programming model | Yes | Yes | |
Standalone use | Yes | Yes | |
Multiple inputs and multiple outputs | Yes | Yes | |
Dynamic number of streams | Yes | No | |
Access to sample-level metadata | Yes | No | |
In-place processing | Yes | Yes | |
Dynamic format changes | Yes | No | |
Quality adjustment | Yes | No | |
Rate change | Yes | No |
The following table compares the features of Media Foundation with those of the Windows Media Format SDK.
Feature group |
Feature | Media Foundation |
Format SDK |
ASF file features | Audio and video streams | Yes | Yes |
Image streams | No | Yes | |
Arbitrary streams (text, file, Web, custom data) | No | Yes | |
Script commands | No | Yes | |
Data unit extensions | Yes | Yes | |
SMPTE time code support | No | Yes | |
Mutual exclusion | Yes | Yes | |
Stream prioritization | Yes | Yes | |
Bandwidth sharing | No | Yes | |
Indexes | Yes | Yes | |
Markers | Yes | Yes | |
Multiple bit rate stream | Yes | Yes | |
Multiple language support | Yes | Yes | |
Codec features | CBR encoding | Yes | Yes |
VBR encoding | Yes | Yes | |
Two-pass encoding | Yes | Yes | |
High-resolution audio support | Yes | Yes | |
Low delay audio | Yes | Yes | |
S/PDIF audio output | Yes | Yes | |
Video image | Yes | Yes | |
Device conformance template | Yes | Yes | |
Video complexity settings | Yes | Yes | |
Frame interpolation | Yes | Yes | |
DirectX Video Acceleration | Yes | Yes | |
File writing | Video resizing | Yes | Yes |
Color space conversion | Yes | Yes | |
Audio resampling | Yes | Yes | |
ASF file sink | Yes | Yes | |
Network sinks | No | Yes | |
Push sinks | No | Yes | |
Watermarking support | No | Yes | |
Input formats, input settings, and data unit extensions | Yes | Yes | |
WMA smart recompression | No | Yes | |
Multichannel audio | Yes | Yes | |
File reading | User-allocated sample support | No | Yes |
Synchronous reading | No | Yes | |
Output format enumeration | Yes | Yes | |
Multichannel audio | Yes | Yes | |
MP3 support | Yes | Yes | |
Network sources | Yes | Yes | |
Metadata | ID3 support | No | Yes |
Custom metadata | Yes | Yes | |
Digital rights management | Live DRM | No | Yes |
DRM Individualization | Yes | Yes | |
Back up and restore DRM licenses | Yes | Yes | |
View DRM attributes in the Metadata Editor | Yes | Yes | |
Output protection levels | Yes | Yes | |
License revocation | Yes | Yes | |
Windows Media DRM for Network Devices | Yes | Yes | |
Secure Audio Path | No | Yes | |
Playlist burning | Yes | Yes | |
Third-party transcription support | Yes | No | |
Local license issuance | Yes | No | |
Enhanced Windows Media DRM renewability | Yes | No |
http://msdn.microsoft.com/en-us/library/dd757928(VS.85).aspx