Cache film length for Player::pass.
[dcpomatic.git] / src / lib / text_decoder.cc
index d6cf517c2e04393706ffcf81593c24fc91598dda..4e2432463c260565fbe7829344d970e6d935ce7d 100644 (file)
@@ -36,14 +36,14 @@ using std::min;
 using boost::shared_ptr;
 using boost::optional;
 using boost::function;
+using namespace dcpomatic;
 
 TextDecoder::TextDecoder (
        Decoder* parent,
        shared_ptr<const TextContent> c,
-       shared_ptr<Log> log,
        ContentTime first
        )
-       : DecoderPart (parent, log)
+       : DecoderPart (parent)
        , _content (c)
        , _position (first)
 {
@@ -148,9 +148,14 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
 
                                v_align = dcp::VALIGN_TOP;
                        } else {
-                               DCPOMATIC_ASSERT (i.vertical_position.proportional);
                                DCPOMATIC_ASSERT (i.vertical_position.reference);
-                               v_position = i.vertical_position.proportional.get();
+                               if (i.vertical_position.proportional) {
+                                       v_position = i.vertical_position.proportional.get();
+                               } else {
+                                       DCPOMATIC_ASSERT (i.vertical_position.line);
+                                       DCPOMATIC_ASSERT (i.vertical_position.lines);
+                                       v_position = float(*i.vertical_position.line) / *i.vertical_position.lines;
+                               }
 
                                if (lowest_proportional) {
                                        /* Adjust line spacing */