2 Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef DCPOMATIC_KDM_WITH_METADATA_H
22 #define DCPOMATIC_KDM_WITH_METADATA_H
24 #ifdef DCPOMATIC_VARIANT_SWAROOP
25 #include "encrypted_ecinema_kdm.h"
27 #include <dcp/encrypted_kdm.h>
28 #include <dcp/name_format.h>
29 #include <boost/shared_ptr.hpp>
36 KDMWithMetadata (dcp::NameFormat::Map const& name_values, boost::shared_ptr<Cinema> cinema)
37 : _name_values (name_values)
41 virtual ~KDMWithMetadata () {}
43 virtual std::string kdm_as_xml () const = 0;
44 virtual void kdm_as_xml (boost::filesystem::path out) const = 0;
46 dcp::NameFormat::Map const& name_values () const {
50 boost::optional<std::string> get (char k) const;
52 boost::shared_ptr<Cinema> cinema () const {
57 dcp::NameFormat::Map _name_values;
58 boost::shared_ptr<Cinema> _cinema;
62 typedef boost::shared_ptr<KDMWithMetadata> KDMWithMetadataPtr;
66 std::list<KDMWithMetadataPtr> screen_kdms, boost::filesystem::path directory,
67 dcp::NameFormat name_format, dcp::NameFormat::Map name_values,
68 boost::function<bool (boost::filesystem::path)> confirm_overwrite
72 void make_zip_file (std::list<KDMWithMetadataPtr> kdms, boost::filesystem::path zip_file, dcp::NameFormat name_format, dcp::NameFormat::Map name_values);
75 std::list<std::list<KDMWithMetadataPtr> > collect (std::list<KDMWithMetadataPtr> kdms);
78 int write_directories (
79 std::list<std::list<KDMWithMetadataPtr> > cinema_kdms,
80 boost::filesystem::path directory,
81 dcp::NameFormat container_name_format,
82 dcp::NameFormat filename_format,
83 dcp::NameFormat::Map name_values,
84 boost::function<bool (boost::filesystem::path)> confirm_overwrite
89 std::list<std::list<KDMWithMetadataPtr> > cinema_kdms,
90 boost::filesystem::path directory,
91 dcp::NameFormat container_name_format,
92 dcp::NameFormat filename_format,
93 dcp::NameFormat::Map name_values,
94 boost::function<bool (boost::filesystem::path)> confirm_overwrite
99 std::list<std::list<KDMWithMetadataPtr> > cinema_kdms,
100 dcp::NameFormat container_name_format,
101 dcp::NameFormat filename_format,
102 dcp::NameFormat::Map name_values,
108 class SpecialKDMWithMetadata : public KDMWithMetadata
111 SpecialKDMWithMetadata (dcp::NameFormat::Map const& name_values, boost::shared_ptr<Cinema> cinema, T k)
112 : KDMWithMetadata (name_values, cinema)
116 std::string kdm_as_xml () const {
117 return kdm.as_xml ();
120 void kdm_as_xml (boost::filesystem::path out) const {
121 return kdm.as_xml (out);
127 typedef SpecialKDMWithMetadata<dcp::EncryptedKDM> DCPKDMWithMetadata;
128 #ifdef DCPOMATIC_VARIANT_SWAROOP
129 typedef SpecialKDMWithMetadata<EncryptedECinemaKDM> ECinemaKDMWithMetadata;