summaryrefslogtreecommitdiff
path: root/src/lib/image_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-04 20:22:47 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-04 20:22:47 +0000
commit1b1bc528ee5ca1fee1bd33f9fb6f79cd551e3b33 (patch)
treed60b9fb573dd8d6ab89036fb8788cd1b1c69aada /src/lib/image_decoder.cc
parent6d8bcba724be622739a749064466901486304cee (diff)
New DCPTime/ContentTime types.
Diffstat (limited to 'src/lib/image_decoder.cc')
-rw-r--r--src/lib/image_decoder.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc
index d8d551ef7..c9b17add8 100644
--- a/src/lib/image_decoder.cc
+++ b/src/lib/image_decoder.cc
@@ -36,7 +36,6 @@ ImageDecoder::ImageDecoder (shared_ptr<const Film> f, shared_ptr<const ImageCont
: Decoder (f)
, VideoDecoder (f, c)
, _image_content (c)
- , _video_position (0)
{
}
@@ -50,12 +49,16 @@ ImageDecoder::pass ()
if (_image && _image_content->still ()) {
video (_image, true, _video_position);
- ++_video_position;
+ _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 (...) {
@@ -83,7 +86,7 @@ ImageDecoder::pass ()
delete magick_image;
video (_image, false, _video_position);
- ++_video_position;
+ _video_position += ContentTime::from_frames (1, _image_content->video_frame_rate ());
return false;
}
@@ -92,6 +95,5 @@ void
ImageDecoder::seek (ContentTime time, bool accurate)
{
Decoder::seek (time, accurate);
-
- _video_position = rint (time * _video_content->video_frame_rate() / TIME_HZ);
+ _video_position = time;
}