* @param intrinsic_duration Intrinsic duration of this content.
* @param entry_point Entry point to use in that content.
*/
-ReelAsset::ReelAsset (boost::shared_ptr<Content> content, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ReelAsset::ReelAsset (shared_ptr<Content> content, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: Object (content->id ())
, _content (content)
, _edit_rate (edit_rate)
_annotation_text = content->file().leaf().string ();
}
-ReelAsset::ReelAsset (boost::shared_ptr<const cxml::Node> node)
+ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
: Object (node->string_child ("Id"))
, _content (_id)
, _annotation_text (node->optional_string_child ("AnnotationText").get_value_or (""))
, _entry_point (node->number_child<int64_t> ("EntryPoint"))
, _duration (node->number_child<int64_t> ("Duration"))
, _hash (node->optional_string_child ("Hash").get_value_or (""))
- , _key_id (node->optional_string_child ("KeyId").get_value_or (""))
{
if (_id.length() > 9) {
_id = _id.substr (9);
_content.set_id (_id);
}
-
- if (_key_id.length() > 9) {
- _key_id = _key_id.substr (9);
- }
}
void
a->add_child("IntrinsicDuration")->add_child_text (raw_convert<string> (_intrinsic_duration));
a->add_child("EntryPoint")->add_child_text (raw_convert<string> (_entry_point));
a->add_child("Duration")->add_child_text (raw_convert<string> (_duration));
- if (!_key_id.empty ()) {
- a->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id);
- }
a->add_child("Hash")->add_child_text (_content.object()->hash ());
}
return _content;
}
- /** @return true if a KeyId is specified for this asset, implying
- * that its content is encrypted.
- */
- bool encrypted () const {
- return !_key_id.empty ();
- }
-
int64_t entry_point () const {
return _entry_point;
}
return _duration;
}
- /** @return Key ID to describe the key that encrypts this asset's;
- * content.
- */
- std::string key_id () const {
- return _key_id;
- }
-
protected:
/** @return the node name that this asset uses in the CPL's <Reel> node
* e.g. MainPicture, MainSound etc.
int64_t _entry_point; ///< The <EntryPoint> from the reel's entry for this asset
int64_t _duration; ///< The <Duration> from the reel's entry for this asset
std::string _hash; ///< The <Hash> from the reel's entry for this asset
- std::string _key_id; ///< The <KeyId> from the reel's entry for this asset, or empty if there isn't one
};
}
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ 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 <libcxml/cxml.h>
+
+using boost::shared_ptr;
+using namespace dcp;
+
+ReelMXFAsset::ReelMXFAsset ()
+ : ReelAsset ()
+{
+
+}
+
+ReelMXFAsset::ReelMXFAsset (shared_ptr<MXF> mxf, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ : ReelAsset (mxf, edit_rate, intrinsic_duration, entry_point)
+ , _key_id (mxf->key_id ())
+{
+
+}
+
+ReelMXFAsset::ReelMXFAsset (shared_ptr<const cxml::Node> node)
+ : ReelAsset (node)
+ , _key_id (node->optional_string_child ("KeyId").get_value_or (""))
+{
+ if (_key_id.length() > 9) {
+ _key_id = _key_id.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;
+ }
+
+ assert (i != c.end ());
+
+ if (!_key_id.empty ()) {
+ (*i)->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id);
+ }
+}
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ 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.
+
+*/
+
+#ifndef LIBDCP_REEL_MXF_ASSET_H
+#define LIBDCP_REEL_MXF_ASSET_H
+
+#include "reel_asset.h"
+
+namespace dcp {
+
+class MXF;
+
+class ReelMXFAsset : public ReelAsset
+{
+public:
+ ReelMXFAsset ();
+ ReelMXFAsset (boost::shared_ptr<MXF> mxf, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+ ReelMXFAsset (boost::shared_ptr<const cxml::Node>);
+
+ void write_to_cpl (xmlpp::Node* node, Standard standard) const;
+
+ /** @return true if a KeyId is specified for this asset, implying
+ * that its content is encrypted.
+ */
+ bool encrypted () const {
+ return !_key_id.empty ();
+ }
+
+ /** @return Key ID to describe the key that encrypts this asset's;
+ * content.
+ */
+ std::string key_id () const {
+ return _key_id;
+ }
+
+private:
+ std::string _key_id; ///< The <KeyId> from the reel's entry for this asset, or empty if there isn't one
+};
+
+}
+
+#endif
}
-ReelPictureAsset::ReelPictureAsset (boost::shared_ptr<PictureMXF> content, int64_t entry_point)
- : ReelAsset (content, content->edit_rate(), content->intrinsic_duration(), entry_point)
+ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureMXF> content, int64_t entry_point)
+ : ReelMXFAsset (content, content->edit_rate(), content->intrinsic_duration(), entry_point)
, _frame_rate (content->frame_rate ())
, _screen_aspect_ratio (content->screen_aspect_ratio ())
{
}
-ReelPictureAsset::ReelPictureAsset (boost::shared_ptr<const cxml::Node> node)
- : ReelAsset (node)
+ReelPictureAsset::ReelPictureAsset (shared_ptr<const cxml::Node> node)
+ : ReelMXFAsset (node)
{
_frame_rate = Fraction (node->string_child ("FrameRate"));
try {
void
ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- ReelAsset::write_to_cpl (node, standard);
+ ReelMXFAsset::write_to_cpl (node, standard);
xmlpp::Node::NodeList c = node->get_children ();
xmlpp::Node::NodeList::iterator i = c.begin();
#ifndef LIBDCP_REEL_PICTURE_ASSET_H
#define LIBDCP_REEL_PICTURE_ASSET_H
-#include "reel_asset.h"
+#include "reel_mxf_asset.h"
#include "picture_mxf.h"
namespace dcp {
/** @class ReelPictureAsset
* @brief Part of a Reel's description which refers to a picture MXF.
*/
-class ReelPictureAsset : public ReelAsset
+class ReelPictureAsset : public ReelMXFAsset
{
public:
ReelPictureAsset ();
using boost::shared_ptr;
using namespace dcp;
-ReelSoundAsset::ReelSoundAsset (boost::shared_ptr<SoundMXF> content, int64_t entry_point)
- : ReelAsset (content, content->edit_rate(), content->intrinsic_duration(), entry_point)
+ReelSoundAsset::ReelSoundAsset (shared_ptr<SoundMXF> content, int64_t entry_point)
+ : ReelMXFAsset (content, content->edit_rate(), content->intrinsic_duration(), entry_point)
{
}
-ReelSoundAsset::ReelSoundAsset (boost::shared_ptr<const cxml::Node> node)
- : ReelAsset (node)
+ReelSoundAsset::ReelSoundAsset (shared_ptr<const cxml::Node> node)
+ : ReelMXFAsset (node)
{
node->ignore_child ("Language");
node->done ();
* @brief ReelSoundAsset class.
*/
-#include "reel_asset.h"
+#include "reel_mxf_asset.h"
#include "sound_mxf.h"
#include <boost/shared_ptr.hpp>
#include <string>
/** @class ReelSoundAsset
* @brief Part of a Reel's description which refers to a sound MXF.
*/
-class ReelSoundAsset : public ReelAsset
+class ReelSoundAsset : public ReelMXFAsset
{
public:
ReelSoundAsset (boost::shared_ptr<dcp::SoundMXF> content, int64_t entry_point);
reel.cc
reel_asset.cc
reel_mono_picture_asset.cc
+ reel_mxf_asset.cc
reel_picture_asset.cc
reel_sound_asset.cc
reel_stereo_picture_asset.cc
reel.h
reel_asset.h
reel_mono_picture_asset.h
+ reel_mxf_asset.h
reel_picture_asset.h
reel_sound_asset.h
reel_stereo_picture_asset.h