 Chromium Code Reviews
 Chromium Code Reviews Issue 170233009:
  Initial implementation of AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master
    
  
    Issue 170233009:
  Initial implementation of AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master| OLD | NEW | 
|---|---|
| (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/track/VideoTrackList.h" | |
| 9 | |
| 10 namespace WebCore { | |
| 11 | |
| 12 VideoTrack::VideoTrack(HTMLMediaElement* mediaElement, const AtomicString& id, c onst AtomicString& 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() : AtomicStri ng()); | |
| 
Inactive
2014/03/08 03:05:59
nullAtom
 
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Done.
 | |
| 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 | |
| 
Inactive
2014/03/08 03:05:59
const AtomicString& ?
 
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Requires changing base class. Will defer to anothe
 | |
| 85 { | |
| 86 return AtomicString(); | |
| 
Inactive
2014/03/08 03:05:59
nullAtom
 
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Done.
 | |
| 87 } | |
| 88 | |
| 89 } | |
| OLD | NEW |