diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-01-10 21:05:54 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-01-10 21:05:54 +0000 |
| commit | 1ee5cc88cb32927f95358e2d03985caf5a1d8e05 (patch) | |
| tree | dd7a17fbcae7179d79249d5bde08319d6159cf7f /src/dc_package.cc | |
| parent | 0ffc4c35a9ae232f3bed9329997c043c42372f6f (diff) | |
Move some more stuff up to Package.
Diffstat (limited to 'src/dc_package.cc')
| -rw-r--r-- | src/dc_package.cc | 75 |
1 files changed, 10 insertions, 65 deletions
diff --git a/src/dc_package.cc b/src/dc_package.cc index b78f3e85..ef016f63 100644 --- a/src/dc_package.cc +++ b/src/dc_package.cc @@ -98,12 +98,6 @@ Package::equals (Package const & other, dcp::EqualityOptions opt, dcp::NoteHandl return r; } -void -Package::add (boost::shared_ptr<CPL> cpl) -{ - _cpls.push_back (cpl); -} - bool Package::encrypted () const { @@ -117,7 +111,7 @@ Package::encrypted () const } void -Package::add (DecryptedKDM const & kdm) +Package::add_kdm (DecryptedKDM const & kdm) { list<DecryptedKDMKey> keys = kdm.keys (); @@ -130,47 +124,6 @@ Package::add (DecryptedKDM const & kdm) } } -boost::filesystem::path -Package::write_pkl (dcp::Standard standard, string pkl_uuid, dcp::XMLMetadata metadata, shared_ptr<const CertificateChain> signer) const -{ - boost::filesystem::path p = _directory; - p /= String::compose ("pkl_%1.xml", pkl_uuid); - - xmlpp::Document doc; - xmlpp::Element* pkl; - if (standard == DCP_INTEROP) { - pkl = doc.create_root_node("PackingList", "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#"); - } else { - pkl = doc.create_root_node("PackingList", "http://www.smpte-ra.org/schemas/429-8/2007/PKL"); - } - - if (signer) { - pkl->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig"); - } - - pkl->add_child("Id")->add_child_text ("urn:uuid:" + pkl_uuid); - - /* XXX: this is a bit of a hack */ - DCP_ASSERT (cpls().size() > 0); - pkl->add_child("AnnotationText")->add_child_text (cpls().front()->annotation_text ()); - - pkl->add_child("IssueDate")->add_child_text (metadata.issue_date); - pkl->add_child("Issuer")->add_child_text (metadata.issuer); - pkl->add_child("Creator")->add_child_text (metadata.creator); - - xmlpp::Element* asset_list = pkl->add_child("AssetList"); - BOOST_FOREACH (shared_ptr<dcp::Asset> i, assets ()) { - i->write_to_pkl (asset_list, _directory, standard); - } - - if (signer) { - signer->sign (pkl, standard); - } - - doc.write_to_file (p.string (), "UTF-8"); - return p.string (); -} - /** Write all the XML files for this DCP. * @param standand INTEROP or SMPTE. * @param metadata Metadata to use for PKL and asset map files. @@ -180,25 +133,10 @@ void Package::write_xml ( Standard standard, dcp::XMLMetadata metadata, - shared_ptr<const CertificateChain> signer + shared_ptr<const dcp::CertificateChain> signer ) { - BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) { - string const filename = "cpl_" + i->id() + ".xml"; - i->write_xml (_directory / filename, standard, signer); - } - - string const pkl_uuid = make_uuid (); - boost::filesystem::path const pkl_path = write_pkl (standard, pkl_uuid, metadata, signer); - - write_volindex (standard); - write_assetmap (standard, pkl_uuid, boost::filesystem::file_size (pkl_path), metadata); -} - -list<shared_ptr<CPL> > -Package::cpls () const -{ - return _cpls; + do_write_xml (standard, metadata, signer); } /** @return All assets (including CPLs) */ @@ -269,3 +207,10 @@ Package::mxf_asset_factory (boost::filesystem::path file) const return asset; } + +string +Package::pkl_annotation_text () const +{ + DCP_ASSERT (!_cpls.empty ()); + return _cpls.front()->annotation_text (); +} |
