cea708overlay: support multiple service blocks in the same dtvcc packet

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4137>
This commit is contained in:
Matthew Waters 2023-03-09 18:03:42 +11:00 committed by GStreamer Marge Bot
parent b8730bc98e
commit df939fe332

View file

@ -227,6 +227,7 @@ gst_cea708dec_process_dtvcc_packet (Cea708Dec * decoder, guint8 * dtvcc_buffer,
parse_index += 1; parse_index += 1;
while (parse_index < dtvcc_size) {
block_size = dtvcc_buffer[parse_index] & 0x1F; block_size = dtvcc_buffer[parse_index] & 0x1F;
service_number = (dtvcc_buffer[parse_index] & 0xE0) >> 5; service_number = (dtvcc_buffer[parse_index] & 0xE0) >> 5;
parse_index += 1; parse_index += 1;
@ -241,14 +242,14 @@ gst_cea708dec_process_dtvcc_packet (Cea708Dec * decoder, guint8 * dtvcc_buffer,
" size=%d seq=%d block_size=%d service_num=%d", dtvcc_size, pkt_size, " size=%d seq=%d block_size=%d service_num=%d", dtvcc_size, pkt_size,
sequence_number, block_size, service_number); sequence_number, block_size, service_number);
/* Process desired_service cc data */ /* Process desired_service cc data */
if (decoder->desired_service == service_number) { if (decoder->desired_service == service_number) {
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
/* The Dtvcc buffer contains a stream of commands, command parameters, /* The Dtvcc buffer contains a stream of commands, command parameters,
* and characters which are the actual captions. Process commands and * and characters which are the actual captions. Process commands and
* store captions in simulated 708 windows: */ * store captions in simulated 708 windows: */
gst_cea708dec_process_dtvcc_byte (decoder, dtvcc_buffer, parse_index + i); gst_cea708dec_process_dtvcc_byte (decoder, dtvcc_buffer,
parse_index + i);
} }
for (window_id = 0; window_id < 8; window_id++) { for (window_id = 0; window_id < 8; window_id++) {
@ -262,6 +263,9 @@ gst_cea708dec_process_dtvcc_packet (Cea708Dec * decoder, guint8 * dtvcc_buffer,
} }
} }
parse_index += block_size;
}
return need_render; return need_render;
} }