static string const smpte_335_ns = "http://www.smpte-ra.org/reg/335/2012";
-CPL::CPL (string annotation_text, ContentKind content_kind)
+CPL::CPL (string annotation_text, ContentKind content_kind, Standard standard)
/* default _content_title_text to annotation_text */
: _issuer ("libdcp" LIBDCP_VERSION)
, _creator ("libdcp" LIBDCP_VERSION)
, _annotation_text (annotation_text)
, _content_title_text (annotation_text)
, _content_kind (content_kind)
+ , _standard (standard)
{
ContentVersion cv;
cv.label_text = cv.id + LocalTime().as_string();
_ratings.push_back (Rating(i));
}
}
- _reels = type_grand_children<Reel> (f, "ReelList", "Reel");
+
+ for (auto i: f.node_child("ReelList")->node_children("Reel")) {
+ _reels.push_back (make_shared<Reel>(i, _standard));
+ }
auto reel_list = f.node_child ("ReelList");
if (reel_list) {
void
-CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<const CertificateChain> signer) const
+CPL::write_xml (boost::filesystem::path file, shared_ptr<const CertificateChain> signer) const
{
xmlpp::Document doc;
xmlpp::Element* root;
- if (standard == Standard::INTEROP) {
+ if (_standard == Standard::INTEROP) {
root = doc.create_root_node ("CompositionPlaylist", cpl_interop_ns);
} else {
root = doc.create_root_node ("CompositionPlaylist", cpl_smpte_ns);
bool first = true;
for (auto i: _reels) {
- auto asset_list = i->write_to_cpl (reel_list, standard);
- if (first && standard == Standard::SMPTE) {
+ auto asset_list = i->write_to_cpl (reel_list, _standard);
+ if (first && _standard == Standard::SMPTE) {
maybe_write_composition_metadata_asset (asset_list);
first = false;
}
indent (root, 0);
if (signer) {
- signer->sign (root, standard);
+ signer->sign (root, _standard);
}
doc.write_to_file_formatted (file.string(), "UTF-8");
}
-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 ()) {
- assets.push_back (i->main_subtitle());
- }
- for (auto j: i->closed_captions()) {
- assets.push_back (j);
- }
- 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
{