summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-09-04 23:04:10 +0100
committerCarl Hetherington <cth@carlh.net>2018-09-04 23:04:10 +0100
commit4227af1dc74eeb042f6b7bb4a02df2bf89225b0d (patch)
tree3de70cf8c1c7442a8306b1c53ff32e4fc630f3d7 /src
parent33e4b489cf5077058dc7b679a75df708d444cfd0 (diff)
parent4a7ece0ebcb4cc8515822fdb6c9baec0394c935b (diff)
Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
Diffstat (limited to 'src')
-rw-r--r--src/lib/butler.cc14
-rw-r--r--src/lib/butler.h8
-rw-r--r--src/lib/decoder_factory.cc2
-rw-r--r--src/wx/film_viewer.cc7
4 files changed, 26 insertions, 5 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index a127ee9bd..3e408c4d5 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -190,17 +190,27 @@ try
}
pair<shared_ptr<PlayerVideo>, DCPTime>
-Butler::get_video ()
+Butler::get_video (Error* e)
{
boost::mutex::scoped_lock lm (_mutex);
+ if (_suspended) {
+ if (e) {
+ *e = AGAIN;
+ }
+ return make_pair(shared_ptr<PlayerVideo>(), DCPTime());
+ }
+
/* Wait for data if we have none */
while (_video.empty() && !_finished && !_died) {
_arrived.wait (lm);
}
if (_video.empty()) {
- return make_pair (shared_ptr<PlayerVideo>(), DCPTime());
+ if (e) {
+ *e = NONE;
+ }
+ return make_pair(shared_ptr<PlayerVideo>(), DCPTime());
}
pair<shared_ptr<PlayerVideo>, DCPTime> const r = _video.get ();
diff --git a/src/lib/butler.h b/src/lib/butler.h
index 4322c401d..fb133d108 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -41,7 +41,13 @@ public:
~Butler ();
void seek (DCPTime position, bool accurate);
- std::pair<boost::shared_ptr<PlayerVideo>, DCPTime> get_video ();
+
+ enum Error {
+ NONE,
+ AGAIN
+ };
+
+ std::pair<boost::shared_ptr<PlayerVideo>, DCPTime> get_video (Error* e = 0);
boost::optional<DCPTime> get_audio (float* out, Frame frames);
boost::optional<TextRingBuffers::Data> get_closed_caption ();
diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc
index b9baefa80..df23ef6f6 100644
--- a/src/lib/decoder_factory.cc
+++ b/src/lib/decoder_factory.cc
@@ -50,7 +50,7 @@ decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fa
return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
} catch (KDMError& e) {
/* This will be found and reported to the user when the content is examined */
- return 0;
+ return shared_ptr<Decoder>();
}
}
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 76e269975..d954e1818 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -294,7 +294,12 @@ FilmViewer::get ()
DCPOMATIC_ASSERT (_butler);
do {
- _player_video = _butler->get_video ();
+ Butler::Error e;
+ _player_video = _butler->get_video (&e);
+ if (!_player_video.first && e == Butler::AGAIN) {
+ signal_manager->when_idle (boost::bind(&FilmViewer::get, this));
+ return;
+ }
} while (
_player_video.first &&
_film->three_d() &&