diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-10-20 23:17:40 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-11-03 09:31:53 +0100 |
| commit | 5048e3e1d91858c2a4132e616438e1943f820124 (patch) | |
| tree | 5ef98efb29690e8320d4e9e36266f41e1214e174 | |
| parent | 80fc63959caa039401a4d7e33bc72cd3c6ec2fe3 (diff) | |
Add Z position to subtitles; existing tests pass.
| -rw-r--r-- | src/subtitle.cc | 7 | ||||
| -rw-r--r-- | src/subtitle.h | 10 | ||||
| -rw-r--r-- | src/subtitle_asset.cc | 16 | ||||
| -rw-r--r-- | src/subtitle_asset.h | 1 | ||||
| -rw-r--r-- | src/subtitle_asset_internal.cc | 10 | ||||
| -rw-r--r-- | src/subtitle_asset_internal.h | 8 | ||||
| -rw-r--r-- | src/subtitle_image.cc | 12 | ||||
| -rw-r--r-- | src/subtitle_image.h | 2 | ||||
| -rw-r--r-- | src/subtitle_string.cc | 5 | ||||
| -rw-r--r-- | src/subtitle_string.h | 3 | ||||
| -rw-r--r-- | test/decryption_test.cc | 1 | ||||
| -rw-r--r-- | test/interop_subtitle_test.cc | 30 | ||||
| -rw-r--r-- | test/shared_subtitle_test.cc | 8 | ||||
| -rw-r--r-- | test/smpte_subtitle_test.cc | 15 | ||||
| -rw-r--r-- | test/test.cc | 1 | ||||
| -rw-r--r-- | test/verify_test.cc | 1 |
16 files changed, 114 insertions, 16 deletions
diff --git a/src/subtitle.cc b/src/subtitle.cc index 15481528..522b0e5f 100644 --- a/src/subtitle.cc +++ b/src/subtitle.cc @@ -53,6 +53,7 @@ Subtitle::Subtitle ( HAlign h_align, float v_position, VAlign v_align, + float z_position, Time fade_up_time, Time fade_down_time ) @@ -62,6 +63,7 @@ Subtitle::Subtitle ( , _h_align (h_align) , _v_position (v_position) , _v_align (v_align) + , _z_position(z_position) , _fade_up_time (fade_up_time) , _fade_down_time (fade_down_time) { @@ -104,6 +106,11 @@ Subtitle::equals(shared_ptr<const Subtitle> other, EqualityOptions, NoteHandler same = false; } + if (z_position() != other->z_position()) { + note(NoteType::ERROR, "subtitle Z positions differ"); + same = false; + } + if (fade_up_time() != other->fade_up_time()) { note(NoteType::ERROR, "subtitle fade-up times differ"); same = false; diff --git a/src/subtitle.h b/src/subtitle.h index 2a8e0322..d42a54b7 100644 --- a/src/subtitle.h +++ b/src/subtitle.h @@ -82,6 +82,10 @@ public: return _v_align; } + float z_position() const { + return _z_position; + } + Time fade_up_time () const { return _fade_up_time; } @@ -109,6 +113,10 @@ public: _v_position = p; } + void set_z_position(float z) { + _z_position = z; + } + void set_fade_up_time (Time t) { _fade_up_time = t; } @@ -128,6 +136,7 @@ protected: HAlign h_align, float v_position, VAlign v_align, + float z_position, Time fade_up_time, Time fade_down_time ); @@ -144,6 +153,7 @@ protected: */ float _v_position = 0; VAlign _v_align = VAlign::CENTER; + float _z_position = 0; Time _fade_up_time; Time _fade_down_time; }; diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 271199ef..f707c665 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -203,6 +203,10 @@ SubtitleAsset::position_align (SubtitleAsset::ParseState& ps, xmlpp::Element con ps.v_align = string_to_valign (va.get ()); } + auto zp = optional_number_attribute<float>(node, "Zposition"); + if (zp) { + ps.z_position = zp.get() / 100; + } } @@ -365,6 +369,9 @@ SubtitleAsset::maybe_add_subtitle (string text, vector<ParseState> const & parse if (i.v_align) { ps.v_align = i.v_align.get(); } + if (i.z_position) { + ps.z_position = i.z_position.get(); + } if (i.direction) { ps.direction = i.direction.get(); } @@ -409,6 +416,7 @@ SubtitleAsset::maybe_add_subtitle (string text, vector<ParseState> const & parse ps.h_align.get_value_or(HAlign::CENTER), ps.v_position.get_value_or(0), ps.v_align.get_value_or(VAlign::CENTER), + ps.z_position.get_value_or(0), ps.direction.get_value_or (Direction::LTR), text, ps.effect.get_value_or (Effect::NONE), @@ -451,6 +459,7 @@ SubtitleAsset::maybe_add_subtitle (string text, vector<ParseState> const & parse ps.h_align.get_value_or(HAlign::CENTER), ps.v_position.get_value_or(0), ps.v_align.get_value_or(VAlign::CENTER), + ps.z_position.get_value_or(0), ps.fade_up_time.get_value_or(Time()), ps.fade_down_time.get_value_or(Time()) ) @@ -674,6 +683,7 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, S float last_h_position; VAlign last_v_align; float last_v_position; + float last_z_position; Direction last_direction; for (auto i: sorted) { @@ -701,15 +711,17 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, S fabs(last_h_position - is->h_position()) > ALIGN_EPSILON || last_v_align != is->v_align() || fabs(last_v_position - is->v_position()) > ALIGN_EPSILON || + fabs(last_z_position - is->z_position()) > ALIGN_EPSILON || last_direction != is->direction() ) { - text = make_shared<order::Text>(subtitle, is->h_align(), is->h_position(), is->v_align(), is->v_position(), is->direction()); + text = make_shared<order::Text>(subtitle, is->h_align(), is->h_position(), is->v_align(), is->v_position(), is->z_position(), is->direction()); subtitle->children.push_back (text); last_h_align = is->h_align (); last_h_position = is->h_position (); last_v_align = is->v_align (); last_v_position = is->v_position (); + last_z_position = is->z_position(); last_direction = is->direction (); } @@ -720,7 +732,7 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, S if (ii) { text.reset (); subtitle->children.push_back ( - make_shared<order::Image>(subtitle, ii->id(), ii->png_image(), ii->h_align(), ii->h_position(), ii->v_align(), ii->v_position()) + make_shared<order::Image>(subtitle, ii->id(), ii->png_image(), ii->h_align(), ii->h_position(), ii->v_align(), ii->v_position(), ii->z_position()) ); } } diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 88b5378c..7448ac9a 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -152,6 +152,7 @@ protected: boost::optional<HAlign> h_align; boost::optional<float> v_position; boost::optional<VAlign> v_align; + boost::optional<float> z_position; boost::optional<Direction> direction; boost::optional<Time> in; boost::optional<Time> out; diff --git a/src/subtitle_asset_internal.cc b/src/subtitle_asset_internal.cc index 7a10f472..bb67b45a 100644 --- a/src/subtitle_asset_internal.cc +++ b/src/subtitle_asset_internal.cc @@ -165,7 +165,7 @@ order::Part::write_xml (xmlpp::Element* parent, order::Context& context) const static void -position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, float h_position, VAlign v_align, float v_position) +position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, float h_position, VAlign v_align, float v_position, float z_position) { if (h_align != HAlign::CENTER) { if (context.standard == Standard::SMPTE) { @@ -202,6 +202,10 @@ position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, floa e->set_attribute ("VPosition", "0"); } } + + if (fabs(z_position) > ALIGN_EPSILON && context.standard == Standard::SMPTE) { + e->set_attribute("Zposition", raw_convert<string>(z_position * 100, 6)); + } } @@ -210,7 +214,7 @@ order::Text::as_xml (xmlpp::Element* parent, Context& context) const { auto e = parent->add_child ("Text"); - position_align (e, context, _h_align, _h_position, _v_align, _v_position); + position_align(e, context, _h_align, _h_position, _v_align, _v_position, _z_position); /* Interop only supports "horizontal" or "vertical" for direction, so only write this for SMPTE. @@ -260,7 +264,7 @@ order::Image::as_xml (xmlpp::Element* parent, Context& context) const { auto e = parent->add_child ("Image"); - position_align (e, context, _h_align, _h_position, _v_align, _v_position); + position_align(e, context, _h_align, _h_position, _v_align, _v_position, _z_position); if (context.standard == Standard::SMPTE) { e->add_child_text ("urn:uuid:" + _id); } else { diff --git a/src/subtitle_asset_internal.h b/src/subtitle_asset_internal.h index 55880797..7fe142fc 100644 --- a/src/subtitle_asset_internal.h +++ b/src/subtitle_asset_internal.h @@ -144,12 +144,13 @@ private: class Text : public Part { public: - Text (std::shared_ptr<Part> parent, HAlign h_align, float h_position, VAlign v_align, float v_position, Direction direction) + Text (std::shared_ptr<Part> parent, HAlign h_align, float h_position, VAlign v_align, float v_position, float z_position, Direction direction) : Part (parent) , _h_align (h_align) , _h_position (h_position) , _v_align (v_align) , _v_position (v_position) + , _z_position(z_position) , _direction (direction) {} @@ -160,6 +161,7 @@ private: float _h_position; VAlign _v_align; float _v_position; + float _z_position; Direction _direction; }; @@ -188,7 +190,7 @@ private: class Image : public Part { public: - Image (std::shared_ptr<Part> parent, std::string id, ArrayData png_data, HAlign h_align, float h_position, VAlign v_align, float v_position) + Image (std::shared_ptr<Part> parent, std::string id, ArrayData png_data, HAlign h_align, float h_position, VAlign v_align, float v_position, float z_position) : Part (parent) , _png_data (png_data) , _id (id) @@ -196,6 +198,7 @@ public: , _h_position (h_position) , _v_align (v_align) , _v_position (v_position) + , _z_position(z_position) {} xmlpp::Element* as_xml (xmlpp::Element* parent, Context& context) const override; @@ -207,6 +210,7 @@ private: float _h_position; VAlign _v_align; float _v_position; + float _z_position; }; diff --git a/src/subtitle_image.cc b/src/subtitle_image.cc index 5f51f05e..19d7f4eb 100644 --- a/src/subtitle_image.cc +++ b/src/subtitle_image.cc @@ -43,8 +43,8 @@ using std::dynamic_pointer_cast; using std::ostream; -using std::string; using std::shared_ptr; +using std::string; using namespace dcp; @@ -56,10 +56,11 @@ SubtitleImage::SubtitleImage ( HAlign h_align, float v_position, VAlign v_align, + float z_position, Time fade_up_time, Time fade_down_time ) - : Subtitle (in, out, h_position, h_align, v_position, v_align, fade_up_time, fade_down_time) + : Subtitle(in, out, h_position, h_align, v_position, v_align, z_position, fade_up_time, fade_down_time) , _png_image (png_image) , _id (make_uuid ()) { @@ -76,10 +77,11 @@ SubtitleImage::SubtitleImage ( HAlign h_align, float v_position, VAlign v_align, + float z_position, Time fade_up_time, Time fade_down_time ) - : Subtitle (in, out, h_position, h_align, v_position, v_align, fade_up_time, fade_down_time) + : Subtitle(in, out, h_position, h_align, v_position, v_align, z_position, fade_up_time, fade_down_time) , _png_image (png_image) , _id (id) { @@ -115,6 +117,7 @@ dcp::operator== (SubtitleImage const & a, SubtitleImage const & b) a.h_align() == b.h_align() && a.v_position() == b.v_position() && a.v_align() == b.v_align() && + a.z_position() == b.z_position() && a.fade_up_time() == b.fade_up_time() && a.fade_down_time() == b.fade_down_time() ); @@ -170,7 +173,8 @@ dcp::operator<< (ostream& s, SubtitleImage const & sub) s << "\n[IMAGE] from " << sub.in() << " to " << sub.out() << ";\n" << "fade up " << sub.fade_up_time() << ", fade down " << sub.fade_down_time() << ";\n" << "v pos " << sub.v_position() << ", valign " << ((int) sub.v_align()) - << ", hpos " << sub.h_position() << ", halign " << ((int) sub.h_align()) << "\n"; + << ", hpos " << sub.h_position() << ", halign " << ((int) sub.h_align()) + << ", zpos " << sub.z_position() << "\n"; return s; } diff --git a/src/subtitle_image.h b/src/subtitle_image.h index 9d74d18c..8b1c3521 100644 --- a/src/subtitle_image.h +++ b/src/subtitle_image.h @@ -66,6 +66,7 @@ public: HAlign h_align, float v_position, VAlign v_align, + float z_position, Time fade_up_time, Time fade_down_time ); @@ -79,6 +80,7 @@ public: HAlign h_align, float v_position, VAlign v_align, + float z_position, Time fade_up_time, Time fade_down_time ); diff --git a/src/subtitle_string.cc b/src/subtitle_string.cc index 7f7c74a5..91a129da 100644 --- a/src/subtitle_string.cc +++ b/src/subtitle_string.cc @@ -67,6 +67,7 @@ SubtitleString::SubtitleString ( HAlign h_align, float v_position, VAlign v_align, + float z_position, Direction direction, string text, Effect effect, @@ -75,7 +76,7 @@ SubtitleString::SubtitleString ( Time fade_down_time, float space_before ) - : Subtitle (in, out, h_position, h_align, v_position, v_align, fade_up_time, fade_down_time) + : Subtitle(in, out, h_position, h_align, v_position, v_align, z_position, fade_up_time, fade_down_time) , _font (font) , _italic (italic) , _bold (bold) @@ -122,6 +123,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.z_position() == b.z_position() && a.direction() == b.direction() && a.text() == b.text() && a.effect() == b.effect() && @@ -167,6 +169,7 @@ dcp::operator<< (ostream& s, SubtitleString const & sub) << ", colour (" << sub.colour().r << ", " << sub.colour().g << ", " << sub.colour().b << ")" << ", vpos " << sub.v_position() << ", valign " << ((int) sub.v_align()) << ", hpos " << sub.h_position() << ", halign " << ((int) sub.h_align()) + << ", zpos " << sub.z_position() << ", direction " << ((int) sub.direction()) << ", effect " << ((int) sub.effect()) << ", effect colour (" << sub.effect_colour().r << ", " << sub.effect_colour().g << ", " << sub.effect_colour().b << ")" diff --git a/src/subtitle_string.h b/src/subtitle_string.h index 0ffa6ec5..98ff960b 100644 --- a/src/subtitle_string.h +++ b/src/subtitle_string.h @@ -70,6 +70,8 @@ public: * @param h_align Horizontal alignment point * @param v_position Vertical position as a fraction of the screen height (between 0 and 1) from v_align * @param v_align Vertical alignment point + * @param z_position Z position as a proportion of the primary picture width between -1 and +1; + * +ve moves the image away from the viewer, -ve moves it toward the viewer, 0 is in the plane of the screen. * @param direction Direction of text * @param text The text to display * @param effect Effect to use @@ -92,6 +94,7 @@ public: HAlign h_align, float v_position, VAlign v_align, + float z_position, Direction direction, std::string text, Effect effect, diff --git a/test/decryption_test.cc b/test/decryption_test.cc index ce5aeece..0f32a6f4 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -194,6 +194,7 @@ BOOST_AUTO_TEST_CASE (decryption_test2) dcp::Time(0, 0, 5, 0, 24), 0.5, dcp::HAlign::CENTER, 0.5, dcp::VAlign::CENTER, + 0, dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, diff --git a/test/interop_subtitle_test.cc b/test/interop_subtitle_test.cc index 3c500069..76aafe32 100644 --- a/test/interop_subtitle_test.cc +++ b/test/interop_subtitle_test.cc @@ -83,6 +83,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HAlign::CENTER, 0.15, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "My jacket was ", dcp::Effect::BORDER, @@ -106,6 +107,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HAlign::CENTER, 0.15, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "Idi Amin's", dcp::Effect::BORDER, @@ -132,6 +134,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HAlign::CENTER, 0.21, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "My corset was H.M. The Queen's", dcp::Effect::BORDER, @@ -155,6 +158,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HAlign::CENTER, 0.15, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "My large wonderbra", dcp::Effect::BORDER, @@ -181,6 +185,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HAlign::CENTER, 0.15, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "Once belonged to the Shah", dcp::Effect::BORDER, @@ -207,6 +212,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) dcp::HAlign::CENTER, 0.15, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "And these are Roy Hattersley's jeans", dcp::Effect::BORDER, @@ -239,6 +245,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "At afternoon tea with John Peel", dcp::Effect::BORDER, @@ -262,6 +269,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "I enquired if his accent was real", dcp::Effect::BORDER, @@ -288,6 +296,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "He said \"out of the house", dcp::Effect::BORDER, @@ -311,6 +320,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "I'm incredibly scouse", dcp::Effect::BORDER, @@ -337,6 +347,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "At home it depends how I feel.\"", dcp::Effect::BORDER, @@ -360,6 +371,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "I spent a long weekend in Brighton", dcp::Effect::BORDER, @@ -386,6 +398,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::RTL, "With the legendary Miss Enid Blyton", dcp::Effect::BORDER, @@ -409,6 +422,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::TTB, "She said \"you be Noddy", dcp::Effect::BORDER, @@ -435,6 +449,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::BTT, "That curious creature the Sphinx", dcp::Effect::BORDER, @@ -458,6 +473,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Is smarter than anyone thinks", dcp::Effect::BORDER, @@ -484,6 +500,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "It sits there and smirks", dcp::Effect::BORDER, @@ -507,6 +524,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "And you don't think it works", dcp::Effect::BORDER, @@ -533,6 +551,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Then when you're not looking, it winks.", dcp::Effect::BORDER, @@ -556,6 +575,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "When it snows you will find Sister Sledge", dcp::Effect::BORDER, @@ -582,6 +602,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Out mooning, at night, on the ledge", dcp::Effect::BORDER, @@ -605,6 +626,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "One storey down", dcp::Effect::BORDER, @@ -631,6 +653,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.89, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "HELLO", dcp::Effect::BORDER, @@ -654,6 +677,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) dcp::HAlign::CENTER, 0.95, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "WORLD", dcp::Effect::BORDER, @@ -699,6 +723,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, @@ -724,6 +749,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) dcp::HAlign::CENTER, 0.4, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "What's going ", dcp::Effect::BORDER, @@ -749,6 +775,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) dcp::HAlign::CENTER, 0.4, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "on", dcp::Effect::BORDER, @@ -808,6 +835,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, @@ -833,6 +861,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) dcp::HAlign::CENTER, 0.4, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "What's going on", dcp::Effect::BORDER, @@ -886,6 +915,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Time (0, 0, 0, 0, 24), dcp::Time (0, 0, 0, 0, 24) ) diff --git a/test/shared_subtitle_test.cc b/test/shared_subtitle_test.cc index 5d9ba9a4..9c841f90 100644 --- a/test/shared_subtitle_test.cc +++ b/test/shared_subtitle_test.cc @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test1) auto root = make_shared<dcp::order::Part>(shared_ptr<dcp::order::Part>()); auto sub1 = make_shared<dcp::order::Subtitle>(root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()); root->children.push_back (sub1); - auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR); + auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR); sub1->children.push_back (text1); text1->font._values["font"] = "Inconsolata"; text1->font._values["size"] = "42"; @@ -127,11 +127,11 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test2) auto root = make_shared<dcp::order::Part>(shared_ptr<dcp::order::Part> ()); auto sub1 = make_shared<dcp::order::Subtitle>(root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()); root->children.push_back (sub1); - auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR); + auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR); sub1->children.push_back (text1); text1->font._values["font"] = "Inconsolata"; text1->font._values["size"] = "42"; - auto text2 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR); + auto text2 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR); sub1->children.push_back (text2); text2->font._values["font"] = "Inconsolata"; text2->font._values["size"] = "48"; @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test3) auto root = make_shared<dcp::order::Part>(shared_ptr<dcp::order::Part> ()); auto sub1 = make_shared<dcp::order::Subtitle>(root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()); root->children.push_back (sub1); - auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR); + auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR); sub1->children.push_back (text1); dcp::order::Font font; font._values["font"] = "Inconsolata"; diff --git a/test/smpte_subtitle_test.cc b/test/smpte_subtitle_test.cc index 347681de..cfea04c4 100644 --- a/test/smpte_subtitle_test.cc +++ b/test/smpte_subtitle_test.cc @@ -66,6 +66,7 @@ BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test) dcp::HAlign::CENTER, 0.5, dcp::VAlign::CENTER, + 0, dcp::Direction::LTR, "Hello", dcp::Effect::NONE, @@ -194,6 +195,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, @@ -219,6 +221,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) dcp::HAlign::CENTER, 0.4, dcp::VAlign::BOTTOM, + 0, dcp::Direction::RTL, "What's going ", dcp::Effect::BORDER, @@ -244,6 +247,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) dcp::HAlign::CENTER, 0.4, dcp::VAlign::BOTTOM, + 0, dcp::Direction::RTL, "on", dcp::Effect::BORDER, @@ -310,6 +314,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Testing is ", dcp::Effect::NONE, @@ -335,6 +340,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "really", dcp::Effect::NONE, @@ -360,6 +366,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, " fun", dcp::Effect::NONE, @@ -385,6 +392,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) dcp::HAlign::CENTER, 0.9, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "This is the ", dcp::Effect::NONE, @@ -410,6 +418,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) dcp::HAlign::CENTER, 0.9, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "second", dcp::Effect::NONE, @@ -435,6 +444,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) dcp::HAlign::CENTER, 0.9, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, " line", dcp::Effect::NONE, @@ -491,6 +501,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Time (0, 0, 0, 0, 24), dcp::Time (0, 0, 0, 0, 24) ) @@ -546,6 +557,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_top_alignment) dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Top line", dcp::Effect::NONE, @@ -571,6 +583,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_top_alignment) dcp::HAlign::CENTER, 0.9, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Bottom line", dcp::Effect::NONE, @@ -632,6 +645,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_bottom_alignment) dcp::HAlign::CENTER, 0.8, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "Top line", dcp::Effect::NONE, @@ -657,6 +671,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_bottom_alignment) dcp::HAlign::CENTER, 0.7, dcp::VAlign::BOTTOM, + 0, dcp::Direction::LTR, "Bottom line", dcp::Effect::NONE, diff --git a/test/test.cc b/test/test.cc index bfee68f7..a2016e92 100644 --- a/test/test.cc +++ b/test/test.cc @@ -400,6 +400,7 @@ simple_subtitle () dcp::HAlign::CENTER, 0.8, dcp::VAlign::TOP, + 0, dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, diff --git a/test/verify_test.cc b/test/verify_test.cc index 0b65c9d3..6dfcc58a 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -1256,6 +1256,7 @@ add_test_subtitle (shared_ptr<dcp::SubtitleAsset> asset, int start_frame, int en dcp::HAlign::CENTER, v_position, v_align, + 0, dcp::Direction::LTR, text, dcp::Effect::NONE, |
