diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-11-02 22:03:52 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-11-02 22:59:02 +0300 |
commit | a33f29365a964c03ae1aba1a480e808e1e05d2f3 (patch) | |
tree | 25b0142c85f16cadc90668d964e9dbfc31db9724 /video | |
parent | 16b917abb10d92096070392e3765affadc5cde29 (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/1378>
Diffstat (limited to 'video')
-rw-r--r-- | video/closedcaption/src/scc_parse/parser.rs | 5 |
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 cc0acba94..245158203 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) } |