X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fhints.cc;h=40b51e81791544e70a6bdba7d7466dcfc605d4da;hp=52debf3ef313c44f3d4b745810e2964fe28cb28e;hb=cd6c6a693f19fcaa6c75ed60f48a54a8cae51352;hpb=c370c651eba466f5073384de8b304a2625c64b89 diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 52debf3ef..40b51e817 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -18,22 +18,24 @@ */ + +#include "audio_analysis.h" +#include "audio_content.h" +#include "audio_processor.h" +#include "compose.hpp" +#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 "hints.h" +#include "player.h" #include "ratio.h" -#include "audio_analysis.h" -#include "compose.hpp" +#include "text_content.h" +#include "types.h" #include "util.h" -#include "cross.h" -#include "player.h" +#include "video_content.h" #include "writer.h" #include #include @@ -45,14 +47,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 +82,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 +154,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 +258,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 +278,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 +332,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 ) @@ -395,6 +397,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 +405,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 +448,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 +494,7 @@ catch (...) store_current (); } + void Hints::hint (string h) { @@ -631,3 +635,20 @@ 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.")); + } +} +