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
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-11-02 22:03:52 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-11-10 18:47:41 +0300
commit4e05fc59998a90d60c7a79a4f42c5f6e0d00456a (patch)
tree78635e088dba80d2a1f92c097fd5580c47b611b8
parenteff3618ebdc3ee33af11674e2aa944164025d21e (diff)
sccparse: Fix leading spaces between the tab and caption data
CCExtractor is creating files like this. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1387>
-rw-r--r--video/closedcaption/src/scc_parse/parser.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/video/closedcaption/src/scc_parse/parser.rs b/video/closedcaption/src/scc_parse/parser.rs
index 603112d79..2de04052b 100644
--- a/video/closedcaption/src/scc_parse/parser.rs
+++ b/video/closedcaption/src/scc_parse/parser.rs
@@ -111,6 +111,7 @@ fn scc_payload(s: &[u8]) -> IResult<&[u8], Vec<u8>> {
/// Parser for a SCC caption line in the form `timecode\tpayload`.
fn caption(s: &[u8]) -> IResult<&[u8], SccLine> {
use nom::bytes::complete::tag;
+ use nom::character::complete::multispace0;
use nom::combinator::map;
use nom::error::context;
use nom::sequence::tuple;
@@ -118,8 +119,8 @@ fn caption(s: &[u8]) -> IResult<&[u8], SccLine> {
context(
"invalid SCC caption line",
map(
- tuple((timecode, tag("\t"), scc_payload, end_of_line)),
- |(tc, _, value, _)| SccLine::Caption(tc, value),
+ tuple((timecode, tag("\t"), multispace0, scc_payload, end_of_line)),
+ |(tc, _, _, value, _)| SccLine::Caption(tc, value),
),
)(s)
}