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.
6 #include "core/html/track/AudioTrack.h"
8 #include "core/html/HTMLMediaElement.h"
12 AudioTrack::AudioTrack(const String& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language, bool enabled)
13 : TrackBase(TrackBase::AudioTrack, label, language, id)
16 ScriptWrappable::init(this);
20 AudioTrack::~AudioTrack()
24 void AudioTrack::setEnabled(bool enabled)
26 if (enabled == m_enabled)
32 mediaElement()->audioTrackChanged();
35 const AtomicString& AudioTrack::alternativeKeyword()
37 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicString::ConstructFromLiteral));
41 const AtomicString& AudioTrack::descriptionsKeyword()
43 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("descriptions", AtomicString::ConstructFromLiteral));
47 const AtomicString& AudioTrack::mainKeyword()
49 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::ConstructFromLiteral));
53 const AtomicString& AudioTrack::mainDescriptionsKeyword()
55 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main-desc", AtomicString::ConstructFromLiteral));
59 const AtomicString& AudioTrack::translationKeyword()
61 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("translation", AtomicString::ConstructFromLiteral));
65 const AtomicString& AudioTrack::commentaryKeyword()
67 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString::ConstructFromLiteral));
71 bool AudioTrack::isValidKind(const AtomicString& kind) const
73 return (kind == alternativeKeyword())
74 || (kind == descriptionsKeyword())
75 || (kind == mainKeyword())
76 || (kind == mainDescriptionsKeyword())
77 || (kind == translationKeyword())
78 || (kind == commentaryKeyword());
81 AtomicString AudioTrack::defaultKind() const