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;
{
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;
}
}
- _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 ();
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));
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));