#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>
#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>
string const old_name = name ();
ContentChangeSignalDespatcher::instance()->suspend();
- ScopeGuard sg = []() {
+ dcp::ScopeGuard sg = []() {
ContentChangeSignalDespatcher::instance()->resume();
};
return false;
}
- for (auto i: decoder->reels()) {
- if (!i->main_sound()) {
- /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
- why_not = _("it does not have sound in all its reels.");
- 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(
} 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;
for (auto i: decoder->reels()) {
if (type == TextType::OPEN_SUBTITLE) {
- if (!i->main_subtitle()) {
- /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
- why_not = _("it does not have open subtitles in all its reels.");
- return false;
- } else if (i->main_subtitle()->entry_point().get_value_or(0) != 0) {
+ if (i->main_subtitle() && i->main_subtitle()->entry_point().get_value_or(0) != 0) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
why_not = _("one of its subtitle reels has a non-zero entry point so it must be re-written.");
return false;
}
}
if (type == TextType::CLOSED_CAPTION) {
- if (i->closed_captions().empty()) {
- /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
- why_not = _("it does not have closed captions in all its reels.");
- return false;
- }
for (auto j: i->closed_captions()) {
if (j->entry_point().get_value_or(0) != 0) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
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;
}