summaryrefslogtreecommitdiffstats
path: root/dom/media/SeekTarget.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/SeekTarget.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/SeekTarget.h')
-rw-r--r--dom/media/SeekTarget.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/dom/media/SeekTarget.h b/dom/media/SeekTarget.h
new file mode 100644
index 000000000..cb5cfd630
--- /dev/null
+++ b/dom/media/SeekTarget.h
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef SEEK_TARGET_H
+#define SEEK_TARGET_H
+
+#include "TimeUnits.h"
+
+namespace mozilla {
+
+enum class MediaDecoderEventVisibility : int8_t {
+ Observable,
+ Suppressed
+};
+
+// Stores the seek target; the time to seek to, and whether an Accurate,
+// "Fast" (nearest keyframe), or "Video Only" (no audio seek) seek was
+// requested.
+struct SeekTarget {
+ enum Type {
+ Invalid,
+ PrevSyncPoint,
+ Accurate,
+ NextFrame,
+ };
+ SeekTarget()
+ : mTime(media::TimeUnit::Invalid())
+ , mType(SeekTarget::Invalid)
+ , mVideoOnly(false)
+ {
+ }
+ SeekTarget(int64_t aTimeUsecs,
+ Type aType,
+ bool aVideoOnly = false)
+ : mTime(media::TimeUnit::FromMicroseconds(aTimeUsecs))
+ , mType(aType)
+ , mVideoOnly(aVideoOnly)
+ {
+ }
+ SeekTarget(const media::TimeUnit& aTime,
+ Type aType,
+ bool aVideoOnly = false)
+ : mTime(aTime)
+ , mType(aType)
+ , mVideoOnly(aVideoOnly)
+ {
+ }
+ SeekTarget(const SeekTarget& aOther)
+ : mTime(aOther.mTime)
+ , mType(aOther.mType)
+ , mVideoOnly(aOther.mVideoOnly)
+ {
+ }
+ bool IsValid() const {
+ return mType != SeekTarget::Invalid;
+ }
+ void Reset() {
+ mTime = media::TimeUnit::Invalid();
+ mType = SeekTarget::Invalid;
+ mVideoOnly = false;
+ }
+ media::TimeUnit GetTime() const {
+ NS_ASSERTION(mTime.IsValid(), "Invalid SeekTarget");
+ return mTime;
+ }
+ void SetTime(const media::TimeUnit& aTime) {
+ NS_ASSERTION(aTime.IsValid(), "Invalid SeekTarget destination");
+ mTime = aTime;
+ }
+ void SetType(Type aType) {
+ mType = aType;
+ }
+ void SetVideoOnly(bool aVideoOnly) {
+ mVideoOnly = aVideoOnly;
+ }
+ bool IsFast() const {
+ return mType == SeekTarget::Type::PrevSyncPoint;
+ }
+ bool IsAccurate() const {
+ return mType == SeekTarget::Type::Accurate;
+ }
+ bool IsNextFrame() const {
+ return mType == SeekTarget::Type::NextFrame;
+ }
+ bool IsVideoOnly() const {
+ return mVideoOnly;
+ }
+
+private:
+ // Seek target time.
+ media::TimeUnit mTime;
+ // Whether we should seek "Fast", or "Accurate".
+ // "Fast" seeks to the seek point preceding mTime, whereas
+ // "Accurate" seeks as close as possible to mTime.
+ Type mType;
+ bool mVideoOnly;
+};
+
+} // namespace mozilla
+
+#endif /* SEEK_TARGET_H */