Custom DirectShow Video Renderer Filter - Dynamic Resolution Change

廉价感情. 提交于 2019-12-13 08:41:21

问题


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?

回答1:


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.



来源:https://stackoverflow.com/questions/8164777/custom-directshow-video-renderer-filter-dynamic-resolution-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!