diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2021-04-16 22:14:43 +0300 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2021-04-16 22:16:46 +0300 |
commit | 61214b57881cd0f487f7536489c5001f8c9bcfee (patch) | |
tree | 32fd3ccb47f712308cddc0acdcfd29c3b54085c5 /video | |
parent | b92360db374ae70e3b031b9e520722c41e401b40 (diff) |
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>
Diffstat (limited to 'video')
-rw-r--r-- | video/closedcaption/src/tttocea608/imp.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/video/closedcaption/src/tttocea608/imp.rs b/video/closedcaption/src/tttocea608/imp.rs index 8900e8d4a..698fb7266 100644 --- a/video/closedcaption/src/tttocea608/imp.rs +++ b/video/closedcaption/src/tttocea608/imp.rs @@ -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 => { - gst_warning!( - CAT, - obj: element, - "Dropping characters after 32nd column: {}", - c - ); + if chars.peek().is_some() { + gst_warning!( + CAT, + obj: element, + "Dropping characters after 32nd column: {}", + c + ); + } break; } Cea608Mode::RollUp2 | Cea608Mode::RollUp3 | Cea608Mode::RollUp4 => { |