diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-04-12 01:37:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-04-12 01:37:00 +0100 |
| commit | 4b8c626b7e66ab1d4d69606e10316542c8873842 (patch) | |
| tree | 94140f93b3911196ab60866fefb5c9f807a7a2ab | |
| parent | 4b8eee1359d817937b84df7e88126fa16040e5c9 (diff) | |
Add direction support for SMPTE subtitles; fix pragma warnings with non-openmp builds.
| -rw-r--r-- | src/mono_picture_asset.cc | 5 | ||||
| -rw-r--r-- | src/object.h | 6 | ||||
| -rw-r--r-- | src/smpte_subtitle_asset.h | 4 | ||||
| -rw-r--r-- | src/subtitle_asset.cc | 13 | ||||
| -rw-r--r-- | src/subtitle_string.cc | 4 | ||||
| -rw-r--r-- | src/subtitle_string.h | 6 | ||||
| -rw-r--r-- | src/text_node.cc | 6 | ||||
| -rw-r--r-- | src/text_node.h | 2 | ||||
| -rw-r--r-- | src/types.cc | 33 | ||||
| -rw-r--r-- | src/types.h | 12 | ||||
| -rwxr-xr-x | test/data/subs2.xml | 6 | ||||
| -rw-r--r-- | test/make_digest_test.cc | 11 | ||||
| -rw-r--r-- | test/read_interop_subtitle_test.cc | 23 | ||||
| -rw-r--r-- | test/write_subtitle_test.cc | 92 | ||||
| -rw-r--r-- | wscript | 2 |
15 files changed, 207 insertions, 18 deletions
diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index b367a19d..8e09d8c6 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -113,7 +113,10 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No bool result = true; +#ifdef LIBDCP_OPENMP #pragma omp parallel for +#endif + for (int i = 0; i < _intrinsic_duration; ++i) { if (i >= other_picture->intrinsic_duration()) { result = false; @@ -134,7 +137,9 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No result = false; } +#ifdef LIBDCP_OPENMP #pragma omp critical +#endif { note (DCP_PROGRESS, String::compose ("Compared video frame %1 of %2", i, _intrinsic_duration)); for (list<pair<NoteType, string> >::const_iterator i = notes.begin(); i != notes.end(); ++i) { diff --git a/src/object.h b/src/object.h index 303e46d3..0fa11251 100644 --- a/src/object.h +++ b/src/object.h @@ -27,7 +27,8 @@ #include <boost/noncopyable.hpp> #include <string> -class write_subtitle_test; +class write_interop_subtitle_test; +class write_smpte_subtitle_test; namespace dcp { @@ -47,7 +48,8 @@ public: } protected: - friend class ::write_subtitle_test; + friend class ::write_interop_subtitle_test; + friend class ::write_smpte_subtitle_test; /** ID */ std::string _id; diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h index a7adee6f..48a0b95c 100644 --- a/src/smpte_subtitle_asset.h +++ b/src/smpte_subtitle_asset.h @@ -69,6 +69,10 @@ public: _language = l; } + void set_issue_date (LocalTime t) { + _issue_date = t; + } + void set_reel_number (int r) { _reel_number = r; } diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 352aff9a..89c96795 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -153,6 +153,7 @@ SubtitleAsset::maybe_add_subtitle (string text, ParseState const & parse_state) effective_text.h_align, effective_text.v_position, effective_text.v_align, + effective_text.direction, text, effective_font.effect.get_value_or (NONE), effective_font.effect_colour.get_value_or (dcp::Colour (0, 0, 0)), @@ -333,6 +334,7 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Stand } xmlpp::Element* text = subtitle_element->add_child ("Text", xmlns); + if (i.h_align() != HALIGN_CENTER) { if (standard == SMPTE) { text->set_attribute ("Halign", halign_to_string (i.h_align ())); @@ -340,6 +342,7 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Stand text->set_attribute ("HAlign", halign_to_string (i.h_align ())); } } + if (i.h_position() > ALIGN_EPSILON) { if (standard == SMPTE) { text->set_attribute ("Hposition", raw_convert<string> (i.h_position() * 100, 6)); @@ -347,11 +350,13 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Stand text->set_attribute ("HPosition", raw_convert<string> (i.h_position() * 100, 6)); } } + if (standard == SMPTE) { text->set_attribute ("Valign", valign_to_string (i.v_align())); } else { text->set_attribute ("VAlign", valign_to_string (i.v_align())); } + if (i.v_position() > ALIGN_EPSILON) { if (standard == SMPTE) { text->set_attribute ("Vposition", raw_convert<string> (i.v_position() * 100, 6)); @@ -365,6 +370,14 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Stand text->set_attribute ("VPosition", "0"); } } + + /* Interop only supports "horizontal" or "vertical" for direction, so only write this + for SMPTE. + */ + if (i.direction() != DIRECTION_LTR && standard == SMPTE) { + text->set_attribute ("Direction", direction_to_string (i.direction ())); + } + text->add_child_text (i.text()); } } diff --git a/src/subtitle_string.cc b/src/subtitle_string.cc index ea24e37f..7ba6e0e1 100644 --- a/src/subtitle_string.cc +++ b/src/subtitle_string.cc @@ -40,6 +40,7 @@ SubtitleString::SubtitleString ( HAlign h_align, float v_position, VAlign v_align, + Direction direction, string text, Effect effect, Colour effect_colour, @@ -58,6 +59,7 @@ SubtitleString::SubtitleString ( , _h_align (h_align) , _v_position (v_position) , _v_align (v_align) + , _direction (direction) , _text (text) , _effect (effect) , _effect_colour (effect_colour) @@ -94,6 +96,7 @@ dcp::operator== (SubtitleString const & a, SubtitleString const & b) a.h_align() == b.h_align() && a.v_position() == b.v_position() && a.v_align() == b.v_align() && + a.direction() == b.direction() && a.text() == b.text() && a.effect() == b.effect() && a.effect_colour() == b.effect_colour() && @@ -124,6 +127,7 @@ dcp::operator<< (ostream& s, SubtitleString const & sub) s << "size " << sub.size() << ", aspect " << sub.aspect_adjust() << ", colour " << sub.colour() << ", vpos " << sub.v_position() << ", valign " << ((int) sub.v_align()) << ", hpos " << sub.h_position() << ", halign " << ((int) sub.h_align()) + << ", direction " << ((int) sub.direction()) << ", effect " << ((int) sub.effect()) << ", effect colour " << sub.effect_colour(); return s; diff --git a/src/subtitle_string.h b/src/subtitle_string.h index bd71b8da..6cf1713d 100644 --- a/src/subtitle_string.h +++ b/src/subtitle_string.h @@ -50,6 +50,7 @@ public: HAlign h_align, float v_position, VAlign v_align, + Direction direction, std::string text, Effect effect, Colour effect_colour, @@ -106,6 +107,10 @@ public: return _v_align; } + Direction direction () const { + return _direction; + } + Effect effect () const { return _effect; } @@ -189,6 +194,7 @@ private: */ float _v_position; VAlign _v_align; + Direction _direction; std::string _text; Effect _effect; Colour _effect_colour; diff --git a/src/text_node.cc b/src/text_node.cc index aa318ce7..7618c460 100644 --- a/src/text_node.cc +++ b/src/text_node.cc @@ -42,6 +42,7 @@ TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr, string fo , h_align (HALIGN_CENTER) , v_position (0) , v_align (VALIGN_CENTER) + , direction (DIRECTION_LTR) { text = node->content (); @@ -77,6 +78,11 @@ TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr, string fo v_align = string_to_valign (va.get ()); } + optional<string> d = node->optional_string_attribute ("Direction"); + if (d) { + direction = string_to_direction (d.get ()); + } + 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_id_attribute))); diff --git a/src/text_node.h b/src/text_node.h index f10d7c4b..753d1a01 100644 --- a/src/text_node.h +++ b/src/text_node.h @@ -46,6 +46,7 @@ public: , h_align (HALIGN_LEFT) , v_position (0) , v_align (VALIGN_TOP) + , direction (DIRECTION_LTR) {} TextNode (boost::shared_ptr<const cxml::Node> node, int tcr, std::string font_id_attribute); @@ -54,6 +55,7 @@ public: HAlign h_align; float v_position; VAlign v_align; + Direction direction; std::string text; std::list<boost::shared_ptr<FontNode> > font_nodes; }; diff --git a/src/types.cc b/src/types.cc index 687e90f8..30c565c9 100644 --- a/src/types.cc +++ b/src/types.cc @@ -232,3 +232,36 @@ dcp::string_to_valign (string s) boost::throw_exception (DCPReadError ("unknown subtitle valign type")); } + +string +dcp::direction_to_string (Direction v) +{ + switch (v) { + case DIRECTION_LTR: + return "ltr"; + case DIRECTION_RTL: + return "rtl"; + case DIRECTION_TTB: + return "ttb"; + case DIRECTION_BTT: + return "btt"; + } + + boost::throw_exception (MiscError ("unknown subtitle direction type")); +} + +Direction +dcp::string_to_direction (string s) +{ + if (s == "ltr") { + return DIRECTION_LTR; + } else if (s == "rtl") { + return DIRECTION_RTL; + } else if (s == "ttb") { + return DIRECTION_TTB; + } else if (s == "btt") { + return DIRECTION_BTT; + } + + boost::throw_exception (DCPReadError ("unknown subtitle direction type")); +} diff --git a/src/types.h b/src/types.h index 16000daa..0f05d889 100644 --- a/src/types.h +++ b/src/types.h @@ -114,6 +114,18 @@ enum VAlign extern std::string valign_to_string (VAlign a); extern VAlign string_to_valign (std::string s); +/** Direction for subtitle test */ +enum Direction +{ + DIRECTION_LTR, ///< left-to-right + DIRECTION_RTL, ///< right-to-left + DIRECTION_TTB, ///< top-to-bottom + DIRECTION_BTT ///< bottom-to-top +}; + +extern std::string direction_to_string (Direction a); +extern Direction string_to_direction (std::string s); + enum Eye { EYE_LEFT, diff --git a/test/data/subs2.xml b/test/data/subs2.xml index c0001b06..a6ec2338 100755 --- a/test/data/subs2.xml +++ b/test/data/subs2.xml @@ -32,10 +32,10 @@ </Subtitle> <Subtitle SpotNumber="4" TimeIn="00:01:15:042" TimeOut="00:01:16:042" FadeUpTime="0" FadeDownTime="0"> <Font Italic="yes"> - <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">With the legendary Miss Enid Blyton</Text> + <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5" Direction="rtl">With the legendary Miss Enid Blyton</Text> </Font> <Font Italic="yes"> - <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">She said "you be Noddy</Text> + <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5" Direction="ttb">She said "you be Noddy</Text> </Font> </Subtitle> <Subtitle SpotNumber="5" TimeIn="00:01:20:219" TimeOut="00:01:22:073" FadeUpTime="0" FadeDownTime="0"> @@ -48,7 +48,7 @@ </Subtitle> <Subtitle SpotNumber="6" TimeIn="00:01:27:115" TimeOut="00:01:28:208" FadeUpTime="0" FadeDownTime="0"> <Font Italic="yes"> - <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5">That curious creature the Sphinx</Text> + <Text HAlign="center" HPosition="0" VAlign="top" VPosition="89" ZPosition="0.5" Direction="btt">That curious creature the Sphinx</Text> </Font> <Font Italic="yes"> <Text HAlign="center" HPosition="0" VAlign="top" VPosition="95" ZPosition="0.5">Is smarter than anyone thinks</Text> diff --git a/test/make_digest_test.cc b/test/make_digest_test.cc index 4614911e..b7e18a12 100644 --- a/test/make_digest_test.cc +++ b/test/make_digest_test.cc @@ -22,7 +22,6 @@ #include <boost/bind.hpp> #include <boost/test/unit_test.hpp> #include <sys/time.h> -#include <iostream> void progress (float) { @@ -43,13 +42,5 @@ BOOST_AUTO_TEST_CASE (make_digest_test) data.write ("build/test/random"); /* Hash it */ - struct timeval A; - gettimeofday (&A, 0); - for (int i = 0; i < 64; ++i) { - BOOST_CHECK_EQUAL (dcp::make_digest ("build/test/random", boost::bind (&progress, _1)), "GKbk/V3fcRtP5MaPdSmAGNbKkaU="); - } - struct timeval B; - gettimeofday (&B, 0); - - std::cout << ((B.tv_sec + B.tv_usec / 1e6) - (A.tv_sec + A.tv_usec / 1e6)) << "\n"; + BOOST_CHECK_EQUAL (dcp::make_digest ("build/test/random", boost::bind (&progress, _1)), "GKbk/V3fcRtP5MaPdSmAGNbKkaU="); } diff --git a/test/read_interop_subtitle_test.cc b/test/read_interop_subtitle_test.cc index 7822d47e..8640b7ef 100644 --- a/test/read_interop_subtitle_test.cc +++ b/test/read_interop_subtitle_test.cc @@ -59,6 +59,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HALIGN_CENTER, 0.15, dcp::VALIGN_BOTTOM, + dcp::DIRECTION_LTR, "My jacket was Idi Amin's", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -81,6 +82,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HALIGN_CENTER, 0.21, dcp::VALIGN_BOTTOM, + dcp::DIRECTION_LTR, "My corset was H.M. The Queen's", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -100,6 +102,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HALIGN_CENTER, 0.15, dcp::VALIGN_BOTTOM, + dcp::DIRECTION_LTR, "My large wonderbra", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -122,6 +125,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HALIGN_CENTER, 0.15, dcp::VALIGN_BOTTOM, + dcp::DIRECTION_LTR, "Once belonged to the Shah", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -144,6 +148,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HALIGN_CENTER, 0.15, dcp::VALIGN_BOTTOM, + dcp::DIRECTION_LTR, "And these are Roy Hattersley's jeans", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -172,6 +177,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "At afternoon tea with John Peel", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -191,6 +197,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "I enquired if his accent was real", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -213,6 +220,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "He said \"out of the house", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -232,6 +240,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "I'm incredibly scouse", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -254,6 +263,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "At home it depends how I feel.\"", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -273,6 +283,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "I spent a long weekend in Brighton", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -295,6 +306,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_RTL, "With the legendary Miss Enid Blyton", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -314,6 +326,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_TTB, "She said \"you be Noddy", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -336,6 +349,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_BTT, "That curious creature the Sphinx", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -355,6 +369,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "Is smarter than anyone thinks", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -377,6 +392,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "It sits there and smirks", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -396,6 +412,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "And you don't think it works", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -418,6 +435,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "Then when you're not looking, it winks.", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -437,6 +455,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "When it snows you will find Sister Sledge", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -459,6 +478,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "Out mooning, at night, on the ledge", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -478,6 +498,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "One storey down", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -500,6 +521,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.89, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "HELLO", dcp::BORDER, dcp::Colour (0, 0, 0), @@ -519,6 +541,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HALIGN_CENTER, 0.95, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "WORLD", dcp::BORDER, dcp::Colour (0, 0, 0), diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index 67bfcd4e..ffd01e1f 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ */ #include "interop_subtitle_asset.h" +#include "smpte_subtitle_asset.h" #include "subtitle_string.h" #include "test.h" #include <boost/test/unit_test.hpp> @@ -27,7 +28,7 @@ using std::string; using boost::shared_ptr; /* Write some subtitle content as Interop XML and check that it is right */ -BOOST_AUTO_TEST_CASE (write_subtitle_test) +BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) { dcp::InteropSubtitleAsset c; c.set_reel_number ("1"); @@ -48,6 +49,7 @@ BOOST_AUTO_TEST_CASE (write_subtitle_test) dcp::HALIGN_CENTER, 0.8, dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, "Hello world", dcp::NONE, dcp::Colour (0, 0, 0), @@ -70,6 +72,7 @@ BOOST_AUTO_TEST_CASE (write_subtitle_test) dcp::HALIGN_CENTER, 0.4, dcp::VALIGN_BOTTOM, + dcp::DIRECTION_LTR, "What's going on", dcp::BORDER, dcp::Colour (1, 2, 3), @@ -101,3 +104,88 @@ BOOST_AUTO_TEST_CASE (write_subtitle_test) list<string> () ); } + +/* Write some subtitle content as SMPTE XML and check that it is right */ +BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) +{ + dcp::SMPTESubtitleAsset c; + c.set_reel_number (1); + c.set_language ("EN"); + c.set_content_title_text ("Test"); + c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00")); + + c.add ( + dcp::SubtitleString ( + string ("Frutiger"), + false, + false, + dcp::Colour (255, 255, 255), + 48, + 1.0, + dcp::Time (0, 4, 9, 22, 24), + dcp::Time (0, 4, 11, 22, 24), + 0, + dcp::HALIGN_CENTER, + 0.8, + dcp::VALIGN_TOP, + dcp::DIRECTION_LTR, + "Hello world", + dcp::NONE, + dcp::Colour (0, 0, 0), + dcp::Time (0, 0, 0, 0, 24), + dcp::Time (0, 0, 0, 0, 24) + ) + ); + + c.add ( + dcp::SubtitleString ( + boost::optional<string> (), + true, + true, + dcp::Colour (128, 0, 64), + 91, + 1.0, + dcp::Time (5, 41, 0, 21, 24), + dcp::Time (6, 12, 15, 21, 24), + 0, + dcp::HALIGN_CENTER, + 0.4, + dcp::VALIGN_BOTTOM, + dcp::DIRECTION_RTL, + "What's going on", + dcp::BORDER, + dcp::Colour (1, 2, 3), + dcp::Time (1, 2, 3, 4, 24), + dcp::Time (5, 6, 7, 8, 24) + ) + ); + + c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6"; + + check_xml ( + c.xml_as_string (), + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<dcst:SubtitleReel xmlns:dcst=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + " <dcst:Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</dcst:Id>\n" + " <dcst:ContentTitleText>Test</dcst:ContentTitleText>\n" + " <dcst:IssueDate>2016-04-01T03:52:00.000+00:00</dcst:IssueDate>\n" + " <dcst:ReelNumber>1</dcst:ReelNumber>\n" + " <dcst:Language>EN</dcst:Language>\n" + " <dcst:EditRate>24 1</dcst:EditRate>\n" + " <dcst:TimeCodeRate>24</dcst:TimeCodeRate>\n" + " <dcst:SubtitleList>\n" + " <dcst:Font ID=\"Frutiger\" Italic=\"no\" Color=\"FFFFFFFF\" Size=\"48\" Effect=\"none\" EffectColor=\"FF000000\" Script=\"normal\" Underline=\"no\" Weight=\"normal\">\n" + " <dcst:Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:22\" TimeOut=\"00:04:11:22\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">\n" + " <dcst:Text Valign=\"top\" Vposition=\"80\">Hello world</dcst:Text>\n" + " </dcst:Subtitle>\n" + " </dcst:Font>\n" + " <dcst:Font Italic=\"yes\" Color=\"FF800040\" Size=\"91\" Effect=\"border\" EffectColor=\"FF010203\" Script=\"normal\" Underline=\"no\" Weight=\"bold\">\n" + " <dcst:Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:21\" TimeOut=\"06:12:15:21\" FadeUpTime=\"01:02:03:04\" FadeDownTime=\"05:06:07:08\">\n" + " <dcst:Text Valign=\"bottom\" Vposition=\"40\" Direction=\"rtl\">What's going on</dcst:Text>\n" + " </dcst:Subtitle>\n" + " </dcst:Font>\n" + " </dcst:SubtitleList>\n" + "</dcst:SubtitleReel>\n", + list<string> () + ); +} @@ -58,7 +58,7 @@ def configure(conf): conf.env.append_value('CXXFLAGS', ['-Wno-unused-result', '-Wno-unused-parameter', '-Wno-unused-local-typedef']) if conf.options.enable_openmp: - conf.env.append_value('CXXFLAGS', '-fopenmp') + conf.env.append_value('CXXFLAGS', ['-fopenmp', '-DLIBDCP_OPENMP']) conf.env.LIB_OPENMP = ['gomp'] conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True) |
