X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhints.cc;h=027510eca8015dafa55c9e38c32b04a261fd7fe4;hb=cf2ed48d21ddbc32bda262064480e88e69dc031a;hp=52debf3ef313c44f3d4b745810e2964fe28cb28e;hpb=c370c651eba466f5073384de8b304a2625c64b89;p=dcpomatic.git diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 52debf3ef..027510eca 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016-2021 Carl Hetherington + Copyright (C) 2016-2022 Carl Hetherington This file is part of DCP-o-matic. @@ -18,22 +18,25 @@ */ + +#include "audio_analysis.h" +#include "audio_content.h" +#include "audio_processor.h" +#include "compose.hpp" +#include "config.h" +#include "content.h" +#include "cross.h" #include "dcp_content_type.h" -#include "hints.h" -#include "types.h" #include "film.h" -#include "content.h" -#include "video_content.h" -#include "text_content.h" -#include "audio_processor.h" #include "font.h" #include "font_data.h" -#include "ratio.h" -#include "audio_analysis.h" -#include "compose.hpp" -#include "util.h" -#include "cross.h" +#include "hints.h" +#include "maths_util.h" #include "player.h" +#include "ratio.h" +#include "text_content.h" +#include "types.h" +#include "video_content.h" #include "writer.h" #include #include @@ -45,14 +48,12 @@ #include "i18n.h" + using std::cout; using std::make_shared; using std::max; -using std::min; -using std::pair; using std::shared_ptr; using std::string; -using std::vector; using std::weak_ptr; using boost::optional; using boost::bind; @@ -82,12 +83,14 @@ Hints::Hints (weak_ptr weak_film) } + void Hints::start () { _thread = boost::thread (bind(&Hints::thread, this)); } + Hints::~Hints () { boost::this_thread::disable_interruption dis; @@ -152,7 +155,7 @@ Hints::check_unusual_container () { auto const film_container = film()->container()->id(); if (film_container != "185" && film_container != "239") { - hint (_("Your DCP uses an unusual container ratio. This may cause problems on some projectors. If possible, use Flat or Scope for the DCP container ratio")); + hint (_("Your DCP uses an unusual container ratio. This may cause problems on some projectors. If possible, use Flat or Scope for the DCP container ratio.")); } } @@ -256,7 +259,7 @@ Hints::check_big_font_files () for (auto i: film()->content()) { for (auto j: i->text) { for (auto k: j->fonts()) { - optional const p = k->file (); + auto const p = k->file (); if (p && boost::filesystem::file_size(p.get()) >= (MAX_FONT_FILE_SIZE - SIZE_SLACK)) { big_font_files = true; } @@ -276,7 +279,7 @@ Hints::check_vob () { int vob = 0; for (auto i: film()->content()) { - if (boost::algorithm::starts_with (i->path(0).filename().string(), "VTS_")) { + if (boost::algorithm::starts_with(i->path(0).filename().string(), "VTS_")) { ++vob; } } @@ -330,8 +333,8 @@ Hints::check_loudness () ch = ch.substr (0, ch.length() - 2); - if (!ch.empty ()) { - hint (String::compose ( + if (!ch.empty()) { + hint(String::compose( _("Your audio level is very high (on %1). You should reduce the gain of your audio content."), ch ) @@ -379,6 +382,7 @@ try auto content = film->content (); + check_certificates (); check_interop (); check_big_font_files (); check_few_audio_channels (); @@ -395,6 +399,7 @@ try check_ffec_and_ffmc_in_smpte_feature (); check_out_of_range_markers (); check_text_languages (); + check_audio_language (); if (check_loudness_done) { emit (bind(boost::ref(Progress), _("Examining subtitles and closed captions"))); @@ -402,9 +407,9 @@ try emit (bind(boost::ref(Progress), _("Examining audio, subtitles and closed captions"))); } - auto player = make_shared(film); + auto player = make_shared(film, Image::Alignment::COMPACT); player->set_ignore_video (); - if (check_loudness_done) { + if (check_loudness_done || _disable_audio_analysis) { /* We don't need to analyse audio because we already loaded a suitable analysis */ player->set_ignore_audio (); } @@ -445,7 +450,7 @@ try bool ccap_mxf_too_big = false; bool subs_mxf_too_big = false; - boost::filesystem::path dcp_dir = film->dir("hints") / dcpomatic::get_process_id(); + auto dcp_dir = film->dir("hints") / dcpomatic::get_process_id(); boost::filesystem::remove_all (dcp_dir); _writer->finish (film->dir("hints") / dcpomatic::get_process_id()); @@ -491,6 +496,7 @@ catch (...) store_current (); } + void Hints::hint (string h) { @@ -631,3 +637,48 @@ Hints::check_text_languages () } } } + + +void +Hints::check_audio_language () +{ + auto content = film()->content(); + auto mapped_audio = + std::find_if(content.begin(), content.end(), [](shared_ptr c) { + return c->audio && !c->audio->mapping().mapped_output_channels().empty(); + }); + + if (mapped_audio != content.end() && !film()->audio_language()) { + hint (_("Some of your content has audio but you have not set the audio language. It is advisable to set the audio language " + "in the \"DCP\" tab unless your audio has no spoken parts.")); + } +} + + +void +Hints::check_certificates () +{ + auto bad = Config::instance()->check_certificates(); + if (!bad) { + return; + } + + switch (*bad) { + case Config::BAD_SIGNER_UTF8_STRINGS: + hint(_("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs contains a small error " + "which will prevent DCPs from being validated correctly on some systems. You are advised to " + "re-create the signing certificate chain by clicking the \"Re-make certificates and key...\" " + "button in the Keys page of Preferences.")); + break; + case Config::BAD_SIGNER_VALIDITY_TOO_LONG: + hint(_("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs has a validity period " + "that is too long. This will cause problems playing back DCPs on some systems. " + "You are advised to re-create the signing certificate chain by clicking the " + "\"Re-make certificates and key...\" button in the Keys page of Preferences.")); + break; + default: + /* Some bad situations can't happen here as DCP-o-matic would have refused to start until they are fixed */ + break; + } +} +