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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/track/VideoTrack.h ('k') | Source/core/html/track/VideoTrack.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(const String& id, const AtomicString& kind, const AtomicS tring& label, const AtomicString& language, bool selected)
13 : TrackBase(TrackBase::VideoTrack, label, language, id)
14 , m_selected(selected)
15 {
16 ScriptWrappable::init(this);
17 setKind(kind);
18 }
19
20 VideoTrack::~VideoTrack()
21 {
22 }
23
24 void VideoTrack::setSelected(bool selected)
25 {
26 if (selected == m_selected)
27 return;
28
29 m_selected = selected;
30
31 if (mediaElement()) {
32 blink::WebMediaPlayer::TrackId selectedTrackId = trackId();
33 mediaElement()->selectedVideoTrackChanged(selected ? &selectedTrackId : 0);
34 }
35 }
36
37 const AtomicString& VideoTrack::alternativeKeyword()
38 {
39 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicStrin g::ConstructFromLiteral));
40 return keyword;
41 }
42
43 const AtomicString& VideoTrack::captionsKeyword()
44 {
45 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString:: ConstructFromLiteral));
46 return keyword;
47 }
48
49 const AtomicString& VideoTrack::mainKeyword()
50 {
51 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::Cons tructFromLiteral));
52 return keyword;
53 }
54
55 const AtomicString& VideoTrack::signKeyword()
56 {
57 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::Cons tructFromLiteral));
58 return keyword;
59 }
60
61 const AtomicString& VideoTrack::subtitlesKeyword()
62 {
63 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString: :ConstructFromLiteral));
64 return keyword;
65 }
66
67 const AtomicString& VideoTrack::commentaryKeyword()
68 {
69 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString ::ConstructFromLiteral));
70 return keyword;
71 }
72
73 bool VideoTrack::isValidKind(const AtomicString& kind) const
74 {
75 return (kind == alternativeKeyword())
76 || (kind == captionsKeyword())
77 || (kind == mainKeyword())
78 || (kind == signKeyword())
79 || (kind == subtitlesKeyword())
80 || (kind == commentaryKeyword());
81 }
82
83 AtomicString VideoTrack::defaultKind() const
84 {
85 return emptyAtom;
86 }
87
88 }
OLDNEW
« 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