X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Ffilm.cc;h=20b959dd04c526e215050cf5f8af4b45c0bdc0b6;hb=a1839a88ab0cffdf04737dae783c21f27f65d491;hp=8c12e70809de314159f7786ce46f973455366b3c;hpb=81f361a0da4eef3ce83d003204042104d5555d39;p=dcpomatic.git diff --git a/src/lib/film.cc b/src/lib/film.cc index 8c12e7080..20b959dd0 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -135,10 +135,12 @@ Film::Film (boost::filesystem::path dir, bool log) set_isdcf_date_today (); _playlist_changed_connection = _playlist->Changed.connect (bind (&Film::playlist_changed, this)); + _playlist_order_changed_connection = _playlist->OrderChanged.connect (bind (&Film::playlist_order_changed, this)); _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2, _3)); /* Make state.directory a complete path without ..s (where possible) (Code swiped from Adam Bowen on stackoverflow) + XXX: couldn't/shouldn't this just be boost::filesystem::canonical? */ boost::filesystem::path p (boost::filesystem::system_complete (dir)); @@ -596,7 +598,27 @@ Film::isdcf_name (bool if_created_now) const if (!dm.audio_language.empty ()) { d << "_" << dm.audio_language; if (!dm.subtitle_language.empty()) { - d << "-" << dm.subtitle_language; + + bool burnt_in = false; + BOOST_FOREACH (shared_ptr i, content ()) { + shared_ptr sc = dynamic_pointer_cast (i); + if (!sc) { + continue; + } + + if (sc->use_subtitles() && sc->burn_subtitles()) { + burnt_in = true; + } + } + + string language = dm.subtitle_language; + if (burnt_in) { + transform (language.begin(), language.end(), language.begin(), ::tolower); + } else { + transform (language.begin(), language.end(), language.begin(), ::toupper); + } + + d << "-" << language; } else { d << "-XX"; } @@ -1071,6 +1093,12 @@ Film::playlist_changed () signal_changed (NAME); } +void +Film::playlist_order_changed () +{ + signal_changed (CONTENT_ORDER); +} + int Film::audio_frame_rate () const { @@ -1161,12 +1189,12 @@ Film::make_kdms ( uint64_t Film::required_disk_space () const { - return uint64_t (j2k_bandwidth() / 8) * length().seconds(); + return _playlist->required_disk_space (j2k_bandwidth(), audio_channels(), audio_frame_rate()); } /** 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 + * false is returned and required and available 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.