12 #include "utils/ColorUtils.h" 13 #include "utils/RegExp.h" 20 #include <string_view> 24 enum class WebvttSection
36 enum class WebvttAlign
46 enum class WebvttVAlign
53 enum class TextAlignment
73 WebvttVAlign verticalAlign;
77 WebvttAlign positionAlign;
83 return this->verticalAlign == other.verticalAlign && this->snapToLines == other.snapToLines &&
84 this->line.isAuto == other.line.isAuto && this->line.value == other.line.value &&
85 this->position.isAuto == other.position.isAuto &&
86 this->position.value == other.position.value &&
87 this->positionAlign == other.positionAlign && this->size == other.size &&
88 this->align == other.align;
103 TextAlignment textAlign;
106 enum class WebvttSelector
120 const std::string& selectorName,
121 const std::string& colorHexRGB)
122 : m_selectorType{selectorType},
123 m_selectorName{selectorName},
125 m_color(colorHexRGB.substr(4, 2) + colorHexRGB.substr(2, 2) + colorHexRGB.substr(0, 2))
129 WebvttSelector m_selectorType = WebvttSelector::ANY;
130 std::string m_selectorName;
132 bool m_isFontBold =
false;
133 bool m_isFontItalic =
false;
134 bool m_isFontUnderline =
false;
141 std::string m_timestampTag;
142 std::string m_annotation;
143 std::vector<std::string> m_classes;
166 bool CheckSignature(
const std::string& data);
173 void DecodeLine(std::string line, std::vector<subtitleData>* subList);
178 bool IsForcedMargins()
const {
return !m_overridePositions; }
183 void SetPeriodStart(
double pts) { m_offset = pts; }
186 void CalculateTextPosition(std::string& subtitleText);
187 void ConvertSubtitle(std::string& text);
188 void GetCueSettings(std::string& cueSettings);
192 bool IsCueLine(std::string& line);
193 void GetCueData(std::string& cueText);
194 std::string GetCueSettingValue(
const std::string& propName,
196 const std::string& defaultValue);
197 std::string GetCueCssValue(
const std::string& cssPropName, std::string& line);
198 void AddDefaultCssClasses();
199 void InsertCssStyleStartTag(
const tagToken& tag,
203 std::deque<std::pair<std::string, webvttCssStyle*>>& cssTagsOpened);
204 void InsertCssStyleCloseTag(
const tagToken& tag,
208 std::deque<std::pair<std::string, webvttCssStyle*>>& cssTagsOpened,
211 void ConvertAddSubtitle(std::vector<subtitleData>* subList);
213 double GetTimeFromRegexTS(
CRegExp& regex,
int indexStart = 1);
216 std::unique_ptr<subtitleData> m_lastSubtitleData;
218 std::string m_previousLines[3];
219 bool m_overrideStyle{
false};
220 bool m_overridePositions{
false};
221 WebvttSection m_currentSection{WebvttSection::UNDEFINED};
224 std::map<std::string, CRegExp> m_cuePropsMapRegex;
228 std::map<std::string, CRegExp> m_cueCssStyleMapRegex;
229 std::vector<std::string> m_feedCssSelectorNames;
231 std::map<WebvttSelector, std::map<std::string, webvttCssStyle>> m_cssSelectors;
233 bool m_CSSColorsLoaded{
false};
234 std::vector<std::pair<std::string, UTILS::COLOR::ColorInfo>> m_CSSColors;
235 double m_offset{0.0};
Definition: WebVTTHandler.h:137
Definition: WebVTTHandler.h:116
Definition: WebVTTHandler.h:69
Definition: WebVTTHandler.h:63
Definition: WebVTTHandler.h:147
Definition: LibInputPointer.h:13
Definition: GUIColorManager.h:30
Definition: WebVTTHandler.h:92