File MR-221-video-anc-add-two-new-CEA-608-caption-formats.patch of Package gstreamer-plugins-base
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/221
Index: gst-plugins-base-1.24.5/gst-libs/gst/video/video-anc.c
===================================================================
--- gst-plugins-base-1.24.5.orig/gst-libs/gst/video/video-anc.c
+++ gst-plugins-base-1.24.5/gst-libs/gst/video/video-anc.c
@@ -1022,6 +1022,8 @@ gst_buffer_add_video_caption_meta (GstBu
switch (caption_type) {
case GST_VIDEO_CAPTION_TYPE_CEA608_RAW:
case GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A:
+ case GST_VIDEO_CAPTION_TYPE_CEA608_SCTE_20:
+ case GST_VIDEO_CAPTION_TYPE_CEA608_ADDITIONAL_CEA_608:
case GST_VIDEO_CAPTION_TYPE_CEA708_RAW:
case GST_VIDEO_CAPTION_TYPE_CEA708_CDP:
break;
@@ -1071,6 +1073,10 @@ gst_video_caption_type_from_caps (const
return GST_VIDEO_CAPTION_TYPE_CEA608_RAW;
} else if (g_strcmp0 (format, "s334-1a") == 0) {
return GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A;
+ } else if (g_strcmp0 (format, "scte-20") == 0) {
+ return GST_VIDEO_CAPTION_TYPE_CEA608_SCTE_20;
+ } else if (g_strcmp0 (format, "additional-cea-608") == 0) {
+ return GST_VIDEO_CAPTION_TYPE_CEA608_ADDITIONAL_CEA_608;
}
} else if (gst_structure_has_name (s, "closedcaption/x-cea-708")) {
if (g_strcmp0 (format, "cc_data") == 0) {
@@ -1108,6 +1114,14 @@ gst_video_caption_type_to_caps (GstVideo
caption_caps = gst_caps_new_simple ("closedcaption/x-cea-608",
"format", G_TYPE_STRING, "s334-1a", NULL);
break;
+ case GST_VIDEO_CAPTION_TYPE_CEA608_SCTE_20:
+ caption_caps = gst_caps_new_simple ("closedcaption/x-cea-608",
+ "format", G_TYPE_STRING, "scte-20", NULL);
+ break;
+ case GST_VIDEO_CAPTION_TYPE_CEA608_ADDITIONAL_CEA_608:
+ caption_caps = gst_caps_new_simple ("closedcaption/x-cea-608",
+ "format", G_TYPE_STRING, "additional-cea-608", NULL);
+ break;
case GST_VIDEO_CAPTION_TYPE_CEA708_RAW:
caption_caps = gst_caps_new_simple ("closedcaption/x-cea-708",
"format", G_TYPE_STRING, "cc_data", NULL);
Index: gst-plugins-base-1.24.5/gst-libs/gst/video/video-anc.h
===================================================================
--- gst-plugins-base-1.24.5.orig/gst-libs/gst/video/video-anc.h
+++ gst-plugins-base-1.24.5/gst-libs/gst/video/video-anc.h
@@ -490,7 +490,53 @@ GstVideoBarMeta *gst_buffer_add_video_ba
* offset relative to the base-line of the original image format (line 9
* for 525-line field 1, line 272 for 525-line field 2, line 5 for
* 625-line field 1 and line 318 for 625-line field 2).
- * @GST_VIDEO_CAPTION_TYPE_CEA708_RAW: CEA-708 as cc_data byte triplets. They
+ * @GST_VIDEO_CAPTION_TYPE_CEA608_SCTE_20: CEA 608 closed caption data as defined in
+ * ANSI/SCTE 20
+ * https://www.scte.org/documents/pdf/standards/SCTE%2020%202012.pdf
+ * Section 5.5
+ * This format is used for the carriage of CEA 608 closed caption data
+ * originating in Vertical Blanking Interval (VBI) service, and transported
+ * in MPEG-2 compliant bitstreams.
+ * The first byte must equal 1000 0001 to indicate valid data.
+ * The next five bits specify the number of CEA 608 closed caption triplets,
+ * followed by the sequence of triplets, laid out as follows for each triplet:
+ * cc priority : 2 bits
+ * field number: 2 bits
+ * line offset: 5 bits
+ * cc data 1: 8 bits
+ * cc data 2: 8 bits
+ * Notes:
+ * cc_priority is a number between 0 and 3 indicating the priority of constructs
+ * in picture reconstruction where different levels of hardware capability exist
+ * field number specifies the number of the field, in display order, from which
+ * the VBI data originated, specified as follows:
+ * 00 Forbidden
+ * 01 1st display field
+ * 10 2nd display field
+ * 11 3rd display field (the repeated field in film mode).
+ * line offset is a five-bit integer giving the offset in lines from which
+ * the VBI data originated, relative to the base VBI frame line
+ * (line 10 of NTSC field 1, line 273 of NTSC field 2, line 6 of PAL field 1,
+ * and line 319 of PAL field 2).
+ * @GST_VIDEO_CAPTION_TYPE_CEA608_ADDITIONAL_CEA_608: CEA-608 byte triplets as defined
+ * in ANSI/SCTE 21
+ * 6.4 Additional CEA-608 Data
+ * https://www.scte.org/documents/pdf/Standards/ANSI_SCTE%2021%202012.pdf.
+ * This format, also known as telecine, is used for the carriage of CEA 608
+ * closed caption data originating in Vertical Blanking Interval (VBI) service,
+ * and transported over cable digital transport streams.
+ * The second and third byte of the byte triplet
+ * is the raw CEA608 data, the first byte is a bitfield: The top/7th bit must
+ * equal 1 to indicate a valid triplet. Bits 6-2 represent the
+ * line offset relative to the base-line of the original image format (line 9
+ * for 525-line field 1, line 272 for 525-line field 2, line 5 for
+ * 625-line field 1 and line 318 for 625-line field 2).
+ * Bits 1-0 represent the field number, as follows:
+ * 00 Forbidden
+ * 01 1st display field
+ * 10 2nd display field
+ * 11 3rd display field (the repeated field in film mode).
+ * @GST_VIDEO_CAPTION_TYPE_CEA708_RAW: CEA-708 as cc_data byte triplets. They
* can also contain 608-in-708 and the first byte of each triplet has to
* be inspected for detecting the type.
* @GST_VIDEO_CAPTION_TYPE_CEA708_CDP: CEA-708 (and optionally CEA-608) in
@@ -506,7 +552,9 @@ typedef enum {
GST_VIDEO_CAPTION_TYPE_CEA608_RAW = 1,
GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A = 2,
GST_VIDEO_CAPTION_TYPE_CEA708_RAW = 3,
- GST_VIDEO_CAPTION_TYPE_CEA708_CDP = 4
+ GST_VIDEO_CAPTION_TYPE_CEA708_CDP = 4,
+ GST_VIDEO_CAPTION_TYPE_CEA608_SCTE_20 = 5,
+ GST_VIDEO_CAPTION_TYPE_CEA608_ADDITIONAL_CEA_608 = 6
} GstVideoCaptionType;
GST_VIDEO_API