Both MPlatform and MFormats SDKs have an MCCDisplay object to overlay a video preview with Closed Captions data.
The result looks like:
MPlatform SDK
You should create an instance of the MCCDisplay object and add it as a plugin to your source:
MCCDisplayLib.MCCDisplayClass m_CCDisplay = new MCCDisplayLib.MCCDisplayClass(); m_objPlaylist.PluginsAdd(m_CCDisplay, 0);
MFormats SDK
You should create an instance of the MCCDiaplay object and process frames with this object before sending them to an output object, e.g. MFPreview:
// create an instance of the object MCCDisplay m_CCDisplay = new MCCDisplay(); // .. grab a frame in your main thread MFFrame sourceFrame; mySource.SourceFrameGet(-1, out myFrame, ""); // process the frame with the MCCDisplay object int framesRest; MFFrame modifiedFrame; ((IMFProcess)m_CCDisplay).ProcessFrame(sourceFrame, out modifiedFrame, out framesRest, ""); // send the modified frame to a preview ((IMFReceiver)myPreview).ReceiverFramePut(modifiedFrame, -1, "");
MCCDisplay object properties
You can specify a style of the overlay using the object properties.
The properties are stored in the system registry:
[HKEY_CURRENT_USER\SOFTWARE\Medialooks\MCCDisplay]
Or can be set with the PropsSet method:
(m_CCDisplay as IMProps).PropsSet("face", "Arial");
Here is a list of properties:
Name | Default value | Description |
---|---|---|
xds_duration | -1.0 | XDS Showing duration (in seconds), 0.0 for disable, -1.0 for display all time |
show_subtitles | true | Enables Closed Captions data to display |
cc_type | 608 |
Sets a type of previewed Closed Captions. Possible values: "608", "708" |
channel | 1 | Sets Closed Captions channel |
cc_style | Sets Closed Captions info display extra style (list of parameters). See more for details. | |
xds_style | XDS info display style (list of parameters). See more for details. | |
color | white | Specifies color for the overlay. Possible values:
|
face | Consolas | Sets font face for the overlay. |
bg-color | Sets the background color. Possible values:
|