X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=82a40d5c4390eec070a47ba42b562793a60af8a6;hb=67a68bd971ebe1b35daa3f75873b4ccb53c00ba0;hp=2dcdf4eefbae6432f9553241da0a44a276d3fe5b;hpb=d41cee056f99ef944746e98c89047f2cd7eef99d;p=dcpomatic.git diff --git a/src/lib/film.cc b/src/lib/film.cc index 2dcdf4eef..82a40d5c4 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -509,10 +509,11 @@ Film::read_metadata (optional path) } /** Given a directory name, return its full path within the Film's directory. - * The directory (and its parents) will be created if they do not exist. + * @param d directory name within the Filn's directory. + * @param create true to create the directory (and its parents) if they do not exist. */ boost::filesystem::path -Film::dir (boost::filesystem::path d) const +Film::dir (boost::filesystem::path d, bool create) const { DCPOMATIC_ASSERT (_directory); @@ -520,7 +521,9 @@ Film::dir (boost::filesystem::path d) const p /= _directory.get(); p /= d; - boost::filesystem::create_directories (p); + if (create) { + boost::filesystem::create_directories (p); + } return p; } @@ -791,24 +794,10 @@ Film::dcp_name (bool if_created_now) const { string unfiltered; if (use_isdcf_name()) { - unfiltered = isdcf_name (if_created_now); - } else { - unfiltered = name (); + return careful_string_filter (isdcf_name (if_created_now)); } - /* Filter out `bad' characters which cause problems with some systems. - There's no apparent list of what really is allowed, so this is a guess. - */ - - string filtered; - string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; - for (size_t i = 0; i < unfiltered.size(); ++i) { - if (allowed.find (unfiltered[i]) != string::npos) { - filtered += unfiltered[i]; - } - } - - return filtered; + return careful_string_filter (name ()); } void @@ -1218,8 +1207,12 @@ Film::frame_size () const return fit_ratio_within (container()->ratio(), full_frame ()); } -/** @param from KDM from time expressed as a local time with an offset from UTC - * @param to KDM to time expressed as a local time with an offset from UTC +/** @param recipient KDM recipient certificate. + * @param trusted_devices Certificates of other trusted devices (can be empty). + * @param cpl_file CPL filename. + * @param from KDM from time expressed as a local time with an offset from UTC. + * @param until KDM to time expressed as a local time with an offset from UTC. + * @param formulation KDM formulation to use. */ dcp::EncryptedKDM Film::make_kdm ( @@ -1278,13 +1271,16 @@ Film::make_kdm ( ).encrypt (signer, recipient, trusted_devices, formulation); } -/** @param from KDM from time expressed as a local time in the time zone of the Screen's Cinema. - * @param to KDM to time expressed as a local time in the time zone of the Screen's Cinema. +/** @param screens Screens to make KDMs for. + * @param cpl_file Path to CPL to make KDMs for. + * @param from KDM from time expressed as a local time in the time zone of the Screen's Cinema. + * @param until KDM to time expressed as a local time in the time zone of the Screen's Cinema. + * @param formulation KDM formulation to use. */ list Film::make_kdms ( list > screens, - boost::filesystem::path dcp, + boost::filesystem::path cpl_file, boost::posix_time::ptime from, boost::posix_time::ptime until, dcp::Formulation formulation @@ -1297,7 +1293,7 @@ Film::make_kdms ( dcp::EncryptedKDM const kdm = make_kdm ( i->recipient.get(), i->trusted_devices, - dcp, + cpl_file, dcp::LocalTime (from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()), dcp::LocalTime (until, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()), formulation @@ -1521,6 +1517,9 @@ Film::reels () const return p; } +/** @param period A period within the DCP + * @return Name of the content which most contributes to the given period. + */ string Film::content_summary (DCPTimePeriod period) const {