No-op: remove all trailing whitespace.
[dcpomatic.git] / src / lib / subrip_decoder.cc
index ed154ebf5b89ff7fa3a44666f5d2c8ac4d12d5bc..c2bd4f3e0bd7dc8fa35167bc726447bca72958d2 100644 (file)
@@ -24,6 +24,7 @@
 using std::list;
 using std::vector;
 using std::string;
+using std::cout;
 using boost::shared_ptr;
 using boost::optional;
 
@@ -39,9 +40,9 @@ void
 SubRipDecoder::seek (ContentTime time, bool accurate)
 {
        SubtitleDecoder::seek (time, accurate);
-       
+
        _next = 0;
-       while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.metric().get().all_as_seconds ()) < time) {
+       while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
                ++_next;
        }
 }
@@ -53,37 +54,27 @@ SubRipDecoder::pass ()
                return true;
        }
 
+       /* XXX: we are ignoring positioning specified in the file */
+
        list<dcp::SubtitleString> out;
        for (list<sub::Line>::const_iterator i = _subtitles[_next].lines.begin(); i != _subtitles[_next].lines.end(); ++i) {
                for (list<sub::Block>::const_iterator j = i->blocks.begin(); j != i->blocks.end(); ++j) {
-
-                       dcp::VAlign va = dcp::TOP;
-                       if (i->vertical_position.reference) {
-                               switch (i->vertical_position.reference.get ()) {
-                               case sub::TOP_OF_SCREEN:
-                                       va = dcp::TOP;
-                                       break;
-                               case sub::CENTRE_OF_SCREEN:
-                                       va = dcp::CENTER;
-                                       break;
-                               case sub::BOTTOM_OF_SCREEN:
-                                       va = dcp::BOTTOM;
-                               }
-                       }
-                       
                        out.push_back (
                                dcp::SubtitleString (
                                        SubRipContent::font_id,
                                        j->italic,
-                                       dcp::Color (255, 255, 255),
-                                       j->font_size,
-                                       dcp::Time (rint (_subtitles[_next].from.metric().get().all_as_milliseconds() / 4)),
-                                       dcp::Time (rint (_subtitles[_next].to.metric().get().all_as_milliseconds() / 4)),
+                                       dcp::Colour (255, 255, 255),
+                                       j->font_size.points (72 * 11),
+                                       1.0,
+                                       dcp::Time (_subtitles[_next].from.all_as_seconds()),
+                                       dcp::Time (_subtitles[_next].to.all_as_seconds()),
+                                       0,
+                                       dcp::HALIGN_CENTER,
                                        i->vertical_position.line.get() * (1.5 / 22) + 0.8,
-                                       va,
+                                       dcp::VALIGN_TOP,
                                        j->text,
                                        dcp::NONE,
-                                       dcp::Color (255, 255, 255),
+                                       dcp::Colour (255, 255, 255),
                                        0,
                                        0
                                        )
@@ -97,7 +88,13 @@ SubRipDecoder::pass ()
 }
 
 list<ContentTimePeriod>
-SubRipDecoder::subtitles_during (ContentTimePeriod p, bool starting) const
+SubRipDecoder::image_subtitles_during (ContentTimePeriod, bool) const
+{
+       return list<ContentTimePeriod> ();
+}
+
+list<ContentTimePeriod>
+SubRipDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const
 {
        /* XXX: inefficient */
 
@@ -106,10 +103,10 @@ SubRipDecoder::subtitles_during (ContentTimePeriod p, bool starting) const
        for (vector<sub::Subtitle>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
 
                ContentTimePeriod t (
-                       ContentTime::from_seconds (i->from.metric().get().all_as_seconds()),
-                       ContentTime::from_seconds (i->to.metric().get().all_as_seconds())
+                       ContentTime::from_seconds (i->from.all_as_seconds()),
+                       ContentTime::from_seconds (i->to.all_as_seconds())
                        );
-               
+
                if ((starting && p.contains (t.from)) || (!starting && p.overlaps (t))) {
                        d.push_back (t);
                }