X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Freel_asset.cc;h=037a39780e55a4a5f43eee630da1955ce77611a6;hb=6d52a032276e7de4bf1c8630f5a9c1b35b0173d7;hp=0c7c6e517a8fd6c1813b115438669778ef7a3ace;hpb=19356a292ba53b6d40270b1e74af5dad2304dbd5;p=libdcp.git diff --git a/src/reel_asset.cc b/src/reel_asset.cc index 0c7c6e51..037a3978 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 other, EqualityOptions opt, NoteHandler 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, String::compose ("Reel: intrinsic durations differ (%1 vs %2)", _intrinsic_duration, other->_intrinsic_duration)); + 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; +}