/* Default to turning these subtitles on */
only_text()->set_use (true);
- if (iop) {
- only_text()->set_language (iop->language ());
- } else if (smpte) {
- only_text()->set_language (smpte->language().get_value_or (""));
- }
-
_length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ());
sc->fix_empty_font_ids ();
/*
- Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
int const TextContentProperty::Y_SCALE = 503;
int const TextContentProperty::USE = 504;
int const TextContentProperty::BURN = 505;
-int const TextContentProperty::LANGUAGE = 506;
-int const TextContentProperty::FONTS = 507;
-int const TextContentProperty::COLOUR = 508;
-int const TextContentProperty::EFFECT = 509;
-int const TextContentProperty::EFFECT_COLOUR = 510;
-int const TextContentProperty::LINE_SPACING = 511;
-int const TextContentProperty::FADE_IN = 512;
-int const TextContentProperty::FADE_OUT = 513;
-int const TextContentProperty::OUTLINE_WIDTH = 514;
-int const TextContentProperty::TYPE = 515;
-int const TextContentProperty::DCP_TRACK = 516;
+int const TextContentProperty::FONTS = 506;
+int const TextContentProperty::COLOUR = 507;
+int const TextContentProperty::EFFECT = 508;
+int const TextContentProperty::EFFECT_COLOUR = 509;
+int const TextContentProperty::LINE_SPACING = 510;
+int const TextContentProperty::FADE_IN = 511;
+int const TextContentProperty::FADE_OUT = 512;
+int const TextContentProperty::OUTLINE_WIDTH = 513;
+int const TextContentProperty::TYPE = 514;
+int const TextContentProperty::DCP_TRACK = 515;
TextContent::TextContent (Content* parent, TextType type, TextType original_type)
: ContentPart (parent)
_fade_out = ContentTime (*fo);
}
- if (version >= 37) {
- _language = node->optional_string_child ("Language").get_value_or ("");
- } else {
- _language = node->optional_string_child ("SubtitleLanguage").get_value_or ("");
- }
-
list<cxml::NodePtr> fonts = node->node_children ("Font");
for (list<cxml::NodePtr>::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
_fonts.push_back (shared_ptr<Font> (new Font (*i)));
_y_offset = ref->y_offset ();
_x_scale = ref->x_scale ();
_y_scale = ref->y_scale ();
- _language = ref->language ();
_fonts = ref_fonts;
_line_spacing = ref->line_spacing ();
_fade_in = ref->fade_in ();
text->add_child("YOffset")->add_child_text (raw_convert<string> (_y_offset));
text->add_child("XScale")->add_child_text (raw_convert<string> (_x_scale));
text->add_child("YScale")->add_child_text (raw_convert<string> (_y_scale));
- text->add_child("Language")->add_child_text (_language);
if (_colour) {
text->add_child("Red")->add_child_text (raw_convert<string> (_colour->r));
text->add_child("Green")->add_child_text (raw_convert<string> (_colour->g));
s += "_" + f->file().get_value_or("Default").string();
}
- /* The DCP track and language are for metadata only, and don't affect
- how this content looks.
- */
+ /* The DCP track is for metadata only, and doesn't affect how this content looks */
return s;
}
maybe_set (_y_scale, s, TextContentProperty::Y_SCALE);
}
-void
-TextContent::set_language (string language)
-{
- maybe_set (_language, language, TextContentProperty::LANGUAGE);
-}
-
void
TextContent::set_line_spacing (double s)
{
/*
- Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
static int const Y_SCALE;
static int const USE;
static int const BURN;
- static int const LANGUAGE;
static int const FONTS;
static int const COLOUR;
static int const EFFECT;
void set_y_offset (double);
void set_x_scale (double);
void set_y_scale (double);
- void set_language (std::string language);
void set_colour (dcp::Colour);
void unset_colour ();
void set_effect (dcp::Effect);
return _fonts;
}
- std::string language () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _language;
- }
-
boost::optional<dcp::Colour> colour () const {
boost::mutex::scoped_lock lm (_mutex);
return _colour;
static std::list<boost::shared_ptr<TextContent> > from_xml (Content* parent, cxml::ConstNodePtr, int version);
-protected:
- /** subtitle language (e.g. "German") or empty if it is not known */
- std::string _language;
-
private:
friend struct ffmpeg_pts_offset_test;
boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->container_nickname());
boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _film->isdcf_metadata().audio_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 ();
- }
- }
+ vector<dcp::LanguageTag> subtitle_languages = _film->subtitle_languages();
+ if (subtitle_languages.empty()) {
+ boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", "None");
+ } else {
+ boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", subtitle_languages.front().description());
}
- boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", subtitle_language.get_value_or("None"));
boost::uintmax_t size = 0;
for (
, _outline_subtitles (0)
, _dcp_track_label (0)
, _dcp_track (0)
- , _language_label (0)
- , _language (0)
, _text_view (0)
, _fonts_dialog (0)
, _original_type (t)
_dcp_track->Destroy ();
_dcp_track = 0;
}
- if (!_language_label) {
- _language_label = create_label (this, _("Language"), true);
- add_label_to_sizer (_grid, _language_label, true, wxGBPosition(_language_row, 0));
- }
- if (!_language) {
- _language = new wxTextCtrl (this, wxID_ANY);
- _language->Bind (wxEVT_TEXT, boost::bind(&TextPanel::language_changed, this));
- _grid->Add (_language, wxGBPosition(_language_row, 1), wxDefaultSpan, wxEXPAND);
- film_content_changed (TextContentProperty::LANGUAGE);
- }
if (!_outline_subtitles) {
_outline_subtitles = new CheckBox (this, _("Show subtitle area"));
_outline_subtitles->Bind (wxEVT_CHECKBOX, boost::bind (&TextPanel::outline_subtitles_changed, this));
break;
case TEXT_CLOSED_CAPTION:
- if (_language_label) {
- _language_label->Destroy ();
- _language_label = 0;
- }
- if (_language) {
- _language->Destroy ();
- _language = 0;
- }
if (!_dcp_track_label) {
_dcp_track_label = create_label (this, _("CCAP track"), true);
- add_label_to_sizer (_grid, _dcp_track_label, true, wxGBPosition(_language_row, 0));
+ add_label_to_sizer (_grid, _dcp_track_label, true, wxGBPosition(_ccap_track_row, 0));
}
if (!_dcp_track) {
_dcp_track = new wxChoice (this, wxID_ANY);
_dcp_track->Bind (wxEVT_CHOICE, boost::bind(&TextPanel::dcp_track_changed, this));
- _grid->Add (_dcp_track, wxGBPosition(_language_row, 1), wxDefaultSpan, wxEXPAND);
+ _grid->Add (_dcp_track, wxGBPosition(_ccap_track_row, 1), wxDefaultSpan, wxEXPAND);
update_dcp_tracks ();
film_content_changed (TextContentProperty::DCP_TRACK);
}
++r;
}
- _language_row = r;
+ _ccap_track_row = r;
++r;
add_label_to_sizer (_grid, _stream_label, true, wxGBPosition (r, 0));
} else if (property == TextContentProperty::LINE_SPACING) {
checked_set (_line_spacing, text ? lrint (text->line_spacing() * 100) : 100);
clear_outline_subtitles ();
- } else if (property == TextContentProperty::LANGUAGE) {
- if (_language) {
- checked_set (_language, text ? text->language() : "");
- }
} else if (property == TextContentProperty::DCP_TRACK) {
if (_dcp_track) {
update_dcp_track_selection ();
}
}
-void
-TextPanel::language_changed ()
-{
- DCPOMATIC_ASSERT (_language);
- BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_text ()) {
- i->text_of_original_type(_original_type)->set_language (wx_to_std (_language->GetValue()));
- }
-}
-
void
TextPanel::content_selection_changed ()
{
film_content_changed (TextContentProperty::X_SCALE);
film_content_changed (TextContentProperty::Y_SCALE);
film_content_changed (TextContentProperty::LINE_SPACING);
- film_content_changed (TextContentProperty::LANGUAGE);
film_content_changed (TextContentProperty::FONTS);
film_content_changed (TextContentProperty::TYPE);
film_content_changed (TextContentProperty::DCP_TRACK);
void y_scale_changed ();
void line_spacing_changed ();
void dcp_track_changed ();
- void language_changed ();
void stream_changed ();
void text_view_clicked ();
void fonts_dialog_clicked ();
wxSpinCtrl* _line_spacing;
wxStaticText* _dcp_track_label;
wxChoice* _dcp_track;
- wxStaticText* _language_label;
- wxTextCtrl* _language;
wxStaticText* _stream_label;
wxChoice* _stream;
wxButton* _text_view_button;
TextType _original_type;
int _outline_subtitles_row;
- int _language_row;
+ int _ccap_track_row;
boost::weak_ptr<Content> _analysis_content;
boost::signals2::scoped_connection _analysis_finished_connection;
film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
film->set_audio_channels (1);
film->set_resolution (RESOLUTION_4K);
+ film->set_subtitle_language (dcp::LanguageTag("fr-FR"));
shared_ptr<Content> text = content_factory("test/data/subrip.srt").front();
BOOST_REQUIRE_EQUAL (text->text.size(), 1U);
- text->text.front()->set_language ("fr");
text->text.front()->set_burn (true);
film->examine_and_add_content (text);
BOOST_REQUIRE (!wait_for_jobs());