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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1496>
This commit is contained in:
Mathieu Duponchelle 2022-01-08 00:16:29 +01:00 committed by GStreamer Marge Bot
parent 6861ea8fe1
commit d8c8737e71

View file

@ -359,7 +359,7 @@ make_padding (GstCCCombiner * self, const GstVideoTimeCode * tc, guint field)
gst_buffer_map (ret, &map, GST_MAP_WRITE); 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[1] = 0x80;
map.data[2] = 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++) { for (i = 0; i < len / 3; i++) {
guint8 cc_type = data[i * 3] & 0x03; if (data[i * 3] & 0x80) {
if (cc_type == 0x01) {
if (field0_608) if (field0_608)
continue; 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];
field0_data[field0_len++] = data[i * 3 + 1]; field0_data[field0_len++] = data[i * 3 + 1];
field0_data[field0_len++] = data[i * 3 + 2]; field0_data[field0_len++] = data[i * 3 + 2];
} else if (cc_type == 0x00) { } else {
if (field1_608) if (field1_608)
continue; 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];
field1_data[field1_len++] = data[i * 3 + 1]; field1_data[field1_len++] = data[i * 3 + 1];
field1_data[field1_len++] = data[i * 3 + 2]; field1_data[field1_len++] = data[i * 3 + 2];
} else {
break;
} }
} }