From 82787546680784a2a6e0993ab5b570f0db3a2d4d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 5 Jun 2015 00:18:00 +0100 Subject: Rename ReelMXFAsset -> ReelEncryptableAsset. --- src/decrypted_kdm.cc | 6 ++-- src/encrypted_kdm.cc | 2 +- src/reel_encryptable_asset.cc | 71 +++++++++++++++++++++++++++++++++++++++++++ src/reel_encryptable_asset.h | 70 ++++++++++++++++++++++++++++++++++++++++++ src/reel_mxf_asset.cc | 69 ----------------------------------------- src/reel_mxf_asset.h | 66 ---------------------------------------- src/reel_picture_asset.cc | 6 ++-- src/reel_picture_asset.h | 6 ++-- src/reel_sound_asset.cc | 4 +-- src/reel_sound_asset.h | 6 ++-- src/wscript | 4 +-- 11 files changed, 158 insertions(+), 152 deletions(-) create mode 100644 src/reel_encryptable_asset.cc create mode 100644 src/reel_encryptable_asset.h delete mode 100644 src/reel_mxf_asset.cc delete mode 100644 src/reel_mxf_asset.h diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index ddcacb34..68429a73 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-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 @@ -20,7 +20,7 @@ #include "decrypted_kdm.h" #include "decrypted_kdm_key.h" #include "encrypted_kdm.h" -#include "reel_mxf_asset.h" +#include "reel_encryptable_asset.h" #include "util.h" #include "exceptions.h" #include "cpl.h" @@ -200,7 +200,7 @@ DecryptedKDM::DecryptedKDM ( { /* Create DecryptedKDMKey objects for each MXF asset */ BOOST_FOREACH(shared_ptr i, cpl->reel_assets ()) { - shared_ptr mxf = boost::dynamic_pointer_cast (i); + shared_ptr mxf = boost::dynamic_pointer_cast (i); if (mxf) { if (!mxf->key_id ()) { throw NotEncryptedError (mxf->id()); diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc index 7cae0533..4d41a066 100644 --- a/src/encrypted_kdm.cc +++ b/src/encrypted_kdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-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 diff --git a/src/reel_encryptable_asset.cc b/src/reel_encryptable_asset.cc new file mode 100644 index 00000000..957fab28 --- /dev/null +++ b/src/reel_encryptable_asset.cc @@ -0,0 +1,71 @@ +/* + Copyright (C) 2012-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 + 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, + 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. + +*/ + +#include "reel_encryptable_asset.h" +#include "mxf.h" +#include "dcp_assert.h" +#include +#include + +using std::string; +using boost::shared_ptr; +using boost::optional; +using namespace dcp; + +ReelEncryptableAsset::ReelEncryptableAsset () + : ReelAsset () +{ + +} + +ReelEncryptableAsset::ReelEncryptableAsset ( + shared_ptr asset, optional key_id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point + ) + : ReelAsset (asset, edit_rate, intrinsic_duration, entry_point) + , _key_id (key_id) +{ + +} + +ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr node) + : ReelAsset (node) + , _key_id (node->optional_string_child ("KeyId")) +{ + if (_key_id && _key_id.get().length() > 9) { + _key_id = _key_id.get().substr (9); + } +} + +void +ReelEncryptableAsset::write_to_cpl (xmlpp::Node* node, Standard s) const +{ + ReelAsset::write_to_cpl (node, s); + + xmlpp::Node::NodeList c = node->get_children (); + xmlpp::Node::NodeList::iterator i = c.begin(); + while (i != c.end() && (*i)->get_name() != cpl_node_name ()) { + ++i; + } + + DCP_ASSERT (i != c.end ()); + + if (_key_id) { + (*i)->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id.get ()); + } +} diff --git a/src/reel_encryptable_asset.h b/src/reel_encryptable_asset.h new file mode 100644 index 00000000..b1c3eb16 --- /dev/null +++ b/src/reel_encryptable_asset.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2012-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 + 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, + 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. + +*/ + +/** @file src/reel_encryptable_asset.h + * @brief ReelEncryptableAsset + */ + +#ifndef LIBDCP_REEL_ENCRYPTABLE_ASSET_H +#define LIBDCP_REEL_ENCRYPTABLE_ASSET_H + +#include "reel_asset.h" + +namespace dcp { + +/** @class ReelEncryptableAsset + * @brief Part of a Reel's description which refers to an asset which can be encrypted. + */ +class ReelEncryptableAsset : public ReelAsset +{ +public: + ReelEncryptableAsset (); + ReelEncryptableAsset ( + boost::shared_ptr asset, + boost::optional key_id, + Fraction edit_rate, + int64_t intrinsic_duration, + int64_t entry_point + ); + ReelEncryptableAsset (boost::shared_ptr); + + /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */ + virtual std::string key_type () const = 0; + + /** @return true if a KeyId is specified for this asset, implying + * that its content is encrypted. + */ + bool encrypted () const { + return _key_id; + } + + /** @return Key ID to describe the key that encrypts this asset's + * content, if there is one. + */ + boost::optional key_id () const { + return _key_id; + } + +private: + boost::optional _key_id; ///< The <KeyId> from the reel's entry for this asset, if there is one +}; + +} + +#endif diff --git a/src/reel_mxf_asset.cc b/src/reel_mxf_asset.cc deleted file mode 100644 index f32ea805..00000000 --- a/src/reel_mxf_asset.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2012-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 - 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, - 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. - -*/ - -#include "reel_mxf_asset.h" -#include "mxf.h" -#include "dcp_assert.h" -#include -#include - -using std::string; -using boost::shared_ptr; -using boost::optional; -using namespace dcp; - -ReelMXFAsset::ReelMXFAsset () - : ReelAsset () -{ - -} - -ReelMXFAsset::ReelMXFAsset (shared_ptr asset, optional key_id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) - : ReelAsset (asset, edit_rate, intrinsic_duration, entry_point) - , _key_id (key_id) -{ - -} - -ReelMXFAsset::ReelMXFAsset (shared_ptr node) - : ReelAsset (node) - , _key_id (node->optional_string_child ("KeyId")) -{ - if (_key_id && _key_id.get().length() > 9) { - _key_id = _key_id.get().substr (9); - } -} - -void -ReelMXFAsset::write_to_cpl (xmlpp::Node* node, Standard s) const -{ - ReelAsset::write_to_cpl (node, s); - - xmlpp::Node::NodeList c = node->get_children (); - xmlpp::Node::NodeList::iterator i = c.begin(); - while (i != c.end() && (*i)->get_name() != cpl_node_name ()) { - ++i; - } - - DCP_ASSERT (i != c.end ()); - - if (_key_id) { - (*i)->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id.get ()); - } -} diff --git a/src/reel_mxf_asset.h b/src/reel_mxf_asset.h deleted file mode 100644 index 2dc3af73..00000000 --- a/src/reel_mxf_asset.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2012-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 - 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, - 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. - -*/ - -/** @file src/reel_mxf_asset.h - * @brief ReelMXFAsset - */ - -#ifndef LIBDCP_REEL_MXF_ASSET_H -#define LIBDCP_REEL_MXF_ASSET_H - -#include "reel_asset.h" - -namespace dcp { - -class MXF; - -/** @class ReelMXFAsset - * @brief Part of a Reel's description which refers to an MXF. - */ -class ReelMXFAsset : public ReelAsset -{ -public: - ReelMXFAsset (); - ReelMXFAsset (boost::shared_ptr asset, boost::optional key_id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); - ReelMXFAsset (boost::shared_ptr); - - /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */ - virtual std::string key_type () const = 0; - - /** @return true if a KeyId is specified for this asset, implying - * that its content is encrypted. - */ - bool encrypted () const { - return _key_id; - } - - /** @return Key ID to describe the key that encrypts this asset's - * content, if there is one. - */ - boost::optional key_id () const { - return _key_id; - } - -private: - boost::optional _key_id; ///< The <KeyId> from the reel's entry for this asset, if there is one -}; - -} - -#endif diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc index fd18dc30..a989f72b 100644 --- a/src/reel_picture_asset.cc +++ b/src/reel_picture_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 @@ -44,7 +44,7 @@ ReelPictureAsset::ReelPictureAsset () } ReelPictureAsset::ReelPictureAsset (shared_ptr asset, int64_t entry_point) - : ReelMXFAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point) + : ReelEncryptableAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point) , _frame_rate (asset->frame_rate ()) , _screen_aspect_ratio (asset->screen_aspect_ratio ()) { @@ -52,7 +52,7 @@ ReelPictureAsset::ReelPictureAsset (shared_ptr asset, int64_t entr } ReelPictureAsset::ReelPictureAsset (shared_ptr node) - : ReelMXFAsset (node) + : ReelEncryptableAsset (node) { _frame_rate = Fraction (node->string_child ("FrameRate")); try { diff --git a/src/reel_picture_asset.h b/src/reel_picture_asset.h index a41cd9d2..98615c72 100644 --- a/src/reel_picture_asset.h +++ b/src/reel_picture_asset.h @@ -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 @@ -24,7 +24,7 @@ #ifndef LIBDCP_REEL_PICTURE_ASSET_H #define LIBDCP_REEL_PICTURE_ASSET_H -#include "reel_mxf_asset.h" +#include "reel_encryptable_asset.h" #include "picture_asset.h" namespace dcp { @@ -32,7 +32,7 @@ namespace dcp { /** @class ReelPictureAsset * @brief Part of a Reel's description which refers to a picture asset. */ -class ReelPictureAsset : public ReelMXFAsset +class ReelPictureAsset : public ReelEncryptableAsset { public: ReelPictureAsset (); diff --git a/src/reel_sound_asset.cc b/src/reel_sound_asset.cc index b3ca5234..131672b8 100644 --- a/src/reel_sound_asset.cc +++ b/src/reel_sound_asset.cc @@ -30,13 +30,13 @@ using boost::shared_ptr; using namespace dcp; ReelSoundAsset::ReelSoundAsset (shared_ptr asset, int64_t entry_point) - : ReelMXFAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point) + : ReelEncryptableAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point) { } ReelSoundAsset::ReelSoundAsset (shared_ptr node) - : ReelMXFAsset (node) + : ReelEncryptableAsset (node) { node->ignore_child ("Language"); node->done (); diff --git a/src/reel_sound_asset.h b/src/reel_sound_asset.h index d7eee59d..9902faa4 100644 --- a/src/reel_sound_asset.h +++ b/src/reel_sound_asset.h @@ -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 @@ -21,7 +21,7 @@ * @brief ReelSoundAsset class. */ -#include "reel_mxf_asset.h" +#include "reel_encryptable_asset.h" #include "sound_asset.h" #include #include @@ -31,7 +31,7 @@ namespace dcp { /** @class ReelSoundAsset * @brief Part of a Reel's description which refers to a sound MXF. */ -class ReelSoundAsset : public ReelMXFAsset +class ReelSoundAsset : public ReelEncryptableAsset { public: ReelSoundAsset (boost::shared_ptr content, int64_t entry_point); diff --git a/src/wscript b/src/wscript index ac3d9b0c..371f11c4 100644 --- a/src/wscript +++ b/src/wscript @@ -34,8 +34,8 @@ def build(bld): picture_asset_writer.cc reel.cc reel_asset.cc + reel_encryptable_asset.cc reel_mono_picture_asset.cc - reel_mxf_asset.cc reel_picture_asset.cc reel_sound_asset.cc reel_stereo_picture_asset.cc @@ -95,8 +95,8 @@ def build(bld): rgb_xyz.h reel.h reel_asset.h + reel_encryptable_asset.h reel_mono_picture_asset.h - reel_mxf_asset.h reel_picture_asset.h reel_sound_asset.h reel_stereo_picture_asset.h -- cgit v1.2.3