Various DCI naming tweaks and a subtitle bug fix.
authorCarl Hetherington <cth@carlh.net>
Tue, 16 Oct 2012 02:28:38 +0000 (03:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 Oct 2012 02:28:38 +0000 (03:28 +0100)
src/lib/film_state.cc
src/lib/imagemagick_encoder.cc
src/wx/film_editor.cc
src/wx/film_editor.h

index e39e14da83fd49db09d816b73d9f6eac1aaea849..094342d7b96471fcbdf58dc8094fcea999db7f39 100644 (file)
@@ -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_";
index d0feb18934e7b8b8d8ff27f661af2a061c072a75..2518f8dc5885987cfe74505c884eca3096c11b67 100644 (file)
@@ -85,7 +85,7 @@ ImageMagickEncoder::process_video (shared_ptr<Image> 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);
index 946c91e0cfe53abde3426107454d9037813d5340..22063256fd521aa3b5c7f2bac760234fa2b8b290 100644 (file)
@@ -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
index 2d13d2dc9fbc91d6727a4bc86e6a3554e5192294..6fb8973bfeb5c33c8b6926045a099b66a329449e 100644 (file)
@@ -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 */