FIXME: Remove all use of add_child() from xmlpp.
[dcpomatic.git] / src / lib / image_content.cc
index 9464babd4656fe61f3aa65fa6bfd7775f095b334..1ac6e085bdc6cebbefdfad195b4fb5a4628b96b1 100644 (file)
 #include "image_examiner.h"
 #include "image_filename_sorter.h"
 #include "job.h"
+#include "util.h"
 #include "video_content.h"
 #include <libcxml/cxml.h>
+#include <dcp/filesystem.h>
 #include <libxml++/libxml++.h>
 #include <iostream>
 
@@ -48,7 +50,7 @@ ImageContent::ImageContent (boost::filesystem::path p)
 {
        video = make_shared<VideoContent>(this);
 
-       if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
+       if (dcp::filesystem::is_regular_file(p) && valid_image_file(p)) {
                add_path (p);
        } else {
                _path_to_scan = p;
@@ -61,7 +63,7 @@ ImageContent::ImageContent (boost::filesystem::path p)
 ImageContent::ImageContent (cxml::ConstNodePtr node, int version)
        : Content (node)
 {
-       video = VideoContent::from_xml (this, node, version);
+       video = VideoContent::from_xml (this, node, version, VideoRange::FULL);
 }
 
 
@@ -97,13 +99,13 @@ ImageContent::technical_summary () const
 
 
 void
-ImageContent::as_xml (xmlpp::Node* node, bool with_paths) const
+ImageContent::as_xml(xmlpp::Element* element, bool with_paths) const
 {
-       node->add_child("Type")->add_child_text ("Image");
-       Content::as_xml (node, with_paths);
+       cxml::add_text_child(element, "Type", "Image");
+       Content::as_xml(element, with_paths);
 
        if (video) {
-               video->as_xml (node);
+               video->as_xml(element);
        }
 }
 
@@ -115,8 +117,8 @@ ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                job->sub (_("Scanning image files"));
                vector<boost::filesystem::path> paths;
                int n = 0;
-               for (auto i: boost::filesystem::directory_iterator(*_path_to_scan)) {
-                       if (boost::filesystem::is_regular_file(i.path()) && valid_image_file (i.path())) {
+               for (auto i: dcp::filesystem::directory_iterator(*_path_to_scan)) {
+                       if (dcp::filesystem::is_regular_file(i.path()) && valid_image_file(i.path())) {
                                paths.push_back (i.path());
                        }
                        ++n;
@@ -136,7 +138,7 @@ ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        Content::examine (film, job);
 
        auto examiner = make_shared<ImageExaminer>(film, shared_from_this(), job);
-       video->take_from_examiner (examiner);
+       video->take_from_examiner(film, examiner);
        set_default_colour_conversion ();
 }