Asked by:
How to dynamic change settings of a MFT component in WinRT?

Question
-
I know how to set parameters to MFT with 3rd parameter of function "msInsertVideoEffect" while registering.
But as I want to change parameters upon playing, are there any methods I can use?? I have some guesses but not quite sure.
1. Is there a method in WInRT library to set parameters when playing, or the function "SetProperties" can called directly without msInsertVideoEffect. If it is, then how can I determine which component I want to configure?
2. If guess one is failed, can I implement the interface and how to expose it to the app?? Can I call the interface directly or need to through MediaExtensionManager or ??
3. Or is any way I can get the instance and query the interface I want to set the parameter??
4. Or I only can clear the effect and insert it again with new parameter?
Thanks.
- Edited by Penny Lu Tuesday, November 1, 2011 9:33 AM
Tuesday, November 1, 2011 9:30 AM
All replies
-
When you insert an effect the pipeline instantiates the WinRT component and calls IMediaExtension.SetProperties before anything else happens, since SetProperties takes an IPropertySet which is set by the tailored app there are several different approaches to establish communication.
One approach would be to define an interface to interact with the effect, implement both IMediaExtension and your custom interface, and at the end of SetProperties add a value to the property set pointing to the current instance of the effect (this). By doing this the metro style app can use your custom interface to communicate with the effect during playback by passing a property set when adding the effect and getting the effect instance when a media element event such as “canplay” is triggered.
Another solution would be to register for IPropertySet events in both the metro style app and the effect so action can be taken when is modified by any of them.
- Edited by Marcelo A GarciaMicrosoft employee Tuesday, November 1, 2011 7:36 PM
- Proposed as answer by Marcelo A GarciaMicrosoft employee Tuesday, November 1, 2011 10:44 PM
Tuesday, November 1, 2011 7:04 PM -
Hi,
I try the method of adding the effect instance to the property set, and it works for "msInsertVideoEffect" API, my metro style APP can get the effect instance and config it. However, I try the same way at another video effect API "MediaCapture.AddEffectAsync", which adds an effect for camera preview & recording, it does not work. The instance got by the metro style APP is invalid.
Can you give me some suggestions?
Thanks.
Friday, November 4, 2011 6:48 AM -
Hello Jay,
Have you looked at the "Grey Scale" sample MFT that we shipped with the CP? I think that if you take a close look at the sample it will answer your questions. Please look at the sample and if you are still having problems please let me know and I will do what I can to help.
The grayscale MFT sample is included with the "Media capture using webcam sample" found here: http://code.msdn.microsoft.com/windowsapps/Media-Capture-Sample-adf87622
Thanks,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Wednesday, March 21, 2012 12:44 AM
Wednesday, March 21, 2012 12:44 AMModerator -
Hi
How can i get the interface of IMediaExtension from a MFT. Like i called MediaCapture.AddEffectAsync to add a MFT, how can i get the instance of the mft?
Monday, February 25, 2013 3:30 AM