}
-template <class T>
-void
-add_encryptable_assets (vector<shared_ptr<T>>& assets, vector<shared_ptr<Reel>> reels)
-{
- for (auto i: reels) {
- if (i->main_picture ()) {
- assets.push_back (i->main_picture());
- }
- if (i->main_sound ()) {
- assets.push_back (i->main_sound());
- }
- if (i->main_subtitle ()) {
- if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(i->main_subtitle())) {
- assets.push_back (enc);
- }
- }
- for (auto j: i->closed_captions()) {
- if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(j)) {
- assets.push_back (enc);
- }
- }
- if (i->atmos ()) {
- assets.push_back (i->atmos());
- }
- }
-}
-
-
-vector<shared_ptr<ReelEncryptableAsset>>
-CPL::reel_encryptable_assets ()
-{
- vector<shared_ptr<ReelEncryptableAsset>> c;
- add_encryptable_assets (c, _reels);
- return c;
-}
-
-
-vector<shared_ptr<const ReelEncryptableAsset>>
-CPL::reel_encryptable_assets () const
-{
- vector<shared_ptr<const ReelEncryptableAsset>> c;
- add_encryptable_assets (c, _reels);
- return c;
-}
-
-
bool
CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
{
namespace dcp {
-class ReelEncryptableAsset;
class ReelFileAsset;
class Reel;
class MXFMetadata;
std::vector<std::shared_ptr<const ReelFileAsset>> reel_file_assets () const;
std::vector<std::shared_ptr<ReelFileAsset>> reel_file_assets ();
- /** @return the ReelEncryptableAssets in this CPL in all reels */
- std::vector<std::shared_ptr<const ReelEncryptableAsset>> reel_encryptable_assets () const;
- std::vector<std::shared_ptr<ReelEncryptableAsset>> reel_encryptable_assets ();
-
/** @return true if we have any encrypted content */
bool any_encrypted () const;
*/
+#include "certificate_chain.h"
+#include "compose.hpp"
+#include "cpl.h"
+#include "dcp_assert.h"
#include "decrypted_kdm.h"
#include "decrypted_kdm_key.h"
#include "encrypted_kdm.h"
-#include "reel_encryptable_asset.h"
+#include "exceptions.h"
#include "reel_asset.h"
+#include "reel_file_asset.h"
#include "util.h"
-#include "exceptions.h"
-#include "cpl.h"
-#include "certificate_chain.h"
-#include "dcp_assert.h"
-#include "compose.hpp"
#include <asdcp/AS_DCP.h>
#include <asdcp/KM_util.h>
#include <openssl/rsa.h>
DecryptedKDM::DecryptedKDM (
string cpl_id,
- map<shared_ptr<const ReelEncryptableAsset>, Key> keys,
+ map<shared_ptr<const ReelFileAsset>, Key> keys,
LocalTime not_valid_before,
LocalTime not_valid_after,
string annotation_text,
, _content_title_text (content_title_text)
, _issue_date (issue_date)
{
- for (map<shared_ptr<const ReelEncryptableAsset>, Key>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
+ for (map<shared_ptr<const ReelFileAsset>, Key>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
add_key (i->first->key_type(), i->first->key_id().get(), i->second, cpl_id, Standard::SMPTE);
}
}
{
/* Create DecryptedKDMKey objects for each encryptable asset */
bool did_one = false;
- for (auto i: cpl->reel_encryptable_assets()) {
- if (i->key_id()) {
- add_key (i->key_type(), i->key_id().get(), key, cpl->id(), Standard::SMPTE);
+ for (auto i: cpl->reel_file_assets()) {
+ if (i->encryptable()) {
+ add_key (i->key_type().get(), i->key_id().get(), key, cpl->id(), Standard::SMPTE);
did_one = true;
}
}
class EncryptedKDM;
class CertificateChain;
class CPL;
-class ReelEncryptableAsset;
+class ReelFileAsset;
/** @class DecryptedKDM
*/
DecryptedKDM (
std::string cpl_id,
- std::map<std::shared_ptr<const ReelEncryptableAsset>, Key> keys,
+ std::map<std::shared_ptr<const ReelFileAsset>, Key> keys,
LocalTime not_valid_before,
LocalTime not_valid_after,
std::string annotation_text,
{
auto ecc = false;
for (auto i: _closed_captions) {
- if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(i)) {
- if (enc->encrypted()) {
- ecc = true;
- }
- }
- }
-
- bool esub = false;
- if (_main_subtitle) {
- if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(_main_picture)) {
- esub = enc->encrypted();
+ if (i->encrypted()) {
+ ecc = true;
}
}
return (
(_main_picture && _main_picture->encrypted()) ||
(_main_sound && _main_sound->encrypted()) ||
- esub ||
+ (_main_subtitle && _main_subtitle->encrypted()) ||
ecc ||
(_atmos && _atmos->encrypted())
);
{
auto ecc = true;
for (auto i: _closed_captions) {
- if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(i)) {
- if (!enc->encrypted()) {
- ecc = false;
- }
- }
- }
-
- /* It's ok if there's no subtitle, or it's not encryptable */
- bool esub = true;
- if (_main_subtitle) {
- if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(_main_picture)) {
- esub = enc->encrypted();
+ if (!i->encrypted()) {
+ ecc = false;
}
}
return (
(!_main_picture || _main_picture->encrypted()) &&
(!_main_sound || _main_sound->encrypted()) &&
- esub &&
+ (!_main_subtitle || _main_subtitle->encrypted()) &&
ecc &&
(!_atmos || _atmos->encrypted())
);
xmlpp::Node*
-ReelAsset::write_to_cpl_asset (xmlpp::Node* node, Standard standard, optional<string> hash) const
+ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
auto a = node->add_child (cpl_node_name (standard));
auto const attr = cpl_node_attribute (standard);
if (_duration) {
a->add_child("Duration")->add_child_text(raw_convert<string>(*_duration));
}
- if (hash) {
- a->add_child("Hash")->add_child_text (hash.get());
- }
return a;
}
explicit ReelAsset (std::shared_ptr<const cxml::Node>);
- virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const = 0;
+ virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
+
+ virtual bool encryptable () const {
+ return false;
+ }
Fraction edit_rate () const {
return _edit_rate;
/** @return Any namespace that should be used on the asset's node in the CPL */
virtual std::pair<std::string, std::string> cpl_node_namespace () const;
- xmlpp::Node* write_to_cpl_asset (xmlpp::Node* node, Standard standard, boost::optional<std::string> hash) const;
-
int64_t _intrinsic_duration = 0; ///< The <IntrinsicDuration> from the reel's entry for this asset
boost::optional<int64_t> _duration; ///< The <Duration> from the reel's entry for this asset, if present
ReelAtmosAsset::ReelAtmosAsset (std::shared_ptr<AtmosAsset> asset, int64_t entry_point)
- : ReelFileAsset (asset, asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
- , ReelEncryptableAsset (asset->key_id())
+ : ReelFileAsset (asset, asset->key_id(), asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
{
}
ReelAtmosAsset::ReelAtmosAsset (std::shared_ptr<const cxml::Node> node)
: ReelFileAsset (node)
- , ReelEncryptableAsset (node)
{
node->ignore_child ("DataType");
node->done ();
}
-string
-ReelAtmosAsset::key_type () const
-{
- return "MDEK";
-}
-
-
xmlpp::Node *
ReelAtmosAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- auto asset = write_to_cpl_asset (node, standard, hash());
- write_to_cpl_encryptable (asset);
+ auto asset = ReelFileAsset::write_to_cpl (node, standard);
asset->add_child("axd:DataType")->add_child_text("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
return asset;
}
#define LIBDCP_REEL_ATMOS_ASSET_H
-#include "reel_asset.h"
+#include "reel_file_asset.h"
#include "atmos_asset.h"
-#include "reel_encryptable_asset.h"
namespace dcp {
/** @class ReelAtmosAsset
* @brief Part of a Reel's description which refers to a Atmos MXF
*/
-class ReelAtmosAsset : public ReelFileAsset, public ReelEncryptableAsset
+class ReelAtmosAsset : public ReelFileAsset
{
public:
ReelAtmosAsset (std::shared_ptr<AtmosAsset> asset, int64_t entry_point);
bool equals (std::shared_ptr<const ReelAtmosAsset>, EqualityOptions, NoteHandler) const;
private:
- std::string key_type () const override;
+ boost::optional<std::string> key_type () const override {
+ return std::string("MDEK");
+ }
std::string cpl_node_name (Standard standard) const override;
std::pair<std::string, std::string> cpl_node_namespace () const override;
};
ReelClosedCaptionAsset::ReelClosedCaptionAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelFileAsset (asset, asset->id(), edit_rate, intrinsic_duration, entry_point)
+ : ReelFileAsset (
+ asset,
+ dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none,
+ asset->id(),
+ edit_rate,
+ intrinsic_duration,
+ entry_point
+ )
{
}
return true;
}
+
+
+++ /dev/null
-/*
- Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
-
- 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.
-
- 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 libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- 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_encryptable_asset.cc
- * @brief ReelEncryptableAsset class
- */
-
-
-#include "reel_encryptable_asset.h"
-#include "util.h"
-#include "mxf.h"
-#include "dcp_assert.h"
-#include <libcxml/cxml.h>
-#include <libxml++/libxml++.h>
-
-
-using std::string;
-using std::shared_ptr;
-using boost::optional;
-using namespace dcp;
-
-
-ReelEncryptableAsset::ReelEncryptableAsset (optional<string> key_id)
- : _key_id (key_id)
-{
-
-}
-
-
-ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr<const cxml::Node> node)
- : _key_id (node->optional_string_child("KeyId"))
-{
- if (_key_id) {
- _key_id = remove_urn_uuid (*_key_id);
- }
-}
-
-
-void
-ReelEncryptableAsset::write_to_cpl_encryptable (xmlpp::Node* node) const
-{
- if (key_id()) {
- auto hash = find_child (node, "Hash");
- node->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
-
- 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.
-
- 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 libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- 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_encryptable_asset.h
- * @brief ReelEncryptableAsset class
- */
-
-
-#ifndef LIBDCP_REEL_ENCRYPTABLE_ASSET_H
-#define LIBDCP_REEL_ENCRYPTABLE_ASSET_H
-
-
-#include "reel_file_asset.h"
-#include "ref.h"
-#include <boost/optional.hpp>
-#include <memory>
-#include <string>
-
-
-namespace cxml {
- class Node;
-}
-
-
-namespace dcp {
-
-
-/** @class ReelEncryptableAsset
- * @brief Part of a Reel's description which refers to an asset which can be encrypted
- */
-class ReelEncryptableAsset
-{
-public:
- explicit ReelEncryptableAsset (boost::optional<std::string> key_id);
- explicit ReelEncryptableAsset (std::shared_ptr<const cxml::Node>);
- virtual ~ReelEncryptableAsset () {}
-
- /** @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 static_cast<bool>(_key_id);
- }
-
- /** @return Key ID to describe the key that encrypts this asset's
- * content, if there is one.
- */
- boost::optional<std::string> key_id () const {
- return _key_id;
- }
-
-protected:
- void write_to_cpl_encryptable (xmlpp::Node* node) const;
-
-private:
- boost::optional<std::string> _key_id; ///< The <KeyId> from the reel's entry for this asset, if there is one
-};
-
-
-}
-
-
-#endif
#include "asset.h"
#include "reel_file_asset.h"
+#include <libxml++/libxml++.h>
using std::shared_ptr;
+using std::string;
+using boost::optional;
using namespace dcp;
-ReelFileAsset::ReelFileAsset (shared_ptr<Asset> asset, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ReelFileAsset::ReelFileAsset (shared_ptr<Asset> asset, optional<string> key_id, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: ReelAsset (id, edit_rate, intrinsic_duration, entry_point)
, _asset_ref (asset)
, _hash (asset->hash())
+ , _key_id (key_id)
{
}
ReelFileAsset::ReelFileAsset (shared_ptr<const cxml::Node> node)
: ReelAsset (node)
, _asset_ref (remove_urn_uuid(node->string_child("Id")))
- , _hash (node->optional_string_child ("Hash"))
+ , _hash (node->optional_string_child("Hash"))
+ , _key_id (node->optional_string_child("KeyId"))
{
-
+ if (_key_id) {
+ _key_id = remove_urn_uuid (*_key_id);
+ }
}
return true;
}
+
+xmlpp::Node *
+ReelFileAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+{
+ auto asset = ReelAsset::write_to_cpl (node, standard);
+ if (_key_id) {
+ asset->add_child("KeyId")->add_child_text("urn:uuid:" + *_key_id);
+ }
+ if (_hash) {
+ asset->add_child("Hash")->add_child_text(*_hash);
+ }
+ return asset;
+}
+
class ReelFileAsset : public ReelAsset
{
public:
- ReelFileAsset (std::shared_ptr<Asset> asset, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+ ReelFileAsset (std::shared_ptr<Asset> asset, boost::optional<std::string> key_id, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelFileAsset (std::shared_ptr<const cxml::Node> node);
+ virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+
/** @return a Ref to our actual asset */
Ref const & asset_ref () const {
return _asset_ref;
bool file_asset_equals (std::shared_ptr<const ReelFileAsset> other, EqualityOptions opt, NoteHandler note) const;
+ virtual boost::optional<std::string> key_type () const {
+ return boost::none;
+ }
+
+ bool encryptable () const override {
+ return static_cast<bool>(key_type());
+ }
+
+ boost::optional<std::string> key_id () const {
+ return _key_id;
+ }
+
+ bool encrypted () const {
+ return static_cast<bool>(key_id());
+ }
+
protected:
template <class T>
/** Either our asset's computed hash or the hash read in from the CPL, if it's present */
boost::optional<std::string> _hash;
+ boost::optional<std::string> _key_id; ///< The <KeyId> from the reel's entry for this asset, if there is one
};
}
-xmlpp::Node *
-ReelInteropClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
-{
- auto asset = write_to_cpl_asset (node, standard, hash());
- if (_language) {
- asset->add_child("Language")->add_child_text(*_language);
- }
-
- return asset;
-}
-
-
string
ReelInteropClosedCaptionAsset::cpl_node_name (Standard) const
{
return make_pair("http://www.digicine.com/PROTO-ASDCP-CC-CPL-20070926#", "cc-cpl");
}
+
+xmlpp::Node *
+ReelInteropClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+{
+ auto asset = ReelClosedCaptionAsset::write_to_cpl (node, standard);
+ if (_language) {
+ asset->add_child("Language")->add_child_text(*_language);
+ }
+ return asset;
+}
ReelInteropClosedCaptionAsset (std::shared_ptr<InteropSubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point);
explicit ReelInteropClosedCaptionAsset (std::shared_ptr<const cxml::Node>);
+ xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+
std::shared_ptr<InteropSubtitleAsset> interop_asset () const {
return std::dynamic_pointer_cast<InteropSubtitleAsset>(asset());
}
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
-
private:
std::string cpl_node_name (Standard) const;
std::pair<std::string, std::string> cpl_node_namespace () const override;
node->done ();
}
-
-xmlpp::Node *
-ReelInteropSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
-{
- auto asset = write_to_cpl_asset (node, standard, _hash);
- if (_language) {
- asset->add_child("Language")->add_child_text(*_language);
- }
- return asset;
-}
-
-
std::shared_ptr<InteropSubtitleAsset> interop_asset () const {
return std::dynamic_pointer_cast<InteropSubtitleAsset>(asset());
}
-
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
};
ReelMarkersAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
int const tcr = edit_rate().numerator / edit_rate().denominator;
- auto asset = write_to_cpl_asset (node, standard, optional<string>());
+ auto asset = ReelAsset::write_to_cpl (node, standard);
auto ml = asset->add_child("MarkerList");
for (auto const& i: _markers) {
auto m = ml->add_child("Marker");
ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureAsset> asset, int64_t entry_point)
- : ReelFileAsset (asset, asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
- , ReelEncryptableAsset (asset->key_id())
+ : ReelFileAsset (asset, asset->key_id(), asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
, _frame_rate (asset->frame_rate ())
, _screen_aspect_ratio (asset->screen_aspect_ratio ())
{
ReelPictureAsset::ReelPictureAsset (shared_ptr<const cxml::Node> node)
: ReelFileAsset (node)
- , ReelEncryptableAsset (node)
{
_frame_rate = Fraction (node->string_child ("FrameRate"));
try {
xmlpp::Node*
ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- auto asset = write_to_cpl_asset (node, standard, hash());
+ auto asset = ReelFileAsset::write_to_cpl (node, standard);
asset->add_child("FrameRate")->add_child_text(String::compose("%1 %2", _frame_rate.numerator, _frame_rate.denominator));
+
if (standard == Standard::INTEROP) {
/* Allowed values for this tag from the standard */
}
}
- asset->add_child ("ScreenAspectRatio")->add_child_text (raw_convert<string> (closest.get(), 2, true));
+ asset->add_child("ScreenAspectRatio")->add_child_text(raw_convert<string>(closest.get(), 2, true));
} else {
- asset->add_child ("ScreenAspectRatio")->add_child_text (
+ asset->add_child("ScreenAspectRatio")->add_child_text(
String::compose ("%1 %2", _screen_aspect_ratio.numerator, _screen_aspect_ratio.denominator)
);
}
- write_to_cpl_encryptable (asset);
-
return asset;
}
-string
-ReelPictureAsset::key_type () const
-{
- return "MDIK";
-}
-
-
bool
ReelPictureAsset::equals (shared_ptr<const ReelPictureAsset> other, EqualityOptions opt, NoteHandler note) const
{
#define LIBDCP_REEL_PICTURE_ASSET_H
-#include "reel_encryptable_asset.h"
-#include "reel_asset.h"
+#include "reel_file_asset.h"
#include "picture_asset.h"
/** @class ReelPictureAsset
* @brief Part of a Reel's description which refers to a picture asset
*/
-class ReelPictureAsset : public ReelFileAsset, public ReelEncryptableAsset
+class ReelPictureAsset : public ReelFileAsset
{
public:
ReelPictureAsset (std::shared_ptr<PictureAsset> asset, int64_t entry_point);
}
private:
- std::string key_type () const;
+ boost::optional<std::string> key_type () const override {
+ return std::string ("MDIK");
+ }
Fraction _frame_rate;
Fraction _screen_aspect_ratio;
ReelSMPTEClosedCaptionAsset::ReelSMPTEClosedCaptionAsset (shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: ReelClosedCaptionAsset (asset, edit_rate, intrinsic_duration, entry_point)
- , ReelEncryptableAsset (asset->key_id())
{
}
ReelSMPTEClosedCaptionAsset::ReelSMPTEClosedCaptionAsset (shared_ptr<const cxml::Node> node)
: ReelClosedCaptionAsset (node)
- , ReelEncryptableAsset (node)
{
node->done ();
}
xmlpp::Node *
ReelSMPTEClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- auto asset = write_to_cpl_asset (node, standard, hash());
- write_to_cpl_encryptable (asset);
-
+ auto asset = ReelClosedCaptionAsset::write_to_cpl (node, standard);
if (_language) {
asset->add_child("Language", "tt")->add_child_text(*_language);
}
-
return asset;
}
#define LIBDCP_REEL_SMPTE_CLOSED_CAPTION_ASSET_H
-#include "reel_encryptable_asset.h"
#include "reel_file_asset.h"
#include "reel_closed_caption_asset.h"
#include "smpte_subtitle_asset.h"
namespace dcp {
-class ReelSMPTEClosedCaptionAsset : public ReelClosedCaptionAsset, public ReelEncryptableAsset
+class ReelSMPTEClosedCaptionAsset : public ReelClosedCaptionAsset
{
public:
ReelSMPTEClosedCaptionAsset (std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point);
}
private:
- std::string key_type () const override {
- return "MDSK";
+ boost::optional<std::string> key_type () const override {
+ return std::string("MDSK");
}
std::string cpl_node_name (Standard) const override;
ReelSMPTESubtitleAsset::ReelSMPTESubtitleAsset (shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: ReelSubtitleAsset (asset, edit_rate, intrinsic_duration, entry_point)
- , ReelEncryptableAsset (asset->key_id())
{
}
ReelSMPTESubtitleAsset::ReelSMPTESubtitleAsset (shared_ptr<const cxml::Node> node)
: ReelSubtitleAsset (node)
- , ReelEncryptableAsset (node)
{
node->done ();
}
-
-xmlpp::Node *
-ReelSMPTESubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
-{
- auto asset = write_to_cpl_asset (node, standard, _hash);
- write_to_cpl_encryptable (asset);
- if (_language) {
- asset->add_child("Language")->add_child_text(*_language);
- }
- return asset;
-}
-
*/
-#include "reel_encryptable_asset.h"
#include "reel_subtitle_asset.h"
#include "smpte_subtitle_asset.h"
/** @class ReelSMPTESubtitleAsset
* @brief Part of a Reel's description which refers to an SMPTE subtitle MXF file
*/
-class ReelSMPTESubtitleAsset : public ReelSubtitleAsset, public ReelEncryptableAsset
+class ReelSMPTESubtitleAsset : public ReelSubtitleAsset
{
public:
ReelSMPTESubtitleAsset (std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelSMPTESubtitleAsset (std::shared_ptr<const cxml::Node>);
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
-
std::shared_ptr<SMPTESubtitleAsset> smpte_asset () const {
return std::dynamic_pointer_cast<SMPTESubtitleAsset>(asset());
}
private:
- std::string key_type () const {
- return "MDSK";
+ boost::optional<std::string> key_type () const override {
+ return std::string("MDSK");
}
};
using std::string;
using std::shared_ptr;
+using boost::optional;
using namespace dcp;
ReelSoundAsset::ReelSoundAsset (shared_ptr<SoundAsset> asset, int64_t entry_point)
- : ReelFileAsset (asset, asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
- , ReelEncryptableAsset (asset->key_id())
+ : ReelFileAsset (asset, asset->key_id(), asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
{
}
ReelSoundAsset::ReelSoundAsset (shared_ptr<const cxml::Node> node)
: ReelFileAsset (node)
- , ReelEncryptableAsset (node)
{
node->ignore_child ("Language");
node->done ();
}
-string
+optional<string>
ReelSoundAsset::key_type () const
{
- return "MDAK";
-}
-
-
-xmlpp::Node *
-ReelSoundAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
-{
- auto asset = write_to_cpl_asset (node, standard, hash());
- write_to_cpl_encryptable (asset);
- return asset;
+ return string("MDAK");
}
*/
-#include "reel_encryptable_asset.h"
-#include "reel_asset.h"
+#include "reel_file_asset.h"
#include "sound_asset.h"
#include <memory>
#include <string>
/** @class ReelSoundAsset
* @brief Part of a Reel's description which refers to a sound asset
*/
-class ReelSoundAsset : public ReelFileAsset, public ReelEncryptableAsset
+class ReelSoundAsset : public ReelFileAsset
{
public:
ReelSoundAsset (std::shared_ptr<dcp::SoundAsset> content, int64_t entry_point);
explicit ReelSoundAsset (std::shared_ptr<const cxml::Node>);
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
bool equals (std::shared_ptr<const ReelSoundAsset>, EqualityOptions, NoteHandler) const;
/** @return the SoundAsset that this object refers to */
std::shared_ptr<SoundAsset> asset () {
- return asset_of_type<SoundAsset> ();
+ return asset_of_type<SoundAsset>();
}
/** @return the SoundAsset that this object refers to */
std::shared_ptr<const SoundAsset> asset () const {
- return asset_of_type<const SoundAsset> ();
+ return asset_of_type<const SoundAsset>();
}
private:
- std::string key_type () const;
+ boost::optional<std::string> key_type () const;
std::string cpl_node_name (Standard standard) const;
};
ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelFileAsset (asset, asset->id(), edit_rate, intrinsic_duration, entry_point)
+ : ReelFileAsset (
+ asset,
+ dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none,
+ asset->id(),
+ edit_rate,
+ intrinsic_duration,
+ entry_point
+ )
{
}
if (!asset_equals (other, opt, note)) {
return false;
}
-
- if (_asset_ref.resolved() && other->_asset_ref.resolved()) {
- return _asset_ref->equals (other->_asset_ref.asset(), opt, note);
+ if (!file_asset_equals (other, opt, note)) {
+ return false;
}
return true;
}
+
+xmlpp::Node *
+ReelSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+{
+ auto asset = ReelFileAsset::write_to_cpl (node, standard);
+ if (_language) {
+ asset->add_child("Language")->add_child_text(*_language);
+ }
+ return asset;
+}
+
+
ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelSubtitleAsset (std::shared_ptr<const cxml::Node>);
+ xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
+
bool equals (std::shared_ptr<const ReelSubtitleAsset>, EqualityOptions, NoteHandler) const;
std::shared_ptr<SubtitleAsset> asset () const {
for (auto i: dcp->cpls()) {
for (auto j: i->reel_file_assets()) {
if (j->asset_ref().resolved()) {
- /* It's a bit surprising / broken but Interop subtitle assets are represented
- * in reels by ReelSubtitleAsset which inherits ReelEncryptableAsset, so it's possible for
- * ReelEncryptableAssets to have assets which are not MXFs.
- */
- if (auto asset = dynamic_pointer_cast<MXF>(j->asset_ref().asset())) {
- if (asset->encrypted()) {
- encrypted.push_back(j->asset_ref().id());
- }
+ auto mxf = dynamic_pointer_cast<MXF>(j->asset_ref().asset());
+ if (mxf && mxf->encrypted()) {
+ encrypted.push_back(j->asset_ref().id());
}
}
}
notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_INTRINSIC_DURATION, i->id()});
}
auto file_asset = dynamic_pointer_cast<ReelFileAsset>(i);
- if (dynamic_pointer_cast<ReelEncryptableAsset>(i) && !file_asset->hash()) {
+ if (i->encryptable() && !file_asset->hash()) {
notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_HASH, i->id()});
}
}
reel_asset.cc
reel_atmos_asset.cc
reel_closed_caption_asset.cc
- reel_encryptable_asset.cc
reel_file_asset.cc
reel_interop_closed_caption_asset.cc
reel_interop_subtitle_asset.cc
reel.h
reel_asset.h
reel_atmos_asset.h
- reel_encryptable_asset.h
+ reel_closed_caption_asset.h
reel_file_asset.h
reel_interop_closed_caption_asset.h
reel_interop_subtitle_asset.h