From 8ef91325f4e565d04493bc05202f8e066b5e3e0c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Jul 2016 15:53:26 +0100 Subject: Basics of allowing custom filenames for DCP components. --- src/dcp.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/dcp.cc') diff --git a/src/dcp.cc b/src/dcp.cc index d2fc9745..18b06c55 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -303,10 +303,10 @@ DCP::add (DecryptedKDM const & kdm) } boost::filesystem::path -DCP::write_pkl (Standard standard, string pkl_uuid, XMLMetadata metadata, shared_ptr signer) const +DCP::write_pkl (string file, Standard standard, string pkl_uuid, XMLMetadata metadata, shared_ptr signer) const { boost::filesystem::path p = _directory; - p /= String::compose ("pkl_%1.xml", pkl_uuid); + p /= file; xmlpp::Document doc; xmlpp::Element* pkl; @@ -458,16 +458,22 @@ void DCP::write_xml ( Standard standard, XMLMetadata metadata, - shared_ptr signer + shared_ptr signer, + FilenameFormat filename_format ) { BOOST_FOREACH (shared_ptr i, cpls ()) { - string const filename = "cpl_" + i->id() + ".xml"; - i->write_xml (_directory / filename, standard, signer); + NameFormat::Map values; + values["type"] = "cpl"; + values["id"] = i->id(); + i->write_xml (_directory / (filename_format.get(values) + ".xml"), standard, signer); } string const pkl_uuid = make_uuid (); - boost::filesystem::path const pkl_path = write_pkl (standard, pkl_uuid, metadata, signer); + NameFormat::Map values; + values["type"] = "pkl"; + values["id"] = pkl_uuid; + boost::filesystem::path const pkl_path = write_pkl (filename_format.get(values) + ".xml", standard, pkl_uuid, metadata, signer); write_volindex (standard); write_assetmap (standard, pkl_uuid, boost::filesystem::file_size (pkl_path), metadata); -- cgit v1.2.3