+ return dcp::Size ();
+}
+
+dcp::KDM
+Film::make_kdm (
+ shared_ptr<dcp::Certificate> target,
+ boost::filesystem::path dcp_dir,
+ boost::posix_time::ptime from,
+ boost::posix_time::ptime until
+ ) const
+{
+ shared_ptr<const Signer> signer = make_signer ();
+
+ dcp::DCP dcp (dir (dcp_dir.string ()));
+
+ try {
+ dcp.read ();
+ } catch (...) {
+ throw KDMError (_("Could not read DCP to make KDM for"));
+ }
+
+ time_t now = time (0);
+ struct tm* tm = localtime (&now);
+ string const issue_date = dcp::tm_to_string (tm);
+
+ dcp.cpls().front()->set_mxf_keys (key ());
+
+ return dcp::KDM (dcp.cpls().front(), signer, target, from, until, "DCP-o-matic", issue_date);
+}
+
+list<dcp::KDM>
+Film::make_kdms (
+ list<shared_ptr<Screen> > screens,
+ boost::filesystem::path dcp,
+ boost::posix_time::ptime from,
+ boost::posix_time::ptime until
+ ) const
+{
+ list<dcp::KDM> kdms;
+
+ for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) {
+ kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until));
+ }
+
+ return kdms;
+}
+
+/** @return The approximate disk space required to encode a DCP of this film with the
+ * current settings, in bytes.
+ */
+uint64_t
+Film::required_disk_space () const
+{
+ return uint64_t (j2k_bandwidth() / 8) * length().seconds();
+}
+
+/** This method checks the disk that the Film is on and tries to decide whether or not
+ * there will be enough space to make a DCP for it. If so, true is returned; if not,
+ * false is returned and required and availabe are filled in with the amount of disk space
+ * required and available respectively (in Gb).
+ *
+ * Note: the decision made by this method isn't, of course, 100% reliable.
+ */
+bool
+Film::should_be_enough_disk_space (double& required, double& available) const
+{
+ boost::filesystem::space_info s = boost::filesystem::space (internal_video_mxf_dir ());
+ required = double (required_disk_space ()) / 1073741824.0f;
+ available = double (s.available) / 1073741824.0f;
+ return (available - required) > 1;