X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fimage_decoder.cc;h=5de0c8582facb1aca80ed8d03479bdf2928331d4;hb=9c5a7319d807063c22d6bc165ee414ce82e26965;hp=c9b17add8a11036b7f5458cb063acff3de2e9b78;hpb=09806bc8d6a48fc79d923ec1cdf6f90176bf8b6a;p=dcpomatic.git diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index c9b17add8..5de0c8582 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -32,9 +32,8 @@ using std::cout; using boost::shared_ptr; using dcp::Size; -ImageDecoder::ImageDecoder (shared_ptr f, shared_ptr c) - : Decoder (f) - , VideoDecoder (f, c) +ImageDecoder::ImageDecoder (shared_ptr c) + : VideoDecoder (c) , _image_content (c) { @@ -43,21 +42,19 @@ ImageDecoder::ImageDecoder (shared_ptr f, shared_ptr= _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_position += ContentTime::from_frames (1, _image_content->video_frame_rate ()); + 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.frames (_image_content->video_frame_rate ()) - ); + boost::filesystem::path const path = _image_content->path (_image_content->still() ? 0 : _video_position); try { magick_image = new Magick::Image (path.string ()); @@ -85,8 +82,8 @@ ImageDecoder::pass () delete magick_image; - video (_image, false, _video_position); - _video_position += ContentTime::from_frames (1, _image_content->video_frame_rate ()); + video (_image, _video_position); + ++_video_position; return false; } @@ -94,6 +91,6 @@ ImageDecoder::pass () void ImageDecoder::seek (ContentTime time, bool accurate) { - Decoder::seek (time, accurate); - _video_position = time; + VideoDecoder::seek (time, accurate); + _video_position = time.frames (_image_content->video_frame_rate ()); }