diff --git a/ext/closedcaption/gstccconverter.c b/ext/closedcaption/gstccconverter.c index 0f973f3041..7ecb89a268 100644 --- a/ext/closedcaption/gstccconverter.c +++ b/ext/closedcaption/gstccconverter.c @@ -533,8 +533,11 @@ convert_cea708_cc_data_cea708_cdp_internal (GstCCConverter * self, gst_byte_writer_put_uint8_unchecked (&bw, 0x72); gst_byte_writer_put_uint8_unchecked (&bw, 0xe0 | cc_count); gst_byte_writer_put_data_unchecked (&bw, cc_data, cc_data_len); - if (cc_count > cc_data_len / 3) { - gst_byte_writer_fill (&bw, 0, 3 * cc_count - cc_data_len); + while (cc_count > cc_data_len / 3) { + gst_byte_writer_put_uint8_unchecked (&bw, 0xf8); + gst_byte_writer_put_uint8_unchecked (&bw, 0x00); + gst_byte_writer_put_uint8_unchecked (&bw, 0x00); + cc_data_len += 3; } gst_byte_writer_put_uint8_unchecked (&bw, 0x74); diff --git a/tests/check/elements/ccconverter.c b/tests/check/elements/ccconverter.c index cbc84b110e..3eb9c69e43 100644 --- a/tests/check/elements/ccconverter.c +++ b/tests/check/elements/ccconverter.c @@ -195,9 +195,9 @@ GST_START_TEST (convert_cea608_raw_cea708_cdp) const guint8 in[] = { 0x80, 0x80 }; const guint8 out[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x38 + 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x80 }; check_conversion (in, sizeof (in), out, sizeof (out), "closedcaption/x-cea-608,format=(string)raw,framerate=(fraction)60/1", @@ -247,9 +247,9 @@ GST_START_TEST (convert_cea608_s334_1a_cea708_cdp) const guint8 in[] = { 0x80, 0x80, 0x80, 0x00, 0x80, 0x80 }; const guint8 out[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80, - 0xfd, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x3b + 0xfd, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7b }; check_conversion (in, sizeof (in), out, sizeof (out), "closedcaption/x-cea-608,format=(string)s334-1a,framerate=(fraction)60/1", @@ -285,9 +285,9 @@ GST_START_TEST (convert_cea708_cc_data_cea708_cdp) const guint8 in[] = { 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80 }; const guint8 out[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80, - 0xfe, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x3a + 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a }; check_conversion (in, sizeof (in), out, sizeof (out), "closedcaption/x-cea-708,format=(string)cc_data,framerate=(fraction)60/1",