mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 05:21:00 +00:00
tttojson: fix row computation
I hadn't really tested the element with pop-on mode, and the row for each line in the input text was hardcoded to 13, which was clearly wrong. Switch to incrementing it properly.
This commit is contained in:
parent
e3fbf2078d
commit
b738d5933d
1 changed files with 6 additions and 1 deletions
|
@ -22,6 +22,7 @@ use gst::subclass::prelude::*;
|
|||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::cmp::min;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::ttutils::{Cea608Mode, Chunk, Line, Lines, TextStyle};
|
||||
|
@ -91,11 +92,13 @@ impl TtToJson {
|
|||
clear: Some(false),
|
||||
};
|
||||
|
||||
let mut row = min(15usize.saturating_sub(text.lines().count()), 13usize) as u32;
|
||||
|
||||
for phrase in text.lines() {
|
||||
lines.lines.push(Line {
|
||||
carriage_return: Some(true),
|
||||
column: Some(0),
|
||||
row: Some(13),
|
||||
row: Some(row),
|
||||
chunks: vec![Chunk {
|
||||
// Default CEA 608 styling
|
||||
style: TextStyle::White,
|
||||
|
@ -103,6 +106,8 @@ impl TtToJson {
|
|||
text: phrase.to_string(),
|
||||
}],
|
||||
});
|
||||
|
||||
row = min(14u32, row + 1);
|
||||
}
|
||||
|
||||
let json = serde_json::to_string(&lines).map_err(|err| {
|
||||
|
|
Loading…
Reference in a new issue