X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fdcp_content.cc;h=0ce4945411c3a5e5d0128df437d2dea86d8f2278;hb=8541ba8e544b77d582e3ce00a2ffae96e52eb30d;hp=94d5c010bd0b7202c79b48fb1dc4e809373c06fc;hpb=736745c86cefc6d5d4d8098799efc86f0f639061;p=dcpomatic.git diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 94d5c010b..0ce494541 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -18,6 +18,7 @@ */ +#include "atmos_content.h" #include "dcp_content.h" #include "video_content.h" #include "audio_content.h" @@ -91,6 +92,7 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); text = TextContent::from_xml (this, node, version); + atmos = AtmosContent::from_xml (this, node); for (int i = 0; i < TEXT_COUNT; ++i) { _reference_text[i] = false; @@ -151,6 +153,12 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Marker")) { _markers[dcp::marker_from_string(i->string_attribute("type"))] = ContentTime(raw_convert(i->content())); } + + BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Rating")) { + _ratings.push_back (dcp::Rating(i)); + } + + _content_version = node->optional_string_child("ContentVersion").get_value_or(""); } void @@ -227,6 +235,11 @@ DCPContent::examine (shared_ptr film, shared_ptr job) as->set_mapping (m); } + if (examiner->has_atmos()) { + boost::mutex::scoped_lock lm (_mutex); + atmos.reset (new AtmosContent(this)); + } + int texts = 0; { boost::mutex::scoped_lock lm (_mutex); @@ -249,6 +262,8 @@ DCPContent::examine (shared_ptr film, shared_ptr job) for (map::const_iterator i = markers.begin(); i != markers.end(); ++i) { _markers[i->first] = ContentTime(i->second.as_editable_units(DCPTime::HZ)); } + _ratings = examiner->ratings (); + _content_version = examiner->content_version (); } if (old_texts == texts) { @@ -314,6 +329,10 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const i->as_xml (node); } + if (atmos) { + atmos->as_xml (node); + } + boost::mutex::scoped_lock lm (_mutex); node->add_child("Name")->add_child_text (_name); node->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0"); @@ -354,6 +373,13 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const marker->set_attribute("type", dcp::marker_to_string(i->first)); marker->add_child_text(raw_convert(i->second.get())); } + + BOOST_FOREACH (dcp::Rating i, _ratings) { + xmlpp::Element* rating = node->add_child("Rating"); + i.as_xml (rating); + } + + node->add_child("ContentVersion")->add_child_text (_content_version); } DCPTime @@ -595,7 +621,7 @@ DCPContent::can_reference (shared_ptr film, function c) { - return static_cast(c->video); + return static_cast(c->video) && c->video->use(); } bool @@ -606,13 +632,8 @@ DCPContent::can_reference_video (shared_ptr film, string& why_not) c return false; } - Resolution video_res = RESOLUTION_2K; - if (video->size().width > 2048 || video->size().height > 1080) { - video_res = RESOLUTION_4K; - } - - if (film->resolution() != video_res) { - if (video_res == RESOLUTION_4K) { + if (film->resolution() != resolution()) { + if (resolution() == RESOLUTION_4K) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it is 4K and the film is 2K."); } else { @@ -633,7 +654,7 @@ DCPContent::can_reference_video (shared_ptr film, string& why_not) c static bool check_audio (shared_ptr c) { - return static_cast(c->audio); + return static_cast(c->audio) && !c->audio->mapping().mapped_output_channels().empty(); } bool @@ -738,3 +759,15 @@ DCPContent::kdm_timing_window_valid () const dcp::LocalTime now; return _kdm->not_valid_before() < now && now < _kdm->not_valid_after(); } + + +Resolution +DCPContent::resolution () const +{ + if (video->size().width > 2048 || video->size().height > 1080) { + return RESOLUTION_4K; + } + + return RESOLUTION_2K; +} +