summaryrefslogtreecommitdiff
path: root/src/reel_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-22 00:49:15 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-22 00:49:15 +0100
commit595d4fbfee788edfad7f9f8dfe7e76ee634c1a94 (patch)
treea4a3f440c20cd1460eb823bcfb34d1503b39c4f7 /src/reel_asset.cc
parent81daf10958b05fc0d617d421617da33ab45f2f4c (diff)
Various attempts to clean up DCP comparison code.
Diffstat (limited to 'src/reel_asset.cc')
-rw-r--r--src/reel_asset.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index 0c7c6e51..978f1dee 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -25,6 +25,7 @@
using std::pair;
using std::string;
+using std::stringstream;
using std::make_pair;
using boost::shared_ptr;
using namespace dcp;
@@ -97,3 +98,49 @@ ReelAsset::cpl_node_attribute (Standard) const
{
return make_pair ("", "");
}
+
+bool
+ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const
+{
+ if (_annotation_text != other->_annotation_text) {
+ stringstream s;
+ s << "Reel: annotation texts differ (" << _annotation_text << " vs " << other->_annotation_text << ")\n";
+ note (DCP_ERROR, s.str ());
+ return false;
+ }
+
+ if (_edit_rate != other->_edit_rate) {
+ note (DCP_ERROR, "Reel: edit rates differ");
+ return false;
+ }
+
+ if (_intrinsic_duration != other->_intrinsic_duration) {
+ note (DCP_ERROR, "Reel: intrinsic durations differ");
+ return false;
+ }
+
+ if (_entry_point != other->_entry_point) {
+ note (DCP_ERROR, "Reel: entry points differ");
+ return false;
+ }
+
+ if (_duration != other->_duration) {
+ note (DCP_ERROR, "Reel: durations differ");
+ return false;
+ }
+
+ if (_hash != other->_hash) {
+ if (!opt.reel_hashes_can_differ) {
+ note (DCP_ERROR, "Reel: hashes differ");
+ return false;
+ } else {
+ note (DCP_NOTE, "Reel: hashes differ");
+ }
+ }
+
+ if (_content.resolved () && other->_content.resolved ()) {
+ return _content->equals (other->_content.object (), opt, note);
+ }
+
+ return true;
+}