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

Side by Side Diff: Source/core/html/track/VideoTrack.cpp

Issue 170233009: Initial implementation of AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master
Patch Set: Addressed IDL comments. Created 6 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/html/track/VideoTrack.h"
7
8 #include "core/html/HTMLMediaElement.h"
9
10 namespace WebCore {
11
12 VideoTrack::VideoTrack(HTMLMediaElement* mediaElement, const String& id, const A tomicString& kind, const AtomicString& label, const AtomicString& language)
13 : TrackBase(TrackBase::VideoTrack, label, language, id)
14 , m_selected(false)
15 {
16 ASSERT(mediaElement);
17 ASSERT(!id.isEmpty());
18
19 ScriptWrappable::init(this);
20 setKind(kind);
21 setMediaElement(mediaElement);
22 }
23
24 VideoTrack::~VideoTrack()
25 {
26 }
27
28 void VideoTrack::setSelected(bool selected)
29 {
30 if (selected == m_selected)
31 return;
32
33 m_selected = selected;
34 if (mediaElement())
35 mediaElement()->selectedVideoTrackChanged(m_selected ? id() : emptyAtom) ;
36 }
37
38 const AtomicString& VideoTrack::alternativeKeyword()
39 {
40 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicStrin g::ConstructFromLiteral));
41 return keyword;
42 }
43
44 const AtomicString& VideoTrack::captionsKeyword()
45 {
46 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString:: ConstructFromLiteral));
47 return keyword;
48 }
49
50 const AtomicString& VideoTrack::mainKeyword()
51 {
52 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::Cons tructFromLiteral));
53 return keyword;
54 }
55
56 const AtomicString& VideoTrack::signKeyword()
57 {
58 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::Cons tructFromLiteral));
59 return keyword;
60 }
61
62 const AtomicString& VideoTrack::subtitlesKeyword()
63 {
64 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString: :ConstructFromLiteral));
65 return keyword;
66 }
67
68 const AtomicString& VideoTrack::commentaryKeyword()
69 {
70 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString ::ConstructFromLiteral));
71 return keyword;
72 }
73
74 bool VideoTrack::isValidKind(const AtomicString& kind) const
75 {
76 return (kind == alternativeKeyword())
77 || (kind == captionsKeyword())
78 || (kind == mainKeyword())
79 || (kind == signKeyword())
80 || (kind == subtitlesKeyword())
81 || (kind == commentaryKeyword());
82 }
83
84 AtomicString VideoTrack::defaultKind() const
85 {
86 return emptyAtom;
87 }
88
89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698