简体   繁体   English

DirectShow BaseClasses-具有视频和输入引脚的视频渲染器类

[英]DirectShow BaseClasses - a video renderer class with video and input pin

I couldn't find a suitable renderer class in BaseClasses that has 2 input pins - one for video and one for audio. 我在BaseClasses中找不到合适的渲染器类,它具有2个输入引脚-一个用于视频,一个用于音频。 Can anybody recommend/provide some code? 有人可以推荐/提供一些代码吗?

Regards Dominik 问候多米尼克

The CBaseRenderer class is a base class for implementing renderer filters. CBaseRenderer类是用于实现渲染器筛选器的基类。 It only supports one input pin though. 虽然它仅支持一个输入引脚。

I've never encountered a renderer class that handles both audio and video, they're always rendered via separate renderer filters. 我从未遇到过同时处理音频和视频的渲染器类,它们始终通过单独的渲染器过滤器进行渲染。

The VMR9 renderer (CLSID_VideoMixingRenderer9) is great for rendering video, while the DirectSound Renderer (CLSID_DSoundRender) is used for rendering audio. VMR9渲染器 (CLSID_VideoMixingRenderer9)非常适合渲染视频,而DirectSound渲染器 (CLSID_DSoundRender)用于渲染音频。

Are you maybe trying to get both streams written to disk in a media file? 您是否正在尝试将两个流都写入媒体文件中的磁盘? Then you'll need a mux filter that understands both media types. 然后,您需要一个了解两种媒体类型的复用器过滤器。 Since I don't know what media types you're using, I could recommend you might have a look at the AVI Mux filter , which does such a job. 由于我不知道您使用的是哪种媒体类型,所以我建议您可以看看AVI Mux过滤器 ,它可以完成此工作。

I hope that this points you in the right direction ;) 我希望这会为您指明正确的方向;)

Alternatively you can add sample grabber filters to your media pipeline after your video and audio encoders and packetize the media and deliver the RTP packets in the sample grabber callbacks. 或者,您可以在视频和音频编码器之后将样本采集器过滤器添加到媒体管道,并打包媒体并在样本采集器回调中传递RTP数据包。 The sample grabbers can be connected to the NULL renderer. 样本采集卡可以连接到NULL渲染器。 That way you can avoid writing a filter and focus on the network transport. 这样,您可以避免编写过滤器,而将精力集中在网络传输上。

Also, you should consider if you even want to mux the streams: usually in RTP video and audio are delivered in separate RTP sessions. 另外,您还应该考虑是否要复用流: 通常在RTP中,视频和音频在单独的RTP会话中传递。 If you still want to write a filter with multiple input pins, you can have a look at some baseclasses I wrote for a video mixer available at http://sourceforge.net/projects/videoprocessing/ as a starting point. 如果您仍然想编写一个具有多个输入引脚的过滤器,则可以从http://sourceforge.net/projects/videoprocessing/上了解我为视频混合器编写的一些基类。

As far as I know there aren't any MSDN samples that have multiple input pins, an unfortunate omission. 据我所知,没有任何MSDN样本具有多个输入引脚,这是一个不幸的遗漏。

The GDCL mp4 multiplexer is well written and has multiple input pins and source code is available on a pretty liberal license. GDCL mp4多路复用器编写精良,具有多个输入引脚,并且源代码可以在相当宽松的许可证上获得。 It's 'reference quality' having been written by one of DirectShow's original architects. 这是DirectShow的原始架构师之一写的“参考质量”。 Though the mp4 handling is quite complex the DirectShow side of it is reasonably simple. 尽管mp4的处理非常复杂,但DirectShow方面却相当简单。 GDCL mp4 filters GDCL mp4过滤器

Most filters with multiple input pins will queue the input pins' incoming data in queues of some kind that are processed by a worker thread that generates the file output file or sends processed data out on the output pins or pins. 大多数具有多个输入引脚的过滤器会将输入引脚的传入数据排队在某种类型的队列中,该队列由工作线程处理,该工作线程生成文件输出文件或将处理后的数据发送到输出引脚上。 CQueue in the base classes is a good starting point for a queue that blocks readers/writers when empty/full though it will require some extra work to support stopping and flushing. 基类中的CQueue是一个队列的良好起点,该队列在空/满时会阻塞读取器/写入器,尽管它需要一些额外的工作来支持停止和刷新。 CAMThread is a useful starting point for a worker thread - see CSource for an example implementation. CAMThread是工作线程的有用起点-有关示例实现,请参见CSource。

Additional references How to make a DirectShow Muxer Filter - Part 1 How to make a DirectShow Muxer Filter - Part 2 其他参考如何制作DirectShow Muxer过滤器-第1部分 如何制作DirectShow Muxer过滤器-第2部分

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

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