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:
authorSebastian Dröge <sebastian@centricular.com>2020-05-13 10:10:45 +0300
committerSebastian Dröge <sebastian@centricular.com>2020-05-13 10:10:45 +0300
commit36bcd5430682048501898431787db8246114364d (patch)
tree7e16dd33f8132b742c019fcd95e24e81bcbf044d /video
parenta4a0a669bdc49f26654500d5deb17c883b92b7fa (diff)
closedcaption/{scc,mcc}parse: Allow an optional UTF-8 BOM at the beginning
Some software is apparently writing an UTF-8 BOM at the beinning of the file.
Diffstat (limited to 'video')
-rw-r--r--video/closedcaption/src/mcc_parser.rs1
-rw-r--r--video/closedcaption/src/scc_parser.rs6
2 files changed, 6 insertions, 1 deletions
diff --git a/video/closedcaption/src/mcc_parser.rs b/video/closedcaption/src/mcc_parser.rs
index 70e221ee5..c2ec97069 100644
--- a/video/closedcaption/src/mcc_parser.rs
+++ b/video/closedcaption/src/mcc_parser.rs
@@ -129,6 +129,7 @@ where
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
(
+ optional(range(&[0xEFu8, 0xBBu8, 0xBFu8][..])),
range(b"File Format=MacCaption_MCC V".as_ref()),
choice!(range(b"1.0".as_ref()), range(b"2.0".as_ref())),
end_of_line(),
diff --git a/video/closedcaption/src/scc_parser.rs b/video/closedcaption/src/scc_parser.rs
index 440b8df25..bd02f3e94 100644
--- a/video/closedcaption/src/scc_parser.rs
+++ b/video/closedcaption/src/scc_parser.rs
@@ -120,7 +120,11 @@ where
I: RangeStream<Token = u8, Range = &'a [u8]>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
- (range(b"Scenarist_SCC V1.0".as_ref()), end_of_line())
+ (
+ optional(range(&[0xEFu8, 0xBBu8, 0xBFu8][..])),
+ range(b"Scenarist_SCC V1.0".as_ref()),
+ end_of_line(),
+ )
.map(|_| SccLine::Header)
.message("while parsing header")
}