X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Freel_sound_asset.cc;h=165453ced012a15a95bb5dcfaa20e0f61c19a00d;hb=689d56339857b0a82156641f28392b8d2f11beea;hp=984434ddc26d93b8a49c59ac1f3309e8451afa8e;hpb=bfb33feb40c5b014e9eae3958b1ecb8161f1d090;p=libdcp.git diff --git a/src/reel_sound_asset.cc b/src/reel_sound_asset.cc index 984434dd..165453ce 100644 --- a/src/reel_sound_asset.cc +++ b/src/reel_sound_asset.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,20 +22,24 @@ */ #include "reel_sound_asset.h" +#include "dcp_assert.h" #include +#include using std::string; using boost::shared_ptr; using namespace dcp; -ReelSoundAsset::ReelSoundAsset (boost::shared_ptr content, int64_t entry_point) - : ReelAsset (content, entry_point) +ReelSoundAsset::ReelSoundAsset (shared_ptr asset, int64_t entry_point) + : ReelAsset (asset, asset->edit_rate(), asset->intrinsic_duration(), entry_point) + , ReelMXF (asset->key_id()) { } -ReelSoundAsset::ReelSoundAsset (boost::shared_ptr node) +ReelSoundAsset::ReelSoundAsset (shared_ptr node) : ReelAsset (node) + , ReelMXF (node) { node->ignore_child ("Language"); node->done (); @@ -46,3 +50,23 @@ ReelSoundAsset::cpl_node_name () const { return "MainSound"; } + +string +ReelSoundAsset::key_type () const +{ + return "MDAK"; +} + +void +ReelSoundAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const +{ + ReelAsset::write_to_cpl (node, standard); + + if (key_id ()) { + /* Find */ + xmlpp::Node* ms = find_child (node, cpl_node_name ()); + /* Find */ + xmlpp::Node* hash = find_child (ms, "Hash"); + ms->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id().get ()); + } +}