diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-03-15 00:49:41 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-03-17 00:24:27 +0000 |
| commit | 2d60083498861ac30c751dbf0ca387573df6dc68 (patch) | |
| tree | e98e7631415074b492d1422149f10f6e55367a42 /src/reel_mxf.cc | |
| parent | ea487953c7e51ec5c16087d739a42981ec9d0ff9 (diff) | |
Move asset refs and hash from ReelAsset to ReelMXF.
Diffstat (limited to 'src/reel_mxf.cc')
| -rw-r--r-- | src/reel_mxf.cc | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/reel_mxf.cc b/src/reel_mxf.cc index 9c2d3b60..f170157e 100644 --- a/src/reel_mxf.cc +++ b/src/reel_mxf.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -43,16 +43,39 @@ using boost::shared_ptr; using boost::optional; using namespace dcp; -ReelMXF::ReelMXF (optional<string> key_id) - : _key_id (key_id) +ReelMXF::ReelMXF (shared_ptr<Asset> asset, optional<string> key_id) + : _asset_ref (asset) + , _key_id (key_id) + , _hash (asset->hash()) { } ReelMXF::ReelMXF (shared_ptr<const cxml::Node> node) - : _key_id (node->optional_string_child ("KeyId")) + : _asset_ref (remove_urn_uuid(node->string_child("Id"))) + , _key_id (node->optional_string_child ("KeyId")) + , _hash (node->optional_string_child ("Hash")) { if (_key_id) { _key_id = remove_urn_uuid (*_key_id); } } + +bool +ReelMXF::mxf_equals (shared_ptr<const ReelMXF> other, EqualityOptions opt, NoteHandler note) const +{ + 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 (_asset_ref.resolved() && other->_asset_ref.resolved()) { + return _asset_ref->equals (other->_asset_ref.asset(), opt, note); + } + + return true; +} |
