summaryrefslogtreecommitdiff
path: root/src/lib/subtitle_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-10 14:41:51 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-10 14:41:51 +0100
commit9053a8274c32c57041a1f8a7fdb0206abbbd4f50 (patch)
treecc15478d01738a3b02da74d7f2ec2bb57043bb69 /src/lib/subtitle_decoder.cc
parent7ecfc2b34b0c50f1859e70287fd7e5bfc0c50ce4 (diff)
Go back to referencing subrip from the top of the frame.
Diffstat (limited to 'src/lib/subtitle_decoder.cc')
-rw-r--r--src/lib/subtitle_decoder.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/subtitle_decoder.cc b/src/lib/subtitle_decoder.cc
index d210c578f..f8f179587 100644
--- a/src/lib/subtitle_decoder.cc
+++ b/src/lib/subtitle_decoder.cc
@@ -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);