Various range fixes.
[dcpomatic.git] / src / lib / film.cc
index cd5fc6535053bb46e87413d13c0516ce96524ed0..26edc80b07a00bbd38d3d83af825cb56a88ebf38 100644 (file)
@@ -63,6 +63,7 @@ using std::ifstream;
 using std::ofstream;
 using std::setfill;
 using std::min;
+using std::make_pair;
 using boost::shared_ptr;
 using boost::lexical_cast;
 using boost::to_upper_copy;
@@ -257,6 +258,9 @@ Film::make_dcp (bool transcode)
        o->out_size = format()->dcp_size ();
        o->padding = format()->dcp_padding (shared_from_this ());
        o->ratio = format()->ratio_as_float (shared_from_this ());
+       if (dcp_length ()) {
+               o->decode_range = make_pair (dcp_trim_start(), dcp_trim_start() + dcp_length().get());
+       }
        o->decode_subtitles = with_subtitles ();
        o->decode_video_skip = dcp_frame_rate (frames_per_second()).skip;
 
@@ -877,7 +881,7 @@ Film::set_content (string c)
                shared_ptr<Options> o (new Options ("", "", ""));
                o->out_size = Size (1024, 1024);
                
-               shared_ptr<Decoder> d = decoder_factory (shared_from_this(), o, 0);
+               shared_ptr<Decoder> d = decoder_factory (shared_from_this(), o, 0, 0);
                
                set_size (d->native_size ());
                set_frames_per_second (d->frames_per_second ());