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

发布于 2024-09-26 22:56:41 字数 92 浏览 1 评论 0原文

我在 BaseClasses 中找不到合适的渲染器类,它有 2 个输入引脚 - 一个用于视频,一个用于音频。有人可以推荐/提供一些代码吗?

问候 多米尼克

I couldn't find a suitable renderer class in BaseClasses that has 2 input pins - one for video and one for audio. Can anybody recommend/provide some code?

Regards
Dominik

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

花海 2024-10-03 22:56:41

CBaseRenderer 类是基类用于实现渲染器过滤器。但它只支持一个输入引脚。

我从未遇到过同时处理音频和视频的渲染器类,它们总是通过单独的渲染器过滤器渲染。

VMR9 渲染器 (CLSID_VideoMishingRenderer9) 非常适合渲染视频,而 DirectSound 渲染器 (CLSID_DSoundRender ) 用于渲染音频。

您是否可能尝试将两个流写入媒体文件中的磁盘?然后,您将需要一个能够识别这两种媒体类型的多路复用器过滤器。由于我不知道您使用的媒体类型,我建议您查看 AVI Mux 过滤器,它可以完成这样的工作。

我希望这能为您指明正确的方向;)

The CBaseRenderer class is a base class for implementing renderer filters. 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.

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.

I hope that this points you in the right direction ;)

转身泪倾城 2024-10-03 22:56:41

或者,您可以在视频和音频编码器之后将示例采集器过滤器添加到媒体管道,并对媒体进行打包并在示例采集器回调中传送 RTP 数据包。样本采集器可以连接到 NULL 渲染器。这样您就可以避免编写过滤器并专注于网络传输。

此外,您还应该考虑是否要混合流:通常在 RTP 中,视频和音频在单独的 RTP 会话中传送。如果您仍然想编写具有多个输入引脚的过滤器,您可以查看我为视频混合器编写的一些基类,可在 http://sourceforge.net/projects/videoprocessing/ 作为起点。

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. The sample grabbers can be connected to the NULL renderer. 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. 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.

韶华倾负 2024-10-03 22:56:41

据我所知,没有任何 MSDN 示例具有多个输入引脚,这是一个不幸的遗漏。

GDCL mp4 多路复用器编写得很好,具有多个输入引脚,并且可以通过相当自由的许可证获得源代码。它的“参考质量”是由 DirectShow 的一位原始架构师编写的。尽管 mp4 处理相当复杂,但 DirectShow 方面却相当简单。 GDCL mp4 过滤器

大多数具有多个输入引脚的过滤器会将输入引脚的传入数据排列在队列中由工作线程处理的某种类型,该工作线程生成文件输出文件或将处理后的数据发送到输出引脚或引脚上。基类中的 CQueue 是一个在空/满时阻塞读取器/写入器的队列的良好起点,尽管它需要一些额外的工作来支持停止和刷新。 CAMThread 是工作线程的一个有用的起点 - 有关示例实现,请参阅 CSource。

其他参考资料
如何制作 DirectShow Muxer Filter - 第 1 部分
如何制作 DirectShow Muxer 过滤器 - 第 2 部分

As far as I know there aren't any MSDN samples that have multiple input pins, an unfortunate omission.

The GDCL mp4 multiplexer is well written and has multiple input pins and source code is available on a pretty liberal license. It's 'reference quality' having been written by one of DirectShow's original architects. Though the mp4 handling is quite complex the DirectShow side of it is reasonably simple. GDCL mp4 filters

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. CAMThread is a useful starting point for a worker thread - see CSource for an example implementation.

Additional references
How to make a DirectShow Muxer Filter - Part 1
How to make a DirectShow Muxer Filter - Part 2

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文