summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-03-28 01:21:28 +0100
committerCarl Hetherington <cth@carlh.net>2025-03-28 01:21:28 +0100
commit034d7176177043dc4cb4518ae6a946efe401b809 (patch)
treeae7187d3d5751b3d23c300118aeaf70e8b163d49 /src/lib
parent66b8fe87f90e812672d213387fe08d734464ac9f (diff)
Copy audio language when setting up a project from a DCP (#3009).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/copy_dcp_details_to_film.cc1
-rw-r--r--src/lib/dcp_content.cc8
-rw-r--r--src/lib/dcp_content.h9
3 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/copy_dcp_details_to_film.cc b/src/lib/copy_dcp_details_to_film.cc
index 32b08d062..9e0ad79c1 100644
--- a/src/lib/copy_dcp_details_to_film.cc
+++ b/src/lib/copy_dcp_details_to_film.cc
@@ -61,6 +61,7 @@ copy_dcp_settings_to_film(shared_ptr<const DCPContent> dcp, shared_ptr<Film> fil
if (dcp->audio) {
film->set_audio_channels(dcp->audio->stream()->channels());
+ film->set_audio_language(dcp->audio_language());
}
film->set_ratings(dcp->ratings());
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 32b97b06f..885cbad93 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -168,6 +168,9 @@ DCPContent::DCPContent(cxml::ConstNodePtr node, boost::optional<boost::filesyste
}
_active_audio_channels = node->optional_number_child<int>("ActiveAudioChannels");
+ if (auto lang = node->optional_string_child("AudioLanguage")) {
+ _audio_language = dcp::LanguageTag(*lang);
+ }
for (auto non_zero: node->node_children("HasNonZeroEntryPoint")) {
try {
@@ -273,6 +276,7 @@ DCPContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool toler
as->set_mapping (m);
_active_audio_channels = examiner->active_audio_channels();
+ _audio_language = examiner->audio_language();
}
if (examiner->has_atmos()) {
@@ -458,6 +462,10 @@ DCPContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_
cxml::add_text_child(element, "ActiveAudioChannels", fmt::to_string(*_active_audio_channels));
}
+ if (_audio_language) {
+ cxml::add_text_child(element, "AudioLanguage", _audio_language->as_string());
+ }
+
for (auto i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
if (_has_non_zero_entry_point[i]) {
auto has = cxml::add_child(element, "HasNonZeroEntryPoint");
diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h
index 8545adf06..a0a18703a 100644
--- a/src/lib/dcp_content.h
+++ b/src/lib/dcp_content.h
@@ -36,6 +36,7 @@
#include <libcxml/cxml.h>
#include <dcp/content_kind.h>
#include <dcp/encrypted_kdm.h>
+#include <dcp/language_tag.h>
#include <dcp/rating.h>
@@ -191,6 +192,13 @@ public:
int active_audio_channels() const;
+ /** @return a guess of the DCP's audio language; if there are multiple reels,
+ * and they have different langauges, this could be wrong.
+ */
+ boost::optional<dcp::LanguageTag> audio_language () const {
+ return _audio_language;
+ }
+
void check_font_ids();
private:
@@ -241,6 +249,7 @@ private:
EnumIndexedVector<bool, TextType> _has_non_zero_entry_point;
boost::optional<int> _active_audio_channels;
+ boost::optional<dcp::LanguageTag> _audio_language;
};