summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-10-16 11:46:36 +0100
committerCarl Hetherington <cth@carlh.net>2013-10-16 11:46:36 +0100
commite24d0def5b4e6c1825620b032af9f63c9eb78693 (patch)
tree1f4ce6093545c9ecc25e227e6ebfc7575810e6b5 /src/lib
parent2f460fefd66910a232960b0cf345912f988c82e0 (diff)
Optimise the fetch-same-frame case a bit (#196).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc24
-rw-r--r--src/lib/player.h10
2 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index ff484e749..a235d1622 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -190,6 +190,13 @@ Player::pass ()
void
Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image, Eyes eyes, bool same, VideoContent::Frame frame)
{
+ /* Keep a note of what came in so that we can repeat it if required */
+ _last_process_video.weak_piece = weak_piece;
+ _last_process_video.image = image;
+ _last_process_video.eyes = eyes;
+ _last_process_video.same = same;
+ _last_process_video.frame = frame;
+
shared_ptr<Piece> piece = weak_piece.lock ();
if (!piece) {
return;
@@ -608,3 +615,20 @@ Player::update_subtitle ()
_out_subtitle.from = _in_subtitle.from + piece->content->position ();
_out_subtitle.to = _in_subtitle.to + piece->content->position ();
}
+
+/** Re-emit the last frame that was emitted, using current settings for crop, ratio, scaler and subtitles */
+void
+Player::repeat_last_video ()
+{
+ if (!_last_process_video.image) {
+ return;
+ }
+
+ process_video (
+ _last_process_video.weak_piece,
+ _last_process_video.image,
+ _last_process_video.eyes,
+ _last_process_video.same,
+ _last_process_video.frame
+ );
+}
diff --git a/src/lib/player.h b/src/lib/player.h
index 2261f66ea..5604d8e03 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -59,6 +59,8 @@ public:
void set_video_container_size (libdcp::Size);
+ void repeat_last_video ();
+
/** Emitted when a video frame is ready.
* First parameter is the video image.
* Second parameter is the eye(s) that should see this image.
@@ -138,6 +140,14 @@ private:
bool _last_emit_was_black;
+ struct {
+ boost::weak_ptr<Piece> weak_piece;
+ boost::shared_ptr<const Image> image;
+ Eyes eyes;
+ bool same;
+ VideoContent::Frame frame;
+ } _last_process_video;
+
boost::signals2::scoped_connection _playlist_changed_connection;
boost::signals2::scoped_connection _playlist_content_changed_connection;
boost::signals2::scoped_connection _film_changed_connection;