/* Copyright (C) 2012-2016 Carl Hetherington 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dcp.h" #include "dcp_cpl.h" #include "reel_asset.h" #include "interop_subtitle_asset.h" #include "util.h" #include using std::string; using std::list; using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace dcp; DCP::DCP (boost::filesystem::path directory) : Package (directory) { } /** Write all the XML files for this DCP. * @param standand INTEROP or SMPTE. * @param metadata Metadata to use for PKL and asset map files. * @param signer Signer to use, or 0. */ void DCP::write_xml ( Standard standard, XMLMetadata metadata, shared_ptr signer ) { BOOST_FOREACH (shared_ptr 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 > DCP::cpls () const { return cpls_of_type (); } shared_ptr DCP::read_cpl (boost::filesystem::path file) const { return shared_ptr (new DCPCPL (file)); } /** @return All assets (including CPLs) */ list > DCP::assets () const { list > assets; BOOST_FOREACH (shared_ptr i, cpls()) { assets.push_back (i); BOOST_FOREACH (shared_ptr j, i->reel_assets ()) { shared_ptr o = j->asset_ref().asset (); assets.push_back (o); /* More Interop special-casing */ shared_ptr sub = dynamic_pointer_cast (o); if (sub) { sub->add_font_assets (assets); } } } return assets; }