Save and re-load DCP content.
authorCarl Hetherington <cth@carlh.net>
Wed, 9 Jul 2014 12:48:35 +0000 (13:48 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 9 Jul 2014 12:48:35 +0000 (13:48 +0100)
src/lib/content_factory.cc
src/lib/dcp_content.cc
src/lib/dcp_content.h

index 789496d08e043c7d911ce2991eff4f689b3e4e68..73e3338166f76688caf53b308bd4b20f273f772a 100644 (file)
@@ -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;
index 3d4a48b89756b4a21ce5b85d4957e7ea4be5b931..8b809a1bda04141d019ae54273cd255c06246f64 100644 (file)
@@ -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
index 22b5fa08da0ba63d94818e30ea3ce77fa41d4f5f..a6ef9740033312da147145dff4cc8aec8fc7d29b 100644 (file)
@@ -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;
 };