summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-06-01 17:10:16 +0200
committerCarl Hetherington <cth@carlh.net>2021-06-01 17:10:16 +0200
commit4d5d4d96ef3314d3242807c4e610565b769414ee (patch)
treebcec645f1970c9959134902df41e75f5b2a8d334
parent1b348977ecc0a8fa31135bf2d554c3d25bafaa2f (diff)
Add hint when no audio language is set (#2033).
-rw-r--r--src/lib/hints.cc18
-rw-r--r--src/lib/hints.h1
-rw-r--r--test/hints_test.cc18
3 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index fe2e5889c..64122db8d 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -400,6 +400,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")));
@@ -637,3 +638,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<const Content> 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."));
+ }
+}
+
diff --git a/src/lib/hints.h b/src/lib/hints.h
index 81a37a3c4..2a5e8d4a0 100644
--- a/src/lib/hints.h
+++ b/src/lib/hints.h
@@ -78,6 +78,7 @@ private:
void check_ffec_and_ffmc_in_smpte_feature ();
void check_out_of_range_markers ();
void check_text_languages ();
+ void check_audio_language ();
boost::thread _thread;
/** This is used to make a partial DCP containing only the subtitles and closed captions that
diff --git a/test/hints_test.cc b/test/hints_test.cc
index 16d130f22..263f02435 100644
--- a/test/hints_test.cc
+++ b/test/hints_test.cc
@@ -19,6 +19,7 @@
*/
+#include "lib/audio_content.h"
#include "lib/content.h"
#include "lib/content_factory.h"
#include "lib/cross.h"
@@ -237,3 +238,20 @@ BOOST_AUTO_TEST_CASE (hints_destroyed_while_running)
dcpomatic_sleep_seconds (1);
}
+
+BOOST_AUTO_TEST_CASE (hints_audio_with_no_language)
+{
+ auto content = content_factory("test/data/sine_440.wav").front();
+ auto film = new_test_film2 ("hints_audio_with_no_language", { content });
+ content->audio->set_gain (-6);
+
+ auto hints = get_hints (film);
+ BOOST_REQUIRE_EQUAL (hints.size(), 1U);
+ BOOST_CHECK_EQUAL (
+ hints[0],
+ "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."
+ );
+
+}
+