X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=0d277b82a0a8e92c1825eedc86dc6b08c7b3085c;hp=297da775047f114e3ac3ec01d89022676c84adc0;hb=ac34066d5e448d1984d11a180be74e31b6e13b5c;hpb=d0070054da8bd1ac06b41cbd41c2583cf1265e10 diff --git a/src/lib/film.cc b/src/lib/film.cc index 297da7750..0d277b82a 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -18,57 +18,60 @@ */ + /** @file src/film.cc * @brief A representation of some audio, video and subtitle content, and details of * how they should be presented in a DCP. */ + #include "atmos_content.h" +#include "audio_content.h" +#include "audio_processor.h" +#include "change_signaller.h" +#include "check_content_change_job.h" +#include "cinema.h" +#include "compose.hpp" +#include "config.h" +#include "cross.h" +#include "dcp_content.h" +#include "dcp_content_type.h" +#include "dcp_encoder.h" +#include "dcpomatic_log.h" +#include "digester.h" +#include "environment_info.h" +#include "examine_content_job.h" +#include "exceptions.h" +#include "ffmpeg_content.h" +#include "ffmpeg_subtitle_stream.h" +#include "file_log.h" #include "film.h" +#include "font.h" #include "job.h" -#include "util.h" #include "job_manager.h" -#include "dcp_encoder.h" -#include "transcode_job.h" -#include "upload_job.h" +#include "kdm_with_metadata.h" #include "null_log.h" -#include "file_log.h" -#include "dcpomatic_log.h" -#include "exceptions.h" -#include "examine_content_job.h" -#include "config.h" #include "playlist.h" -#include "dcp_content_type.h" #include "ratio.h" -#include "cross.h" -#include "environment_info.h" -#include "audio_processor.h" -#include "digester.h" -#include "compose.hpp" #include "screen.h" -#include "audio_content.h" -#include "video_content.h" #include "text_content.h" -#include "ffmpeg_content.h" -#include "dcp_content.h" -#include "kdm_with_metadata.h" -#include "cinema.h" -#include "change_signaller.h" -#include "check_content_change_job.h" -#include "ffmpeg_subtitle_stream.h" -#include "font.h" +#include "transcode_job.h" +#include "upload_job.h" +#include "util.h" +#include "video_content.h" +#include "version.h" #include -#include #include -#include -#include +#include #include +#include #include -#include #include +#include +#include #include -#include #include +#include #include #include #include @@ -80,26 +83,27 @@ #include "i18n.h" -using std::string; -using std::pair; -using std::vector; -using std::setfill; -using std::min; -using std::max; -using std::make_pair; -using std::cout; -using std::list; -using std::set; -using std::runtime_error; -using std::copy; + using std::back_inserter; -using std::map; +using std::copy; +using std::cout; +using std::dynamic_pointer_cast; using std::exception; using std::find; +using std::list; +using std::make_pair; +using std::make_shared; +using std::map; +using std::max; +using std::min; +using std::pair; +using std::runtime_error; +using std::set; +using std::setfill; using std::shared_ptr; +using std::string; +using std::vector; using std::weak_ptr; -using std::make_shared; -using std::dynamic_pointer_cast; using boost::optional; using boost::is_any_of; #if BOOST_VERSION >= 106100 @@ -108,7 +112,9 @@ using namespace boost::placeholders; using dcp::raw_convert; using namespace dcpomatic; -string const Film::metadata_file = "metadata.xml"; + +static constexpr char metadata_file[] = "metadata.xml"; + /* 5 -> 6 * AudioMapping XML changed. @@ -141,6 +147,7 @@ string const Film::metadata_file = "metadata.xml"; */ int const Film::current_state_version = 38; + /** Construct a Film object in a given directory. * * @param dir Film directory. @@ -455,6 +462,9 @@ Film::metadata (bool with_content_paths) const auto root = doc->create_root_node ("Metadata"); root->add_child("Version")->add_child_text (raw_convert (current_state_version)); + auto last_write = root->add_child("LastWrittenBy"); + last_write->add_child_text (dcpomatic_version); + last_write->set_attribute("git", dcpomatic_git_commit); root->add_child("Name")->add_child_text (_name); root->add_child("UseISDCFName")->add_child_text (_use_isdcf_name ? "1" : "0"); @@ -719,6 +729,41 @@ Film::read_metadata (optional path) _audio_language = dcp::LanguageTag(*audio_language); } + /* Read the old ISDCFMetadata tag from 2.14.x metadata */ + auto isdcf = f.optional_node_child("ISDCFMetadata"); + if (isdcf) { + if (auto territory = isdcf->optional_string_child("Territory")) { + try { + _release_territory = dcp::LanguageTag::RegionSubtag(*territory); + } catch (...) { + /* Invalid region subtag; just ignore it */ + } + } + if (auto audio_language = isdcf->optional_string_child("AudioLanguage")) { + try { + _audio_language = dcp::LanguageTag(*audio_language); + } catch (...) { + /* Invalid language tag; just ignore it */ + } + } + if (auto content_version = isdcf->optional_string_child("ContentVersion")) { + _content_versions.push_back (*content_version); + } + if (auto rating = isdcf->optional_string_child("Rating")) { + _ratings.push_back (dcp::Rating("", *rating)); + } + if (auto mastered_luminance = isdcf->optional_number_child("MasteredLuminance")) { + _luminance = dcp::Luminance(*mastered_luminance, dcp::Luminance::Unit::FOOT_LAMBERT); + } + _studio = isdcf->optional_string_child("Studio"); + _facility = isdcf->optional_string_child("Facility"); + _temp_version = isdcf->optional_bool_child("TempVersion").get_value_or("false"); + _pre_release = isdcf->optional_bool_child("PreRelease").get_value_or("false"); + _red_band = isdcf->optional_bool_child("RedBand").get_value_or("false"); + _two_d_version_of_three_d = isdcf->optional_bool_child("TwoDVersionOfThreeD").get_value_or("false"); + _chain = isdcf->optional_string_child("Chain"); + } + list notes; _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); @@ -1876,7 +1921,7 @@ void Film::use_template (string name) { _template_film.reset (new Film (optional())); - _template_film->read_metadata (Config::instance()->template_path (name)); + _template_film->read_metadata (Config::instance()->template_read_path(name)); _use_isdcf_name = _template_film->_use_isdcf_name; _dcp_content_type = _template_film->_dcp_content_type; _container = _template_film->_container;