summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-05-05 15:24:36 +0200
committerCarl Hetherington <cth@carlh.net>2020-05-05 15:24:36 +0200
commit5d6c87f482cec7049107f8d32c2c49e79e4819d7 (patch)
treed1a67553ace20964fe32481d9ac36c66d1bacc36 /src
parentf6608b815d3f374370730098dbc54104099df721 (diff)
Set 'i' earlier in name_values.
Diffstat (limited to 'src')
-rw-r--r--src/lib/kdm_with_metadata.cc2
-rw-r--r--src/lib/kdm_with_metadata.h9
-rw-r--r--src/tools/dcpomatic_kdm.cc16
-rw-r--r--src/tools/dcpomatic_kdm_cli.cc30
-rw-r--r--src/wx/kdm_dialog.cc1
5 files changed, 22 insertions, 36 deletions
diff --git a/src/lib/kdm_with_metadata.cc b/src/lib/kdm_with_metadata.cc
index 4c9514e2e..d1ddf06f4 100644
--- a/src/lib/kdm_with_metadata.cc
+++ b/src/lib/kdm_with_metadata.cc
@@ -66,7 +66,6 @@ write_files (
/* Write KDMs to the specified directory */
BOOST_FOREACH (KDMWithMetadataPtr i, kdms) {
- name_values['i'] = i->kdm_id ();
boost::filesystem::path out = directory / careful_string_filter(name_format.get(name_values, ".xml"));
if (!boost::filesystem::exists (out) || confirm_overwrite (out)) {
i->kdm_as_xml (out);
@@ -96,7 +95,6 @@ make_zip_file (list<KDMWithMetadataPtr> kdms, boost::filesystem::path zip_file,
Zipper zipper (zip_file);
BOOST_FOREACH (KDMWithMetadataPtr i, kdms) {
- name_values['i'] = i->kdm_id ();
string const name = careful_string_filter(name_format.get(name_values, ".xml"));
zipper.add (name, i->kdm_as_xml());
}
diff --git a/src/lib/kdm_with_metadata.h b/src/lib/kdm_with_metadata.h
index c2a13fced..e7b3c23ba 100644
--- a/src/lib/kdm_with_metadata.h
+++ b/src/lib/kdm_with_metadata.h
@@ -42,7 +42,6 @@ public:
virtual std::string kdm_as_xml () const = 0;
virtual void kdm_as_xml (boost::filesystem::path out) const = 0;
- virtual std::string kdm_id () const = 0;
dcp::NameFormat::Map const& name_values () const {
return _name_values;
@@ -121,10 +120,6 @@ public:
return kdm.as_xml (out);
}
- std::string kdm_id () const {
- return kdm.cpl_id ();
- }
-
dcp::EncryptedKDM kdm;
};
@@ -145,10 +140,6 @@ public:
return kdm.as_xml (out);
}
- std::string kdm_id () const {
- return kdm.id ();
- }
-
EncryptedECinemaKDM kdm;
};
#endif
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 7920f7e57..da856d358 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -334,6 +334,7 @@ private:
name_values['f'] = title;
name_values['b'] = begin.date() + " " + begin.time_of_day(true, false);
name_values['e'] = end.date() + " " + end.time_of_day(true, false);
+ name_values['i'] = kdm.id();
/* Encrypt */
kdms.push_back (
@@ -381,24 +382,23 @@ private:
kdm.add_key (j);
}
+ dcp::EncryptedKDM const encrypted = kdm.encrypt(
+ signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(),
+ !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0
+ );
+
dcp::NameFormat::Map name_values;
name_values['c'] = i->cinema->name;
name_values['s'] = i->name;
name_values['f'] = title;
name_values['b'] = begin.date() + " " + begin.time_of_day(true, false);
name_values['e'] = end.date() + " " + end.time_of_day(true, false);
+ name_values['i'] = encrypted.cpl_id ();
/* Encrypt */
kdms.push_back (
KDMWithMetadataPtr(
- new DCPKDMWithMetadata(
- name_values,
- i->cinema,
- kdm.encrypt(
- signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(),
- !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0
- )
- )
+ new DCPKDMWithMetadata(name_values, i->cinema, encrypted)
)
);
}
diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc
index a85624c82..6bcad22f6 100644
--- a/src/tools/dcpomatic_kdm_cli.cc
+++ b/src/tools/dcpomatic_kdm_cli.cc
@@ -250,6 +250,7 @@ from_film (
name_values['f'] = film->name();
name_values['b'] = dcp::LocalTime(begin).date() + " " + dcp::LocalTime(begin).time_of_day(true, false);
name_values['e'] = dcp::LocalTime(end).date() + " " + dcp::LocalTime(end).time_of_day(true, false);
+ name_values['i'] = kdm.cpl_id();
kdms.push_back (KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, i->cinema, kdm)));
}
@@ -358,19 +359,7 @@ from_dkdm (
dcp::LocalTime begin(valid_from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute());
dcp::LocalTime end(valid_to, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute());
- dcp::NameFormat::Map name_values;
- name_values['c'] = i->cinema->name;
- name_values['s'] = i->name;
- name_values['f'] = dkdm.annotation_text().get_value_or("");
- name_values['b'] = begin.date() + " " + begin.time_of_day(true, false);
- name_values['e'] = end.date() + " " + end.time_of_day(true, false);
-
- kdms.push_back (
- KDMWithMetadataPtr(
- new DCPKDMWithMetadata(
- name_values,
- i->cinema,
- kdm_from_dkdm(
+ dcp::EncryptedKDM const kdm = kdm_from_dkdm(
dkdm,
i->recipient.get(),
i->trusted_device_thumbprints(),
@@ -379,10 +368,17 @@ from_dkdm (
formulation,
disable_forensic_marking_picture,
disable_forensic_marking_audio
- )
- )
- )
- );
+ );
+
+ dcp::NameFormat::Map name_values;
+ name_values['c'] = i->cinema->name;
+ name_values['s'] = i->name;
+ name_values['f'] = dkdm.annotation_text().get_value_or("");
+ name_values['b'] = begin.date() + " " + begin.time_of_day(true, false);
+ name_values['e'] = end.date() + " " + end.time_of_day(true, false);
+ name_values['i'] = kdm.cpl_id();
+
+ kdms.push_back (KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, i->cinema, kdm)));
}
write_files (kdms, zip, output, container_name_format, filename_format, values, verbose);
} catch (FileError& e) {
diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc
index d946e1d12..d74741871 100644
--- a/src/wx/kdm_dialog.cc
+++ b/src/wx/kdm_dialog.cc
@@ -185,6 +185,7 @@ KDMDialog::make_clicked ()
name_values['f'] = film->name();
name_values['b'] = dcp::LocalTime(begin).date() + " " + dcp::LocalTime(begin).time_of_day(false, false);
name_values['e'] = dcp::LocalTime(end).date() + " " + dcp::LocalTime(end).time_of_day(false, false);
+ name_values['i'] = kdm.cpl_id();
kdms.push_back (KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, i->cinema, kdm)));
}