MPlatform SDK
For example, you use MFile object. You need to playback it on the main preview, create a CG configuration on another preview and then set this configuration for your MFile to output it to a device.
To do it you need to create external MPreview object:
//Initialize object
m_objFile = new MFileClass();
//Initialize main preview
m_objFile.PreviewWindowSet("", panelPreview.Handle.ToInt32());
m_objFile.PreviewEnable("", 1, 1);
//Set new file for a playback
m_objFile.FileNameSet(@"d:\temp\clip1.mpg", "in=1 out=10");
//Start playback
m_objFile.FilePlayStart();
//Create a second preview
MPreviewClass prev = new MPreviewClass();
prev.PreviewWindowSet("", panel1.Handle.ToInt32());
prev.PreviewEnable("", 1, 1);
prev.ObjectStart(m_objFile);
Then add Character Generator to the second preview as a plugin:
m_objCharGen = new MLCHARGENLib.CoMLCharGenClass();
prev.PluginsAdd(m_objCharGen, 0);
Then create your required configuration just on this preview. Add CG items, set their properties etc. Your changes will not be shown in the main preview and on output.
When your configuration is ready, you should save it to string with the SaveToXMLString method:
string myConfiguration;
m_objCharGen.SaveToXMLString(out myConfiguration, 1);
Add a new CG object to your MFile and load this configuration:
myMainCG = new MLCHARGENLib.CoMLCharGenClass();
m_objFile.PluginsAdd(myMainCG, 0);
myMainCG.LoadFromXML(myConfiguration, 0);
So you get a full configuration on air. Then you can output your MFile object to some device.
MFormats SDK
You just process a frame with the CG object and send the modified frame to a preview (MFPreview object) and use the original frame for output.