7 #ifndef PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
8 #define PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
18 enum class TextUnitType {
27 enum class WritingDirection {
30 kVerticalGrowingRight,
33 enum class TextAlignment {
47 TextNumber(
float value, TextUnitType type) : value(value), type(type) {}
56 std::optional<TextNumber>
line;
63 std::optional<TextNumber>
width;
80 std::optional<bool> underline;
81 std::optional<bool> bold;
82 std::optional<bool> italic;
87 std::string backgroundColor;
95 const std::vector<TextFragment>& sub_fragments)
96 : style(style), sub_fragments(sub_fragments) {}
98 : style(style), body(body) {}
100 : style(style), body(body) {}
102 const std::vector<uint8_t>&
image)
105 : style(style), newline(newline) {}
109 std::vector<TextFragment> sub_fragments;
113 bool newline =
false;
115 bool is_empty()
const;
126 const std::string& id()
const {
return id_; }
127 int64_t start_time()
const {
return start_time_; }
128 int64_t duration()
const {
return duration_; }
129 const TextSettings& settings()
const {
return settings_; }
131 int64_t EndTime()
const;
133 int32_t sub_stream_index()
const {
return sub_stream_index_; }
134 void set_sub_stream_index(int32_t idx) { sub_stream_index_ = idx; }
141 const std::string id_;
142 const int64_t start_time_ = 0;
143 const int64_t duration_ = 0;
146 int32_t sub_stream_index_ = -1;
All the methods that are virtual are virtual for mocking.
std::vector< uint8_t > image
PNG image data.
TextAlignment text_alignment
How to align the text within the cue box.
std::string region
The region to draw the cue in.
std::optional< TextNumber > height
WritingDirection writing_direction
std::optional< TextNumber > width
std::optional< TextNumber > position
std::optional< TextNumber > line