issue in changing format from higher resolution to lower resolution in Directshow, dynamic format change is not happening

Viewed 71

I have 4 filters video input filter obtained from enum monikers, a smart tee, sample grabber, and null renderer, when I start with higher resolution I first create all the filters and run the media control.

IAMStreamConfig:: GetStreamCaps -to see all the modes available

ISampleGrabber::SetCallback, with ISampleGrabberCB::SampleCB option, I'm able to call getCurrentBuffer() to get frames,

when I want to change the format, I do all the steps but on request for the frame using the callback method I don't get any frames()

What are the usual steps for changing the format dynamically, I did try the same by stopping the media control, changing the format using SetFormat()

and run again, still no luck

1 Answers

To change format the least amount of steps you need is to stop the graph, disconnect all pins, change format on video capture filter (using either IAMStreamConfig::SetFormat or connecting it downstream with explicitly defined media type), then reconnect all other pins downstream.

That is, the sequence of steps is not really much different from just dropping everything and rebuilding the entire pipeline from scratch.

There is some dynamic format change support to change resolution on the go in DirectShow but it is incomplete and, in particular, not usable in your case.

Related