summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-08-02 16:00:47 +0100
committerCarl Hetherington <cth@carlh.net>2017-08-14 21:07:48 +0100
commit7a3f4f1b6411f7d15bf00e863fb5e70a5d930dd8 (patch)
treed00041a7602ab4f21ce11377b4a1754cb6d43bd1
parentd66bcea066deb3b3cd919a69aab7e2078fb52ca8 (diff)
Remove Film dependency from Empty.
-rw-r--r--src/lib/empty.cc6
-rw-r--r--src/lib/empty.h2
-rw-r--r--src/lib/player.cc4
-rw-r--r--test/empty_test.cc4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/empty.cc b/src/lib/empty.cc
index 98bf1f3d1..68a153b07 100644
--- a/src/lib/empty.cc
+++ b/src/lib/empty.cc
@@ -34,16 +34,16 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::function;
-Empty::Empty (shared_ptr<const Film> film, function<shared_ptr<ContentPart> (Content *)> part)
+Empty::Empty (ContentList content, DCPTime length, function<shared_ptr<ContentPart> (Content *)> part)
{
list<DCPTimePeriod> full;
- BOOST_FOREACH (shared_ptr<Content> i, film->content()) {
+ BOOST_FOREACH (shared_ptr<Content> i, content) {
if (part (i.get())) {
full.push_back (DCPTimePeriod (i->position(), i->end()));
}
}
- _periods = subtract (DCPTimePeriod(DCPTime(), film->length()), coalesce(full));
+ _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
if (!_periods.empty ()) {
_position = _periods.front().from;
diff --git a/src/lib/empty.h b/src/lib/empty.h
index ee1171428..d8b00047f 100644
--- a/src/lib/empty.h
+++ b/src/lib/empty.h
@@ -31,7 +31,7 @@ class Empty
{
public:
Empty () {}
- Empty (boost::shared_ptr<const Film> film, boost::function<boost::shared_ptr<ContentPart> (Content *)> part);
+ Empty (ContentList content, DCPTime length, boost::function<boost::shared_ptr<ContentPart> (Content *)> part);
DCPTime position () const {
return _position;
diff --git a/src/lib/player.cc b/src/lib/player.cc
index db09d1768..3d191a302 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -156,8 +156,8 @@ Player::setup_pieces ()
}
}
- _black = Empty (_film, bind(&Content::video, _1));
- _silent = Empty (_film, bind(&Content::audio, _1));
+ _black = Empty (_film->content(), _film->length(), bind(&Content::video, _1));
+ _silent = Empty (_film->content(), _film->length(), bind(&Content::audio, _1));
_last_video_time = DCPTime ();
_last_audio_time = DCPTime ();
diff --git a/test/empty_test.cc b/test/empty_test.cc
index 326ae9530..713972739 100644
--- a/test/empty_test.cc
+++ b/test/empty_test.cc
@@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE (empty_test1)
contentB->video->set_length (1);
contentB->set_position (DCPTime::from_frames (7, vfr));
- Empty black (film, bind(&Content::video, _1));
+ Empty black (film->content(), film->length(), bind(&Content::video, _1));
BOOST_REQUIRE_EQUAL (black._periods.size(), 2);
BOOST_CHECK (black._periods.front().from == DCPTime());
BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(2, vfr));
@@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE (empty_test2)
contentB->video->set_length (1);
contentB->set_position (DCPTime::from_frames (7, vfr));
- Empty black (film, bind(&Content::video, _1));
+ Empty black (film->content(), film->length(), bind(&Content::video, _1));
BOOST_REQUIRE_EQUAL (black._periods.size(), 1);
BOOST_CHECK (black._periods.front().from == DCPTime::from_frames(3, vfr));
BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(7, vfr));