mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
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>
This commit is contained in:
parent
16b917abb1
commit
a33f29365a
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue