summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-10-29 19:33:09 +0000
committerCarl Hetherington <cth@carlh.net>2015-10-29 19:33:09 +0000
commit914bd98baa57c6f2c117e33b21a9ee3d25d0fdc2 (patch)
tree1a1c540c723566d5c009c4df210195e32e1d833f /src
parent6dc0cdbd5be3f8f60bd50523501a0bd85666ebda (diff)
Pick up SMPTE subtitle font IDs correctly.
Diffstat (limited to 'src')
-rw-r--r--src/font_node.cc10
-rw-r--r--src/font_node.h2
-rw-r--r--src/interop_subtitle_asset.cc2
-rw-r--r--src/smpte_subtitle_asset.cc2
-rw-r--r--src/subtitle_node.cc6
-rw-r--r--src/subtitle_node.h2
-rw-r--r--src/text_node.cc4
-rw-r--r--src/text_node.h2
8 files changed, 15 insertions, 15 deletions
diff --git a/src/font_node.cc b/src/font_node.cc
index 5461d6ae..5d857bc1 100644
--- a/src/font_node.cc
+++ b/src/font_node.cc
@@ -31,11 +31,11 @@ using boost::shared_ptr;
using boost::optional;
using namespace dcp;
-FontNode::FontNode (cxml::ConstNodePtr node, int tcr)
+FontNode::FontNode (cxml::ConstNodePtr node, int tcr, string font_id_attribute)
{
text = node->content ();
- id = node->optional_string_attribute ("Id");
+ id = node->optional_string_attribute (font_id_attribute);
size = node->optional_number_attribute<int64_t> ("Size").get_value_or (0);
aspect_adjust = node->optional_number_attribute<float> ("AspectAdjust");
italic = node->optional_bool_attribute ("Italic");
@@ -54,17 +54,17 @@ FontNode::FontNode (cxml::ConstNodePtr node, int tcr)
list<cxml::NodePtr> s = node->node_children ("Subtitle");
BOOST_FOREACH (cxml::NodePtr& i, s) {
- subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, tcr)));
+ subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, tcr, font_id_attribute)));
}
list<cxml::NodePtr> f = node->node_children ("Font");
BOOST_FOREACH (cxml::NodePtr& i, f) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr, font_id_attribute)));
}
list<cxml::NodePtr> t = node->node_children ("Text");
BOOST_FOREACH (cxml::NodePtr& i, t) {
- text_nodes.push_back (shared_ptr<TextNode> (new TextNode (i, tcr)));
+ text_nodes.push_back (shared_ptr<TextNode> (new TextNode (i, tcr, font_id_attribute)));
}
}
diff --git a/src/font_node.h b/src/font_node.h
index 92dd6b21..50815636 100644
--- a/src/font_node.h
+++ b/src/font_node.h
@@ -40,7 +40,7 @@ public:
: size (0)
{}
- FontNode (cxml::ConstNodePtr node, int tcr);
+ FontNode (cxml::ConstNodePtr node, int tcr, std::string font_id_attribute);
FontNode (std::list<boost::shared_ptr<FontNode> > const & font_nodes);
std::string text;
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc
index bf493fda..5777c31a 100644
--- a/src/interop_subtitle_asset.cc
+++ b/src/interop_subtitle_asset.cc
@@ -55,7 +55,7 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file)
list<cxml::NodePtr> f = xml->node_children ("Font");
list<shared_ptr<dcp::FontNode> > font_nodes;
BOOST_FOREACH (cxml::NodePtr& i, f) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250, "Id")));
}
parse_subtitles (xml, font_nodes);
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc
index 130b344f..070ade73 100644
--- a/src/smpte_subtitle_asset.cc
+++ b/src/smpte_subtitle_asset.cc
@@ -121,7 +121,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file)
list<cxml::NodePtr> f = subtitle_list->node_children ("Font");
list<shared_ptr<dcp::FontNode> > font_nodes;
BOOST_FOREACH (cxml::NodePtr& i, f) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, _time_code_rate)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, _time_code_rate, "ID")));
}
parse_subtitles (xml, font_nodes);
diff --git a/src/subtitle_node.cc b/src/subtitle_node.cc
index f53878b6..e221b43b 100644
--- a/src/subtitle_node.cc
+++ b/src/subtitle_node.cc
@@ -31,19 +31,19 @@ using boost::shared_ptr;
using boost::lexical_cast;
using namespace dcp;
-SubtitleNode::SubtitleNode (boost::shared_ptr<const cxml::Node> node, int tcr)
+SubtitleNode::SubtitleNode (boost::shared_ptr<const cxml::Node> node, int tcr, string font_id_attribute)
{
in = Time (node->string_attribute ("TimeIn"), tcr);
out = Time (node->string_attribute ("TimeOut"), tcr);
list<cxml::NodePtr> f = node->node_children ("Font");
for (list<cxml::NodePtr>::iterator i = f.begin(); i != f.end(); ++i) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (*i, tcr)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (*i, tcr, font_id_attribute)));
}
list<cxml::NodePtr> t = node->node_children ("Text");
for (list<cxml::NodePtr>::iterator i = t.begin(); i != t.end(); ++i) {
- text_nodes.push_back (shared_ptr<TextNode> (new TextNode (*i, tcr)));
+ text_nodes.push_back (shared_ptr<TextNode> (new TextNode (*i, tcr, font_id_attribute)));
}
fade_up_time = fade_time (node, "FadeUpTime", tcr);
diff --git a/src/subtitle_node.h b/src/subtitle_node.h
index 40189704..78861050 100644
--- a/src/subtitle_node.h
+++ b/src/subtitle_node.h
@@ -38,7 +38,7 @@ class SubtitleNode
{
public:
SubtitleNode () {}
- SubtitleNode (boost::shared_ptr<const cxml::Node> node, int tcr);
+ SubtitleNode (boost::shared_ptr<const cxml::Node> node, int tcr, std::string font_id_attribute);
Time in;
Time out;
diff --git a/src/text_node.cc b/src/text_node.cc
index 666e5846..aa318ce7 100644
--- a/src/text_node.cc
+++ b/src/text_node.cc
@@ -37,7 +37,7 @@ using namespace dcp;
* in this object's member variables.
* @param node Node to read.
*/
-TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr)
+TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr, string font_id_attribute)
: h_position (0)
, h_align (HALIGN_CENTER)
, v_position (0)
@@ -79,6 +79,6 @@ TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr)
list<cxml::NodePtr> f = node->node_children ("Font");
BOOST_FOREACH (cxml::NodePtr& i, f) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr, font_id_attribute)));
}
}
diff --git a/src/text_node.h b/src/text_node.h
index 1affd83f..f10d7c4b 100644
--- a/src/text_node.h
+++ b/src/text_node.h
@@ -48,7 +48,7 @@ public:
, v_align (VALIGN_TOP)
{}
- TextNode (boost::shared_ptr<const cxml::Node> node, int tcr);
+ TextNode (boost::shared_ptr<const cxml::Node> node, int tcr, std::string font_id_attribute);
float h_position;
HAlign h_align;