Shaka Player Embedded
vtt_cue.h
Go to the documentation of this file.
1 // Copyright 2018 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_MEDIA_VTT_CUE_H_
16 #define SHAKA_EMBEDDED_MEDIA_VTT_CUE_H_
17 
18 #include <mutex>
19 #include <string>
20 
21 #include "../macros.h"
22 
23 namespace shaka {
24 namespace media {
25 
31 enum class DirectionSetting : uint8_t {
36  Horizontal,
37 
44 
51 };
52 
58 enum class LineAlignSetting : uint8_t {
64  Start,
65 
67  Center,
68 
74  End,
75 };
76 
82 enum class PositionAlignSetting : uint8_t {
87  LineLeft,
88 
90  Center,
91 
96  LineRight,
97 
102  Auto,
103 };
104 
110 enum class AlignSetting : uint8_t {
115  Start,
116 
118  Center,
119 
124  End,
125 
130  Left,
131 
136  Right,
137 };
138 
139 
148  public:
149  VTTCue(double start_time, double end_time, const std::string& text);
150  VTTCue(const VTTCue& cue);
151  VTTCue(VTTCue&& cue);
152  ~VTTCue();
153 
154  VTTCue& operator=(const VTTCue& cue);
155  VTTCue& operator=(VTTCue&& cue);
156 
160  std::string id() const;
162  void SetId(const std::string& id);
164  double start_time() const;
166  void SetStartTime(double time);
168  double end_time() const;
170  void SetEndTime(double time);
172  bool pause_on_exit() const;
174  void SetPauseOnExit(bool pause);
176 
180  DirectionSetting vertical() const;
182  void SetVertical(DirectionSetting setting);
184  bool snap_to_lines() const;
186  void SetSnapToLines(bool snap);
188  LineAlignSetting line_align() const;
190  void SetLineAlign(LineAlignSetting align);
192  double line() const;
194  void SetLine(double line);
196  double position() const;
198  void SetPosition(double position);
200  PositionAlignSetting position_align() const;
202  void SetPositionAlign(PositionAlignSetting align);
204  double size() const;
206  void SetSize(double size);
208  AlignSetting align() const;
210  void SetAlign(AlignSetting align);
212  std::string text() const;
214  void SetText(const std::string& text);
216 
217  private:
218  mutable std::mutex mutex_;
219 
220  std::string id_;
221  std::string text_;
222  double start_time_;
223  double end_time_;
224  double line_;
225  double position_;
226  double size_;
227  DirectionSetting vertical_;
228  LineAlignSetting line_align_;
229  PositionAlignSetting position_align_;
230  AlignSetting align_;
231  bool snap_to_lines_;
232  bool pause_on_exit_;
233 };
234 
235 } // namespace media
236 } // namespace shaka
237 
238 #endif // SHAKA_EMBEDDED_VTT_CUE_H_
#define SHAKA_EXPORT
Definition: macros.h:30
DirectionSetting
Definition: vtt_cue.h:31
LineAlignSetting
Definition: vtt_cue.h:58
PositionAlignSetting
Definition: vtt_cue.h:82