diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-09 13:48:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-09 13:48:35 +0100 |
| commit | 58c574239f98b03f253934d061d976bdb3e30899 (patch) | |
| tree | aaa2ce9f918185d1c33b343e47e51761fa697780 /src | |
| parent | 0dc52cd6e69890cd8a2c539e80389ea8bac5cc3c (diff) | |
Save and re-load DCP content.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/content_factory.cc | 3 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 15 | ||||
| -rw-r--r-- | src/lib/dcp_content.h | 6 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index 789496d08..73e333816 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -26,6 +26,7 @@ #include "image_content.h" #include "sndfile_content.h" #include "subrip_content.h" +#include "dcp_content.h" #include "util.h" using std::string; @@ -54,6 +55,8 @@ content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, l content.reset (new SndfileContent (film, node, version)); } else if (type == "SubRip") { content.reset (new SubRipContent (film, node, version)); + } else if (type == "DCP") { + content.reset (new DCPContent (film, node, version)); } return content; diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 3d4a48b89..8b809a1bd 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -39,6 +39,16 @@ DCPContent::DCPContent (shared_ptr<const Film> f, boost::filesystem::path p) read_directory (p); } +DCPContent::DCPContent (shared_ptr<const Film> f, cxml::ConstNodePtr node, int version) + : Content (f, node) + , VideoContent (f, node, version) + , SingleStreamAudioContent (f, node, version) + , SubtitleContent (f, node, version) +{ + _name = node->string_child ("Name"); + _directory = node->string_child ("Directory"); +} + void DCPContent::read_directory (boost::filesystem::path p) { @@ -82,9 +92,14 @@ void DCPContent::as_xml (xmlpp::Node* node) const { node->add_child("Type")->add_child_text ("DCP"); + Content::as_xml (node); VideoContent::as_xml (node); SingleStreamAudioContent::as_xml (node); + SubtitleContent::as_xml (node); + + node->add_child("Name")->add_child_text (_name); + node->add_child("Directory")->add_child_text (_directory.string ()); } DCPTime diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 22b5fa08d..a6ef97400 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -17,6 +17,7 @@ */ +#include <libcxml/cxml.h> #include "video_content.h" #include "single_stream_audio_content.h" #include "subtitle_content.h" @@ -25,6 +26,7 @@ class DCPContent : public VideoContent, public SingleStreamAudioContent, public { public: DCPContent (boost::shared_ptr<const Film> f, boost::filesystem::path p); + DCPContent (boost::shared_ptr<const Film> f, cxml::ConstNodePtr, int version); boost::shared_ptr<DCPContent> shared_from_this () { return boost::dynamic_pointer_cast<DCPContent> (Content::shared_from_this ()); @@ -44,7 +46,7 @@ public: private: void read_directory (boost::filesystem::path); - - boost::filesystem::path _directory; + std::string _name; + boost::filesystem::path _directory; }; |
