X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.cc;h=ab7649be151f5e3dd1834bf6b3c84c61712d9ae1;hb=a5d004b0773f633401528392fc28e66d70e13ac8;hp=b96b0fbe0edf48a809ba93f89c28e87de56a5b08;hpb=cc6c991ddd53e2f151140cbadef2da660cd7d6a3;p=dcpomatic.git diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index b96b0fbe0..ab7649be1 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -34,8 +34,7 @@ #include "compose.hpp" #include #include -#include -#include +#include #include #include "i18n.h" @@ -48,10 +47,13 @@ using std::max; using std::string; using std::pair; using boost::optional; -using boost::shared_ptr; -using boost::weak_ptr; -using boost::dynamic_pointer_cast; +using std::shared_ptr; +using std::weak_ptr; +using std::dynamic_pointer_cast; using namespace dcpomatic; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif Playlist::Playlist () : _sequence (true) @@ -135,7 +137,7 @@ Playlist::maybe_sequence (shared_ptr film) DCPTime next_left; DCPTime next_right; - BOOST_FOREACH (shared_ptr i, cont) { + for (auto i: cont) { if (!i->video) { continue; } @@ -154,7 +156,7 @@ Playlist::maybe_sequence (shared_ptr film) /* Captions */ DCPTime next; - BOOST_FOREACH (shared_ptr i, cont) { + for (auto i: cont) { if (i->text.empty() || find (placed.begin(), placed.end(), i) != placed.end()) { continue; } @@ -174,9 +176,9 @@ Playlist::video_identifier () const { string t; - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { bool burn = false; - BOOST_FOREACH (shared_ptr j, i->text) { + for (auto j: i->text) { if (j->burn()) { burn = true; } @@ -201,7 +203,7 @@ Playlist::set_from_xml (shared_ptr film, cxml::ConstNodePtr node, in { boost::mutex::scoped_lock lm (_mutex); - BOOST_FOREACH (cxml::NodePtr i, node->node_children ("Content")) { + for (auto i: node->node_children ("Content")) { shared_ptr content = content_factory (i, version, notes); /* See if this content should be nudged to start on a video frame */ @@ -259,7 +261,7 @@ Playlist::set_from_xml (shared_ptr film, cxml::ConstNodePtr node, in void Playlist::as_xml (xmlpp::Node* node, bool with_content_paths) { - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { i->as_xml (node->add_child ("Content"), with_content_paths); } } @@ -322,7 +324,7 @@ Playlist::remove (ContentList c) { boost::mutex::scoped_lock lm (_mutex); - BOOST_FOREACH (shared_ptr i, c) { + for (auto i: c) { ContentList::iterator j = _content.begin (); while (j != _content.end() && *j != i) { ++j; @@ -363,12 +365,12 @@ Playlist::best_video_frame_rate () const list candidates; /* Start with the ones without skip / repeat so they will get matched in preference to skipped/repeated ones */ - BOOST_FOREACH (int i, allowed_dcp_frame_rates) { + for (auto i: allowed_dcp_frame_rates) { candidates.push_back (FrameRateCandidate(i, i)); } /* Then the skip/repeat ones */ - BOOST_FOREACH (int i, allowed_dcp_frame_rates) { + for (auto i: allowed_dcp_frame_rates) { candidates.push_back (FrameRateCandidate (float(i) / 2, i)); candidates.push_back (FrameRateCandidate (float(i) * 2, i)); } @@ -380,7 +382,7 @@ Playlist::best_video_frame_rate () const while (i != candidates.end()) { float this_error = 0; - BOOST_FOREACH (shared_ptr j, content()) { + for (auto j: content()) { if (!j->video || !j->video_frame_rate()) { continue; } @@ -415,7 +417,7 @@ DCPTime Playlist::length (shared_ptr film) const { DCPTime len; - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { len = max (len, i->end(film)); } @@ -432,7 +434,7 @@ Playlist::start () const } DCPTime start = DCPTime::max (); - BOOST_FOREACH (shared_ptr i, cont) { + for (auto i: cont) { start = min (start, i->position ()); } @@ -443,7 +445,7 @@ Playlist::start () const void Playlist::disconnect () { - BOOST_FOREACH (boost::signals2::connection& i, _content_connections) { + for (auto& i: _content_connections) { i.disconnect (); } @@ -456,7 +458,7 @@ Playlist::reconnect (shared_ptr film) { disconnect (); - BOOST_FOREACH (shared_ptr i, _content) { + for (auto i: _content) { _content_connections.push_back (i->Change.connect(boost::bind(&Playlist::content_change, this, film, _1, _2, _3, _4))); } } @@ -465,7 +467,7 @@ DCPTime Playlist::video_end (shared_ptr film) const { DCPTime end; - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { if (i->video) { end = max (end, i->end(film)); } @@ -478,7 +480,7 @@ DCPTime Playlist::text_end (shared_ptr film) const { DCPTime end; - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { if (!i->text.empty ()) { end = max (end, i->end(film)); } @@ -549,7 +551,7 @@ void Playlist::repeat (shared_ptr film, ContentList c, int n) { pair range (DCPTime::max (), DCPTime ()); - BOOST_FOREACH (shared_ptr i, c) { + for (auto i: c) { range.first = min (range.first, i->position ()); range.second = max (range.second, i->position ()); range.first = min (range.first, i->end(film)); @@ -563,7 +565,7 @@ Playlist::repeat (shared_ptr film, ContentList c, int n) DCPTime pos = range.second; for (int i = 0; i < n; ++i) { - BOOST_FOREACH (shared_ptr j, c) { + for (auto j: c) { shared_ptr copy = j->clone (); copy->set_position (film, pos + copy->position() - range.first); _content.push_back (copy); @@ -631,7 +633,7 @@ Playlist::required_disk_space (shared_ptr film, int j2k_bandwidth, i int64_t video = uint64_t (j2k_bandwidth / 8) * length(film).seconds(); int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length(film).seconds(); - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { shared_ptr d = dynamic_pointer_cast (i); if (d) { if (d->reference_video()) { @@ -652,7 +654,7 @@ Playlist::content_summary (shared_ptr film, DCPTimePeriod period) co { string best_summary; int best_score = -1; - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { int score = 0; optional const o = DCPTimePeriod(i->position(), i->end(film)).overlap (period); if (o) { @@ -677,7 +679,7 @@ Playlist::speed_up_range (int dcp_video_frame_rate) const { pair range (DBL_MAX, -DBL_MAX); - BOOST_FOREACH (shared_ptr i, content()) { + for (auto i: content()) { if (!i->video) { continue; }