Shaka Player Embedded
media_track.cc
Go to the documentation of this file.
1 // Copyright 2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "src/js/mse/media_track.h"
16 
17 namespace shaka {
18 namespace js {
19 namespace mse {
20 
21 MediaTrack::MediaTrack(std::shared_ptr<media::MediaTrack> track)
22  : track_(track) {}
23 
25 
26 const std::string& MediaTrack::label() const {
27  return track_->label;
28 }
29 
30 const std::string& MediaTrack::language() const {
31  return track_->language;
32 }
33 
34 const std::string& MediaTrack::id() const {
35  return track_->id;
36 }
37 
39  return track_->kind;
40 }
41 
42 bool MediaTrack::enabled() const {
43  return track_->enabled();
44 }
45 
47  track_->SetEnabled(enabled);
48 }
49 
50 
51 // \cond Doxygen_Skip
52 AudioTrack::~AudioTrack() {}
53 VideoTrack::~VideoTrack() {}
54 // \endcond Doxygen_Skip
55 
56 
58  AddGenericProperty<AudioTrack>("kind", &MediaTrack::kind);
59  AddGenericProperty<AudioTrack>("label", &MediaTrack::label);
60  AddGenericProperty<AudioTrack>("language", &MediaTrack::language);
61  AddGenericProperty<AudioTrack>("id", &MediaTrack::id);
62  AddGenericProperty<AudioTrack>("enabled", &MediaTrack::enabled,
64 }
65 
67  AddGenericProperty<VideoTrack>("kind", &MediaTrack::kind);
68  AddGenericProperty<VideoTrack>("label", &MediaTrack::label);
69  AddGenericProperty<VideoTrack>("language", &MediaTrack::language);
70  AddGenericProperty<VideoTrack>("id", &MediaTrack::id);
71  // The property is called "selected" on video tracks, but use the same fields
72  // as audio for consistency.
73  AddGenericProperty<VideoTrack>("selected", &MediaTrack::enabled,
75 }
76 
77 } // namespace mse
78 } // namespace js
79 } // namespace shaka
const std::string & id() const
Definition: media_track.cc:34
media::MediaTrackKind kind() const
Definition: media_track.cc:38
void SetEnabled(bool enabled)
Definition: media_track.cc:46
const std::string & language() const
Definition: media_track.cc:30
MediaTrack(std::shared_ptr< media::MediaTrack > track)
Definition: media_track.cc:21
const std::string & label() const
Definition: media_track.cc:26