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)
{
}
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 (...) {
delete magick_image;
- video (_image, false, _video_position);
+ video (_image, _video_position);
++_video_position;
return false;
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 ());
}