if (!dm.audio_language.empty ()) {
d += "_" + dm.audio_language;
- if (!dm.subtitle_language.empty()) {
- /* I'm not clear on the precise details of the convention for CCAP labelling;
- for now I'm just appending -CCAP if we have any closed captions.
- */
+ /* I'm not clear on the precise details of the convention for CCAP labelling;
+ for now I'm just appending -CCAP if we have any closed captions.
+ */
- bool burnt_in = true;
- bool ccap = false;
- BOOST_FOREACH (shared_ptr<Content> i, content()) {
- BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
- if (j->type() == TEXT_OPEN_SUBTITLE && j->use() && !j->burn()) {
+ optional<string> subtitle_language;
+ bool burnt_in = true;
+ bool ccap = false;
+ BOOST_FOREACH (shared_ptr<Content> i, content()) {
+ BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
+ if (j->type() == TEXT_OPEN_SUBTITLE && j->use()) {
+ subtitle_language = j->language ();
+ if (!j->burn()) {
burnt_in = false;
- } else if (j->type() == TEXT_CLOSED_CAPTION) {
- ccap = true;
}
+ } else if (j->type() == TEXT_CLOSED_CAPTION && j->use()) {
+ ccap = true;
}
}
+ }
- string language = dm.subtitle_language;
- if (burnt_in && language != "XX") {
- transform (language.begin(), language.end(), language.begin(), ::tolower);
+ if (subtitle_language) {
+ if (burnt_in && *subtitle_language != "XX") {
+ transform (subtitle_language->begin(), subtitle_language->end(), subtitle_language->begin(), ::tolower);
} else {
- transform (language.begin(), language.end(), language.begin(), ::toupper);
+ transform (subtitle_language->begin(), subtitle_language->end(), subtitle_language->begin(), ::toupper);
}
- d += "-" + language;
+ d += "-" + *subtitle_language;
if (ccap) {
d += "-CCAP";
}
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
: content_version (node->number_child<int> ("ContentVersion"))
, audio_language (node->string_child ("AudioLanguage"))
- , subtitle_language (node->string_child ("SubtitleLanguage"))
, territory (node->string_child ("Territory"))
, rating (node->string_child ("Rating"))
, studio (node->string_child ("Studio"))
{
root->add_child("ContentVersion")->add_child_text (raw_convert<string> (content_version));
root->add_child("AudioLanguage")->add_child_text (audio_language);
- root->add_child("SubtitleLanguage")->add_child_text (subtitle_language);
root->add_child("Territory")->add_child_text (territory);
root->add_child("Rating")->add_child_text (rating);
root->add_child("Studio")->add_child_text (studio);
{
return a.content_version == b.content_version &&
a.audio_language == b.audio_language &&
- a.subtitle_language == b.subtitle_language &&
a.territory == b.territory &&
a.rating == b.rating &&
a.studio == b.studio &&
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
int content_version;
std::string audio_language;
- std::string subtitle_language;
std::string territory;
std::string rating;
std::string studio;
/*
- Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "font.h"
#include "util.h"
#include "reel_writer.h"
+#include "text_content.h"
#include <dcp/cpl.h>
#include <dcp/locale_convert.h>
#include <boost/foreach.hpp>
boost::algorithm::replace_all (text, "$TYPE", _film->dcp_content_type()->pretty_name());
boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->container_nickname());
boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _film->isdcf_metadata().audio_language);
- boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", _film->isdcf_metadata().subtitle_language);
+
+ optional<string> subtitle_language;
+ BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
+ BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
+ if (j->type() == TEXT_OPEN_SUBTITLE && j->use()) {
+ subtitle_language = j->language ();
+ }
+ }
+ }
+ boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", subtitle_language.get_value_or("None"));
boost::uintmax_t size = 0;
for (
/*
- Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
add (_("Audio Language (e.g. EN)"), true);
_audio_language = add (new wxTextCtrl (this, wxID_ANY));
- add (_("Subtitle Language (e.g. FR)"), true);
- _subtitle_language = add (new wxTextCtrl (this, wxID_ANY));
-
add (_("Territory (e.g. UK)"), true);
_territory = add (new wxTextCtrl (this, wxID_ANY));
_content_version->SetValue (dm.content_version);
_audio_language->SetValue (std_to_wx (dm.audio_language));
- _subtitle_language->SetValue (std_to_wx (dm.subtitle_language));
_territory->SetValue (std_to_wx (dm.territory));
_rating->SetValue (std_to_wx (dm.rating));
_studio->SetValue (std_to_wx (dm.studio));
dm.content_version = _content_version->GetValue ();
dm.audio_language = wx_to_std (_audio_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 ());
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
private:
wxSpinCtrl* _content_version;
wxTextCtrl* _audio_language;
- wxTextCtrl* _subtitle_language;
wxTextCtrl* _territory;
wxTextCtrl* _rating;
wxTextCtrl* _studio;
/*
- Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "lib/audio_mapping.h"
#include "lib/ffmpeg_content.h"
#include "lib/audio_content.h"
+#include "lib/content_factory.h"
+#include "lib/text_content.h"
#include "test.h"
#include <iostream>
ISDCFMetadata m;
m.content_version = 1;
m.audio_language = "EN";
- m.subtitle_language = "XX";
m.territory = "UK";
m.rating = "PG";
m.studio = "ST";
film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
film->set_audio_channels (1);
film->set_resolution (RESOLUTION_4K);
+ shared_ptr<Content> text = content_factory("test/data/subrip.srt").front();
+ BOOST_REQUIRE_EQUAL (text->text.size(), 1);
+ text->text.front()->set_language ("fr");
+ text->text.front()->set_burn (true);
+ film->examine_and_add_content (text);
+ BOOST_REQUIRE (!wait_for_jobs());
m.content_version = 2;
m.audio_language = "DE";
- m.subtitle_language = "FR";
m.territory = "US";
m.rating = "R";
m.studio = "DI";