diff options
Diffstat (limited to 'src/lib/image_decoder.cc')
| -rw-r--r-- | src/lib/image_decoder.cc | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index a7999c02a..58ba732bb 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -30,37 +30,41 @@ using std::cout; using boost::shared_ptr; -using libdcp::Size; +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) { } -void +bool ImageDecoder::pass () { if (_video_position >= _image_content->video_length ()) { - return; + return true; } if (_image && _image_content->still ()) { video (_image, true, _video_position); - return; + _video_position += ContentTime::from_frames (1, _image_content->video_frame_rate ()); + return false; } Magick::Image* magick_image = 0; - boost::filesystem::path const path = _image_content->path (_image_content->still() ? 0 : _video_position); + + boost::filesystem::path const path = _image_content->path ( + _image_content->still() ? 0 : _video_position.frames (_image_content->video_frame_rate ()) + ); + try { magick_image = new Magick::Image (path.string ()); } catch (...) { throw OpenFileError (path); } - libdcp::Size size (magick_image->columns(), magick_image->rows()); + dcp::Size size (magick_image->columns(), magick_image->rows()); _image.reset (new Image (PIX_FMT_RGB24, size, true)); @@ -81,16 +85,14 @@ ImageDecoder::pass () delete magick_image; video (_image, false, _video_position); -} + _video_position += ContentTime::from_frames (1, _image_content->video_frame_rate ()); -void -ImageDecoder::seek (VideoContent::Frame frame, bool) -{ - _video_position = frame; + return false; } -bool -ImageDecoder::done () const +void +ImageDecoder::seek (ContentTime time, bool accurate) { - return _video_position >= _image_content->video_length (); + Decoder::seek (time, accurate); + _video_position = time; } |
