0

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?
Emir Akaydın
  • 5,708
  • 1
  • 29
  • 57

1 Answers1

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.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Yes, all we want is to change resolutions, not other media type changes like YUV->RGB etc. We want to do exactly like the VMR does. By the way, our class is extended from CBaseVideoRenderer and it is extended from CBaseRenderer which uses CRendererInputPin as a friend class. Should I use a custom Pin to override QueryAccept and get these resolution changes? – Emir Akaydın Nov 17 '11 at 11:31
  • So what exactly you want to support? Extend the stride like VMR does, or handle format changes requested by upstream filter like VMR does it? – Roman R. Nov 18 '11 at 13:23
  • They are initiated by upstream filter, so you should set a breakpoint on `IPin::ReceiveConnection`, `IPin::QueryAccept` and `IPinConnection::DynamicQueryAccept` (if applicable). Then check where the execution reaches on resolution change and step through base class to see if it is rejecting the request before getting it to where you expect in `CheckMediaType`. – Roman R. Nov 18 '11 at 14:48
  • Actually I've read this myself, too. But one of my problems is I'm using CBaseVideoRenderer and it already has a default Pin. And this Pin (CRendererInputPin) is a friend class of its base class. I tried to override QueryAccept before but failed. Should I use something raw like CBaseFilter and create everything over it myself (including pin) or is it possible to write virtual methods of Pin class using CBaseVideoRenderer? I tried it before but didn't work. – Emir Akaydın Nov 18 '11 at 15:08
  • I managed to override both IPin::ReceiveConnection and IPin::QueryAccept but none of them are being called. I'm still on it but couldn't solve it, yet. – Emir Akaydın Nov 18 '11 at 17:22
  • Finally I managed to create a custom pin. My problem is not completely solved yet, but your answer is correct. Thank you. :) – Emir Akaydın Nov 18 '11 at 17:27