summaryrefslogtreecommitdiff
path: root/src/lib/player.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/player.cc')
-rw-r--r--src/lib/player.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 8fd5715d4..6ee8c5029 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -238,6 +238,10 @@ Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image
work_image = im;
}
+#ifdef DCPOMATIC_DEBUG
+ _last_video = piece->content;
+#endif
+
Video (work_image, same, time);
time += TIME_HZ / _film->dcp_video_frame_rate();
@@ -348,7 +352,10 @@ Player::flush ()
}
-/** @return true on error */
+/** Seek so that the next pass() will yield (approximately) the requested frame.
+ * Pass accurate = true to try harder to get close to the request.
+ * @return true on error
+ */
void
Player::seek (Time t, bool accurate)
{
@@ -374,11 +381,16 @@ Player::seek (Time t, bool accurate)
(*i)->video_position = (*i)->audio_position = vc->start() + s;
FrameRateConversion frc (vc->video_frame_rate(), _film->dcp_video_frame_rate());
- VideoContent::Frame f = s * vc->video_frame_rate() / (frc.factor() * TIME_HZ);
+ /* Here we are converting from time (in the DCP) to a frame number in the content.
+ Hence we need to use the DCP's frame rate and the double/skip correction, not
+ the source's rate.
+ */
+ VideoContent::Frame f = s * _film->dcp_video_frame_rate() / (frc.factor() * TIME_HZ);
dynamic_pointer_cast<VideoDecoder>((*i)->decoder)->seek (f, accurate);
}
_video_position = _audio_position = t;
+
/* XXX: don't seek audio because we don't need to... */
}
@@ -501,6 +513,10 @@ Player::resampler (shared_ptr<AudioContent> c)
void
Player::emit_black ()
{
+#ifdef DCPOMATIC_DEBUG
+ _last_video.reset ();
+#endif
+
/* XXX: use same here */
Video (_black_frame, false, _video_position);
_video_position += _film->video_frames_to_time (1);