summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-07-24 20:42:50 +0100
committerCarl Hetherington <cth@carlh.net>2019-07-24 20:42:50 +0100
commit335ef709439cd3678f6813a3fb880110e4c9cb26 (patch)
tree31ce9d5b82eb789d702133ab64493bd7b20ded93 /src/lib
parent697d21c3f9bc6243151372f988936662b9993510 (diff)
Optimise the feel of some GUI functions by doing the seek after
many content changes in an idle handler, rather than blocking the UI update until the seek and image redisplay have finished.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/butler.cc8
-rw-r--r--src/lib/butler.h2
-rw-r--r--src/lib/ffmpeg_encoder.cc2
3 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index 8c46d5190..2d6c46c7e 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -216,12 +216,16 @@ try
_arrived.notify_all ();
}
+/** @param blocking true if we should block until video is available. If blocking is false
+ * and no video is immediately available the method will return a 0 PlayerVideo and the error AGAIN.
+ * @param e if non-0 this is filled with an error code (if an error occurs) or is untouched if no error occurs.
+ */
pair<shared_ptr<PlayerVideo>, DCPTime>
-Butler::get_video (Error* e)
+Butler::get_video (bool blocking, Error* e)
{
boost::mutex::scoped_lock lm (_mutex);
- if (_suspended) {
+ if (_suspended || (_video.empty() && !blocking)) {
if (e) {
*e = AGAIN;
}
diff --git a/src/lib/butler.h b/src/lib/butler.h
index 09c182f9c..e5581ccb4 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -54,7 +54,7 @@ public:
AGAIN
};
- std::pair<boost::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> get_video (Error* e = 0);
+ std::pair<boost::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> get_video (bool blocking, Error* e = 0);
boost::optional<dcpomatic::DCPTime> get_audio (float* out, Frame frames);
boost::optional<TextRingBuffers::Data> get_closed_caption ();
diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc
index 7c641f5ab..572e7ae16 100644
--- a/src/lib/ffmpeg_encoder.cc
+++ b/src/lib/ffmpeg_encoder.cc
@@ -150,7 +150,7 @@ FFmpegEncoder::go ()
}
for (int j = 0; j < gets_per_frame; ++j) {
- pair<shared_ptr<PlayerVideo>, DCPTime> v = _butler->get_video ();
+ pair<shared_ptr<PlayerVideo>, DCPTime> v = _butler->get_video (true, 0);
encoder->get(v.first->eyes())->video(v.first, v.second);
}