diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-02-16 10:40:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-02-16 10:40:12 +0100 |
| commit | bb949ec65adf95f4a2c7dd5ee7e97b9daaaf3d3f (patch) | |
| tree | 09153b297f7cebd3f13ab58188982366185298f6 /src/lib/playlist.cc | |
| parent | 39d51cddeeea82e602ab1925430b0dfb5752ac79 (diff) | |
C++11 tidying.
Diffstat (limited to 'src/lib/playlist.cc')
| -rw-r--r-- | src/lib/playlist.cc | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 20534e467..e8714e9d6 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,6 +18,7 @@ */ + #include "playlist.h" #include "video_content.h" #include "text_content.h" @@ -39,6 +40,7 @@ #include "i18n.h" + using std::list; using std::cout; using std::vector; @@ -55,13 +57,13 @@ using namespace dcpomatic; using namespace boost::placeholders; #endif + Playlist::Playlist () - : _sequence (true) - , _sequencing (false) { } + Playlist::~Playlist () { boost::mutex::scoped_lock lm (_mutex); @@ -69,6 +71,7 @@ Playlist::~Playlist () disconnect (); } + void Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ptr<Content> content, int property, bool frequent) { @@ -117,6 +120,7 @@ Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ ContentChange (type, content, property, frequent); } + void Playlist::maybe_sequence (shared_ptr<const Film> film) { @@ -126,7 +130,7 @@ Playlist::maybe_sequence (shared_ptr<const Film> film) _sequencing = true; - ContentList cont = content (); + auto cont = content (); /* Keep track of the content that we've set the position of so that we don't do it twice. @@ -171,6 +175,7 @@ Playlist::maybe_sequence (shared_ptr<const Film> film) _sequencing = false; } + string Playlist::video_identifier () const { @@ -193,6 +198,7 @@ Playlist::video_identifier () const return digester.get (); } + /** @param film Film that this Playlist is for. * @param node <Playlist> node. * @param version Metadata version number. @@ -227,7 +233,7 @@ Playlist::set_from_xml (shared_ptr<const Film> film, cxml::ConstNodePtr node, in } /* ...or have a start trim which is an integer number of frames */ - ContentTime const old_trim = content->trim_start(); + auto const old_trim = content->trim_start(); content->set_trim_start(old_trim); if (old_trim != content->trim_start()) { string note = _("Your project contains video content whose trim was not aligned to a frame boundary."); @@ -255,6 +261,7 @@ Playlist::set_from_xml (shared_ptr<const Film> film, cxml::ConstNodePtr node, in reconnect (film); } + /** @param node <Playlist> node. * @param with_content_paths true to include <Path> nodes in <Content> nodes, false to omit them. */ @@ -266,6 +273,7 @@ Playlist::as_xml (xmlpp::Node* node, bool with_content_paths) } } + void Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c) { @@ -283,6 +291,7 @@ Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c) LengthChange (); } + void Playlist::remove (shared_ptr<Content> c) { @@ -316,6 +325,7 @@ Playlist::remove (shared_ptr<Content> c) LengthChange (); } + void Playlist::remove (ContentList c) { @@ -325,7 +335,7 @@ Playlist::remove (ContentList c) boost::mutex::scoped_lock lm (_mutex); for (auto i: c) { - ContentList::iterator j = _content.begin (); + auto j = _content.begin (); while (j != _content.end() && *j != i) { ++j; } @@ -343,6 +353,7 @@ Playlist::remove (ContentList c) LengthChange (); } + class FrameRateCandidate { public: @@ -355,6 +366,7 @@ public: int dcp; }; + /** @return the best frame rate from Config::_allowed_dcp_frame_rates for the content in this list */ int Playlist::best_video_frame_rate () const @@ -412,6 +424,7 @@ Playlist::best_video_frame_rate () const return best->dcp; } + /** @return length of the playlist from time 0 to the last thing on the playlist */ DCPTime Playlist::length (shared_ptr<const Film> film) const @@ -424,6 +437,7 @@ Playlist::length (shared_ptr<const Film> film) const return len; } + /** @return position of the first thing on the playlist, if it's not empty */ optional<DCPTime> Playlist::start () const @@ -441,6 +455,7 @@ Playlist::start () const return start; } + /** Must be called with a lock held on _mutex */ void Playlist::disconnect () @@ -452,6 +467,7 @@ Playlist::disconnect () _content_connections.clear (); } + /** Must be called with a lock held on _mutex */ void Playlist::reconnect (shared_ptr<const Film> film) @@ -463,6 +479,7 @@ Playlist::reconnect (shared_ptr<const Film> film) } } + DCPTime Playlist::video_end (shared_ptr<const Film> film) const { @@ -476,6 +493,7 @@ Playlist::video_end (shared_ptr<const Film> film) const return end; } + DCPTime Playlist::text_end (shared_ptr<const Film> film) const { @@ -489,10 +507,11 @@ Playlist::text_end (shared_ptr<const Film> film) const return end; } + FrameRateChange Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const { - ContentList cont = content (); + auto cont = content (); for (ContentList::const_reverse_iterator i = cont.rbegin(); i != cont.rend(); ++i) { if (!(*i)->video) { continue; @@ -515,12 +534,14 @@ Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const return FrameRateChange (dcp_video_frame_rate, dcp_video_frame_rate); } + void Playlist::set_sequence (bool s) { _sequence = s; } + bool ContentSorter::operator() (shared_ptr<Content> a, shared_ptr<Content> b) { @@ -539,6 +560,7 @@ ContentSorter::operator() (shared_ptr<Content> a, shared_ptr<Content> b) return a->digest() < b->digest(); } + /** @return content in ascending order of position */ ContentList Playlist::content () const @@ -547,10 +569,11 @@ Playlist::content () const return _content; } + void Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n) { - pair<DCPTime, DCPTime> range (DCPTime::max (), DCPTime ()); + pair<DCPTime, DCPTime> range (DCPTime::max(), DCPTime()); for (auto i: c) { range.first = min (range.first, i->position ()); range.second = max (range.second, i->position ()); @@ -580,6 +603,7 @@ Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n) Change (ChangeType::DONE); } + void Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c) { @@ -603,6 +627,7 @@ Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c) c->set_position (film, p); } + void Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c) { @@ -627,6 +652,7 @@ Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c) c->set_position (film, c->position() + next_c->length_after_trim(film)); } + int64_t Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const { @@ -649,6 +675,7 @@ Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, i return video + audio + 65536; } + string Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) const { @@ -674,6 +701,7 @@ Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) co return best_summary; } + pair<double, double> Playlist::speed_up_range (int dcp_video_frame_rate) const { |
