XDS (Extended Data Services) is information about the program that travels in field 2 of CEA-608 captions: the program name, the content rating and other data. The rating is used by the V-Chip in TV sets in the USA and Canada to block programs that parents do not allow.
The SDK can:
- insert the program name and the rating when it writes a file or a stream;
- decode XDS from incoming captions and report it as text.
Inserting XDS when writing
Add the following attributes to the configuration of MFWriter or MWriter:
| Attribute | Meaning |
|---|---|
xds_program_name |
Program name, up to 32 characters. Only printable ASCII characters are kept; others become spaces. |
xds_content_advisory |
Rating, see below. |
xds_repeat_frames |
Number of frames to wait before the XDS data is sent again. 0 (default) sends it once at the start. Receivers that tune in later need the data repeated, so set a value, for example 300 (10 seconds at 30 fps). |
writer.WriterSet(@"C:\media\out.ts", 0,
"format='mpegts' video::codec='mpeg2video' audio::codec='mp2' " +
"xds_program_name='Evening News' xds_content_advisory='TV-PG-DL' xds_repeat_frames='300'");In MPlatform, pass the same string to MWriter.WriterNameSet.
Rating values
Spaces and underscores in the value are ignored, and case does not matter.
| System | Values |
|---|---|
| US TV Parental Guidelines |
TV-Y, TV-Y7, TV-G, TV-PG, TV-14, TV-MA, optionally followed by content letters: D (suggestive dialogue), L (language), S (sexual content), V (violence), FV (fantasy violence, with TV-Y7). Examples: TV-14-DLV, TV-Y7-FV. |
| MPA (movies) |
G, PG, PG-13, R, NC-17, X, NR (not rated) |
Limitations
- XDS is inserted into the captions of the video stream, so the video must be MPEG-2 or H.264 (see Embedding, replacing and removing captions in files and streams).
- On frames that carry XDS, XDS replaces the captions of the source for that frame.
- XDS bytes are added in the order the video is encoded. With B-frames, a decoder receives them in a different order and the XDS packet is damaged. Use an encoder configuration without B-frames when you insert XDS.
- XDS is not sent to SDI outputs by this mechanism.
Reading XDS
XDS is decoded by the MCCDisplay plugin (see Previewing captions and subtitles with MCCDisplay). After a frame passes through MCCDisplay, the decoded information is in the XDS frame string, one item per line:
Program name: Evening News
Program rating (V-Chip): TV-PG ...MCCDisplay also draws this text over the video. To get the text without drawing anything, set show_subtitles to false.
MFormats
var ccDisplay = new MCCDisplayClass();
ccDisplay.PropsSet("show_subtitles", "false"); // decode only, do not draw
reader.SourceFrameGet(-1, out MFFrame frame, "");
ccDisplay.ProcessFrame(frame, out MFFrame outFrame, out int rest, "");
outFrame.MFStrGet("XDS", out string xds); // null until XDS has been received
Marshal.ReleaseComObject(outFrame);
Marshal.ReleaseComObject(frame);MPlatform
Add MCCDisplay to the source with PluginsAdd and read XDS in the OnFrameSafe event of the same object: the event receives the frame after the plugins of the object have processed it.
Notes
- XDS arrives slowly and is not on the first frames. Check every frame.
- MCCDisplay keeps the decoded values for
xds_durationseconds; the default-1keeps them without limit,0turns XDS decoding off. - XDS is not reported when MCCDisplay shows Teletext (
cc_type=teletext).
Still have questions?
Tell us what didn’t work or what you’d like clarified.