diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-02 10:47:35 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-02 10:47:35 +0200 |
| commit | a6696b9a58c14d81f0ae30482051c2cd47a004db (patch) | |
| tree | 0fb2983324b891f7dd3ecde04eb92dae00cb0a85 /src/wx | |
| parent | a4b7d0af831b8cd9aafca5f2b264be416a7b1148 (diff) | |
Add language to audio content and use it instead of the general metadata.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_panel.cc | 64 | ||||
| -rw-r--r-- | src/wx/audio_panel.h | 10 | ||||
| -rw-r--r-- | src/wx/dcp_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/isdcf_metadata_dialog.cc | 5 | ||||
| -rw-r--r-- | src/wx/isdcf_metadata_dialog.h | 1 | ||||
| -rw-r--r-- | src/wx/smpte_metadata_dialog.cc | 17 | ||||
| -rw-r--r-- | src/wx/smpte_metadata_dialog.h | 2 |
7 files changed, 66 insertions, 35 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 59c9cd2a8..85ca19208 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -18,15 +18,17 @@ */ -#include "audio_panel.h" -#include "audio_mapping_view.h" -#include "wx_util.h" -#include "gain_calculator_dialog.h" -#include "content_panel.h" + #include "audio_dialog.h" -#include "static_text.h" +#include "audio_mapping_view.h" +#include "audio_panel.h" #include "check_box.h" +#include "content_panel.h" #include "dcpomatic_button.h" +#include "gain_calculator_dialog.h" +#include "language_tag_widget.h" +#include "static_text.h" +#include "wx_util.h" #include "lib/config.h" #include "lib/ffmpeg_audio_stream.h" #include "lib/ffmpeg_content.h" @@ -37,6 +39,7 @@ #include <wx/spinctrl.h> #include <iostream> + using std::vector; using std::cout; using std::string; @@ -50,6 +53,7 @@ using boost::optional; using namespace boost::placeholders; #endif + AudioPanel::AudioPanel (ContentPanel* p) : ContentSubPanel (p, _("Audio")) , _audio_dialog (0) @@ -91,6 +95,9 @@ AudioPanel::AudioPanel (ContentPanel* p) /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time _delay_ms_label = create_label (this, _("ms"), false); + _enable_language = new wxCheckBox (this, wxID_ANY, _("Language")); + _language = new LanguageTagWidget (this, _("Language used for the dialogue in this content"), boost::none); + _mapping = new AudioMappingView (this, _("Content"), _("content"), _("DCP"), _("DCP")); _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); @@ -111,6 +118,8 @@ AudioPanel::AudioPanel (ContentPanel* p) _reference->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::reference_clicked, this)); _show->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::show_clicked, this)); _gain_calculate_button->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::gain_calculate_button_clicked, this)); + _enable_language->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::enable_language_clicked, this)); + _language->Changed.connect (boost::bind(&AudioPanel::language_changed, this)); _mapping_connection = _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1)); _active_jobs_connection = JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&AudioPanel::active_jobs_changed, this, _1, _2)); @@ -136,7 +145,7 @@ AudioPanel::add_to_grid () add_label_to_sizer (_grid, _gain_label, true, wxGBPosition(r, 0)); { auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (_gain->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); + s->Add (_gain->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); s->Add (_gain_db_label, 0, wxALIGN_CENTER_VERTICAL); _grid->Add (s, wxGBPosition(r, 1)); } @@ -146,10 +155,16 @@ AudioPanel::add_to_grid () add_label_to_sizer (_grid, _delay_label, true, wxGBPosition(r, 0)); auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (_delay->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); + s->Add (_delay->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); s->Add (_delay_ms_label, 0, wxALIGN_CENTER_VERTICAL); _grid->Add (s, wxGBPosition(r, 1)); ++r; + + s = new wxBoxSizer (wxHORIZONTAL); + s->Add (_enable_language, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); + s->Add (_language->sizer(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT); + _grid->Add (s, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND); + ++r; } AudioPanel::~AudioPanel () @@ -229,6 +244,14 @@ AudioPanel::film_content_changed (int property) setup_sensitivity (); } else if (property == ContentProperty::VIDEO_FRAME_RATE) { setup_description (); + } else if (property == AudioContentProperty::LANGUAGE) { + if (ac.size() == 1 && ac.front()->audio->language()) { + _enable_language->SetValue (true); + _language->set (ac.front()->audio->language()); + } else { + _enable_language->SetValue (false); + _language->set (boost::none); + } } } @@ -294,6 +317,7 @@ AudioPanel::content_selection_changed () film_content_changed (AudioContentProperty::STREAMS); film_content_changed (AudioContentProperty::GAIN); + film_content_changed (AudioContentProperty::LANGUAGE); film_content_changed (DCPContentProperty::REFERENCE_AUDIO); setup_sensitivity (); @@ -336,6 +360,8 @@ AudioPanel::setup_sensitivity () _mapping->Enable (sel.size() == 1); _description->Enable (sel.size() == 1); } + + _language->enable (_enable_language->GetValue()); } void @@ -440,3 +466,25 @@ AudioPanel::set_film (shared_ptr<Film>) _audio_dialog = nullptr; } } + + +void +AudioPanel::enable_language_clicked () +{ + setup_sensitivity (); + auto sel = _parent->selected_audio (); + if (sel.size() == 1) { + sel.front()->audio->set_language (_enable_language->GetValue() ? _language->get() : boost::none); + } +} + + +void +AudioPanel::language_changed () +{ + auto sel = _parent->selected_audio (); + if (sel.size() == 1) { + sel.front()->audio->set_language (_language->get()); + } +} + diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h index aee352a55..aef2f76ad 100644 --- a/src/wx/audio_panel.h +++ b/src/wx/audio_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,16 +18,20 @@ */ + #include "lib/audio_mapping.h" #include "content_sub_panel.h" #include "content_widget.h" + class wxSpinCtrlDouble; class wxButton; class wxChoice; class wxStaticText; class AudioMappingView; class AudioDialog; +class LanguageTagWidget; + class AudioPanel : public ContentSubPanel { @@ -50,6 +54,8 @@ private: void setup_sensitivity (); void reference_clicked (); void add_to_grid (); + void enable_language_clicked (); + void language_changed (); boost::optional<float> peak () const; wxCheckBox* _reference; @@ -63,6 +69,8 @@ private: wxStaticText* _delay_label; wxStaticText* _delay_ms_label; ContentSpinCtrl<AudioContent>* _delay; + wxCheckBox* _enable_language = nullptr; + LanguageTagWidget* _language = nullptr; AudioMappingView* _mapping; wxStaticText* _description; AudioDialog* _audio_dialog; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index d098c5c95..8501eae9c 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -381,7 +381,6 @@ DCPPanel::film_changed (Film::Property p) break; } case Film::Property::ISDCF_METADATA: - case Film::Property::SUBTITLE_LANGUAGES: setup_dcp_name (); break; case Film::Property::VIDEO_FRAME_RATE: @@ -454,6 +453,7 @@ void DCPPanel::film_content_changed (int property) { if (property == AudioContentProperty::STREAMS || + property == AudioContentProperty::LANGUAGE || property == TextContentProperty::USE || property == TextContentProperty::BURN || property == TextContentProperty::LANGUAGE || diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc index 2dcd85d3a..2fde930c6 100644 --- a/src/wx/isdcf_metadata_dialog.cc +++ b/src/wx/isdcf_metadata_dialog.cc @@ -38,9 +38,6 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo add (_("Content version"), true); _content_version = add (new wxSpinCtrl (this, wxID_ANY)); - add (_("Audio Language (e.g. EN)"), true); - _audio_language = add (new wxTextCtrl (this, wxID_ANY)); - add (_("Territory (e.g. UK)"), true); _territory = add (new wxTextCtrl (this, wxID_ANY)); @@ -78,7 +75,6 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo _content_version->SetRange (1, 1024); _content_version->SetValue (dm.content_version); - _audio_language->SetValue (std_to_wx (dm.audio_language)); _territory->SetValue (std_to_wx (dm.territory)); _rating->SetValue (std_to_wx (dm.rating)); _studio->SetValue (std_to_wx (dm.studio)); @@ -102,7 +98,6 @@ ISDCFMetadataDialog::isdcf_metadata () const ISDCFMetadata dm; dm.content_version = _content_version->GetValue (); - dm.audio_language = wx_to_std (_audio_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 986449247..778009551 100644 --- a/src/wx/isdcf_metadata_dialog.h +++ b/src/wx/isdcf_metadata_dialog.h @@ -34,7 +34,6 @@ public: private: wxSpinCtrl* _content_version; - wxTextCtrl* _audio_language; wxTextCtrl* _territory; wxTextCtrl* _rating; wxTextCtrl* _studio; diff --git a/src/wx/smpte_metadata_dialog.cc b/src/wx/smpte_metadata_dialog.cc index 3c35a5c72..464da6710 100644 --- a/src/wx/smpte_metadata_dialog.cc +++ b/src/wx/smpte_metadata_dialog.cc @@ -76,14 +76,6 @@ SMPTEMetadataDialog::main_panel (wxWindow* parent) ); sizer->Add (_name_language->sizer(), 0, wxEXPAND); - add_label_to_sizer (sizer, panel, _("Audio language"), true, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL); - _audio_language = new LanguageTagWidget( - panel, - _("The main language that is spoken in the film's soundtrack"), - film()->audio_language() - ); - sizer->Add (_audio_language->sizer(), 0, wxEXPAND); - { int flags = wxALIGN_TOP | wxRIGHT | wxTOP; #ifdef __WXOSX__ @@ -227,7 +219,6 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_ _luminance_unit->Append (_("foot lambert")); _name_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::name_language_changed, this, _1)); - _audio_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::audio_language_changed, this, _1)); _edit_release_territory->Bind (wxEVT_BUTTON, boost::bind(&SMPTEMetadataDialog::edit_release_territory, this)); _version_number->Bind (wxEVT_SPINCTRL, boost::bind(&SMPTEMetadataDialog::version_number_changed, this)); _status->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::status_changed, this)); @@ -254,7 +245,6 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_ film_changed (ChangeType::DONE, Film::Property::FACILITY); film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS); film_changed (ChangeType::DONE, Film::Property::LUMINANCE); - film_changed (ChangeType::DONE, Film::Property::SUBTITLE_LANGUAGES); setup_sensitivity (); } @@ -361,13 +351,6 @@ SMPTEMetadataDialog::name_language_changed (dcp::LanguageTag tag) void -SMPTEMetadataDialog::audio_language_changed (dcp::LanguageTag tag) -{ - film()->set_audio_language (tag); -} - - -void SMPTEMetadataDialog::edit_release_territory () { DCPOMATIC_ASSERT (film()->release_territory()); diff --git a/src/wx/smpte_metadata_dialog.h b/src/wx/smpte_metadata_dialog.h index 83c1ab39c..46272adbb 100644 --- a/src/wx/smpte_metadata_dialog.h +++ b/src/wx/smpte_metadata_dialog.h @@ -49,7 +49,6 @@ private: std::vector<std::string> content_versions () const; void set_content_versions (std::vector<std::string> v); void name_language_changed (dcp::LanguageTag tag); - void audio_language_changed (dcp::LanguageTag tag); void edit_release_territory (); void version_number_changed (); void status_changed (); @@ -65,7 +64,6 @@ private: void enable_facility_changed (); LanguageTagWidget* _name_language; - LanguageTagWidget* _audio_language; wxCheckBox* _enable_release_territory; /** The current release territory displayed in the UI; since we can't easily convert * the string in _release_territory_text to a RegionSubtag we just store the RegionSubtag |
