tttocea608: only warn when we do drop characters

In roll-up mode, we drop out of the loop and warn when the 32nd
character is reached, the warning is unnecessary when there were
no characters left to loop on.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/499>
This commit is contained in:
Mathieu Duponchelle 2021-04-16 21:14:43 +02:00
parent b92360db37
commit 61214b5788

View file

@ -676,7 +676,9 @@ impl TtToCea608 {
}
};
for c in text.chars() {
let mut chars = text.chars().peekable();
while let Some(c) = chars.next() {
if c == '\r' {
continue;
}
@ -723,12 +725,14 @@ impl TtToCea608 {
if col > 31 {
match state.mode {
Cea608Mode::PaintOn | Cea608Mode::PopOn => {
if chars.peek().is_some() {
gst_warning!(
CAT,
obj: element,
"Dropping characters after 32nd column: {}",
c
);
}
break;
}
Cea608Mode::RollUp2 | Cea608Mode::RollUp3 | Cea608Mode::RollUp4 => {