Merge master.
[dcpomatic.git] / src / lib / imagemagick_decoder.cc
index 508863e3e003d43350524ee46ec2b966cc1fe82a..6a2be1a7ca720560666d955da64eb5651c7eeef2 100644 (file)
@@ -61,12 +61,14 @@ ImageMagickDecoder::video_length () const
 bool
 ImageMagickDecoder::pass ()
 {
-       if (_position > 0 && _position < _imagemagick_content->video_length ()) {
-               repeat_last_video ();
+       if (_position < 0 || _position >= _imagemagick_content->video_length ()) {
+               return true;
+       }
+
+       if (have_last_video ()) {
+               repeat_last_video (double (_position) / 24);
                _position++;
                return false;
-       } else if (_position >= _imagemagick_content->video_length ()) {
-               return true;
        }
        
        Magick::Image* magick_image = new Magick::Image (_imagemagick_content->file().string ());
@@ -90,7 +92,7 @@ ImageMagickDecoder::pass ()
 
        image = image->crop (_film->crop(), true);
        
-       emit_video (image, 0);
+       emit_video (image, double (_position) / 24);
 
        ++_position;
        return false;