7 #ifndef PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
8 #define PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
15 #include "packager/base/optional.h"
20 enum class TextUnitType {
29 enum class WritingDirection {
32 kVerticalGrowingRight,
35 enum class TextAlignment {
49 TextNumber(
float value, TextUnitType type) : value(value), type(type) {}
58 base::Optional<TextNumber>
line;
65 base::Optional<TextNumber>
width;
82 base::Optional<bool> underline;
83 base::Optional<bool> bold;
84 base::Optional<bool> italic;
92 const std::vector<TextFragment>& sub_fragments)
93 : style(style), sub_fragments(sub_fragments) {}
95 : style(style), body(body) {}
97 : style(style), body(body) {}
99 const std::vector<uint8_t>&
image)
102 : style(style), newline(newline) {}
106 std::vector<TextFragment> sub_fragments;
110 bool newline =
false;
112 bool is_empty()
const;
123 const std::string& id()
const {
return id_; }
124 int64_t start_time()
const {
return start_time_; }
125 int64_t duration()
const {
return duration_; }
126 const TextSettings& settings()
const {
return settings_; }
128 int64_t EndTime()
const;
130 int32_t sub_stream_index()
const {
return sub_stream_index_; }
131 void set_sub_stream_index(int32_t idx) { sub_stream_index_ = idx; }
138 const std::string id_;
139 const int64_t start_time_ = 0;
140 const int64_t duration_ = 0;
143 int32_t sub_stream_index_ = -1;
149 #endif // PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_