From 5d3ebbb2e7844485e8dddd6471209d56b05633ae Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Mar 2014 13:53:51 +0000 Subject: Cope with loading films with now-disabled filters. --- src/lib/content.cc | 5 ++++- src/lib/content_factory.cc | 5 +++-- src/lib/content_factory.h | 2 +- src/lib/ffmpeg_content.cc | 9 +++++++-- src/lib/ffmpeg_content.h | 2 +- src/lib/film.cc | 12 +++++++++--- src/lib/film.h | 2 +- src/lib/playlist.cc | 4 ++-- src/lib/playlist.h | 2 +- 9 files changed, 29 insertions(+), 14 deletions(-) (limited to 'src/lib') diff --git a/src/lib/content.cc b/src/lib/content.cc index 1883dfb4a..829468247 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -195,7 +195,10 @@ Content::clone () const xmlpp::Document doc; xmlpp::Node* node = doc.create_root_node ("Content"); as_xml (node); - return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version); + + /* notes is unused here (we assume) */ + list notes; + return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version, notes); } string diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index bab22b8eb..98b1dd859 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -24,17 +24,18 @@ #include "util.h" using std::string; +using std::list; using boost::shared_ptr; shared_ptr -content_factory (shared_ptr film, cxml::NodePtr node, int version) +content_factory (shared_ptr film, cxml::NodePtr node, int version, list& notes) { string const type = node->string_child ("Type"); boost::shared_ptr content; if (type == "FFmpeg") { - content.reset (new FFmpegContent (film, node, version)); + content.reset (new FFmpegContent (film, node, version, notes)); } else if (type == "Image") { content.reset (new ImageContent (film, node, version)); } else if (type == "Sndfile") { diff --git a/src/lib/content_factory.h b/src/lib/content_factory.h index 071d925e0..2eeebbc9f 100644 --- a/src/lib/content_factory.h +++ b/src/lib/content_factory.h @@ -19,5 +19,5 @@ class Film; -extern boost::shared_ptr content_factory (boost::shared_ptr, cxml::NodePtr, int); +extern boost::shared_ptr content_factory (boost::shared_ptr, cxml::NodePtr, int, std::list &); extern boost::shared_ptr content_factory (boost::shared_ptr, boost::filesystem::path); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index e52e36f78..fadeec9cd 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -58,7 +58,7 @@ FFmpegContent::FFmpegContent (shared_ptr f, boost::filesystem::path } -FFmpegContent::FFmpegContent (shared_ptr f, shared_ptr node, int version) +FFmpegContent::FFmpegContent (shared_ptr f, shared_ptr node, int version, list& notes) : Content (f, node) , VideoContent (f, node, version) , AudioContent (f, node) @@ -82,7 +82,12 @@ FFmpegContent::FFmpegContent (shared_ptr f, shared_ptrnode_children ("Filter"); for (list::iterator i = c.begin(); i != c.end(); ++i) { - _filters.push_back (Filter::from_id ((*i)->content ())); + Filter const * f = Filter::from_id ((*i)->content ()); + if (f) { + _filters.push_back (f); + } else { + notes.push_back (String::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), (*i)->content())); + } } _first_video = node->optional_number_child ("FirstVideo"); diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 9600666b3..6ab95d2fe 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -127,7 +127,7 @@ class FFmpegContent : public VideoContent, public AudioContent, public SubtitleC { public: FFmpegContent (boost::shared_ptr, boost::filesystem::path); - FFmpegContent (boost::shared_ptr, boost::shared_ptr, int version); + FFmpegContent (boost::shared_ptr, boost::shared_ptr, int version, std::list &); FFmpegContent (boost::shared_ptr, std::vector >); boost::shared_ptr shared_from_this () { diff --git a/src/lib/film.cc b/src/lib/film.cc index 8aa0deed0..04692fc1e 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -381,8 +381,10 @@ Film::write_metadata () const _dirty = false; } -/** Read state from our metadata file */ -void +/** Read state from our metadata file. + * @return Notes about things that the user should know about, or empty. + */ +list Film::read_metadata () { LocaleGuard lg; @@ -430,9 +432,13 @@ Film::read_metadata () _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); _key = libdcp::Key (f.string_child ("Key")); - _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version); + + list notes; + /* This method is the only one that can return notes (so far) */ + _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); _dirty = false; + return notes; } /** Given a directory name, return its full path within the Film's directory. diff --git a/src/lib/film.h b/src/lib/film.h index de9891c9f..162b67b35 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -83,7 +83,7 @@ public: boost::filesystem::path file (boost::filesystem::path f) const; boost::filesystem::path dir (boost::filesystem::path d) const; - void read_metadata (); + std::list read_metadata (); void write_metadata () const; boost::shared_ptr metadata () const; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index daa82cb94..608323e3b 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -113,11 +113,11 @@ Playlist::video_identifier () const /** @param node node */ void -Playlist::set_from_xml (shared_ptr film, shared_ptr node, int version) +Playlist::set_from_xml (shared_ptr film, shared_ptr node, int version, list& notes) { list c = node->node_children ("Content"); for (list::iterator i = c.begin(); i != c.end(); ++i) { - _content.push_back (content_factory (film, *i, version)); + _content.push_back (content_factory (film, *i, version, notes)); } sort (_content.begin(), _content.end(), ContentSorter ()); diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 1915e3d04..394023f5c 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -56,7 +56,7 @@ public: ~Playlist (); void as_xml (xmlpp::Node *); - void set_from_xml (boost::shared_ptr, boost::shared_ptr, int); + void set_from_xml (boost::shared_ptr, boost::shared_ptr, int, std::list &); void add (boost::shared_ptr); void remove (boost::shared_ptr); -- cgit v1.2.3