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
)
19 AudioTrack::~AudioTrack()
23 DEFINE_TRACE(AudioTrack
)
25 TrackBase::trace(visitor
);
28 void AudioTrack::setEnabled(bool enabled
)
30 if (enabled
== m_enabled
)
36 mediaElement()->audioTrackChanged();
39 const AtomicString
& AudioTrack::alternativeKeyword()
41 DEFINE_STATIC_LOCAL(const AtomicString
, keyword
, ("alternative", AtomicString::ConstructFromLiteral
));
45 const AtomicString
& AudioTrack::descriptionsKeyword()
47 DEFINE_STATIC_LOCAL(const AtomicString
, keyword
, ("descriptions", AtomicString::ConstructFromLiteral
));
51 const AtomicString
& AudioTrack::mainKeyword()
53 DEFINE_STATIC_LOCAL(const AtomicString
, keyword
, ("main", AtomicString::ConstructFromLiteral
));
57 const AtomicString
& AudioTrack::mainDescriptionsKeyword()
59 DEFINE_STATIC_LOCAL(const AtomicString
, keyword
, ("main-desc", AtomicString::ConstructFromLiteral
));
63 const AtomicString
& AudioTrack::translationKeyword()
65 DEFINE_STATIC_LOCAL(const AtomicString
, keyword
, ("translation", AtomicString::ConstructFromLiteral
));
69 const AtomicString
& AudioTrack::commentaryKeyword()
71 DEFINE_STATIC_LOCAL(const AtomicString
, keyword
, ("commentary", AtomicString::ConstructFromLiteral
));
75 bool AudioTrack::isValidKindKeyword(const String
& kind
)
77 return (kind
== alternativeKeyword())
78 || (kind
== descriptionsKeyword())
79 || (kind
== mainKeyword())
80 || (kind
== mainDescriptionsKeyword())
81 || (kind
== translationKeyword())
82 || (kind
== commentaryKeyword())
83 || (kind
== emptyAtom
);
86 AtomicString
AudioTrack::defaultKind() const