Fix (I think) AuthenticatedPublic signer.
[libdcp.git] / src / asset.cc
index 84bdd2bd4bbe68dfeffcb2892e559e06ab77723f..06b87953e4631dd42a1cff4a2b680bb0cafc2ba5 100644 (file)
@@ -24,8 +24,9 @@
 #include <iostream>
 #include <fstream>
 #include <boost/filesystem.hpp>
-#include <boost/function.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/function.hpp>
+#include <libxml++/nodes/element.h>
 #include "AS_DCP.h"
 #include "KM_util.h"
 #include "asset.h"
@@ -87,29 +88,36 @@ string
 Asset::digest () const
 {
        if (_digest.empty ()) {
-               _digest = make_digest (path().string());
+               _digest = make_digest (path().string(), 0);
        }
 
        return _digest;
 }
 
+void
+Asset::compute_digest (boost::function<void (float)> progress)
+{
+       if (!_digest.empty ()) {
+               return;
+       }
+
+       _digest = make_digest (path().string(), &progress);
+}
 
 bool
 Asset::equals (shared_ptr<const Asset> other, EqualityOptions, boost::function<void (NoteType, string)> note) const
 {
        if (_edit_rate != other->_edit_rate) {
-               note (ERROR, "MXF edit rates differ");
+               note (ERROR, "asset edit rates differ");
                return false;
        }
        
        if (_intrinsic_duration != other->_intrinsic_duration) {
-               note (ERROR, "MXF intrinsic durations differ");
-               return false;
+               note (ERROR, "asset intrinsic durations differ");
        }
 
        if (_duration != other->_duration) {
-               note (ERROR, "MXF durations differ");
-               return false;
+               note (ERROR, "asset durations differ");
        }
 
        return true;