summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-04-28 20:11:21 +0000
committerCarl Hetherington <cth@carlh.net>2019-04-28 20:11:21 +0000
commit554167b8c83ce15f662a71dccd9e6826231c360e (patch)
treede28b152a7474600384de9035a7e0ddb8e412137 /src
parent4540ff0beb2dad9911afc309b75952adc226fa48 (diff)
Restore ISDCF subtitle language option as an override (#1536).
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc19
-rw-r--r--src/lib/isdcf_metadata.cc7
-rw-r--r--src/lib/isdcf_metadata.h3
-rw-r--r--src/wx/isdcf_metadata_dialog.cc25
-rw-r--r--src/wx/isdcf_metadata_dialog.h4
5 files changed, 48 insertions, 10 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index c70e82cda..aa16fdad8 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -478,12 +478,6 @@ Film::read_metadata (optional<boost::filesystem::path> path)
_isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
}
- list<string> notes;
-
- if (_isdcf_metadata.has_subtitle_language) {
- notes.push_back(_("This film had a subtitle language, configured within the ISDCF metadata dialogue, which will be ignored by this version of DCP-o-matic. "
- "Please set the language for each piece of subtitle or closed-caption content in the film."));
- }
{
optional<string> c = f.optional_string_child ("DCPContentType");
@@ -537,6 +531,7 @@ Film::read_metadata (optional<boost::filesystem::path> path)
_reencode_j2k = f.optional_bool_child("ReencodeJ2K").get_value_or(false);
_user_explicit_video_frame_rate = f.optional_bool_child("UserExplicitVideoFrameRate").get_value_or(false);
+ list<string> notes;
_playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
/* Write backtraces to this film's directory, until another film is loaded */
@@ -748,7 +743,16 @@ Film::isdcf_name (bool if_created_now) const
}
}
- if (subtitle_language) {
+ if (dm.subtitle_language) {
+ /* Subtitle language is overridden in ISDCF metadata, primarily to handle
+ content with pre-burnt subtitles.
+ */
+ d += "-" + *dm.subtitle_language;
+ if (ccap) {
+ d += "-CCAP";
+ }
+ } else if (subtitle_language) {
+ /* Language is worked out from the content */
if (burnt_in && *subtitle_language != "XX") {
transform (subtitle_language->begin(), subtitle_language->end(), subtitle_language->begin(), ::tolower);
} else {
@@ -760,6 +764,7 @@ Film::isdcf_name (bool if_created_now) const
d += "-CCAP";
}
} else {
+ /* No subtitles */
d += "-XX";
}
}
diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc
index 0d7d02cde..c333325a1 100644
--- a/src/lib/isdcf_metadata.cc
+++ b/src/lib/isdcf_metadata.cc
@@ -33,8 +33,7 @@ using dcp::raw_convert;
ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
: content_version (node->number_child<int> ("ContentVersion"))
, audio_language (node->string_child ("AudioLanguage"))
- /* Old versions contained this tag, but not these details are held in content */
- , has_subtitle_language (static_cast<bool>(node->optional_node_child("SubtitleLanguage")))
+ , subtitle_language (node->optional_string_child("SubtitleLanguage"))
, territory (node->string_child ("Territory"))
, rating (node->string_child ("Rating"))
, studio (node->string_child ("Studio"))
@@ -54,6 +53,9 @@ void
ISDCFMetadata::as_xml (xmlpp::Node* root) const
{
root->add_child("ContentVersion")->add_child_text (raw_convert<string> (content_version));
+ if (subtitle_language) {
+ root->add_child("SubtitleLanguage")->add_child_text (*subtitle_language);
+ }
root->add_child("AudioLanguage")->add_child_text (audio_language);
root->add_child("Territory")->add_child_text (territory);
root->add_child("Rating")->add_child_text (rating);
@@ -71,6 +73,7 @@ bool
operator== (ISDCFMetadata const & a, ISDCFMetadata const & b)
{
return a.content_version == b.content_version &&
+ a.subtitle_language == b.subtitle_language &&
a.audio_language == b.audio_language &&
a.territory == b.territory &&
a.rating == b.rating &&
diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h
index 20f840416..f54565f5d 100644
--- a/src/lib/isdcf_metadata.h
+++ b/src/lib/isdcf_metadata.h
@@ -46,7 +46,8 @@ public:
int content_version;
std::string audio_language;
- bool has_subtitle_language;
+ /** if set, this overrides any languages specified in individual Content objects */
+ boost::optional<std::string> subtitle_language;
std::string territory;
std::string rating;
std::string studio;
diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc
index 9226af8b9..3d79f3bf6 100644
--- a/src/wx/isdcf_metadata_dialog.cc
+++ b/src/wx/isdcf_metadata_dialog.cc
@@ -41,6 +41,16 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo
add (_("Audio Language (e.g. EN)"), true);
_audio_language = add (new wxTextCtrl (this, wxID_ANY));
+ _enable_subtitle_language = add (new wxCheckBox(this, wxID_ANY, _("Subtitle language (e.g. FR)")));
+ _subtitle_language = add (new wxTextCtrl(this, wxID_ANY));
+
+ wxStaticText* subtitle_note = add (_("(use this to override languages specified\nin the 'timed text' tab)"), false);
+ wxFont font = subtitle_note->GetFont();
+ font.SetStyle (wxFONTSTYLE_ITALIC);
+ font.SetPointSize (font.GetPointSize() - 1);
+ subtitle_note->SetFont (font);
+ add_spacer ();
+
add (_("Territory (e.g. UK)"), true);
_territory = add (new wxTextCtrl (this, wxID_ANY));
@@ -79,6 +89,8 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo
_content_version->SetValue (dm.content_version);
_audio_language->SetValue (std_to_wx (dm.audio_language));
+ _enable_subtitle_language->SetValue (static_cast<bool>(dm.subtitle_language));
+ _subtitle_language->SetValue (std_to_wx(dm.subtitle_language.get_value_or("")));
_territory->SetValue (std_to_wx (dm.territory));
_rating->SetValue (std_to_wx (dm.rating));
_studio->SetValue (std_to_wx (dm.studio));
@@ -90,9 +102,19 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo
_two_d_version_of_three_d->SetValue (dm.two_d_version_of_three_d);
_mastered_luminance->SetValue (std_to_wx (dm.mastered_luminance));
+ _enable_subtitle_language->Bind (wxEVT_CHECKBOX, boost::bind(&ISDCFMetadataDialog::setup_sensitivity, this));
+
+ setup_sensitivity ();
+
layout ();
}
+void
+ISDCFMetadataDialog::setup_sensitivity ()
+{
+ _subtitle_language->Enable (_enable_subtitle_language->GetValue());
+}
+
ISDCFMetadata
ISDCFMetadataDialog::isdcf_metadata () const
{
@@ -100,6 +122,9 @@ ISDCFMetadataDialog::isdcf_metadata () const
dm.content_version = _content_version->GetValue ();
dm.audio_language = wx_to_std (_audio_language->GetValue ());
+ if (_enable_subtitle_language->GetValue()) {
+ dm.subtitle_language = wx_to_std (_subtitle_language->GetValue());
+ }
dm.territory = wx_to_std (_territory->GetValue ());
dm.rating = wx_to_std (_rating->GetValue ());
dm.studio = wx_to_std (_studio->GetValue ());
diff --git a/src/wx/isdcf_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h
index b1ecb5a36..335c29a4a 100644
--- a/src/wx/isdcf_metadata_dialog.h
+++ b/src/wx/isdcf_metadata_dialog.h
@@ -34,8 +34,12 @@ public:
ISDCFMetadata isdcf_metadata () const;
private:
+ void setup_sensitivity ();
+
wxSpinCtrl* _content_version;
wxTextCtrl* _audio_language;
+ wxCheckBox* _enable_subtitle_language;
+ wxTextCtrl* _subtitle_language;
wxTextCtrl* _territory;
wxTextCtrl* _rating;
wxTextCtrl* _studio;