Go back to referencing subrip from the top of the frame.
authorCarl Hetherington <cth@carlh.net>
Fri, 10 Jun 2016 13:41:51 +0000 (14:41 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 10 Jun 2016 13:41:51 +0000 (14:41 +0100)
src/lib/subtitle_decoder.cc

index d210c578fd712a16517d680b952efe7f4dfc124e..f8f179587f6be35d85b10f0ff848a79d13639ef7 100644 (file)
@@ -141,9 +141,14 @@ SubtitleDecoder::give_text (ContentTimePeriod period, sub::Subtitle const & subt
 {
        /* See if our next subtitle needs to be placed on screen by us */
        bool needs_placement = false;
+       optional<int> bottom_line;
        BOOST_FOREACH (sub::Line i, subtitle.lines) {
                if (!i.vertical_position.reference || i.vertical_position.reference.get() == sub::TOP_OF_SUBTITLE) {
                        needs_placement = true;
+                       DCPOMATIC_ASSERT (i.vertical_position.line);
+                       if (!bottom_line || bottom_line.get() < i.vertical_position.line.get()) {
+                               bottom_line = i.vertical_position.line.get();
+                       }
                }
        }
 
@@ -163,8 +168,8 @@ SubtitleDecoder::give_text (ContentTimePeriod period, sub::Subtitle const & subt
                                /* This 0.053 is an arbitrary value to lift the bottom sub off the bottom
                                   of the screen a bit to a pleasing degree.
                                */
-                               v_position = 0.053 + i.vertical_position.line.get() * 1.2 * j.font_size.proportional (72 * 11);
-                               v_align = dcp::VALIGN_BOTTOM;
+                               v_position = 1.015 - (1 + bottom_line.get() - i.vertical_position.line.get()) * 1.2 * j.font_size.proportional (72 * 11);
+                               v_align = dcp::VALIGN_TOP;
                        } else {
                                DCPOMATIC_ASSERT (i.vertical_position.proportional);
                                DCPOMATIC_ASSERT (i.vertical_position.reference);