*/
-#ifndef LIBDCP_REEL_MXF_H
-#define LIBDCP_REEL_MXF_H
+#ifndef LIBDCP_REEL_FILE_ASSET_H
+#define LIBDCP_REEL_FILE_ASSET_H
+#include "reel_asset.h"
#include "ref.h"
#include <boost/optional.hpp>
-#include <memory>
#include <string>
-namespace cxml {
- class Node;
-}
-
-
namespace dcp {
-/** @class ReelFileAsset
- * @brief Part of a Reel's description which refers to an asset which can be encrypted
- */
-class ReelFileAsset
+class ReelFileAsset : public ReelAsset
{
public:
- explicit ReelFileAsset (std::shared_ptr<Asset> asset, boost::optional<std::string> key_id);
- explicit ReelFileAsset (std::shared_ptr<const cxml::Node>);
- virtual ~ReelFileAsset () {}
+ 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);
- /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */
- virtual std::string key_type () const = 0;
+ 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 {
_hash = h;
}
- /** @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);
+ bool file_asset_equals(std::shared_ptr<const ReelFileAsset> other, EqualityOptions const& 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());
}
- /** @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;
}
- bool mxf_equals (std::shared_ptr<const ReelFileAsset> other, EqualityOptions opt, NoteHandler note) const;
+ bool encrypted () const {
+ return static_cast<bool>(key_id());
+ }
protected:
template <class T>
std::shared_ptr<T> asset_of_type () const {
- return std::dynamic_pointer_cast<T> (_asset_ref.asset ());
+ return std::dynamic_pointer_cast<T>(_asset_ref.asset());
}
template <class T>
std::shared_ptr<T> asset_of_type () {
- return std::dynamic_pointer_cast<T> (_asset_ref.asset ());
+ return std::dynamic_pointer_cast<T>(_asset_ref.asset());
}
- void write_to_cpl_mxf (xmlpp::Node* node) const;
-
/** Reference to the asset (MXF or XML file) that this reel entry
* applies to.
*/
Ref _asset_ref;
-private:
- boost::optional<std::string> _key_id; ///< The <KeyId> from the reel's entry for this asset, if there is one
/** 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
};