Missing setup of AtmosContent in DCP.
[dcpomatic.git] / src / lib / dcp_content.cc
index 4280ad13aa7474b698a5255c3e2e635216d15ba2..66f5331b0decb567b86afb129fd36d485fb8e1bb 100644 (file)
@@ -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;
@@ -233,6 +235,15 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                as->set_mapping (m);
        }
 
+       if (examiner->has_atmos()) {
+               {
+                       boost::mutex::scoped_lock lm (_mutex);
+                       atmos.reset (new AtmosContent(this));
+               }
+               atmos->set_length (examiner->atmos_length());
+               atmos->set_edit_rate (examiner->atmos_edit_rate());
+       }
+
        int texts = 0;
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -322,6 +333,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");
@@ -610,7 +625,7 @@ DCPContent::can_reference (shared_ptr<const Film> film, function<bool (shared_pt
 static
 bool check_video (shared_ptr<const Content> c)
 {
-       return static_cast<bool>(c->video);
+       return static_cast<bool>(c->video) && c->video->use();
 }
 
 bool
@@ -643,7 +658,7 @@ DCPContent::can_reference_video (shared_ptr<const Film> film, string& why_not) c
 static
 bool check_audio (shared_ptr<const Content> c)
 {
-       return static_cast<bool>(c->audio);
+       return static_cast<bool>(c->audio) && !c->audio->mapping().mapped_output_channels().empty();
 }
 
 bool