summaryrefslogtreecommitdiff
path: root/src/lib/text_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-06-21 22:33:02 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-19 23:36:56 +0100
commit491edba4e79656a045103a284c65b846a167d2ff (patch)
treec11e2a9f7b7f097a2320f2b6a21e69a1aab9b581 /src/lib/text_content.cc
parent26acd1ec8426d8be48c37ca20b3af26b4bc73fa7 (diff)
Add type for text content (CCAP/subtitle).
Diffstat (limited to 'src/lib/text_content.cc')
-rw-r--r--src/lib/text_content.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc
index 9eae63519..96e9cbb8d 100644
--- a/src/lib/text_content.cc
+++ b/src/lib/text_content.cc
@@ -55,6 +55,7 @@ int const TextContentProperty::LINE_SPACING = 511;
int const TextContentProperty::FADE_IN = 512;
int const TextContentProperty::FADE_OUT = 513;
int const TextContentProperty::OUTLINE_WIDTH = 514;
+int const TextContentProperty::TYPE = 515;
TextContent::TextContent (Content* parent)
: ContentPart (parent)
@@ -66,6 +67,7 @@ TextContent::TextContent (Content* parent)
, _y_scale (1)
, _line_spacing (1)
, _outline_width (2)
+ , _type (TEXT_SUBTITLE)
{
}
@@ -101,6 +103,7 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version)
, _y_scale (1)
, _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or (1))
, _outline_width (node->optional_number_child<int>("OutlineWidth").get_value_or (2))
+ , _type (TEXT_SUBTITLE)
{
if (version >= 32) {
_use = node->bool_child ("UseSubtitles");
@@ -179,6 +182,8 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version)
}
connect_to_fonts ();
+
+ _type = string_to_text_type (node->optional_string_child("TextType").get_value_or("subtitle"));
}
TextContent::TextContent (Content* parent, vector<shared_ptr<Content> > c)
@@ -307,6 +312,8 @@ TextContent::as_xml (xmlpp::Node* root) const
for (list<shared_ptr<Font> >::const_iterator i = _fonts.begin(); i != _fonts.end(); ++i) {
(*i)->as_xml (root->add_child("Font"));
}
+
+ root->add_child("TextType", text_type_to_string(_type));
}
string
@@ -476,6 +483,12 @@ TextContent::unset_fade_out ()
}
void
+TextContent::set_type (TextType type)
+{
+ maybe_set (_type, type, TextContentProperty::TYPE);
+}
+
+void
TextContent::set_outline_width (int w)
{
maybe_set (_outline_width, w, TextContentProperty::OUTLINE_WIDTH);