The link Walkthrough: Creating a Windows Store app using WRL and Media Foundation
provides example of a custom MFT creation and using it as activatable class. Inside C# code the MFT is referenced using activatable class ID string like this
mediaCapture.AddEffectAsync(MediaStreamType.Photo, "GrayscaleTransform.GrayscaleEffect", null);
the MediaCapture knows about the MFT with the string "GrayscaleTransform.GrayscaleEffect"
.
How does the MediaCapture reference the MFT only with this string?
I need to know the process because I am working on a project which requires creating video from images (using WRL) for which i am following this Developing a WinRT component to create a video file using Media Foundation. But before i write IMFSample
to SinkWriter
I need it to pass it through a custom activatable MFT class. If I pass the activatable class ID from C# to the WRL class will I be able to reference the custom MFT?
Basic MFT Processing Model describes referencing an MFT using CLSID. But is it possible to extract any CLSID with just the activatable classID string?
So to summarize, How can I use a custom MFT to process an IMFSample
using the activatable classID string in side a WRL?
We use the Windows::Foundation::ActivateInstance function inside AddEffectAsync to create a new instance of the MoCOM object.
Since you want to use the MFT outside of a Media Foundation topology you will need to configure it to process the data. This starts with getting the stream identifiers, setting the media types and getting the buffer requirements. Once the MFT is properly setup you can then start processing the samples.
As an aside MFTs are specifically designed to be framework agnostic. Back in the DirectShow days there was no easy way to use DirectShow filters outside of the filter-graph. We specifically designed the MFT architecture (based on DMO technology that originated on the DSound team) to make them easy to setup and use independently of a topology manager.
I hope this helps,
James