diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content.h | 2 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 7 | ||||
| -rw-r--r-- | src/lib/playlist.h | 4 | ||||
| -rw-r--r-- | src/lib/spl.cc | 2 | ||||
| -rw-r--r-- | src/lib/spl.h | 9 | ||||
| -rw-r--r-- | src/lib/wscript | 1 |
6 files changed, 22 insertions, 3 deletions
diff --git a/src/lib/content.h b/src/lib/content.h index 55cf4acae..96359fadb 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -184,7 +184,7 @@ public: std::string calculate_digest () const; - /* CHANGE_PENDING and CHANGE_CANCELLED may be emitted from any thread; CHANGE_DONE always from GUI thread */ + /* CHANGE_TYPE_PENDING and CHANGE_TYPE_CANCELLED may be emitted from any thread; CHANGE_TYPE_DONE always from GUI thread */ boost::signals2::signal<void (ChangeType, boost::weak_ptr<Content>, int, bool)> Change; boost::shared_ptr<VideoContent> video; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index c10235f9b..f530d2ee3 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -68,6 +68,13 @@ Playlist::~Playlist () void Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ptr<Content> content, int property, bool frequent) { + /* Make sure we only hear about atomic changes (e.g. a PENDING always with the DONE/CANCELLED) + Ignore any DONE/CANCELLED that arrives without a PENDING. + */ + if (_checker.send (type, property)) { + return; + } + shared_ptr<const Film> film = weak_film.lock (); DCPOMATIC_ASSERT (film); diff --git a/src/lib/playlist.h b/src/lib/playlist.h index d9140bdfb..dd43ed2e3 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -23,6 +23,7 @@ #include "util.h" #include "frame_rate_change.h" +#include "atomicity_checker.h" #include <libcxml/cxml.h> #include <boost/shared_ptr.hpp> #include <boost/signals2.hpp> @@ -90,6 +91,7 @@ private: bool _sequence; bool _sequencing; std::list<boost::signals2::connection> _content_connections; + AtomicityChecker _checker; }; #endif diff --git a/src/lib/spl.cc b/src/lib/spl.cc index 2cba229c1..cd33c4047 100644 --- a/src/lib/spl.cc +++ b/src/lib/spl.cc @@ -35,6 +35,7 @@ SPL::read (boost::filesystem::path path, ContentStore* store) _missing = false; cxml::Document doc ("SPL"); doc.read_file (path); + _id = doc.string_child("Id"); BOOST_FOREACH (cxml::ConstNodePtr i, doc.node_children("Entry")) { shared_ptr<Content> c = store->get(i->string_child("Digest")); if (c) { @@ -52,6 +53,7 @@ SPL::write (boost::filesystem::path path) const { xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("SPL"); + root->add_child("Id")->add_child_text (_id); BOOST_FOREACH (SPLEntry i, _spl) { i.as_xml (root->add_child("Entry")); } diff --git a/src/lib/spl.h b/src/lib/spl.h index b94c08571..b19ef7e7a 100644 --- a/src/lib/spl.h +++ b/src/lib/spl.h @@ -22,6 +22,7 @@ #define DCPOMATIC_SPL_H #include "spl_entry.h" +#include <dcp/util.h> class ContentStore; @@ -29,7 +30,8 @@ class SPL { public: SPL () - : _missing (false) + : _id (dcp::make_uuid()) + , _missing (false) {} void add (SPLEntry e) { @@ -55,6 +57,10 @@ public: void read (boost::filesystem::path path, ContentStore* store); void write (boost::filesystem::path path) const; + std::string id () const { + return _id; + } + std::string name () const { return _name; } @@ -64,6 +70,7 @@ public: } private: + std::string _id; std::string _name; std::vector<SPLEntry> _spl; /** true if any content was missing when read() was last called on this SPL */ diff --git a/src/lib/wscript b/src/lib/wscript index e2aeb7107..62881e95d 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -24,6 +24,7 @@ sources = """ active_text.cc analyse_audio_job.cc atmos_mxf_content.cc + atomicity_checker.cc audio_analysis.cc audio_buffers.cc audio_content.cc |
