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' { if c == '\r' {
continue; continue;
} }
@ -723,12 +725,14 @@ impl TtToCea608 {
if col > 31 { if col > 31 {
match state.mode { match state.mode {
Cea608Mode::PaintOn | Cea608Mode::PopOn => { Cea608Mode::PaintOn | Cea608Mode::PopOn => {
gst_warning!( if chars.peek().is_some() {
CAT, gst_warning!(
obj: element, CAT,
"Dropping characters after 32nd column: {}", obj: element,
c "Dropping characters after 32nd column: {}",
); c
);
}
break; break;
} }
Cea608Mode::RollUp2 | Cea608Mode::RollUp3 | Cea608Mode::RollUp4 => { Cea608Mode::RollUp2 | Cea608Mode::RollUp3 | Cea608Mode::RollUp4 => {