Allow up to 500MB/s J2K bitrate.
authorCarl Hetherington <cth@carlh.net>
Sat, 22 Mar 2014 16:00:15 +0000 (16:00 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 22 Mar 2014 16:00:15 +0000 (16:00 +0000)
Requested-by: Jonathan Jensen
src/lib/config.cc
src/lib/config.h
src/wx/config_dialog.cc
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/kdm_dialog.cc

index 30f85850d397ca4c60f128c9dca7cf287734b55d..eda56416d20a380f4e0ca654540593ba1ce1ae64 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -70,6 +70,7 @@ Config::Config ()
                )
        , _check_for_updates (false)
        , _check_for_test_updates (false)
+       , _maximum_j2k_bandwidth (250000000)
 {
        _allowed_dcp_frame_rates.push_back (24);
        _allowed_dcp_frame_rates.push_back (25);
@@ -185,6 +186,8 @@ Config::read ()
 
        _check_for_updates = f.optional_bool_child("CheckForUpdates").get_value_or (false);
        _check_for_test_updates = f.optional_bool_child("CheckForTestUpdates").get_value_or (false);
+
+       _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
 }
 
 void
@@ -362,6 +365,8 @@ Config::write () const
        root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0");
        root->add_child("CheckForTestUpdates")->add_child_text (_check_for_test_updates ? "1" : "0");
 
+       root->add_child("MaximumJ2KBandwidth")->add_child_text (lexical_cast<string> (_maximum_j2k_bandwidth));
+
        doc.write_to_file_formatted (file(false).string ());
 }
 
@@ -387,3 +392,10 @@ Config::drop ()
        delete _instance;
        _instance = 0;
 }
+
+void
+Config::changed ()
+{
+       write ();
+       Changed ();
+}
index b9e8d6b021b3939e454a7e8d319d8e22c0716bf4..a40e3680aace969bcf3fcfaa00d8dc206bbdc18a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -66,7 +66,7 @@ public:
 
        void set_use_any_servers (bool u) {
                _use_any_servers = u;
-               write ();
+               changed ();
        }
 
        bool use_any_servers () const {
@@ -76,7 +76,7 @@ public:
        /** @param s New list of servers */
        void set_servers (std::vector<std::string> s) {
                _servers = s;
-               write ();
+               changed ();
        }
 
        /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
@@ -89,7 +89,7 @@ public:
                return _tms_ip;
        }
        
-       /** @return The path on a TMS that we should write DCPs to */
+       /** @return The path on a TMS that we should changed DCPs to */
        std::string tms_path () const {
                return _tms_path;
        }
@@ -180,150 +180,162 @@ public:
        bool check_for_test_updates () const {
                return _check_for_test_updates;
        }
+
+       int maximum_j2k_bandwidth () const {
+               return _maximum_j2k_bandwidth;
+       }
        
        /** @param n New number of local encoding threads */
        void set_num_local_encoding_threads (int n) {
                _num_local_encoding_threads = n;
-               write ();
+               changed ();
        }
 
        void set_default_directory (boost::filesystem::path d) {
                _default_directory = d;
-               write ();
+               changed ();
        }
 
        /** @param p New server port */
        void set_server_port_base (int p) {
                _server_port_base = p;
-               write ();
+               changed ();
        }
 
        /** @param i IP address of a TMS that we can copy DCPs to */
        void set_tms_ip (std::string i) {
                _tms_ip = i;
-               write ();
+               changed ();
        }
 
-       /** @param p Path on a TMS that we should write DCPs to */
+       /** @param p Path on a TMS that we should changed DCPs to */
        void set_tms_path (std::string p) {
                _tms_path = p;
-               write ();
+               changed ();
        }
 
        /** @param u User name to log into the TMS with */
        void set_tms_user (std::string u) {
                _tms_user = u;
-               write ();
+               changed ();
        }
 
        /** @param p Password to log into the TMS with */
        void set_tms_password (std::string p) {
                _tms_password = p;
-               write ();
+               changed ();
        }
 
        void add_cinema (boost::shared_ptr<Cinema> c) {
                _cinemas.push_back (c);
+               changed ();
        }
 
        void remove_cinema (boost::shared_ptr<Cinema> c) {
                _cinemas.remove (c);
+               changed ();
        }
 
        void set_allowed_dcp_frame_rates (std::list<int> const & r) {
                _allowed_dcp_frame_rates = r;
-               write ();
+               changed ();
        }
 
        void set_default_dci_metadata (DCIMetadata d) {
                _default_dci_metadata = d;
-               write ();
+               changed ();
        }
 
        void set_language (std::string l) {
                _language = l;
-               write ();
+               changed ();
        }
 
        void unset_language () {
                _language = boost::none;
-               write ();
+               changed ();
        }
 
        void set_default_still_length (int s) {
                _default_still_length = s;
-               write ();
+               changed ();
        }
 
        void set_default_container (Ratio const * c) {
                _default_container = c;
-               write ();
+               changed ();
        }
 
        void set_default_dcp_content_type (DCPContentType const * t) {
                _default_dcp_content_type = t;
-               write ();
+               changed ();
        }
 
        void set_dcp_metadata (libdcp::XMLMetadata m) {
                _dcp_metadata = m;
-               write ();
+               changed ();
        }
 
        void set_default_j2k_bandwidth (int b) {
                _default_j2k_bandwidth = b;
-               write ();
+               changed ();
        }
 
        void set_default_audio_delay (int d) {
                _default_audio_delay = d;
-               write ();
+               changed ();
        }
 
        void set_colour_conversions (std::vector<PresetColourConversion> const & c) {
                _colour_conversions = c;
-               write ();
+               changed ();
        }
 
        void set_mail_server (std::string s) {
                _mail_server = s;
-               write ();
+               changed ();
        }
 
        void set_mail_user (std::string u) {
                _mail_user = u;
-               write ();
+               changed ();
        }
 
        void set_mail_password (std::string p) {
                _mail_password = p;
-               write ();
+               changed ();
        }
 
        void set_kdm_from (std::string f) {
                _kdm_from = f;
-               write ();
+               changed ();
        }
 
        void set_kdm_email (std::string e) {
                _kdm_email = e;
-               write ();
+               changed ();
        }
 
        void set_check_for_updates (bool c) {
                _check_for_updates = c;
-               write ();
+               changed ();
        }
 
        void set_check_for_test_updates (bool c) {
                _check_for_test_updates = c;
-               write ();
+               changed ();
        }
-       
-       void write () const;
 
+       void set_maximum_j2k_bandwidth (int b) {
+               _maximum_j2k_bandwidth = b;
+               changed ();
+       }
+       
        boost::filesystem::path signer_chain_directory () const;
 
+       void changed ();
+       boost::signals2::signal<void ()> Changed;
+
        static Config* instance ();
        static void drop ();
 
@@ -332,6 +344,7 @@ private:
        boost::filesystem::path file (bool) const;
        void read ();
        void read_old_metadata ();
+       void write () const;
 
        /** number of threads to use for J2K encoding on the local machine */
        int _num_local_encoding_threads;
@@ -375,6 +388,8 @@ private:
        /** true to check for updates on startup */
        bool _check_for_updates;
        bool _check_for_test_updates;
+       /** maximum allowed J2K bandwidth in bits per second */
+       int _maximum_j2k_bandwidth;
 
        /** Singleton instance, or 0 */
        static Config* _instance;
index 8938c84f949070a821791d88ec6a9baa26b752ca..545ba80b8dd7345e4345143f474f182d6a8511cc 100644 (file)
@@ -104,6 +104,10 @@ public:
                add_label_to_sizer (table, panel, _("Threads to use for encoding on this host"), true);
                _num_local_encoding_threads = new wxSpinCtrl (panel);
                table->Add (_num_local_encoding_threads, 1);
+
+               add_label_to_sizer (table, panel, _("Maximum JPEG2000 bandwidth"), true);
+               _maximum_j2k_bandwidth = new wxSpinCtrl (panel);
+               table->Add (_maximum_j2k_bandwidth, 1);
                
                add_label_to_sizer (table, panel, _("Outgoing mail server"), true);
                _mail_server = new wxTextCtrl (panel, wxID_ANY);
@@ -159,6 +163,10 @@ public:
                _num_local_encoding_threads->SetRange (1, 128);
                _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ());
                _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this));
+
+               _maximum_j2k_bandwidth->SetRange (1, 500);
+               _maximum_j2k_bandwidth->SetValue (config->maximum_j2k_bandwidth() / 1000000);
+               _maximum_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::maximum_j2k_bandwidth_changed, this));
                
                _mail_server->SetValue (std_to_wx (config->mail_server ()));
                _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_server_changed, this));
@@ -250,10 +258,16 @@ private:
        {
                Config::instance()->set_num_local_encoding_threads (_num_local_encoding_threads->GetValue ());
        }
+
+       void maximum_j2k_bandwidth_changed ()
+       {
+               Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000);
+       }
        
        wxCheckBox* _set_language;
        wxChoice* _language;
        wxSpinCtrl* _num_local_encoding_threads;
+       wxSpinCtrl* _maximum_j2k_bandwidth;
        wxTextCtrl* _mail_server;
        wxTextCtrl* _mail_user;
        wxTextCtrl* _mail_password;
index d16d5fc26f7d5f63b4b1b4a1f0588fb33a0f01e6..31b9b8368b0097e006c974c20aef437fa4db1111 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -92,6 +92,8 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        JobManager::instance()->ActiveJobsChanged.connect (
                bind (&FilmEditor::active_jobs_changed, this, _1)
                );
+
+       Config::instance()->Changed.connect (boost::bind (&FilmEditor::config_changed, this));
        
        SetSizerAndFit (s);
 }
@@ -213,7 +215,7 @@ FilmEditor::make_dcp_panel ()
        }
 
        _audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
-       _j2k_bandwidth->SetRange (1, 250);
+       _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
 
        _resolution->Append (_("2K"));
        _resolution->Append (_("4K"));
@@ -268,19 +270,25 @@ FilmEditor::make_content_panel ()
                _content->InsertColumn (0, wxT(""));
                _content->SetColumnWidth (0, 512);
 
+#ifdef DCPOMATIC_OSX
+               int const pad = 2;
+#else
+               int const pad = 0;
+#endif         
+
                wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
                _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
-               b->Add (_content_add_file, 1, wxEXPAND | wxALL, 2);
+               b->Add (_content_add_file, 1, wxEXPAND | wxALL, pad);
                _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
-               b->Add (_content_add_folder, 1, wxEXPAND | wxALL, 2);
+               b->Add (_content_add_folder, 1, wxEXPAND | wxALL, pad);
                _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
-               b->Add (_content_remove, 1, wxEXPAND | wxALL, 2);
+               b->Add (_content_remove, 1, wxEXPAND | wxALL, pad);
                _content_earlier = new wxButton (_content_panel, wxID_ANY, _("Up"));
-               b->Add (_content_earlier, 1, wxEXPAND | wxALL, 2);
+               b->Add (_content_earlier, 1, wxEXPAND | wxALL, pad);
                _content_later = new wxButton (_content_panel, wxID_ANY, _("Down"));
-               b->Add (_content_later, 1, wxEXPAND | wxALL, 2);
+               b->Add (_content_later, 1, wxEXPAND | wxALL, pad);
                _content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
-               b->Add (_content_timeline, 1, wxEXPAND | wxALL, 2);
+               b->Add (_content_timeline, 1, wxEXPAND | wxALL, pad);
 
                s->Add (b, 0, wxALL, 4);
 
@@ -998,3 +1006,9 @@ FilmEditor::content_later_clicked ()
                content_selection_changed ();
        }
 }
+
+void
+FilmEditor::config_changed ()
+{
+       _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+}
index 23c87e6784510288c54c8e9e96484b520e05bccc..a1336ec900a6434b540ebd210a7c00a6f0bf742c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -110,6 +110,7 @@ private:
        void setup_content_sensitivity ();
        
        void active_jobs_changed (bool);
+       void config_changed ();
 
        FilmEditorPanel* _video_panel;
        FilmEditorPanel* _audio_panel;
index 1f4d62bde1f90a03d9b2819369c6f69e3454edab..cc643c8ef09925aaff9c9c5231bb8f1adefab94e 100644 (file)
@@ -263,8 +263,6 @@ KDMDialog::add_cinema_clicked ()
        Config::instance()->add_cinema (c);
        add_cinema (c);
 
-       Config::instance()->write ();
-       
        d->Destroy ();
 }
 
@@ -284,7 +282,7 @@ KDMDialog::edit_cinema_clicked ()
        c.second->email = d->email ();
        _targets->SetItemText (c.first, std_to_wx (d->name()));
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 
        d->Destroy ();  
 }
@@ -300,8 +298,6 @@ KDMDialog::remove_cinema_clicked ()
 
        Config::instance()->remove_cinema (c.second);
        _targets->Delete (c.first);
-
-       Config::instance()->write ();   
 }
 
 void
@@ -322,7 +318,7 @@ KDMDialog::add_screen_clicked ()
        c->add_screen (s);
        add_screen (c, s);
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 
        d->Destroy ();
 }
@@ -343,7 +339,7 @@ KDMDialog::edit_screen_clicked ()
        s.second->certificate = d->certificate ();
        _targets->SetItemText (s.first, std_to_wx (d->name()));
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 
        d->Destroy ();
 }
@@ -370,7 +366,7 @@ KDMDialog::remove_screen_clicked ()
        i->second->remove_screen (s.second);
        _targets->Delete (s.first);
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 }
 
 list<shared_ptr<Screen> >