Posted on 2007-04-29 13:21
vcommon 阅读(7199)
评论(3) 编辑 收藏 引用
简介
这篇文章解释了如何将使用DirectShow的应用程序转向使用vista上的Digital Media API,即Media Foundation.
本文假设你已经非常熟悉DirectShow。并且本文并不讲述Media Foundation.
对比Media Foundation 和DirectShow
我们已经跨入了对高清数字媒体时代。未来的数字高清将无处不在。但是他非常需要健壮的保护,而这是当前的数字媒体平台所不具备的。Media Fundation就是为了这个而存在。
让我们审视高清数字,这个平台需要很有弹性,便于从小故障下恢复。需要考虑大量的不同品质的video 和audio.Media Foundation就是为了这个而存在。比如,支持下一代的HD技术:
1:DirectX 视频加速(DXVA) 2.0提供了比DXVA1.0更高效率的视频加速,更稳定,最新的视频解码能力,和扩展的硬件视频加速。在DXVA2.0下,windows可以直接处理某些高清内容,并容易错误恢复。
2:Color-space能得以保存在整个视频处理流程中,所以中途可以无转换损失,用户可以享受到高逼真的画质。这个也能减少CPU等消耗。
3:增强的视频渲染器(enchanced video render EVR)增强了视频处理和时钟等。
让我们研究一下文件保护,在用户购买了一部电影之后,他可以把电影传到他的某个设备上(一些设备支持直接在播放的时候录制),这个过程中会有多种保护模式,购买后的使用保护,播放时防录制保护,复制保护,如果某一个保护没有正确完成,就会使整套保护没有了意义。所以这需要有一个无缝的平台去相互协作。Media Foundation就是为了这个而存在。
最后,让我们来总览一下DirectShow. DirectShow的API对这些数字高清媒体的应用程序确实是非常通用的,万能的,但是,DirectShow作为一个10多年的老技术而言已经力不从心了。比如:
1:流程是静态static的,所以实现动态的Graph和Major format change是非常困难的。
2:DirectShow filter的线程模型是非常复杂的,要完全理解并永不出错是太困难了。
3:DirectShow filter只能用于DirectShow。
4:DirectShow不支持文件保护。
作为DirectShow的接替者,Media Foundation出现了,他不会马上替代DirectShow,作为第一步,他将在vista上慢慢展露他的影响。
但是目前为止,Media Foundation只能在媒体保护(Proteced media process))方面大施手脚,还未向DirectShow进行足够的扩展和替代。
Appendix: Feature Comparisons
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 |