From d8c8737e714ffb64b1393ad18400bea8f9f7fac7 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Sat, 8 Jan 2022 00:16:29 +0100 Subject: [PATCH] cccombiner: fix s334-1a scheduling The previous code was mistakenly trying to compute a cc_type out of the first byte in the byte triplet, whereas it is to be interpreted as: > Bit b7 of the LINE value is the field number (0 for field 2; 1 for field 1). > Bits b6 and b5 are 0. Bits b4-b0 form a 5-bit unsigned integer which > represents the offset The same mistake was made when creating padding packets. Part-of: --- .../gst-plugins-bad/ext/closedcaption/gstcccombiner.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/closedcaption/gstcccombiner.c b/subprojects/gst-plugins-bad/ext/closedcaption/gstcccombiner.c index ce88727504..3a1dc62511 100644 --- a/subprojects/gst-plugins-bad/ext/closedcaption/gstcccombiner.c +++ b/subprojects/gst-plugins-bad/ext/closedcaption/gstcccombiner.c @@ -359,7 +359,7 @@ make_padding (GstCCCombiner * self, const GstVideoTimeCode * tc, guint field) gst_buffer_map (ret, &map, GST_MAP_WRITE); - map.data[0] = 0x80 | (field == 0 ? 0x01 : 0x00); + map.data[0] = field == 0 ? 0x80 : 0x00; map.data[1] = 0x80; map.data[2] = 0x80; @@ -493,9 +493,7 @@ schedule_cea608_s334_1a (GstCCCombiner * self, guint8 * data, guint len, } for (i = 0; i < len / 3; i++) { - guint8 cc_type = data[i * 3] & 0x03; - - if (cc_type == 0x01) { + if (data[i * 3] & 0x80) { if (field0_608) continue; @@ -507,7 +505,7 @@ schedule_cea608_s334_1a (GstCCCombiner * self, guint8 * data, guint len, field0_data[field0_len++] = data[i * 3]; field0_data[field0_len++] = data[i * 3 + 1]; field0_data[field0_len++] = data[i * 3 + 2]; - } else if (cc_type == 0x00) { + } else { if (field1_608) continue; @@ -519,8 +517,6 @@ schedule_cea608_s334_1a (GstCCCombiner * self, guint8 * data, guint len, field1_data[field1_len++] = data[i * 3]; field1_data[field1_len++] = data[i * 3 + 1]; field1_data[field1_len++] = data[i * 3 + 2]; - } else { - break; } }