diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-12-18 09:39:36 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-12-18 09:39:36 +0000 |
| commit | 9c399a21b37d83ceb2c81706975e2c46d1a3f673 (patch) | |
| tree | 5b1123cd22cad797c9587c22927f9c9249ed4ca4 /src/lib/image_decoder.cc | |
| parent | da19eaac0dd80afed3dd282d61ea3298196a5090 (diff) | |
Considerable rework of decoder timing; tests pass, at least.
Diffstat (limited to 'src/lib/image_decoder.cc')
| -rw-r--r-- | src/lib/image_decoder.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index 723690247..9e90b5bc8 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -36,20 +36,22 @@ ImageDecoder::ImageDecoder (shared_ptr<const Film> f, shared_ptr<const ImageCont : Decoder (f) , VideoDecoder (f, c) , _image_content (c) + , _video_position (0) { } -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 (_image, true, _video_position * TIME_HZ / _video_content->video_frame_rate ()); + ++_video_position; + return false; } Magick::Image* magick_image = new Magick::Image (_image_content->path (_image_content->still() ? 0 : _video_position).string ()); @@ -73,17 +75,16 @@ ImageDecoder::pass () delete magick_image; - video (_image, false, _video_position); -} + video (_image, false, _video_position * TIME_HZ / _video_content->video_frame_rate ()); + ++_video_position; -void -ImageDecoder::seek (DCPTime time, bool) -{ - _video_position = _video_content->time_to_content_video_frames (time); + 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 = rint (time * _video_content->video_frame_rate() / TIME_HZ); } |
