summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-01-05 01:28:19 +0100
committerCarl Hetherington <cth@carlh.net>2024-01-05 17:06:21 +0100
commit43cca4d3a11e077b3e75c713b95942cc3afc9eb1 (patch)
treebbbf9102ec0e6fbd0cab778d9ce834cb52b5a9fc /src/lib
parentcb330f076f72000d028b11e88702addb0a2ab480 (diff)
Add new "territory type" so that INT-T{D,L} can be chosen (#2704).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc19
-rw-r--r--src/lib/film.h7
-rw-r--r--src/lib/film_property.h1
-rw-r--r--src/lib/territory_type.cc57
-rw-r--r--src/lib/territory_type.h41
5 files changed, 124 insertions, 1 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index a5b393cc1..5b6b44892 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -426,6 +426,7 @@ Film::metadata (bool with_content_paths) const
root->add_child("ContentVersion")->add_child_text(i);
}
root->add_child("NameLanguage")->add_child_text(_name_language.to_string());
+ root->add_child("TerritoryType")->add_child_text(territory_type_to_string(_territory_type));
if (_release_territory) {
root->add_child("ReleaseTerritory")->add_child_text(_release_territory->subtag());
}
@@ -617,6 +618,10 @@ Film::read_metadata (optional<boost::filesystem::path> path)
if (name_language) {
_name_language = dcp::LanguageTag (*name_language);
}
+ auto territory_type = f.optional_string_child("TerritoryType");
+ if (territory_type) {
+ _territory_type = string_to_territory_type(*territory_type);
+ }
auto release_territory = f.optional_string_child("ReleaseTerritory");
if (release_territory) {
_release_territory = dcp::LanguageTag::RegionSubtag (*release_territory);
@@ -977,7 +982,11 @@ Film::isdcf_name (bool if_created_now) const
isdcf_name += "-XX";
}
- if (_release_territory) {
+ if (_territory_type == TerritoryType::INTERNATIONAL_TEXTED) {
+ isdcf_name += "_INT-TD";
+ } else if (_territory_type == TerritoryType::INTERNATIONAL_TEXTLESS) {
+ isdcf_name += "_INT-TL";
+ } else if (_release_territory) {
auto territory = _release_territory->subtag();
isdcf_name += "_" + to_upper (territory);
if (!_ratings.empty()) {
@@ -2207,3 +2216,11 @@ Film::last_written_by_earlier_than(int major, int minor, int micro) const
return our_micro < micro;
}
+
+void
+Film::set_territory_type(TerritoryType type)
+{
+ FilmChangeSignaller ch(this, FilmProperty::TERRITORY_TYPE);
+ _territory_type = type;
+}
+
diff --git a/src/lib/film.h b/src/lib/film.h
index 8aeae8e4e..f24255858 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -37,6 +37,7 @@
#include "named_channel.h"
#include "resolution.h"
#include "signaller.h"
+#include "territory_type.h"
#include "transcode_job.h"
#include "types.h"
#include "util.h"
@@ -314,6 +315,10 @@ public:
return _name_language;
}
+ TerritoryType territory_type() const {
+ return _territory_type;
+ }
+
boost::optional<dcp::LanguageTag::RegionSubtag> release_territory () const {
return _release_territory;
}
@@ -407,6 +412,7 @@ public:
void set_ratings (std::vector<dcp::Rating> r);
void set_content_versions (std::vector<std::string> v);
void set_name_language (dcp::LanguageTag lang);
+ void set_territory_type(TerritoryType type);
void set_release_territory (boost::optional<dcp::LanguageTag::RegionSubtag> region = boost::none);
void set_sign_language_video_language (boost::optional<dcp::LanguageTag> tag);
void set_version_number (int v);
@@ -523,6 +529,7 @@ private:
std::vector<dcp::Rating> _ratings;
std::vector<std::string> _content_versions;
dcp::LanguageTag _name_language;
+ TerritoryType _territory_type = TerritoryType::SPECIFIC;
boost::optional<dcp::LanguageTag::RegionSubtag> _release_territory;
boost::optional<dcp::LanguageTag> _sign_language_video_language;
int _version_number;
diff --git a/src/lib/film_property.h b/src/lib/film_property.h
index 55596af70..c23297965 100644
--- a/src/lib/film_property.h
+++ b/src/lib/film_property.h
@@ -70,6 +70,7 @@ enum class FilmProperty {
RED_BAND,
TWO_D_VERSION_OF_THREE_D,
LUMINANCE,
+ TERRITORY_TYPE,
};
diff --git a/src/lib/territory_type.cc b/src/lib/territory_type.cc
new file mode 100644
index 000000000..83bf6dadb
--- /dev/null
+++ b/src/lib/territory_type.cc
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "dcpomatic_assert.h"
+#include "territory_type.h"
+
+
+using std::string;
+
+
+string
+territory_type_to_string(TerritoryType type)
+{
+ switch (type) {
+ case TerritoryType::INTERNATIONAL_TEXTED:
+ return "international-texted";
+ case TerritoryType::INTERNATIONAL_TEXTLESS:
+ return "international-textless";
+ case TerritoryType::SPECIFIC:
+ return "specific";
+ }
+
+ DCPOMATIC_ASSERT(false);
+}
+
+
+TerritoryType
+string_to_territory_type(string type)
+{
+ if (type == "international-texted") {
+ return TerritoryType::INTERNATIONAL_TEXTED;
+ } else if (type == "international-textless") {
+ return TerritoryType::INTERNATIONAL_TEXTLESS;
+ } else if (type == "specific") {
+ return TerritoryType::SPECIFIC;
+ }
+
+ DCPOMATIC_ASSERT(false);
+}
+
diff --git a/src/lib/territory_type.h b/src/lib/territory_type.h
new file mode 100644
index 000000000..f1e09d91a
--- /dev/null
+++ b/src/lib/territory_type.h
@@ -0,0 +1,41 @@
+/*
+ Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef DCPOMATIC_TERRITORY_TYPE_H
+#define DCPOMATIC_TERRITORY_TYPE_H
+
+
+#include <string>
+
+
+enum class TerritoryType
+{
+ INTERNATIONAL_TEXTED,
+ INTERNATIONAL_TEXTLESS,
+ SPECIFIC
+};
+
+
+std::string territory_type_to_string(TerritoryType);
+TerritoryType string_to_territory_type(std::string);
+
+
+#endif
+