Shaka Player Embedded
media_track.h
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 #ifndef SHAKA_EMBEDDED_JS_MSE_MEDIA_TRACK_H_
16 #define SHAKA_EMBEDDED_JS_MSE_MEDIA_TRACK_H_
17 
18 #include <memory>
19 #include <string>
20 
24 #include "src/mapping/enum.h"
25 
26 namespace shaka {
27 namespace js {
28 namespace mse {
29 
30 class MediaTrack : public BackingObject {
31  public:
32  explicit MediaTrack(std::shared_ptr<media::MediaTrack> track);
33  ~MediaTrack() override;
34 
35  const std::string& label() const;
36  const std::string& language() const;
37  const std::string& id() const;
39  bool enabled() const;
40  void SetEnabled(bool enabled);
41 
42  private:
43  std::shared_ptr<media::MediaTrack> track_;
44 };
45 
49 class AudioTrack : public MediaTrack {
51 
52  public:
54 };
55 
59 class VideoTrack : public MediaTrack {
61 
62  public:
64 };
65 
66 class AudioTrackFactory : public BackingObjectFactory<AudioTrack> {
67  public:
69 };
70 
71 class VideoTrackFactory : public BackingObjectFactory<VideoTrack> {
72  public:
74 };
75 
76 } // namespace mse
77 } // namespace js
78 } // namespace shaka
79 
81  AddMapping(Enum::Unknown, "");
82  AddMapping(Enum::Alternative, "alternative");
83  AddMapping(Enum::Captions, "captions");
84  AddMapping(Enum::Descriptions, "descriptions");
85  AddMapping(Enum::Main, "main");
86  AddMapping(Enum::MainDesc, "main-desc");
87  AddMapping(Enum::Sign, "sign");
88  AddMapping(Enum::Subtitles, "subtitles");
89  AddMapping(Enum::Translation, "translation");
90  AddMapping(Enum::Commentary, "commentary");
91 }
92 
93 #endif // SHAKA_EMBEDDED_JS_MSE_MEDIA_TRACK_H_
const std::string & id() const
Definition: media_track.cc:34
DEFINE_ENUM_MAPPING(shaka::media, MediaTrackKind)
Definition: media_track.h:80
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
#define DECLARE_TYPE_INFO(type)
const std::string & label() const
Definition: media_track.cc:26