It builds.
[dcpomatic.git] / src / lib / image_decoder.cc
index d8d551ef7943310eab3ade64c80cbc9b4257d06d..5de0c8582facb1aca80ed8d03479bdf2928331d4 100644 (file)
@@ -32,11 +32,9 @@ using std::cout;
 using boost::shared_ptr;
 using dcp::Size;
 
-ImageDecoder::ImageDecoder (shared_ptr<const Film> f, shared_ptr<const ImageContent> c)
-       : Decoder (f)
-       , VideoDecoder (f, c)
+ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
+       : VideoDecoder (c)
        , _image_content (c)
-       , _video_position (0)
 {
 
 }
@@ -44,18 +42,20 @@ ImageDecoder::ImageDecoder (shared_ptr<const Film> f, shared_ptr<const ImageCont
 bool
 ImageDecoder::pass ()
 {
-       if (_video_position >= _image_content->video_length ()) {
+       if (_video_position >= _image_content->video_length().frames (_image_content->video_frame_rate ())) {
                return true;
        }
 
        if (_image && _image_content->still ()) {
-               video (_image, true, _video_position);
+               video (_image, _video_position);
                ++_video_position;
                return false;
        }
 
        Magick::Image* magick_image = 0;
+
        boost::filesystem::path const path = _image_content->path (_image_content->still() ? 0 : _video_position);
+       
        try {
                magick_image = new Magick::Image (path.string ());
        } catch (...) {
@@ -82,7 +82,7 @@ ImageDecoder::pass ()
 
        delete magick_image;
 
-       video (_image, false, _video_position);
+       video (_image, _video_position);
        ++_video_position;
 
        return false;
@@ -91,7 +91,6 @@ ImageDecoder::pass ()
 void
 ImageDecoder::seek (ContentTime time, bool accurate)
 {
-       Decoder::seek (time, accurate);
-       
-       _video_position = rint (time * _video_content->video_frame_rate() / TIME_HZ);
+       VideoDecoder::seek (time, accurate);
+       _video_position = time.frames (_image_content->video_frame_rate ());
 }