另外我感到做dxshow的应用没前途,因为这是微软开发的sdk,而微软本身也开始涉足视频点播市场,同时他们的播放器作的很好。他们的sdk我想仅仅只是提供给开发者初浅应用。深入应用的部分只要涉及到他本身利益决不会公开给你。而且当你的产品和他的产品有利益上冲突的时候,决不会对你袖手旁观。dxshow和DirectX其他部分不一样,原来就不是directx体系中的一员,现在也只是dx的高层应用。开发dx应用可以是方方面面的,即便只是游戏一项内容就很广。但开发dxshow就只有多媒体这一方面了,而且视频是其中的重头戏。我们使用dxshow开发的播放器其核心部分都是微软的,实际上是被微软牵着走。我们做什么?用户界面?source filter?...都是离心很远的无足轻重的部分。看看asf格式的文件,你的source filter拿它有办法吗?即使有办法那还不是人家的一个例子!即使不是人家的例子、即使很有办法,看看下面的文字,你也会灰心丧气:
Microsoft patents the ASF media file format and stops the author of VirtualDub, a GPLed video capture and processing program for Windows, from supporting ASF since he reverse-engineered the ASF file spec. The consequences are numerous: Third parties cannot develop their own tools to decode ASF or convert ASF to other formats, and if ASF becomes the dominate media format on the Internet (due to Microsoft's proprietary but high-quality MPEG4 codec and strong marketing), Microsoft gains de facto technical control over the creation and distribution of digital media. And if patenting file formats becomes a common practice, it can have a chilling effect on free software development since the reading/writing of data in popular formats (say, Microsoft Word files or MPEG4 video) would be prohibited, unless one uses designated drivers.
所以dxshow就像是微软拿出来炫耀的东西,就像一个富人家拿出一勺粥给可怜巴巴的站在他门前的瞪圆了眼睛急切等待着的你,说:“这是给你的,我们家里有的是,还有香喷喷的大米饭。”
所以我觉得dxshow是微软丢给程序员的狗食,要是唯物主义者,那就尝尝,其味道还可以,但结果肯定是没有什么作为的。不吃,自己动手开发这样一套东西太复杂,太难。不过dxshow设计思想还是可以好好学习的,就如那个async例子,从中可以学到很多编程方面的东西。
LONGLONG Size(LONGLONG *pSizeAvailable)
{
LONGLONG llCurrentAvailable = Int32x32To64((timeGetTime() - m_dwTimeStart),m_dwKBPerSec);
/*The timeGetTime function retrieves the system time, in milliseconds. The system time is the time elapsed since Windows was started.*/
if(pSizeAvailable)*pSizeAvailable = min(m_llLength, llCurrentAvailable);
return m_llLength;
}