From 27e1f73c75e6c0f75d4863cfe2c8e50f811913d9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 16 Oct 2012 03:28:38 +0100 Subject: [PATCH] Various DCI naming tweaks and a subtitle bug fix. --- src/lib/film_state.cc | 22 +++++++++++++++++----- src/lib/imagemagick_encoder.cc | 2 +- src/wx/film_editor.cc | 20 +++++++++++++++++++- src/wx/film_editor.h | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/lib/film_state.cc b/src/lib/film_state.cc index e39e14da8..094342d7b 100644 --- a/src/lib/film_state.cc +++ b/src/lib/film_state.cc @@ -360,7 +360,14 @@ FilmState::dci_name () const { stringstream d; - d << name << "_"; + string fixed_name = to_upper_copy (name); + for (size_t i = 0; i < fixed_name.length(); ++i) { + if (fixed_name[i] == ' ') { + fixed_name[i] = '-'; + } + } + + d << fixed_name << "_"; if (dcp_content_type) { d << dcp_content_type->dci_name() << "_"; @@ -372,9 +379,14 @@ FilmState::dci_name () const if (!audio_language.empty ()) { d << audio_language; - if (!subtitle_language.empty ()) { - d << "-" << subtitle_language; + if (with_subtitles) { + if (!subtitle_language.empty ()) { + d << "-" << subtitle_language; + } else { + d << "-XX"; + } } + d << "_"; } @@ -388,10 +400,10 @@ FilmState::dci_name () const switch (audio_channels) { case 1: - d << "1_"; + d << "10_"; break; case 2: - d << "2_"; + d << "20_"; break; case 6: d << "51_"; diff --git a/src/lib/imagemagick_encoder.cc b/src/lib/imagemagick_encoder.cc index d0feb1893..2518f8dc5 100644 --- a/src/lib/imagemagick_encoder.cc +++ b/src/lib/imagemagick_encoder.cc @@ -85,7 +85,7 @@ ImageMagickEncoder::process_video (shared_ptr image, int frame, shared_pt << "y " << sub->position().y << "\n"; metadata.close (); - filesystem::rename (tmp_metadata_file, _opt->frame_out_path (frame, false, ".sub.png")); + filesystem::rename (tmp_metadata_file, _opt->frame_out_path (frame, false, ".sub")); } frame_done (frame); diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 946c91e0c..22063256f 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -61,6 +61,10 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent) _name = new wxTextCtrl (this, wxID_ANY); _sizer->Add (_name, 1, wxEXPAND); + add_label_to_sizer (_sizer, this, "DCP Name"); + _dcp_name = new wxStaticText (this, wxID_ANY, wxT ("")); + _sizer->Add (_dcp_name, 0, wxALIGN_CENTER_VERTICAL | wxSHRINK); + _use_dci_name = new wxCheckBox (this, wxID_ANY, wxT ("Use DCI name")); _sizer->Add (_use_dci_name, 1, wxEXPAND); _edit_dci_button = new wxButton (this, wxID_ANY, wxT ("Edit...")); @@ -350,6 +354,8 @@ FilmEditor::name_changed (wxCommandEvent &) _ignore_changes = Film::NAME; _film->set_name (string (_name->GetValue().mb_str())); _ignore_changes = Film::NONE; + + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); } void @@ -408,6 +414,7 @@ FilmEditor::film_changed (Film::Property p) ++n; } _format->SetSelection (n); + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); break; } case Film::CROP: @@ -430,6 +437,7 @@ FilmEditor::film_changed (Film::Property p) } case Film::NAME: _name->ChangeValue (std_to_wx (_film->name ())); + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); break; case Film::FRAMES_PER_SECOND: { @@ -439,6 +447,7 @@ FilmEditor::film_changed (Film::Property p) break; } case Film::AUDIO_CHANNELS: + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); case Film::AUDIO_SAMPLE_RATE: if (_film->audio_channels() == 0 && _film->audio_sample_rate() == 0) { _audio->SetLabel (wxT ("")); @@ -465,6 +474,7 @@ FilmEditor::film_changed (Film::Property p) break; case Film::DCP_CONTENT_TYPE: _dcp_content_type->SetSelection (DCPContentType::as_index (_film->dcp_content_type ())); + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); break; case Film::THUMBS: break; @@ -499,6 +509,7 @@ FilmEditor::film_changed (Film::Property p) _with_subtitles->SetValue (_film->with_subtitles ()); _subtitle_scale->Enable (_film->with_subtitles ()); _subtitle_offset->Enable (_film->with_subtitles ()); + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); break; case Film::SUBTITLE_OFFSET: _subtitle_offset->SetValue (_film->subtitle_offset ()); @@ -508,9 +519,10 @@ FilmEditor::film_changed (Film::Property p) break; case Film::USE_DCI_NAME: _use_dci_name->SetValue (_film->use_dci_name ()); + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); break; case Film::DCI_METADATA: - _name->SetValue (std_to_wx (_film->state_copy()->dci_name())); + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); break; } } @@ -530,6 +542,8 @@ FilmEditor::format_changed (wxCommandEvent &) _film->set_format (_formats[n]); } _ignore_changes = Film::NONE; + + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); } /** Called when the DCP content type widget has been changed */ @@ -546,6 +560,8 @@ FilmEditor::dcp_content_type_changed (wxCommandEvent &) _film->set_dcp_content_type (DCPContentType::from_index (n)); } _ignore_changes = Film::NONE; + + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); } /** Sets the Film that we are editing */ @@ -822,6 +838,8 @@ FilmEditor::use_dci_name_toggled (wxCommandEvent &) _ignore_changes = Film::USE_DCI_NAME; _film->set_use_dci_name (_use_dci_name->GetValue ()); _ignore_changes = Film::NONE; + + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); } void diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 2d13d2dc9..6fb8973bf 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -86,6 +86,7 @@ private: Film* _film; /** The Film's name */ wxTextCtrl* _name; + wxStaticText* _dcp_name; wxCheckBox* _use_dci_name; wxButton* _edit_dci_button; /** The Film's format */ -- 2.30.2