X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fcpl.cc;h=145ce1cdcc53b273ce48b32a156701bce62dc71d;hb=488e3d1bd5e6b17d49f6db4df14c64f4b64db89b;hp=39e78baa89a723b89d9a23352aeaf7a3a29f3588;hpb=3370a67e8a9aeaec45911ba1c714a0d259781fdf;p=libdcp.git diff --git a/src/cpl.cc b/src/cpl.cc index 39e78baa..145ce1cd 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -80,7 +80,7 @@ static string const smpte_395_ns = "http://www.smpte-ra.org/reg/395/2014/13/1/aa 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) @@ -88,6 +88,7 @@ CPL::CPL (string annotation_text, ContentKind content_kind) , _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(); @@ -137,7 +138,10 @@ CPL::CPL (boost::filesystem::path file) _ratings.push_back (Rating(i)); } } - _reels = type_grand_children (f, "ReelList", "Reel"); + + for (auto i: f.node_child("ReelList")->node_children("Reel")) { + _reels.push_back (make_shared(i, _standard)); + } auto reel_list = f.node_child ("ReelList"); if (reel_list) { @@ -167,11 +171,11 @@ CPL::add (std::shared_ptr reel) void -CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr signer) const +CPL::write_xml (boost::filesystem::path file, shared_ptr 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); @@ -206,8 +210,8 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptrwrite_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; } @@ -216,7 +220,7 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptrsign (root, standard); + signer->sign (root, _standard); } doc.write_to_file_formatted (file.string(), "UTF-8"); @@ -534,48 +538,6 @@ CPL::reel_file_assets () const } -template -void -add_encryptable_assets (vector>& assets, vector> 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> -CPL::reel_encryptable_assets () -{ - vector> c; - add_encryptable_assets (c, _reels); - return c; -} - - -vector> -CPL::reel_encryptable_assets () const -{ - vector> c; - add_encryptable_assets (c, _reels); - return c; -} - - bool CPL::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const {