Merge master.
[dcpomatic.git] / src / lib / subrip_content.cc
index 79a1d49999acf8849fb007a68e0188ad29d81dff..73499a5f69c384a17bc5e2ed39787afd31882af3 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "subrip_content.h"
 #include "util.h"
+#include "subrip.h"
 
 #include "i18n.h"
 
@@ -35,15 +36,18 @@ SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::pa
 
 SubRipContent::SubRipContent (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version)
        : Content (film, node)
-       , SubtitleContent (film, node)
+       , SubtitleContent (film, node, version)
 {
 
 }
 
 void
-SubRipContent::examine (boost::shared_ptr<Job>)
+SubRipContent::examine (boost::shared_ptr<Job> job)
 {
-
+       Content::examine (job);
+       SubRip s (shared_from_this ());
+       boost::mutex::scoped_lock lm (_mutex);
+       _length = s.length ();
 }
 
 string
@@ -72,10 +76,13 @@ SubRipContent::as_xml (xmlpp::Node* node)
        SubtitleContent::as_xml (node);
 }
 
-Time
+DCPTime
 SubRipContent::full_length () const
 {
-
+       /* XXX: this assumes that the timing of the SubRip file is appropriate
+          for the DCP's frame rate.
+       */
+       return _length;
 }
 
 string
@@ -86,8 +93,8 @@ SubRipContent::identifier () const
        stringstream s;
        s << Content::identifier()
          << "_" << subtitle_scale()
-         << "_" << subtitle_offset();
+         << "_" << subtitle_x_offset()
+         << "_" << subtitle_y_offset();
 
        return s.str ();
 }
-