X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Freel_asset.cc;h=c4432f212635f7aab6db95586e7c4c5b86273b95;hb=db536bd9f9f16b79286c5f0bb54d0f283050f7dd;hp=04f34904abfacfa785205ba34facf0de30f8ab0a;hpb=6425742f95a4c2e539061b29016a4a5bd10ac9ae;p=libdcp.git diff --git a/src/reel_asset.cc b/src/reel_asset.cc index 04f34904..c4432f21 100644 --- a/src/reel_asset.cc +++ b/src/reel_asset.cc @@ -1,20 +1,34 @@ /* Copyright (C) 2014-2015 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of libdcp. + + libdcp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + libdcp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - + along with libdcp. If not, see . + + In addition, as a special exception, the copyright holders give + permission to link the code of portions of this program with the + OpenSSL library under certain conditions as described in each + individual source file, and distribute linked combinations + including the two. + + You must obey the GNU General Public License in all respects + for all of the code used other than OpenSSL. If you modify + file(s) with this exception, you may extend this exception to your + version of the file(s), but you are not obligated to do so. If you + do not wish to do so, delete this exception statement from your + version. If you delete this exception statement from all source + files in the program, then also delete it here. */ /** @file src/reel_asset.cc @@ -27,8 +41,10 @@ #include "compose.hpp" #include #include +#include using std::pair; +using std::cout; using std::string; using std::stringstream; using std::make_pair; @@ -58,26 +74,23 @@ ReelAsset::ReelAsset (shared_ptr asset, Fraction edit_rate, int64_t intri , _intrinsic_duration (intrinsic_duration) , _entry_point (entry_point) , _duration (intrinsic_duration - entry_point) - , _hash (make_digest (asset->file (), 0)) + , _hash (asset->hash ()) { /* default _annotation_text to the leaf name of our file */ _annotation_text = asset->file().leaf().string (); } ReelAsset::ReelAsset (shared_ptr node) - : Object (node->string_child ("Id")) + : Object (remove_urn_uuid (node->string_child ("Id"))) , _asset_ref (_id) , _annotation_text (node->optional_string_child ("AnnotationText").get_value_or ("")) , _edit_rate (Fraction (node->string_child ("EditRate"))) , _intrinsic_duration (node->number_child ("IntrinsicDuration")) , _entry_point (node->number_child ("EntryPoint")) , _duration (node->number_child ("Duration")) - , _hash (node->optional_string_child ("Hash").get_value_or ("")) + , _hash (node->optional_string_child ("Hash")) { - if (_id.length() > 9) { - _id = _id.substr (9); - _asset_ref.set_id (_id); - } + } void @@ -94,7 +107,9 @@ ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const a->add_child("IntrinsicDuration")->add_child_text (raw_convert (_intrinsic_duration)); a->add_child("EntryPoint")->add_child_text (raw_convert (_entry_point)); a->add_child("Duration")->add_child_text (raw_convert (_duration)); - a->add_child("Hash")->add_child_text (_asset_ref.object()->hash ()); + if (_hash) { + a->add_child("Hash")->add_child_text (_hash.get()); + } } pair @@ -147,7 +162,7 @@ ReelAsset::equals (shared_ptr other, EqualityOptions opt, NoteH } if (_asset_ref.resolved () && other->_asset_ref.resolved ()) { - return _asset_ref->equals (other->_asset_ref.object (), opt, note); + return _asset_ref->equals (other->_asset_ref.asset(), opt, note); } return true;