简体   繁体   English

流中的DirectShow,C#和视频

[英]DirectShow, c# and video from a stream

Is looking for a way of rendering a byte stream using DirectShow. 正在寻找一种使用DirectShow渲染字节流的方法。 IGraphBuilder.RenderFile already does the heavy lifing when the stream is in a file on disk, but I can't seem to find a good example of how to provide the data myself using a stream into the filter graph. 当流在磁盘上的文件中时,IGraphBuilder.RenderFile已经很费劲了,但是我似乎找不到一个很好的示例,说明如何使用流自己向过滤器图中提供数据。 I'm a total newbie to DirectShow, so from my point I have a stream that I would like to push in as source to the rendering graph instead of having it read from a file. 我是DirectShow的新手,所以从我的角度来看,我有一个流,我想将其作为源推入渲染图,而不是从文件中读取。

(As a side note, I'm ultimately trying to get this to work on WindowsCE using the port of DirectShowNet for CompactFramework, see here , but I guess part one is just trying to figure out how it works on the full framework. On CE I basically get an open stream and nowhere to save it to, so I just have to stream directly to DirectShow) (作为一个旁注,我最终尝试使用DirectShowNet for CompactFramework的端口使它在WindowsCE上运行, 请参阅此处 ,但我想第一部分只是试图弄清楚它在完整框架上如何工作。在CE上我基本上得到了一个开放流,并且无处可保存,因此我只需要直接流到DirectShow)

In order to provide media samples to a graph from a socket, you must build your own source filter. 为了从套接字向图提供媒体样本,您必须构建自己的源过滤器。 The source filter must do the job of connecting/authenticating with a stream server, then turn the TCP/UDP stream into discrete media samples that can be passed downstream via your filters output pin(s). 源过滤器必须完成与流服务器的连接/身份验证工作,然后将TCP / UDP流转换为离散的媒体样本,这些样本可以通过您的过滤器输出引脚传递到下游。

For the sake of performance, you may consider implementing your filter in C++ (Microsoft don't provide a managed API for DirectShow for a reason...) 为了提高性能,您可以考虑使用C ++实现过滤器(出于某种原因,Microsoft不提供DirectShow的托管API ...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM