std::shared_ptr
[dcpomatic.git] / src / lib / empty.cc
index 98bf1f3d186e2619d864706e82dbebde22b2b108..00baaeb141e86a7d4a12ae7abb5181ed583f055b 100644 (file)
 #include "content_part.h"
 #include "dcp_content.h"
 #include "dcpomatic_time_coalesce.h"
+#include "piece.h"
 #include <boost/foreach.hpp>
 #include <iostream>
 
 using std::cout;
 using std::list;
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
 using boost::function;
+using namespace dcpomatic;
 
-Empty::Empty (shared_ptr<const Film> film, function<shared_ptr<ContentPart> (Content *)> part)
+Empty::Empty (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist, function<bool (shared_ptr<const Content>)> part, DCPTime length)
 {
        list<DCPTimePeriod> full;
-       BOOST_FOREACH (shared_ptr<Content> i, film->content()) {
-               if (part (i.get())) {
-                       full.push_back (DCPTimePeriod (i->position(), i->end()));
+       BOOST_FOREACH (shared_ptr<Content> i, playlist->content()) {
+               if (part(i)) {
+                       full.push_back (DCPTimePeriod (i->position(), i->end(film)));
                }
        }
 
-       _periods = subtract (DCPTimePeriod(DCPTime(), film->length()), coalesce(full));
+       _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
 
        if (!_periods.empty ()) {
                _position = _periods.front().from;