summaryrefslogtreecommitdiffstats
path: root/dom/media/webm
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-05-07 13:40:21 +0200
committerMoonchild <moonchild@palemoon.org>2020-05-20 13:47:02 +0000
commit6b7997abbe7acb25d77266633db03680f80cb8eb (patch)
tree1c017f8dbada0b103281510abcdb4384a2770ba7 /dom/media/webm
parentf358c4dfa98a079816afe53f0449d5f1ce93244c (diff)
downloadUXP-6b7997abbe7acb25d77266633db03680f80cb8eb.tar
UXP-6b7997abbe7acb25d77266633db03680f80cb8eb.tar.gz
UXP-6b7997abbe7acb25d77266633db03680f80cb8eb.tar.lz
UXP-6b7997abbe7acb25d77266633db03680f80cb8eb.tar.xz
UXP-6b7997abbe7acb25d77266633db03680f80cb8eb.zip
Issue #1536 - Part 2: Parse content to decide whether it's a media segment.
Diffstat (limited to 'dom/media/webm')
-rw-r--r--dom/media/webm/WebMBufferedParser.cpp6
-rw-r--r--dom/media/webm/WebMBufferedParser.h13
2 files changed, 17 insertions, 2 deletions
diff --git a/dom/media/webm/WebMBufferedParser.cpp b/dom/media/webm/WebMBufferedParser.cpp
index 0f6b0cd54..979308cf0 100644
--- a/dom/media/webm/WebMBufferedParser.cpp
+++ b/dom/media/webm/WebMBufferedParser.cpp
@@ -275,6 +275,12 @@ WebMBufferedParser::EndSegmentOffset(int64_t aOffset)
return mBlockEndOffset;
}
+int64_t
+WebMBufferedParser::GetClusterOffset() const
+{
+ return mClusterOffset;
+}
+
// SyncOffsetComparator and TimeComparator are slightly confusing, in that
// the nsTArray they're used with (mTimeMapping) is sorted by mEndOffset and
// these comparators are used on the other fields of WebMTimeDataOffset.
diff --git a/dom/media/webm/WebMBufferedParser.h b/dom/media/webm/WebMBufferedParser.h
index 858653fc1..4245561fc 100644
--- a/dom/media/webm/WebMBufferedParser.h
+++ b/dom/media/webm/WebMBufferedParser.h
@@ -67,7 +67,7 @@ struct WebMBufferedParser
, mVIntLeft(0)
, mBlockSize(0)
, mClusterTimecode(0)
- , mClusterOffset(0)
+ , mClusterOffset(-1)
, mClusterEndOffset(-1)
, mBlockOffset(0)
, mBlockTimecode(0)
@@ -87,6 +87,12 @@ struct WebMBufferedParser
return mTimecodeScale;
}
+ // Use this function when we would only feed media segment for the parser.
+ void AppendMediaSegmentOnly()
+ {
+ mGotTimecodeScale = true;
+ }
+
// If this parser is not expected to parse a segment info, it must be told
// the appropriate timecode scale to use from elsewhere.
void SetTimecodeScale(uint32_t aTimecodeScale) {
@@ -115,6 +121,9 @@ struct WebMBufferedParser
// This allows to determine the end of the interval containg aOffset.
int64_t EndSegmentOffset(int64_t aOffset);
+ // Return the Cluster offset, return -1 if we can't find the Cluster.
+ int64_t GetClusterOffset() const;
+
// The offset at which this parser started parsing. Used to merge
// adjacent parsers, in which case the later parser adopts the earlier
// parser's mStartOffset.
@@ -232,7 +241,7 @@ private:
// Start offset of the cluster currently being parsed. Used as the sync
// point offset for the offset-to-time mapping as each block timecode is
- // been parsed.
+ // been parsed. -1 if unknown.
int64_t mClusterOffset;
// End offset of the cluster currently being parsed. -1 if unknown.