Supporters update.
[dcpomatic.git] / src / lib / dcp_content.cc
index b9b64149f1984832f200806be88c413eaf0fb235..bdd5e0e091c0aa6b523ec7c7400ec9449beef3a0 100644 (file)
@@ -31,7 +31,6 @@
 #include "job.h"
 #include "log.h"
 #include "overlaps.h"
-#include "scope_guard.h"
 #include "text_content.h"
 #include "video_content.h"
 #include <dcp/dcp.h>
@@ -41,6 +40,7 @@
 #include <dcp/reel_picture_asset.h>
 #include <dcp/reel_subtitle_asset.h>
 #include <dcp/reel.h>
+#include <dcp/scope_guard.h>
 #include <libxml++/libxml++.h>
 #include <iterator>
 #include <iostream>
@@ -224,7 +224,7 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        string const old_name = name ();
 
        ContentChangeSignalDespatcher::instance()->suspend();
-       ScopeGuard sg = []() {
+       dcp::ScopeGuard sg = []() {
                ContentChangeSignalDespatcher::instance()->resume();
        };
 
@@ -720,6 +720,14 @@ DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) c
                return false;
        }
 
+       if (audio && audio->stream()) {
+               auto const channels = audio->stream()->channels();
+               if (channels != film->audio_channels()) {
+                       why_not = String::compose(_("it has a different number of audio channels than the project; set the project to have %1 channels."), channels);
+                       return false;
+               }
+       }
+
        /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
        return can_reference(
                film, [](shared_ptr<const Content> c) {
@@ -740,6 +748,9 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri
        } catch (dcp::ReadError &) {
                /* We couldn't read the DCP, so it's probably missing */
                return false;
+       } catch (DCPError &) {
+               /* We couldn't read the DCP, so it's probably missing */
+               return false;
        } catch (dcp::KDMDecryptionError &) {
                /* We have an incorrect KDM */
                return false;
@@ -827,7 +838,7 @@ DCPContent::kdm_timing_window_valid () const
 Resolution
 DCPContent::resolution () const
 {
-       if (video->size().width > 2048 || video->size().height > 1080) {
+       if (video->size() && (video->size()->width > 2048 || video->size()->height > 1080)) {
                return Resolution::FOUR_K;
        }