问题
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:
- How should I trigger
CheckMediaType
/SetMediaType
calls after streaming starts? ActuallySetMediaType
is the important one for me. Or is there another way to query current stream resolution? - 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