X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=e0aa08a77c141034aae6cf24b9639e4f278c37a6;hp=e021c0aa91801949a980d85242b7b2af96f7e8bd;hb=7c0e02d933c243f0559631402e02fb598caf4647;hpb=4d879e836147720bed8208f92d8d39bcbd661221 diff --git a/src/lib/film.cc b/src/lib/film.cc index e021c0aa9..e0aa08a77 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -32,6 +32,7 @@ #include "cinema.h" #include "compose.hpp" #include "config.h" +#include "constants.h" #include "cross.h" #include "dcp_content.h" #include "dcp_content_type.h" @@ -56,7 +57,6 @@ #include "text_content.h" #include "transcode_job.h" #include "upload_job.h" -#include "util.h" #include "video_content.h" #include "version.h" #include @@ -174,6 +174,7 @@ Film::Film (optional dir) , _user_explicit_container (false) , _user_explicit_resolution (false) , _name_language (dcp::LanguageTag("en-US")) + , _release_territory(Config::instance()->default_territory()) , _version_number (1) , _status (dcp::Status::FINAL) , _audio_language(Config::instance()->default_audio_language()) @@ -631,7 +632,7 @@ Film::read_metadata (optional path) _sign_language_video_language = dcp::LanguageTag(*sign_language_video_language); } - _version_number = f.optional_number_child("VersionNumber").get_value_or(0); + _version_number = f.optional_number_child("VersionNumber").get_value_or(1); auto status = f.optional_string_child("Status"); if (status) { @@ -808,6 +809,11 @@ Film::isdcf_name (bool if_created_now) const auto raw_name = name (); + auto to_upper = [](string s) { + transform(s.begin(), s.end(), s.begin(), ::toupper); + return s; + }; + /* Split the raw name up into words */ vector words; split (words, raw_name, is_any_of (" _-")); @@ -902,13 +908,14 @@ Film::isdcf_name (bool if_created_now) const isdcf_name += "_" + container()->isdcf_name(); } + auto content_list = content(); + /* XXX: this uses the first bit of content only */ /* Interior aspect ratio. The standard says we don't do this for trailers, for some strange reason */ if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::ContentKind::TRAILER) { - auto cl = content(); - auto first_video = std::find_if(cl.begin(), cl.end(), [](shared_ptr c) { return static_cast(c->video); }); - if (first_video != cl.end()) { + auto first_video = std::find_if(content_list.begin(), content_list.end(), [](shared_ptr c) { return static_cast(c->video); }); + if (first_video != content_list.end()) { auto first_ratio = lrintf((*first_video)->video->scaled_size(frame_size()).ratio() * 100); auto container_ratio = lrintf(container()->ratio() * 100); if (first_ratio != container_ratio) { @@ -938,7 +945,7 @@ Film::isdcf_name (bool if_created_now) const auto burnt_in = true; auto ccap = false; - for (auto i: content()) { + for (auto i: content_list) { for (auto j: i->text) { if (j->type() == TextType::OPEN_SUBTITLE && j->use() && !j->burn()) { burnt_in = false; @@ -969,9 +976,7 @@ Film::isdcf_name (bool if_created_now) const if (_release_territory) { auto territory = _release_territory->subtag(); isdcf_name += "_" + to_upper (territory); - if (_ratings.empty ()) { - isdcf_name += "-NR"; - } else { + if (!_ratings.empty()) { auto label = _ratings[0].label; boost::erase_all(label, "+"); boost::erase_all(label, "-"); @@ -997,6 +1002,10 @@ Film::isdcf_name (bool if_created_now) const isdcf_name += "-VI"; } + if (find_if(content_list.begin(), content_list.end(), [](shared_ptr c) { return static_cast(c->atmos); }) != content_list.end()) { + isdcf_name += "-ATMOS"; + } + isdcf_name += "_" + resolution_to_string (_resolution); if (_studio && _studio->length() >= 2) { @@ -1024,7 +1033,7 @@ Film::isdcf_name (bool if_created_now) const } auto vf = false; - for (auto i: content()) { + for (auto i: content_list) { auto dc = dynamic_pointer_cast(i); if (!dc) { continue;