Make Atmos content work more like other content. Now its MXFs
[dcpomatic.git] / src / lib / dcp_examiner.cc
index a7d451eca75e14d326ea82d527a5e090b30e1782..133c1614e922b5b5f8b6efbcb8a88d7321c2d785 100644 (file)
@@ -23,6 +23,7 @@
 #include "exceptions.h"
 #include "image.h"
 #include "config.h"
+#include "util.h"
 #include <dcp/dcp.h>
 #include <dcp/decrypted_kdm.h>
 #include <dcp/cpl.h>
@@ -38,6 +39,7 @@
 #include <dcp/sound_asset.h>
 #include <dcp/sound_asset_reader.h>
 #include <dcp/subtitle_asset.h>
+#include <dcp/reel_atmos_asset.h>
 #include <dcp/reel_subtitle_asset.h>
 #include <dcp/reel_closed_caption_asset.h>
 #include <dcp/reel_markers_asset.h>
@@ -64,6 +66,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
        , _needs_assets (false)
        , _kdm_valid (false)
        , _three_d (false)
+       , _has_atmos (false)
 {
        shared_ptr<dcp::CPL> cpl;
 
@@ -95,6 +98,9 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                if (j->main_subtitle() && !j->main_subtitle()->asset_ref().resolved()) {
                                        ++unsatisfied;
                                }
+                               if (j->atmos() && !j->atmos()->asset_ref().resolved()) {
+                                       ++unsatisfied;
+                               }
                        }
 
                        if (unsatisfied < least_unsatisfied) {
@@ -190,6 +196,10 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                        _markers.insert (rm.begin(), rm.end());
                }
 
+               if (i->atmos()) {
+                       _has_atmos = true;
+               }
+
                if (i->main_picture()) {
                        _reel_lengths.push_back (i->main_picture()->actual_duration());
                } else if (i->main_sound()) {
@@ -198,6 +208,8 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                        _reel_lengths.push_back (i->main_subtitle()->actual_duration());
                } else if (!i->closed_captions().empty()) {
                        _reel_lengths.push_back (i->closed_captions().front()->actual_duration());
+               } else if (!i->atmos()) {
+                       _reel_lengths.push_back (i->atmos()->actual_duration());
                }
        }
 
@@ -225,6 +237,10 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                        if (i->main_subtitle()) {
                                i->main_subtitle()->asset()->subtitles ();
                        }
+
+                       if (i->atmos()) {
+                               i->atmos()->asset()->start_read()->get_frame(0);
+                       }
                }
        } catch (dcp::ReadError& e) {
                _kdm_valid = false;
@@ -236,6 +252,8 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
        _standard = cpl->standard().get();
        _three_d = !cpl->reels().empty() && cpl->reels().front()->main_picture() &&
                dynamic_pointer_cast<dcp::StereoPictureAsset> (cpl->reels().front()->main_picture()->asset());
+       _ratings = list_to_vector (cpl->ratings());
+       _content_version = cpl->content_version_label_text ();
 
        _cpl = cpl->id ();
 }