I am writing a transform and want to change the output size of the frame and video. I inspected the sample and found out the order of function calling:
SetInputType
SetOutputType
GetInputCurrentType
SetInputType
UpdateFormatInfo
GetOutputCurrentType
SetOutputType
GetOutputStreamInfo
SetProperties
ProcessOutput (THROW NEED INPUT)
ProcessInput
ProcessOutput
ProcessOutput (THROW
....
.... repeat until done
In which step do I need to modify the output size and how?
Example: Input a 640x480 video, output 480x480 video, without stretching.
There are 2 steps to "changing the output size" in your MFT.
1) You need to modify the SetOutputType and GetOutputAvailableType routines:
2) You need to modify the processing of the samples in ProcessInput/ProcessOutput to actually DO the resizing. Just changing the media types doesn't perform any kind of automatic resizing. How you change dimensions depends on the actual format of the video data (which you did not provide), and the details of how you want to do the resizing. Did you just want to chop off the extra lines? From the top or the bottom? Do you need to support chopping width too?
I have a c++ class that handles all the overhead of creating MFTs, along with a number of sample MFTs that show how to use that class available at http://www.LimeGreenSocks.com/MFT. It's still in beta as of this writing, but it should give you some ideas.
Probably the closest sample for what you are trying to do is the Rotate. When rotating, an 800x600 video can become a 600x800 video. The Rotate even allows the rotation to be changed while streaming (see Format Changes under Asynchronous MFTs). The c++ rotate mft is a well-commented ~350 lines long.