Hand-apply d3bc61f0af33fedf02ac1a28cf91989ee9cd2fb6 from master;
[dcpomatic.git] / src / lib / content.cc
index 21e49a2c955ae7e74091ec5c1a43f4e9e238b857..ec16b961015ee19a8eb6d1b487e297879adf53e5 100644 (file)
@@ -32,6 +32,7 @@
 #include "exceptions.h"
 #include "film.h"
 #include "safe_stringstream.h"
+#include "job.h"
 
 #include "i18n.h"
 
@@ -88,7 +89,7 @@ Content::Content (shared_ptr<const Film> f, cxml::ConstNodePtr node)
        for (list<cxml::NodePtr>::const_iterator i = path_children.begin(); i != path_children.end(); ++i) {
                _paths.push_back ((*i)->content ());
        }
-       _digest = node->string_child ("Digest");
+       _digest = node->optional_string_child ("Digest");
        _position = DCPTime (node->number_child<double> ("Position"));
        _trim_start = DCPTime (node->number_child<double> ("TrimStart"));
        _trim_end = DCPTime (node->number_child<double> ("TrimEnd"));
@@ -124,15 +125,23 @@ Content::as_xml (xmlpp::Node* node) const
        for (vector<boost::filesystem::path>::const_iterator i = _paths.begin(); i != _paths.end(); ++i) {
                node->add_child("Path")->add_child_text (i->string ());
        }
-       node->add_child("Digest")->add_child_text (_digest);
+       if (_digest) {
+               node->add_child("Digest")->add_child_text (_digest.get ());
+       }
        node->add_child("Position")->add_child_text (raw_convert<string> (_position.get ()));
        node->add_child("TrimStart")->add_child_text (raw_convert<string> (_trim_start.get ()));
        node->add_child("TrimEnd")->add_child_text (raw_convert<string> (_trim_end.get ()));
 }
 
 void
-Content::examine (shared_ptr<Job> job)
+Content::examine (shared_ptr<Job> job, bool calculate_digest)
 {
+       if (!calculate_digest) {
+               return;
+       }
+
+       job->sub (_("Computing digest"));
+       
        boost::mutex::scoped_lock lm (_mutex);
        vector<boost::filesystem::path> p = _paths;
        lm.unlock ();