summaryrefslogtreecommitdiff
path: root/src/parse/subtitle.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-02-26 17:48:29 +0000
committerCarl Hetherington <cth@carlh.net>2014-02-26 17:48:29 +0000
commit471c9d05fc19484f3e50cf805d14237b72bbb7b2 (patch)
tree579ff1520617941734365a8e9f53985a86396507 /src/parse/subtitle.cc
parentd7d879c988d484cb1a5fd65831001f656605c34e (diff)
Hacks to support MXF-wrapped subtitles.
Diffstat (limited to 'src/parse/subtitle.cc')
-rw-r--r--src/parse/subtitle.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/parse/subtitle.cc b/src/parse/subtitle.cc
index 612af716..914be677 100644
--- a/src/parse/subtitle.cc
+++ b/src/parse/subtitle.cc
@@ -84,10 +84,14 @@ Font::Font (list<shared_ptr<Font> > const & font_nodes)
LoadFont::LoadFont (shared_ptr<const cxml::Node> node)
{
- id = node->string_attribute ("Id");
- uri = node->string_attribute ("URI");
+ optional<string> x = node->optional_string_attribute ("Id");
+ if (!x) {
+ x = node->optional_string_attribute ("ID");
+ }
+ id = x.get_value_or ("");
+
+ uri = node->optional_string_attribute ("URI");
}
-
Subtitle::Subtitle (shared_ptr<const cxml::Node> node)
{
@@ -123,9 +127,19 @@ Subtitle::fade_time (shared_ptr<const cxml::Node> node, string name)
Text::Text (shared_ptr<const cxml::Node> node)
: v_align (CENTER)
{
+ /* Vertical position */
text = node->content ();
- v_position = node->number_attribute<float> ("VPosition");
+ optional<float> x = node->optional_number_attribute<float> ("VPosition");
+ if (!x) {
+ x = node->number_attribute<float> ("Vposition");
+ }
+ v_position = x.get ();
+
+ /* Vertical alignment */
optional<string> v = node->optional_string_attribute ("VAlign");
+ if (!v) {
+ v = node->optional_string_attribute ("Valign");
+ }
if (v) {
v_align = string_to_valign (v.get ());
}