tttocea608: fix disappearing text after special character in non-popon

To avoid special characters getting de-duplicated by the decoder, we
insert no-op control commands after those. The no-op command must be
picked according to the mode we're in however, inserting
"resume_caption_loading" commands in roll-up mode caused obvious issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1147>
This commit is contained in:
Mathieu Duponchelle 2023-03-24 17:29:04 +01:00
parent 82ccba4267
commit 93f61483b5

View file

@ -661,7 +661,16 @@ impl TtToCea608 {
}
if is_specialna(cc_data) {
state.resume_caption_loading(self, mut_list);
// adapted from libcaption's generation code:
// specialna are treated as control charcters. Duplicated control charcters are discarded
// So we write a resume after a specialna as a noop control command to break repetition detection
match state.mode {
Cea608Mode::RollUp2 => state.roll_up_2(self, mut_list),
Cea608Mode::RollUp3 => state.roll_up_3(self, mut_list),
Cea608Mode::RollUp4 => state.roll_up_4(self, mut_list),
Cea608Mode::PopOn => state.resume_caption_loading(self, mut_list),
Cea608Mode::PaintOn => state.resume_direct_captioning(self, mut_list),
}
}
col += 1;