Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2021-04-16 22:14:43 +0300
committerMathieu Duponchelle <mathieu@centricular.com>2021-04-16 22:16:46 +0300
commit61214b57881cd0f487f7536489c5001f8c9bcfee (patch)
tree32fd3ccb47f712308cddc0acdcfd29c3b54085c5 /video
parentb92360db374ae70e3b031b9e520722c41e401b40 (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.rs18
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 => {