自定义 DirectShow 视频渲染器过滤器 - 动态分辨率更改

发布于 2024-12-16 14:39:54 字数 1232 浏览 0 评论 0原文

我有一个自定义 DirectShow 视频渲染过滤器,它比Microsoft 的视频渲染过滤器具有一些扩展功能,例如叠加图像。我知道我可以使用 Transform Filter 执行相同的操作,但我选择了这种方式。我还相信,使用 Transform Filter 我会遇到同样的问题,我将在下面描述。

当我使用Microsoft 的视频渲染器过滤器时,它能够在流启动/更改时自动调整窗口大小和缓冲区大小。我的过滤器能够执行相同的操作,但不同的是,我无法在流启动后接收事件。我相信我可以以某种方式查询,但我不知道如何查询。

当前事件管道如下所示。

On Pin Connect
--------------
CreateInstance  
Video Renderer Class Constructor
CheckMediaType  
SetMediaType    
-> Width: 100, Height: 100  
CheckMediaType  
CheckMediaType  
CheckMediaType  
SetMediaType
-> Width: 100, Height: 100  

On Play
-------
StartStreaming
DoRenderSample
...
...
...
DoRenderSample

On Stop
-------
Video Renderer Class Destructor

我的源过滤器设置的默认窗口大小是 100x100。我可以通过引脚连接两次。但在 StartStreaming 之后,我无法再次获取 CheckMediaTypeSetMediaType 事件。我可以尝试从源过滤器触发它们(这也是我的代码),但由于 Microsoft 的视频渲染器 能够在 StartStreaming 上自动调整大小,我希望拥有相同的功能。

问题:

  1. 流媒体开始后,我应该如何触发 CheckMediaType / SetMediaType 调用?实际上 SetMediaType 对我来说很重要。或者还有其他方法来查询当前流分辨率吗?
  2. 我是否需要在 DoRenderSample 中连续检查可能的视频尺寸变化?

I have a Custom DirectShow Video Renderer Filter which has some extended features over Microsoft's Video Renderer Filter like overlay images. I know I could do the same with a Transform Filter but I've chosen that way. I also believe, I would face the same problem with a Transform Filter which I'll describe below.

When I use Microsoft's Video Renderer Filter, it is capable of resizing the window and buffer sizes automatically when stream starts/changes. My filter is capable of doing the same but except, I'm unable to receive events after stream starts. I believe I can query somehow but I don't know how.

Current event pipeline is like below.

On Pin Connect
--------------
CreateInstance  
Video Renderer Class Constructor
CheckMediaType  
SetMediaType    
-> Width: 100, Height: 100  
CheckMediaType  
CheckMediaType  
CheckMediaType  
SetMediaType
-> Width: 100, Height: 100  

On Play
-------
StartStreaming
DoRenderSample
...
...
...
DoRenderSample

On Stop
-------
Video Renderer Class Destructor

Default windows size set by my source filter is 100x100. I'm able to get this on pin connect twice. But after StartStreaming, I'm unable to get CheckMediaType and SetMediaType events again. I could try to trigger them from source filter (it's my code as well) but since Microsoft's Video Renderer is capable of automatically resizing on StartStreaming, I wanted to have the same feature.

Questions:

  1. How should I trigger CheckMediaType / SetMediaType calls after streaming starts? Actually SetMediaType is the important one for me. Or is there another way to query current stream resolution?
  2. Do I need to check for possible video size changes continuously in DoRenderSample?

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

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

发布评论

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

评论(1

坦然微笑 2024-12-23 14:39:55

CheckMediaTypeSetMediaType 并不完全是“事件”,它们不会自行出现,因此您无法触发它们。你要改变决议吗?像VMR那样靠自己去扩展步伐?或者接受上游过滤器的分辨率更改?

此 MSDN 部分涵盖详细信息:动态格式更改

CheckMediaType and SetMediaType are not exactly "events", they don't come up on their own, so you cannot trigger them. Are you going to change resolutions? On your own to extend stride like VMR does? Or accept resolution changes from upstream filter?

This MSDN section covers details: Dynamic Format Changes.

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