Use get_pixel_size rather than get_size which is slightly nicer as we then don't...
[dcpomatic.git] / src / lib / reel_writer.cc
index c8d848933a566e040afaa4d611efab346995e8ad..609ea8437b28a1ec377319563dcc1cd70655c2a2 100644 (file)
 
 using std::list;
 using std::string;
+using std::cout;
 using boost::shared_ptr;
 using boost::optional;
 using boost::dynamic_pointer_cast;
+using dcp::Data;
 
 int const ReelWriter::_info_size = 48;
 
@@ -197,7 +199,7 @@ ReelWriter::check_existing_picture_asset ()
 
        bool ok = false;
 
-       while (!ok) {
+       while (!ok && _first_nonexistant_frame > 0) {
                /* Read the data from the info file; for 3D we just check the left
                   frames until we find a good one.
                */
@@ -226,7 +228,7 @@ ReelWriter::check_existing_picture_asset ()
                }
        }
 
-       if (!_film->three_d ()) {
+       if (!_film->three_d() && ok) {
                /* If we are doing 3D we might have found a good L frame with no R, so only
                   do this if we're in 2D and we've just found a good B(oth) frame.
                */
@@ -484,7 +486,9 @@ ReelWriter::write (PlayerSubtitles subs)
                }
        }
 
-       for (list<dcp::SubtitleString>::const_iterator i = subs.text.begin(); i != subs.text.end(); ++i) {
-               _subtitle_asset->add (*i);
+       BOOST_FOREACH (dcp::SubtitleString i, subs.text) {
+               i.set_in  (i.in()  - dcp::Time (_period.from.seconds(), i.in().tcr));
+               i.set_out (i.out() - dcp::Time (_period.from.seconds(), i.out().tcr));
+               _subtitle_asset->add (i);
        }
 }