播放内存流中的视频文件 [英] Play video file from a memory stream
问题描述
只是想知道这是否可行.我有一个Windows应用程序,该程序从我PC上的.avi文件读取所有字节,然后将其存储在byte []中.所以现在我在内存中有了avi文件,我想直接从内存中将其加载到某种视频播放器控件中.我尝试使用wmplayer控件,显然这是不可能的.我已经阅读了有关使用DirectShow和VLC插件的建议,但是我不知道从哪开始使用这两个插件,而且我还没有看到任何样例代码.有人有任何想法可以详细说明所提到的插件,或者有不同的方法吗?
Just curious to see if this is possible. I have a windows application that reads all the bytes from a .avi file situated on my pc and then stores it in a byte[]. So now I have the avi file in memory, and I want to load it into some sort of a video player control, directly from memory. I've tried using the wmplayer control, apparently this is not possible. I've read suggestion about using the DirectShow and VLC plugins, but I have no idea where to even start using those two and I haven't seen any sample code of this being down. Anybody have any ideas to elaborate on the mentioned plugins, or have a different approach to it?
推荐答案
对于DirectShow,可能需要内存中的源过滤器.我不知道可以使用这种过滤器,但是可以基于
For DirectShow, an in-memory source filter may be required. I am not aware of such a filter being available, but one can be based on Async Filter Sample from DirectShow samples. This is in C++ though.
对于.NET,可以使用 DirectShow.NET 库.一个示例GSSF过滤器可能是内存中源过滤器实现的良好开端.该库还提供DirectShow的COM Interop,可用于构建实例化此过滤器的测试播放器应用程序.
For .NET, DirectShow.NET library can be used. A sample GSSF filter there may be a good start for an in-memory source filter implementation. This library also provides COM Interop for DirectShow that could be used to build a test player application that instantiates this filter.
这篇关于播放内存流中的视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!