summaryrefslogtreecommitdiff
path: root/subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2023-05-05 15:17:16 +1000
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-05-10 00:52:01 +0000
commit21b232ce3056bfd449e1757e856dbd5262ce2ed4 (patch)
treee3992d6b9d5fe714c6bd9a8ffd3ecca1cfc4bbe2 /subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
parent4e8af5c41d65cfed2c39b38da70daa0da0dc7a83 (diff)
downloadgstreamer-21b232ce3056bfd449e1757e856dbd5262ce2ed4.tar.gz
closedcaption: write 0x00 padding instead of 0x80 in cc_data/cdp
Depending on the exact output format, 0x00 may be a better default for padding than 0x80. 0x00 is the recommended padding value when used in CDP (and cc_data) but is not when used in s334-1a. See CTA-708-E 4.3.5 amd SMPTE 334-1-2007 5.3.2. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4578>
Diffstat (limited to 'subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c')
-rw-r--r--subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c b/subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
index 455a93e48e..84f73632c1 100644
--- a/subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
+++ b/subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
@@ -859,12 +859,13 @@ cc_buffer_take_separated (CCBuffer * buf,
void
cc_buffer_take_cc_data (CCBuffer * buf,
- const struct cdp_fps_entry *fps_entry, guint8 * cc_data,
- guint * cc_data_len)
+ const struct cdp_fps_entry *fps_entry, gboolean nul_padding,
+ guint8 * cc_data, guint * cc_data_len)
{
guint write_cea608_1_size, write_cea608_2_size, write_ccp_size;
guint field1_padding, field2_padding;
gboolean wrote_first;
+ guint8 padding_byte = nul_padding ? 0x00 : 0x80;
cc_buffer_get_out_sizes (buf, fps_entry, &write_cea608_1_size,
&field1_padding, &write_cea608_2_size, &field2_padding, &write_ccp_size);
@@ -897,11 +898,13 @@ cc_buffer_take_cc_data (CCBuffer * buf,
GST_TRACE_OBJECT (buf, "writing valid field1 padding because "
"we need to write valid field2");
cc_data[out_i++] = 0xfc;
+ cc_data[out_i++] = 0x80;
+ cc_data[out_i++] = 0x80;
} else {
cc_data[out_i++] = 0xf8;
+ cc_data[out_i++] = padding_byte;
+ cc_data[out_i++] = padding_byte;
}
- cc_data[out_i++] = 0x80;
- cc_data[out_i++] = 0x80;
cea608_1_i += 2;
buf->last_cea608_written_was_field1 = TRUE;
}
@@ -915,8 +918,8 @@ cc_buffer_take_cc_data (CCBuffer * buf,
buf->last_cea608_written_was_field1 = FALSE;
} else if (cea608_2_i < write_cea608_2_size + field2_padding) {
cc_data[out_i++] = 0xf9;
- cc_data[out_i++] = 0x80;
- cc_data[out_i++] = 0x80;
+ cc_data[out_i++] = padding_byte;
+ cc_data[out_i++] = padding_byte;
cea608_2_i += 2;
buf->last_cea608_written_was_field1 = FALSE;
}