set_file (file);
}
-list<shared_ptr<const Content> >
-CPL::content () const
+list<shared_ptr<const ReelAsset> >
+CPL::reel_assets () const
{
- list<shared_ptr<const Content> > c;
+ list<shared_ptr<const ReelAsset> > c;
for (list<shared_ptr<Reel> >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) {
if ((*i)->main_picture ()) {
- c.push_back ((*i)->main_picture()->mxf ());
+ c.push_back ((*i)->main_picture());
}
if ((*i)->main_sound ()) {
- c.push_back ((*i)->main_sound()->mxf ());
+ c.push_back ((*i)->main_sound());
}
if ((*i)->main_subtitle ()) {
- c.push_back ((*i)->main_subtitle()->subtitle_content ());
+ c.push_back ((*i)->main_subtitle());
}
}
/*
Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ 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.
namespace dcp {
-class Content;
+class ReelAsset;
class Reel;
class XMLMetadata;
class MXFMetadata;
return _reels;
}
- /** @return the Content in this CPL across all its reels
- * (Content is picture, sound and subtitles)
+ /** @return the ReelAssets in this CPL in all reels.
*/
- std::list<boost::shared_ptr<const Content> > content () const;
+ std::list<boost::shared_ptr<const ReelAsset> > reel_assets () const;
bool encrypted () const;
#include "decrypted_kdm.h"
#include "decrypted_kdm_key.h"
#include "encrypted_kdm.h"
+#include "reel_mxf_asset.h"
#include "util.h"
#include "exceptions.h"
#include "cpl.h"
DecryptedKDM::DecryptedKDM (
boost::shared_ptr<const CPL> cpl,
+ Key key,
LocalTime not_valid_before,
LocalTime not_valid_after,
string annotation_text,
, _issue_date (issue_date)
{
/* Create DecryptedKDMKey objects for each MXF asset */
- list<shared_ptr<const Content> > content = cpl->content ();
- for (list<shared_ptr<const Content> >::iterator i = content.begin(); i != content.end(); ++i) {
+ list<shared_ptr<const ReelAsset> > assets = cpl->reel_assets ();
+ for (list<shared_ptr<const ReelAsset> >::iterator i = assets.begin(); i != assets.end(); ++i) {
/* XXX: do non-MXF assets need keys? */
- shared_ptr<const MXF> mxf = boost::dynamic_pointer_cast<const MXF> (*i);
+ shared_ptr<const ReelMXFAsset> mxf = boost::dynamic_pointer_cast<const ReelMXFAsset> (*i);
if (mxf) {
if (mxf->key_id().empty ()) {
- throw NotEncryptedError (mxf->file().string ());
+ throw NotEncryptedError (mxf->id());
}
- _keys.push_back (DecryptedKDMKey (mxf->key_type(), mxf->key_id(), mxf->key().get (), cpl->id ()));
+ _keys.push_back (DecryptedKDMKey (mxf->key_type(), mxf->key_id(), key, cpl->id ()));
}
}
}
/** Construct a DecryptedKDM.
* @param cpl CPL that the keys are for.
+ * @param key Key that was used to encrypt the MXFs.
* @param not_valid_before Start time for the KDM.
* @param not_valid_after End time for the KDM.
*/
DecryptedKDM (
boost::shared_ptr<const CPL> cpl,
+ Key key,
LocalTime not_valid_before,
LocalTime not_valid_after,
std::string annotation_text,
std::string issue_date
);
- /** Add a key to this KDM.
- * @param type Key type (MDIK, MDAK etc.)
- * @param id Key id.
- * @param key the key itself (which has been used to encrypt a MXF).
- */
- void add_key (std::string type, std::string id, Key key);
-
/** Encrypt this KDM's keys and sign the whole KDM.
* @param signer Signer.
* @param recipient Certificate of the projector/server which should receive this KDM's keys.
class NotEncryptedError : public StringError
{
public:
- NotEncryptedError (std::string const & asset_filename);
+ NotEncryptedError (std::string const & what);
~NotEncryptedError () throw () {}
};
MXF (boost::filesystem::path file);
~MXF ();
- /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */
- virtual std::string key_type () const = 0;
-
bool equals (
boost::shared_ptr<const Content> other,
EqualityOptions opt,
return true;
}
-
-string
-PictureMXF::key_type () const
-{
- return "MDIK";
-}
Fraction _screen_aspect_ratio;
private:
- std::string key_type () const;
std::string asdcp_kind () const {
return "Picture";
}
ReelMXFAsset (boost::shared_ptr<MXF> mxf, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
ReelMXFAsset (boost::shared_ptr<const cxml::Node>);
+ /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */
+ virtual std::string key_type () const = 0;
+
void write_to_cpl (xmlpp::Node* node, Standard standard) const;
/** @return true if a KeyId is specified for this asset, implying
);
}
}
+
+string
+ReelPictureAsset::key_type () const
+{
+ return "MDIK";
+}
}
private:
+ std::string key_type () const;
+
Fraction _frame_rate;
Fraction _screen_aspect_ratio;
};
{
return "MainSound";
}
+
+string
+ReelSoundAsset::key_type () const
+{
+ return "MDAK";
+}
}
private:
+ std::string key_type () const;
std::string cpl_node_name () const;
};
/* XXX: can't we use a shared_ptr here? */
return shared_ptr<SoundMXFWriter> (new SoundMXFWriter (this, file, standard));
}
-
-string
-SoundMXF::key_type () const
-{
- return "MDAK";
-}
}
private:
- std::string key_type () const;
std::string asdcp_kind () const {
return "Sound";
}
dcp::DecryptedKDM kdm (
cpl,
+ key,
dcp::LocalTime ("2013-01-01T00:00:00+00:00"),
dcp::LocalTime ("2017-01-08T00:00:00+00:00"),
"libdcp",
/* A KDM using our certificate chain's leaf key pair */
dcp::DecryptedKDM kdm_A (
cpl,
+ key,
dcp::LocalTime ("2013-01-01T00:00:00+00:00"),
dcp::LocalTime ("2013-01-08T00:00:00+00:00"),
"libdcp",