Merge 1.0 in.
[dcpomatic.git] / src / wx / film_editor.cc
index d82013d8a78aa92a48018955cbed1b6a5072b8c2..56b6973757e0f7be59a52f892060a4223b4123a9 100644 (file)
@@ -38,6 +38,7 @@
 #include "lib/config.h"
 #include "lib/still_image_content.h"
 #include "lib/moving_image_content.h"
+#include "lib/ffmpeg_content.h"
 #include "lib/sndfile_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/sound_processor.h"
@@ -147,6 +148,10 @@ FilmEditor::make_dcp_panel ()
        }
        ++r;
 
+       _encrypted = new wxCheckBox (_dcp_panel, wxID_ANY, wxT ("Encrypted"));
+       grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       ++r;
+
        add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Audio channels"), true, wxGBPosition (r, 0));
        _audio_channels = new wxSpinCtrl (_dcp_panel, wxID_ANY);
        grid->Add (_audio_channels, wxGBPosition (r, 1));
@@ -171,6 +176,11 @@ FilmEditor::make_dcp_panel ()
        }
        ++r;
 
+       add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Standard"), true, wxGBPosition (r, 0));
+       _standard = new wxChoice (_dcp_panel, wxID_ANY);
+       grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       ++r;
+
        add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Scaler"), true, wxGBPosition (r, 0));
        _scaler = new wxChoice (_dcp_panel, wxID_ANY);
        grid->Add (_scaler, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
@@ -197,10 +207,13 @@ FilmEditor::make_dcp_panel ()
        }
 
        _audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
-       _j2k_bandwidth->SetRange (50, 250);
+       _j2k_bandwidth->SetRange (1, 250);
 
        _resolution->Append (_("2K"));
        _resolution->Append (_("4K"));
+
+       _standard->Append (_("SMPTE"));
+       _standard->Append (_("Interop"));
 }
 
 void
@@ -226,6 +239,7 @@ FilmEditor::connect_to_widgets ()
        _resolution->Bind       (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::resolution_changed, this));
        _sequence_video->Bind   (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::sequence_video_changed, this));
        _three_d->Bind          (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::three_d_changed, this));
+       _standard->Bind         (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::standard_changed, this));
 }
 
 void
@@ -245,7 +259,7 @@ FilmEditor::make_content_panel ()
                _content->SetColumnWidth (0, 512);
 
                wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
-               _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file..."));
+               _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
                b->Add (_content_add_file, 1, wxEXPAND | wxLEFT | wxRIGHT);
                _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
                b->Add (_content_add_folder, 1, wxEXPAND | wxLEFT | wxRIGHT);
@@ -296,6 +310,17 @@ FilmEditor::j2k_bandwidth_changed ()
        _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1e6);
 }
 
+void
+FilmEditor::encrypted_toggled ()
+{
+       if (!_film) {
+               return;
+       }
+
+       _film->set_encrypted (_encrypted->GetValue ());
+}
+                              
+/** Called when the name widget has been changed */
 void
 FilmEditor::frame_rate_changed ()
 {
@@ -330,6 +355,15 @@ FilmEditor::resolution_changed ()
        _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
 }
 
+void
+FilmEditor::standard_changed ()
+{
+       if (!_film) {
+               return;
+       }
+
+       _film->set_interop (_standard->GetSelection() == 1);
+}
 
 /** Called when the metadata stored in the Film object has changed;
  *  so that we can update the GUI.
@@ -373,6 +407,9 @@ FilmEditor::film_changed (Film::Property p)
        case Film::SCALER:
                checked_set (_scaler, Scaler::as_index (_film->scaler ()));
                break;
+       case Film::ENCRYPTED:
+               checked_set (_encrypted, _film->encrypted ());
+               break;
        case Film::RESOLUTION:
                checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
                setup_dcp_name ();
@@ -416,6 +453,9 @@ FilmEditor::film_changed (Film::Property p)
                checked_set (_three_d, _film->three_d ());
                setup_dcp_name ();
                break;
+       case Film::INTEROP:
+               checked_set (_standard, _film->interop() ? 1 : 0);
+               break;
        }
 }
 
@@ -526,12 +566,14 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::RESOLUTION);
        film_changed (Film::SCALER);
        film_changed (Film::WITH_SUBTITLES);
+       film_changed (Film::ENCRYPTED);
        film_changed (Film::J2K_BANDWIDTH);
        film_changed (Film::DCI_METADATA);
        film_changed (Film::VIDEO_FRAME_RATE);
        film_changed (Film::AUDIO_CHANNELS);
        film_changed (Film::SEQUENCE_VIDEO);
        film_changed (Film::THREE_D);
+       film_changed (Film::INTEROP);
 
        if (!_film->content().empty ()) {
                set_selection (_film->content().front ());
@@ -555,6 +597,7 @@ FilmEditor::set_general_sensitivity (bool s)
        _content_remove->Enable (s);
        _content_timeline->Enable (s);
        _dcp_content_type->Enable (s);
+       _encrypted->Enable (s);
        _frame_rate->Enable (s);
        _audio_channels->Enable (s);
        _j2k_bandwidth->Enable (s);
@@ -564,6 +607,7 @@ FilmEditor::set_general_sensitivity (bool s)
        _resolution->Enable (s);
        _scaler->Enable (s);
        _three_d->Enable (s);
+       _standard->Enable (s);
 
        /* Set the panels in the content notebook */
        for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
@@ -733,11 +777,14 @@ FilmEditor::content_selection_changed ()
        /* All other sensitivity in content panels should be triggered by
           one of these.
        */
-       film_content_changed (s, ContentProperty::START);
+       film_content_changed (s, ContentProperty::POSITION);
        film_content_changed (s, ContentProperty::LENGTH);
+       film_content_changed (s, ContentProperty::TRIM_START);
+       film_content_changed (s, ContentProperty::TRIM_END);
        film_content_changed (s, VideoContentProperty::VIDEO_CROP);
        film_content_changed (s, VideoContentProperty::VIDEO_RATIO);
        film_content_changed (s, VideoContentProperty::VIDEO_FRAME_TYPE);
+       film_content_changed (s, VideoContentProperty::COLOUR_CONVERSION);
        film_content_changed (s, AudioContentProperty::AUDIO_GAIN);
        film_content_changed (s, AudioContentProperty::AUDIO_DELAY);
        film_content_changed (s, AudioContentProperty::AUDIO_MAPPING);