Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: Source/core/html/track/VideoTrack.cpp

Issue 284513003: Implement AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nits Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/track/VideoTrack.h ('k') | Source/core/html/track/VideoTrack.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/VideoTrack.cpp
diff --git a/Source/core/html/track/VideoTrack.cpp b/Source/core/html/track/VideoTrack.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5a93e6ed0f75113fc94553243b4662ed5897e4c7
--- /dev/null
+++ b/Source/core/html/track/VideoTrack.cpp
@@ -0,0 +1,88 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/html/track/VideoTrack.h"
+
+#include "core/html/HTMLMediaElement.h"
+
+namespace WebCore {
+
+VideoTrack::VideoTrack(const String& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language, bool selected)
+ : TrackBase(TrackBase::VideoTrack, label, language, id)
+ , m_selected(selected)
+{
+ ScriptWrappable::init(this);
+ setKind(kind);
+}
+
+VideoTrack::~VideoTrack()
+{
+}
+
+void VideoTrack::setSelected(bool selected)
+{
+ if (selected == m_selected)
+ return;
+
+ m_selected = selected;
+
+ if (mediaElement()) {
+ blink::WebMediaPlayer::TrackId selectedTrackId = trackId();
+ mediaElement()->selectedVideoTrackChanged(selected ? &selectedTrackId : 0);
+ }
+}
+
+const AtomicString& VideoTrack::alternativeKeyword()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicString::ConstructFromLiteral));
+ return keyword;
+}
+
+const AtomicString& VideoTrack::captionsKeyword()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString::ConstructFromLiteral));
+ return keyword;
+}
+
+const AtomicString& VideoTrack::mainKeyword()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::ConstructFromLiteral));
+ return keyword;
+}
+
+const AtomicString& VideoTrack::signKeyword()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::ConstructFromLiteral));
+ return keyword;
+}
+
+const AtomicString& VideoTrack::subtitlesKeyword()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString::ConstructFromLiteral));
+ return keyword;
+}
+
+const AtomicString& VideoTrack::commentaryKeyword()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString::ConstructFromLiteral));
+ return keyword;
+}
+
+bool VideoTrack::isValidKind(const AtomicString& kind) const
+{
+ return (kind == alternativeKeyword())
+ || (kind == captionsKeyword())
+ || (kind == mainKeyword())
+ || (kind == signKeyword())
+ || (kind == subtitlesKeyword())
+ || (kind == commentaryKeyword());
+}
+
+AtomicString VideoTrack::defaultKind() const
+{
+ return emptyAtom;
+}
+
+}
« no previous file with comments | « Source/core/html/track/VideoTrack.h ('k') | Source/core/html/track/VideoTrack.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698