Merge master into direct-mxf.
authorCarl Hetherington <cth@carlh.net>
Sat, 26 Jan 2013 22:51:54 +0000 (22:51 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 26 Jan 2013 22:51:54 +0000 (22:51 +0000)
26 files changed:
ChangeLog
debian/changelog
src/lib/config.cc
src/lib/config.h
src/lib/dci_metadata.cc [new file with mode: 0644]
src/lib/dci_metadata.h [new file with mode: 0644]
src/lib/film.cc
src/lib/film.h
src/lib/format.cc
src/lib/format.h
src/lib/subtitle.cc
src/lib/wscript
src/wx/config_dialog.cc
src/wx/config_dialog.h
src/wx/dci_metadata_dialog.cc [new file with mode: 0644]
src/wx/dci_metadata_dialog.h [new file with mode: 0644]
src/wx/dci_name_dialog.cc [deleted file]
src/wx/dci_name_dialog.h [deleted file]
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/film_viewer.cc
src/wx/film_viewer.h
src/wx/wscript
src/wx/wx_util.cc
src/wx/wx_util.h
wscript

index 36bda83b42a7474b84b6f101ea1483b81939290a..25a55aa6b4fe1ea7fce3ce378a056a91003a1ce2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2013-01-25  Carl Hetherington  <cth@carlh.net>
+
+       * When using formats which pad smaller frames into
+       larger ones, the padding black now shown in
+       the preview.
+
+       * Fix the old DCP content type being left behind
+       when creating a new film.
+
+       * Add option to specify default details
+       for the DCI name details dialog in new
+       Films (#42).
+
+2013-01-24  Carl Hetherington  <cth@carlh.net>
+
+       * Version 0.72 released.
+
+2013-01-24  Carl Hetherington  <cth@carlh.net>
+
+       * Version 0.71 released.
+
+2013-01-24  Carl Hetherington  <cth@carlh.net>
+
+       * Fix lack of audio with trimmed DCPs.
+
 2013-01-23  Carl Hetherington  <cth@carlh.net>
 
        * Remove multi-reel support (for now); needs more thinking about
index b8385a4b020bdd8db606901420891afab446bbc9..9ee5288bab6887c56b0b186a6e85a815e9c4732d 100644 (file)
@@ -1,4 +1,16 @@
-dvdomatic (0.71beta2-1) UNRELEASED; urgency=low
+dvdomatic (0.72-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Carl Hetherington <carl@houllier.lan>  Thu, 24 Jan 2013 15:31:57 +0000
+
+dvdomatic (0.71-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Carl Hetherington <carl@houllier.lan>  Thu, 24 Jan 2013 11:36:04 +0000
+
+dvdomatic (0.70-1) UNRELEASED; urgency=low
 
   * New upstream release.
   * New upstream release.
index 307b9684414359ffb823a937f3febc515711db84..c165859b01bd25b3d7e1d768c86f8bca71af8c85 100644 (file)
@@ -90,6 +90,8 @@ Config::Config ()
                } else if (k == "sound_processor") {
                        _sound_processor = SoundProcessor::from_id (v);
                }
+
+               _default_dci_metadata.read (k, v);
        }
 }
 
@@ -136,7 +138,9 @@ Config::write () const
        f << "tms_path " << _tms_path << "\n";
        f << "tms_user " << _tms_user << "\n";
        f << "tms_password " << _tms_password << "\n";
-       f << "sound_processor " << _sound_processor->id ();
+       f << "sound_processor " << _sound_processor->id () << "\n";
+
+       _default_dci_metadata.write (f);
 }
 
 string
index c41437efbe290f6aacad37ec5387fd21dc4d99db..fed297ad00f91018029f3b51b214bbf3b46c3bfd 100644 (file)
@@ -27,6 +27,7 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 #include <boost/signals2.hpp>
+#include "dci_metadata.h"
 
 class ServerDescription;
 class Scaler;
@@ -98,6 +99,10 @@ public:
                return _allowed_dcp_frame_rates;
        }
        
+       DCIMetadata default_dci_metadata () const {
+               return _default_dci_metadata;
+       }
+
        /** @param n New number of local encoding threads */
        void set_num_local_encoding_threads (int n) {
                _num_local_encoding_threads = n;
@@ -149,6 +154,10 @@ public:
                _allowed_dcp_frame_rates = r;
        }
 
+       void set_default_dci_metadata (DCIMetadata d) {
+               _default_dci_metadata = d;
+       }
+       
        void write () const;
 
        static Config* instance ();
@@ -181,6 +190,8 @@ private:
        /** Our sound processor */
        SoundProcessor const * _sound_processor;
        std::list<int> _allowed_dcp_frame_rates;
+       /** Default DCI metadata for newly-created Films */
+       DCIMetadata _default_dci_metadata;
 
        /** Singleton instance, or 0 */
        static Config* _instance;
diff --git a/src/lib/dci_metadata.cc b/src/lib/dci_metadata.cc
new file mode 100644 (file)
index 0000000..2b4cc3a
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+    Copyright (C) 2012 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include "dci_metadata.h"
+
+using namespace std;
+
+void
+DCIMetadata::write (ostream& f) const
+{
+       f << "audio_language " << audio_language << "\n";
+       f << "subtitle_language " << subtitle_language << "\n";
+       f << "territory " << territory << "\n";
+       f << "rating " << rating << "\n";
+       f << "studio " << studio << "\n";
+       f << "facility " << facility << "\n";
+       f << "package_type " << package_type << "\n";
+}
+
+void
+DCIMetadata::read (string k, string v)
+{
+       if (k == "audio_language") {
+               audio_language = v;
+       } else if (k == "subtitle_language") {
+               subtitle_language = v;
+       } else if (k == "territory") {
+               territory = v;
+       } else if (k == "rating") {
+               rating = v;
+       } else if (k == "studio") {
+               studio = v;
+       } else if (k == "facility") {
+               facility = v;
+       } else if (k == "package_type") {
+               package_type = v;
+       }
+}      
diff --git a/src/lib/dci_metadata.h b/src/lib/dci_metadata.h
new file mode 100644 (file)
index 0000000..eecdc76
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2012 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef DVDOMATIC_DCI_METADATA_H
+#define DVDOMATIC_DCI_METADATA_H
+
+#include <string>
+
+class DCIMetadata
+{
+public:
+       void read (std::string, std::string);
+       void write (std::ostream &) const;
+       
+       std::string audio_language;
+       std::string subtitle_language;
+       std::string territory;
+       std::string rating;
+       std::string studio;
+       std::string facility;
+       std::string package_type;
+};
+
+#endif
index f6eb032fd7e7b0c4f98df7ea969d4140ec72b32c..bdc4cca734d7075fc58bfaa52b46c2046f368bdd 100644 (file)
@@ -100,6 +100,7 @@ Film::Film (string d, bool must_exist)
        , _subtitle_scale (1)
        , _colour_lut (0)
        , _j2k_bandwidth (200000000)
+       , _dci_metadata (Config::instance()->default_dci_metadata ())
        , _frames_per_second (0)
        , _dirty (false)
 {
@@ -169,13 +170,7 @@ Film::Film (Film const & o)
        , _subtitle_scale    (o._subtitle_scale)
        , _colour_lut        (o._colour_lut)
        , _j2k_bandwidth     (o._j2k_bandwidth)
-       , _audio_language    (o._audio_language)
-       , _subtitle_language (o._subtitle_language)
-       , _territory         (o._territory)
-       , _rating            (o._rating)
-       , _studio            (o._studio)
-       , _facility          (o._facility)
-       , _package_type      (o._package_type)
+       , _dci_metadata      (o._dci_metadata)
        , _size              (o._size)
        , _length            (o._length)
        , _dcp_intrinsic_duration (o._dcp_intrinsic_duration)
@@ -413,14 +408,7 @@ Film::write_metadata () const
        f << "subtitle_scale " << _subtitle_scale << "\n";
        f << "colour_lut " << _colour_lut << "\n";
        f << "j2k_bandwidth " << _j2k_bandwidth << "\n";
-       f << "audio_language " << _audio_language << "\n";
-       f << "subtitle_language " << _subtitle_language << "\n";
-       f << "territory " << _territory << "\n";
-       f << "rating " << _rating << "\n";
-       f << "studio " << _studio << "\n";
-       f << "facility " << _facility << "\n";
-       f << "package_type " << _package_type << "\n";
-
+       _dci_metadata.write (f);
        f << "width " << _size.width << "\n";
        f << "height " << _size.height << "\n";
        f << "length " << _length.get_value_or(0) << "\n";
@@ -543,21 +531,9 @@ Film::read_metadata ()
                        _colour_lut = atoi (v.c_str ());
                } else if (k == "j2k_bandwidth") {
                        _j2k_bandwidth = atoi (v.c_str ());
-               } else if (k == "audio_language") {
-                       _audio_language = v;
-               } else if (k == "subtitle_language") {
-                       _subtitle_language = v;
-               } else if (k == "territory") {
-                       _territory = v;
-               } else if (k == "rating") {
-                       _rating = v;
-               } else if (k == "studio") {
-                       _studio = v;
-               } else if (k == "facility") {
-                       _facility = v;
-               } else if (k == "package_type") {
-                       _package_type = v;
                }
+
+               _dci_metadata.read (k, v);
                
                /* Cached stuff */
                if (k == "width") {
@@ -734,10 +710,12 @@ Film::dci_name () const
                d << format()->dci_name() << "_";
        }
 
-       if (!audio_language().empty ()) {
-               d << audio_language();
-               if (!subtitle_language().empty() && with_subtitles()) {
-                       d << "-" << subtitle_language();
+       DCIMetadata const dm = dci_metadata ();
+
+       if (!dm.audio_language.empty ()) {
+               d << dm.audio_language;
+               if (!dm.subtitle_language.empty() && with_subtitles()) {
+                       d << "-" << dm.subtitle_language;
                } else {
                        d << "-XX";
                }
@@ -745,10 +723,10 @@ Film::dci_name () const
                d << "_";
        }
 
-       if (!territory().empty ()) {
-               d << territory();
-               if (!rating().empty ()) {
-                       d << "-" << rating();
+       if (!dm.territory.empty ()) {
+               d << dm.territory;
+               if (!dm.rating.empty ()) {
+                       d << "-" << dm.rating;
                }
                d << "_";
        }
@@ -770,18 +748,18 @@ Film::dci_name () const
 
        d << "2K_";
 
-       if (!studio().empty ()) {
-               d << studio() << "_";
+       if (!dm.studio.empty ()) {
+               d << dm.studio << "_";
        }
 
        d << boost::gregorian::to_iso_string (_dci_date) << "_";
 
-       if (!facility().empty ()) {
-               d << facility() << "_";
+       if (!dm.facility.empty ()) {
+               d << dm.facility << "_";
        }
 
-       if (!package_type().empty ()) {
-               d << package_type();
+       if (!dm.package_type.empty ()) {
+               d << dm.package_type;
        }
 
        return d.str ();
@@ -1207,71 +1185,11 @@ Film::set_j2k_bandwidth (int b)
 }
 
 void
-Film::set_audio_language (string l)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _audio_language = l;
-       }
-       signal_changed (DCI_METADATA);
-}
-
-void
-Film::set_subtitle_language (string l)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _subtitle_language = l;
-       }
-       signal_changed (DCI_METADATA);
-}
-
-void
-Film::set_territory (string t)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _territory = t;
-       }
-       signal_changed (DCI_METADATA);
-}
-
-void
-Film::set_rating (string r)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _rating = r;
-       }
-       signal_changed (DCI_METADATA);
-}
-
-void
-Film::set_studio (string s)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _studio = s;
-       }
-       signal_changed (DCI_METADATA);
-}
-
-void
-Film::set_facility (string f)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _facility = f;
-       }
-       signal_changed (DCI_METADATA);
-}
-
-void
-Film::set_package_type (string p)
+Film::set_dci_metadata (DCIMetadata m)
 {
        {
                boost::mutex::scoped_lock lm (_state_mutex);
-               _package_type = p;
+               _dci_metadata = m;
        }
        signal_changed (DCI_METADATA);
 }
index 07764dac89da6be57bbe009d49af6c02378cee05..7c4c72f7b2689835cc7963b02f80956995c34fc8 100644 (file)
@@ -38,6 +38,7 @@ extern "C" {
 #include "dcp_content_type.h"
 #include "util.h"
 #include "stream.h"
+#include "dci_metadata.h"
 
 class Format;
 class Job;
@@ -275,41 +276,11 @@ public:
                return _j2k_bandwidth;
        }
 
-       std::string audio_language () const {
+       DCIMetadata dci_metadata () const {
                boost::mutex::scoped_lock lm (_state_mutex);
-               return _audio_language;
+               return _dci_metadata;
        }
        
-       std::string subtitle_language () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _subtitle_language;
-       }
-       
-       std::string territory () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _territory;
-       }
-       
-       std::string rating () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _rating;
-       }
-       
-       std::string studio () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _studio;
-       }
-       
-       std::string facility () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _facility;
-       }
-       
-       std::string package_type () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _package_type;
-       }
-
        libdcp::Size size () const {
                boost::mutex::scoped_lock lm (_state_mutex);
                return _size;
@@ -378,13 +349,7 @@ public:
        void set_subtitle_scale (float);
        void set_colour_lut (int);
        void set_j2k_bandwidth (int);
-       void set_audio_language (std::string);
-       void set_subtitle_language (std::string);
-       void set_territory (std::string);
-       void set_rating (std::string);
-       void set_studio (std::string);
-       void set_facility (std::string);
-       void set_package_type (std::string);
+       void set_dci_metadata (DCIMetadata);
        void set_size (libdcp::Size);
        void set_length (SourceFrame);
        void unset_length ();
@@ -484,15 +449,9 @@ private:
        int _colour_lut;
        /** bandwidth for J2K files in bits per second */
        int _j2k_bandwidth;
-       
-       /* DCI naming stuff */
-       std::string _audio_language;
-       std::string _subtitle_language;
-       std::string _territory;
-       std::string _rating;
-       std::string _studio;
-       std::string _facility;
-       std::string _package_type;
+
+       /** DCI naming stuff */
+       DCIMetadata _dci_metadata;
 
        /* Data which are cached to speed things up */
 
index 4583dd0e58602840c95cb5b1724c5ab557a3fb6a..016c21fdea09fb60d45636f91d2ee9b5d888879b 100644 (file)
@@ -148,6 +148,9 @@ FixedFormat::FixedFormat (int r, libdcp::Size dcp, string id, string n, string d
 
 }
 
+/** @return Number of pixels (int the DCP image) to pad either side of the film
+ *  (so there are dcp_padding() pixels on the left and dcp_padding() on the right)
+ */
 int
 Format::dcp_padding (shared_ptr<const Film> f) const
 {
@@ -161,6 +164,12 @@ Format::dcp_padding (shared_ptr<const Film> f) const
        return p;
 }
 
+float
+Format::container_ratio_as_float () const
+{
+       return static_cast<float> (_dcp_size.width) / _dcp_size.height;
+}
+
 VariableFormat::VariableFormat (libdcp::Size dcp, string id, string n, string d)
        : Format (dcp, id, n, d)
 {
index b4c691e56fea19e45b023782d4b255feb77b53dd..783ff25ce455b31dd207fa4f37026d8fee132a1d 100644 (file)
@@ -46,6 +46,9 @@ public:
        /** @return the ratio as a floating point number */
        virtual float ratio_as_float (boost::shared_ptr<const Film> f) const = 0;
 
+       /** @return the ratio of the container (including any padding) as a floating point number */
+       float container_ratio_as_float () const;
+
        int dcp_padding (boost::shared_ptr<const Film> f) const;
 
        /** @return size in pixels of the images that we should
index 3754e5acf012c9a8dfe921fab46bb02440f397ef..bd5f0c87969cc76b473c4af506c0c88e913ec235 100644 (file)
@@ -35,7 +35,7 @@ using libdcp::Size;
  */
 TimedSubtitle::TimedSubtitle (AVSubtitle const & sub)
 {
-       assert (sub.rects > 0);
+       assert (sub.num_rects > 0);
        
        /* Subtitle PTS in seconds (within the source, not taking into account any of the
           source that we may have chopped off for the DCP)
index 5d676f249f35c135dd2ba117b8c6d4b1d76a632a..454565cdc447d55c386e64773c5ea48779fee939 100644 (file)
@@ -6,7 +6,7 @@ def build(bld):
 
     obj.name = 'libdvdomatic'
     obj.export_includes = ['.']
-    obj.uselib = 'AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE SNDFILE BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 OPENJPEG POSTPROC TIFF MAGICK SSH DCP GLIB'
+    obj.uselib = 'AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE SNDFILE BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 OPENJPEG POSTPROC TIFF MAGICK SSH DCP GLIB LZMA'
     if bld.env.TARGET_WINDOWS:
         obj.uselib += ' WINSOCK2'
     obj.source = """
@@ -17,6 +17,7 @@ def build(bld):
                 config.cc
                  combiner.cc
                  cross.cc
+                dci_metadata.cc
                 dcp_content_type.cc
                 dcp_video_frame.cc
                  decoder.cc
index 9de8e700194642eaeff484c075f098c486b66919..b656a5278b5cd32ede5fc8f75e508335cc58182a 100644 (file)
@@ -35,6 +35,7 @@
 #include "filter_dialog.h"
 #include "server_dialog.h"
 #include "dir_picker_ctrl.h"
+#include "dci_metadata_dialog.h"
 
 using namespace std;
 using boost::bind;
@@ -79,8 +80,13 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
        table->Add (_default_directory, 1, wxEXPAND);
        table->AddSpacer (0);
 
+       add_label_to_sizer (table, this, "Default DCI name details");
+       _default_dci_metadata_button = new wxButton (this, wxID_ANY, _("Edit..."));
+       table->Add (_default_dci_metadata_button);
+       table->AddSpacer (1);
+
        add_label_to_sizer (table, this, "Reference scaler for A/B");
-       _reference_scaler = new wxComboBox (this, wxID_ANY);
+       _reference_scaler = new wxChoice (this, wxID_ANY);
        vector<Scaler const *> const sc = Scaler::all ();
        for (vector<Scaler const *>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
                _reference_scaler->Append (std_to_wx ((*i)->name ()));
@@ -142,8 +148,10 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
        _default_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir()))));
        _default_directory->Connect (wxID_ANY, wxEVT_COMMAND_DIRPICKER_CHANGED, wxCommandEventHandler (ConfigDialog::default_directory_changed), 0, this);
 
+       _default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this);
+
        _reference_scaler->SetSelection (Scaler::as_index (config->reference_scaler ()));
-       _reference_scaler->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (ConfigDialog::reference_scaler_changed), 0, this);
+       _reference_scaler->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::reference_scaler_changed), 0, this);
 
        pair<string, string> p = Filter::ffmpeg_strings (config->reference_filters ());
        _reference_filters->SetLabel (std_to_wx (p.first + " " + p.second));
@@ -307,3 +315,12 @@ ConfigDialog::reference_filters_changed (vector<Filter const *> f)
        pair<string, string> p = Filter::ffmpeg_strings (Config::instance()->reference_filters ());
        _reference_filters->SetLabel (std_to_wx (p.first + " " + p.second));
 }
+
+void
+ConfigDialog::edit_default_dci_metadata_clicked (wxCommandEvent &)
+{
+       DCIMetadataDialog* d = new DCIMetadataDialog (this, Config::instance()->default_dci_metadata ());
+       d->ShowModal ();
+       Config::instance()->set_default_dci_metadata (d->dci_metadata ());
+       d->Destroy ();
+}
index 32123a0d7eb92748d3b0e3cd701dca15c614bb53..948bf0571e2f95e347dd3440a6303a9ebc878f87 100644 (file)
@@ -45,6 +45,7 @@ private:
        void tms_password_changed (wxCommandEvent &);
        void num_local_encoding_threads_changed (wxCommandEvent &);
        void default_directory_changed (wxCommandEvent &);
+       void edit_default_dci_metadata_clicked (wxCommandEvent &);
        void reference_scaler_changed (wxCommandEvent &);
        void edit_reference_filters_clicked (wxCommandEvent &);
        void reference_filters_changed (std::vector<Filter const *>);
@@ -64,8 +65,9 @@ private:
        DirPickerCtrl* _default_directory;
 #else
        wxDirPickerCtrl* _default_directory;
-#endif 
-       wxComboBox* _reference_scaler;
+#endif
+       wxButton* _default_dci_metadata_button;
+       wxChoice* _reference_scaler;
        wxStaticText* _reference_filters;
        wxButton* _reference_filters_button;
        wxListCtrl* _servers;
diff --git a/src/wx/dci_metadata_dialog.cc b/src/wx/dci_metadata_dialog.cc
new file mode 100644 (file)
index 0000000..c5682e1
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+    Copyright (C) 2012 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/sizer.h>
+#include "dci_metadata_dialog.h"
+#include "wx_util.h"
+#include "film.h"
+
+using boost::shared_ptr;
+
+DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm)
+       : wxDialog (parent, wxID_ANY, _("DCI name"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+{
+       wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
+       table->AddGrowableCol (1, 1);
+
+       add_label_to_sizer (table, this, "Audio Language (e.g. EN)");
+       _audio_language = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_audio_language, 1, wxEXPAND);
+
+       add_label_to_sizer (table, this, "Subtitle Language (e.g. FR)");
+       _subtitle_language = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_subtitle_language, 1, wxEXPAND);
+       
+       add_label_to_sizer (table, this, "Territory (e.g. UK)");
+       _territory = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_territory, 1, wxEXPAND);
+
+       add_label_to_sizer (table, this, "Rating (e.g. 15)");
+       _rating = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_rating, 1, wxEXPAND);
+
+       add_label_to_sizer (table, this, "Studio (e.g. TCF)");
+       _studio = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_studio, 1, wxEXPAND);
+
+       add_label_to_sizer (table, this, "Facility (e.g. DLA)");
+       _facility = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_facility, 1, wxEXPAND);
+
+       add_label_to_sizer (table, this, "Package Type (e.g. OV)");
+       _package_type = new wxTextCtrl (this, wxID_ANY);
+       table->Add (_package_type, 1, wxEXPAND);
+
+       _audio_language->SetValue (std_to_wx (dm.audio_language));
+       _subtitle_language->SetValue (std_to_wx (dm.subtitle_language));
+       _territory->SetValue (std_to_wx (dm.territory));
+       _rating->SetValue (std_to_wx (dm.rating));
+       _studio->SetValue (std_to_wx (dm.studio));
+       _facility->SetValue (std_to_wx (dm.facility));
+       _package_type->SetValue (std_to_wx (dm.package_type));
+
+       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
+       
+       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+       if (buttons) {
+               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+       }
+       
+       SetSizer (overall_sizer);
+       overall_sizer->Layout ();
+       overall_sizer->SetSizeHints (this);
+}
+
+DCIMetadata
+DCIMetadataDialog::dci_metadata () const
+{
+       DCIMetadata dm;
+
+       dm.audio_language = wx_to_std (_audio_language->GetValue ());
+       dm.subtitle_language = wx_to_std (_subtitle_language->GetValue ());
+       dm.territory = wx_to_std (_territory->GetValue ());
+       dm.rating = wx_to_std (_rating->GetValue ());
+       dm.studio = wx_to_std (_studio->GetValue ());
+       dm.facility = wx_to_std (_facility->GetValue ());
+       dm.package_type = wx_to_std (_package_type->GetValue ());
+
+       return dm;
+}
diff --git a/src/wx/dci_metadata_dialog.h b/src/wx/dci_metadata_dialog.h
new file mode 100644 (file)
index 0000000..fbc5e3b
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+    Copyright (C) 2012 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/dialog.h>
+#include <wx/textctrl.h>
+#include <boost/shared_ptr.hpp>
+#include "dci_metadata.h"
+
+class Film;
+
+class DCIMetadataDialog : public wxDialog
+{
+public:
+       DCIMetadataDialog (wxWindow *, DCIMetadata);
+
+       DCIMetadata dci_metadata () const;
+
+private:
+       wxTextCtrl* _audio_language;
+       wxTextCtrl* _subtitle_language;
+       wxTextCtrl* _territory;
+       wxTextCtrl* _rating;
+       wxTextCtrl* _studio;
+       wxTextCtrl* _facility;
+       wxTextCtrl* _package_type;
+};
diff --git a/src/wx/dci_name_dialog.cc b/src/wx/dci_name_dialog.cc
deleted file mode 100644 (file)
index 6927d6c..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-    Copyright (C) 2012 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <wx/sizer.h>
-#include "dci_name_dialog.h"
-#include "wx_util.h"
-#include "film.h"
-
-using boost::shared_ptr;
-
-DCINameDialog::DCINameDialog (wxWindow* parent, shared_ptr<Film> film)
-       : wxDialog (parent, wxID_ANY, _("DCI name"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
-       , _film (film)
-{
-       wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
-       table->AddGrowableCol (1, 1);
-
-       add_label_to_sizer (table, this, "Audio Language (e.g. EN)");
-       _audio_language = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_audio_language, 1, wxEXPAND);
-
-       add_label_to_sizer (table, this, "Subtitle Language (e.g. FR)");
-       _subtitle_language = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_subtitle_language, 1, wxEXPAND);
-       
-       add_label_to_sizer (table, this, "Territory (e.g. UK)");
-       _territory = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_territory, 1, wxEXPAND);
-
-       add_label_to_sizer (table, this, "Rating (e.g. 15)");
-       _rating = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_rating, 1, wxEXPAND);
-
-       add_label_to_sizer (table, this, "Studio (e.g. TCF)");
-       _studio = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_studio, 1, wxEXPAND);
-
-       add_label_to_sizer (table, this, "Facility (e.g. DLA)");
-       _facility = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_facility, 1, wxEXPAND);
-
-       add_label_to_sizer (table, this, "Package Type (e.g. OV)");
-       _package_type = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_package_type, 1, wxEXPAND);
-
-       _audio_language->SetValue (std_to_wx (_film->audio_language ()));
-       _subtitle_language->SetValue (std_to_wx (_film->subtitle_language ()));
-       _territory->SetValue (std_to_wx (_film->territory ()));
-       _rating->SetValue (std_to_wx (_film->rating ()));
-       _studio->SetValue (std_to_wx (_film->studio ()));
-       _facility->SetValue (std_to_wx (_film->facility ()));
-       _package_type->SetValue (std_to_wx (_film->package_type ()));
-       
-       _audio_language->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::audio_language_changed), 0, this);
-       _subtitle_language->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::subtitle_language_changed), 0, this);
-       _territory->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::territory_changed), 0, this);
-       _rating->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::rating_changed), 0, this);
-       _studio->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::studio_changed), 0, this);
-       _facility->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::facility_changed), 0, this);
-       _package_type->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::package_type_changed), 0, this);
-
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
-       
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
-       if (buttons) {
-               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
-       }
-       
-       SetSizer (overall_sizer);
-       overall_sizer->Layout ();
-       overall_sizer->SetSizeHints (this);
-}
-
-void
-DCINameDialog::audio_language_changed (wxCommandEvent &)
-{
-       _film->set_audio_language (wx_to_std (_audio_language->GetValue ()));
-}
-
-void
-DCINameDialog::subtitle_language_changed (wxCommandEvent &)
-{
-       _film->set_subtitle_language (wx_to_std (_subtitle_language->GetValue ()));
-}
-
-void
-DCINameDialog::territory_changed (wxCommandEvent &)
-{
-       _film->set_territory (wx_to_std (_territory->GetValue ()));
-}
-
-void
-DCINameDialog::rating_changed (wxCommandEvent &)
-{
-       _film->set_rating (wx_to_std (_rating->GetValue ()));
-}
-
-void
-DCINameDialog::studio_changed (wxCommandEvent &)
-{
-       _film->set_studio (wx_to_std (_studio->GetValue ()));
-}
-
-void
-DCINameDialog::facility_changed (wxCommandEvent &)
-{
-       _film->set_facility (wx_to_std (_facility->GetValue ()));
-}
-
-void
-DCINameDialog::package_type_changed (wxCommandEvent &)
-{
-       _film->set_package_type (wx_to_std (_package_type->GetValue ()));
-}
diff --git a/src/wx/dci_name_dialog.h b/src/wx/dci_name_dialog.h
deleted file mode 100644 (file)
index 1fd5436..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-    Copyright (C) 2012 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <wx/dialog.h>
-#include <wx/textctrl.h>
-#include <boost/shared_ptr.hpp>
-
-class Film;
-
-class DCINameDialog : public wxDialog
-{
-public:
-       DCINameDialog (wxWindow *, boost::shared_ptr<Film>);
-
-private:
-       void audio_language_changed (wxCommandEvent &);
-       void subtitle_language_changed (wxCommandEvent &);
-       void territory_changed (wxCommandEvent &);
-       void rating_changed (wxCommandEvent &);
-       void studio_changed (wxCommandEvent &);
-       void facility_changed (wxCommandEvent &);
-       void package_type_changed (wxCommandEvent &);
-       
-       wxTextCtrl* _audio_language;
-       wxTextCtrl* _subtitle_language;
-       wxTextCtrl* _territory;
-       wxTextCtrl* _rating;
-       wxTextCtrl* _studio;
-       wxTextCtrl* _facility;
-       wxTextCtrl* _package_type;
-
-       boost::shared_ptr<Film> _film;
-};
index 4e99bcd960da73a6ce9fe99b40c065ab7c98baf4..f274416fb6225cfa4b3f42fd93b8b06b7e8c1d29 100644 (file)
@@ -43,7 +43,7 @@
 #include "film_editor.h"
 #include "gain_calculator_dialog.h"
 #include "sound_processor.h"
-#include "dci_name_dialog.h"
+#include "dci_metadata_dialog.h"
 #include "scaler.h"
 
 using std::string;
@@ -120,7 +120,7 @@ FilmEditor::make_film_panel ()
        _film_sizer->AddSpacer (0);
 
        add_label_to_sizer (_film_sizer, _film_panel, "Content Type");
-       _dcp_content_type = new wxComboBox (_film_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
+       _dcp_content_type = new wxChoice (_film_panel, wxID_ANY);
        _film_sizer->Add (_dcp_content_type);
 
        video_control (add_label_to_sizer (_film_sizer, _film_panel, "Frames Per Second"));
@@ -177,7 +177,7 @@ FilmEditor::connect_to_widgets ()
        _name->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (FilmEditor::name_changed), 0, this);
        _use_dci_name->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::use_dci_name_toggled), 0, this);
        _edit_dci_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_dci_button_clicked), 0, this);
-       _format->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
+       _format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
        _content->Connect (wxID_ANY, wxEVT_COMMAND_FILEPICKER_CHANGED, wxCommandEventHandler (FilmEditor::content_changed), 0, this);
        _trust_content_header->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::trust_content_header_changed), 0, this);
        _left_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::left_crop_changed), 0, this);
@@ -185,8 +185,8 @@ FilmEditor::connect_to_widgets ()
        _top_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::top_crop_changed), 0, this);
        _bottom_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::bottom_crop_changed), 0, this);
        _filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_filters_clicked), 0, this);
-       _scaler->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::scaler_changed), 0, this);
-       _dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
+       _scaler->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::scaler_changed), 0, this);
+       _dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
        _dcp_ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::dcp_ab_toggled), 0, this);
        _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this);
        _trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::trim_start_changed), 0, this);
@@ -194,10 +194,10 @@ FilmEditor::connect_to_widgets ()
        _with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
        _subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
        _subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
-       _colour_lut->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::colour_lut_changed), 0, this);
+       _colour_lut->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::colour_lut_changed), 0, this);
        _j2k_bandwidth->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this);
-       _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::subtitle_stream_changed), 0, this);
-       _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::audio_stream_changed), 0, this);
+       _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::subtitle_stream_changed), 0, this);
+       _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::audio_stream_changed), 0, this);
        _audio_gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
        _audio_gain_calculate_button->Connect (
                wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::audio_gain_calculate_button_clicked), 0, this
@@ -222,7 +222,7 @@ FilmEditor::make_video_panel ()
        _video_panel->SetSizer (pad);
 
        add_label_to_sizer (_video_sizer, _video_panel, "Format");
-       _format = new wxComboBox (_video_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
+       _format = new wxChoice (_video_panel, wxID_ANY);
        _video_sizer->Add (_format);
 
        {
@@ -259,7 +259,7 @@ FilmEditor::make_video_panel ()
        }
 
        video_control (add_label_to_sizer (_video_sizer, _video_panel, "Scaler"));
-       _scaler = new wxComboBox (_video_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
+       _scaler = new wxChoice (_video_panel, wxID_ANY);
        _video_sizer->Add (video_control (_scaler), 1);
 
        vector<Scaler const *> const sc = Scaler::all ();
@@ -268,7 +268,7 @@ FilmEditor::make_video_panel ()
        }
 
        add_label_to_sizer (_video_sizer, _video_panel, "Colour look-up table");
-       _colour_lut = new wxComboBox (_video_panel, wxID_ANY);
+       _colour_lut = new wxChoice (_video_panel, wxID_ANY);
        for (int i = 0; i < 2; ++i) {
                _colour_lut->Append (std_to_wx (colour_lut_index_to_name (i)));
        }
@@ -328,7 +328,7 @@ FilmEditor::make_audio_panel ()
                _use_content_audio = new wxRadioButton (_audio_panel, wxID_ANY, _("Use content's audio"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
                _audio_sizer->Add (video_control (_use_content_audio));
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _audio_stream = new wxComboBox (_audio_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
+               _audio_stream = new wxChoice (_audio_panel, wxID_ANY);
                s->Add (video_control (_audio_stream), 1);
                _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
                s->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
@@ -373,7 +373,7 @@ FilmEditor::make_subtitle_panel ()
        video_control (_with_subtitles);
        _subtitle_sizer->Add (_with_subtitles, 1);
        
-       _subtitle_stream = new wxComboBox (_subtitle_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
+       _subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY);
        _subtitle_sizer->Add (video_control (_subtitle_stream));
 
        video_control (add_label_to_sizer (_subtitle_sizer, _subtitle_panel, "Subtitle Offset"));
@@ -1058,8 +1058,9 @@ FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
                return;
        }
 
-       DCINameDialog* d = new DCINameDialog (this, _film);
+       DCIMetadataDialog* d = new DCIMetadataDialog (this, _film->dci_metadata ());
        d->ShowModal ();
+       _film->set_dci_metadata (d->dci_metadata ());
        d->Destroy ();
 }
 
@@ -1086,7 +1087,7 @@ FilmEditor::setup_streams ()
        if (_film->subtitle_stream()) {
                checked_set (_subtitle_stream, _film->subtitle_stream()->to_string());
        } else {
-               _subtitle_stream->SetValue (wxT (""));
+               _subtitle_stream->SetSelection (wxNOT_FOUND);
        }
 }
 
index 7272315fcfedc88af94bf8bc9b9f3f977057652e..90be752d832a84d20611a9164016294bcab53607 100644 (file)
@@ -118,7 +118,7 @@ private:
        wxCheckBox* _use_dci_name;
        wxButton* _edit_dci_button;
        /** The Film's format */
-       wxComboBox* _format;
+       wxChoice* _format;
        /** The Film's content file */
        wxFilePickerCtrl* _content;
        wxCheckBox* _trust_content_header;
@@ -135,9 +135,9 @@ private:
        /** Button to open the filters dialogue */
        wxButton* _filters_button;
        /** The Film's scaler */
-       wxComboBox* _scaler;
+       wxChoice* _scaler;
        wxRadioButton* _use_content_audio;
-       wxComboBox* _audio_stream;
+       wxChoice* _audio_stream;
        wxRadioButton* _use_external_audio;
        wxFilePickerCtrl* _external_audio[MAX_AUDIO_CHANNELS];
        /** The Film's audio gain */
@@ -147,13 +147,13 @@ private:
        /** The Film's audio delay */
        wxSpinCtrl* _audio_delay;
        wxCheckBox* _with_subtitles;
-       wxComboBox* _subtitle_stream;
+       wxChoice* _subtitle_stream;
        wxSpinCtrl* _subtitle_offset;
        wxSpinCtrl* _subtitle_scale;
-       wxComboBox* _colour_lut;
+       wxChoice* _colour_lut;
        wxSpinCtrl* _j2k_bandwidth;
        /** The Film's DCP content type */
-       wxComboBox* _dcp_content_type;
+       wxChoice* _dcp_content_type;
        /** The Film's frames per second */
        wxStaticText* _frames_per_second;
        /** The Film's original size */
index 4176f4f426e8287f1dffc16b335542ed132a0e05..7b8f0222006560ad3611cfbde747d25376e032a3 100644 (file)
@@ -51,11 +51,8 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        , _panel (new wxPanel (this))
        , _slider (new wxSlider (this, wxID_ANY, 0, 0, 4096))
        , _play_button (new wxToggleButton (this, wxID_ANY, wxT ("Play")))
+       , _display_frame_x (0)
        , _got_frame (false)
-       , _out_width (0)
-       , _out_height (0)
-       , _panel_width (0)
-       , _panel_height (0)
        , _clear_required (false)
 {
        _panel->SetDoubleBuffered (true);
@@ -196,14 +193,21 @@ FilmViewer::paint_panel (wxPaintEvent &)
                _clear_required = false;
        }
 
-       if (!_display_frame || !_film || !_out_width || !_out_height) {
+       if (!_display_frame || !_film || !_out_size.width || !_out_size.height) {
                dc.Clear ();
                return;
        }
 
-       wxImage frame (_out_width, _out_height, _display_frame->data()[0], true);
+       if (_display_frame_x) {
+               dc.SetPen(*wxBLACK_PEN);
+               dc.SetBrush(*wxBLACK_BRUSH);
+               dc.DrawRectangle (0, 0, _display_frame_x, _film_size.height);
+               dc.DrawRectangle (_display_frame_x + _film_size.width, 0, _display_frame_x * 2 + _film_size.width, _film_size.height);
+       }
+
+       wxImage frame (_film_size.width, _film_size.height, _display_frame->data()[0], true);
        wxBitmap frame_bitmap (frame);
-       dc.DrawBitmap (frame_bitmap, 0, 0);
+       dc.DrawBitmap (frame_bitmap, _display_frame_x, 0);
 
        if (_film->with_subtitles() && _display_sub) {
                wxImage sub (_display_sub->size().width, _display_sub->size().height, _display_sub->data()[0], _display_sub->alpha(), true);
@@ -232,8 +236,8 @@ FilmViewer::slider_moved (wxScrollEvent &)
 void
 FilmViewer::panel_sized (wxSizeEvent& ev)
 {
-       _panel_width = ev.GetSize().GetWidth();
-       _panel_height = ev.GetSize().GetHeight();
+       _panel_size.width = ev.GetSize().GetWidth();
+       _panel_size.height = ev.GetSize().GetHeight();
        calculate_sizes ();
        update_from_raw ();
 }
@@ -254,7 +258,7 @@ FilmViewer::update_from_raw ()
 void
 FilmViewer::raw_to_display ()
 {
-       if (!_raw_frame || _out_width < 64 || _out_height < 64 || !_film) {
+       if (!_raw_frame || _out_size.width < 64 || _out_size.height < 64 || !_film) {
                return;
        }
 
@@ -264,7 +268,7 @@ FilmViewer::raw_to_display ()
        }
 
        /* Get a compacted image as we have to feed it to wxWidgets */
-       _display_frame = _raw_frame->scale_and_convert_to_rgb (libdcp::Size (_out_width, _out_height), 0, _film->scaler(), false);
+       _display_frame = _raw_frame->scale_and_convert_to_rgb (_film_size, 0, _film->scaler(), false);
 
        if (old_size != _display_frame->size()) {
                _clear_required = true;
@@ -272,13 +276,14 @@ FilmViewer::raw_to_display ()
 
        if (_raw_sub) {
                Rect tx = subtitle_transformed_area (
-                       float (_out_width) / _film->size().width,
-                       float (_out_height) / _film->size().height,
+                       float (_film_size.width) / _film->size().width,
+                       float (_film_size.height) / _film->size().height,
                        _raw_sub->area(), _film->subtitle_offset(), _film->subtitle_scale()
                        );
                
                _display_sub.reset (new RGBPlusAlphaImage (_raw_sub->image()->scale (tx.size(), _film->scaler(), false)));
                _display_sub_position = tx.position();
+               _display_sub_position.x += _display_frame_x;
        } else {
                _display_sub.reset ();
        }
@@ -290,17 +295,36 @@ FilmViewer::calculate_sizes ()
        if (!_film) {
                return;
        }
+
+       Format const * format = _film->format ();
        
-       float const panel_ratio = static_cast<float> (_panel_width) / _panel_height;
-       float const film_ratio = _film->format() ? _film->format()->ratio_as_float(_film) : 1.78;
+       float const panel_ratio = static_cast<float> (_panel_size.width) / _panel_size.height;
+       float const film_ratio = format ? format->container_ratio_as_float () : 1.78;
+                       
        if (panel_ratio < film_ratio) {
                /* panel is less widscreen than the film; clamp width */
-               _out_width = _panel_width;
-               _out_height = _out_width / film_ratio;
+               _out_size.width = _panel_size.width;
+               _out_size.height = _out_size.width / film_ratio;
        } else {
-               /* panel is more widescreen than the film; clamp heignt */
-               _out_height = _panel_height;
-               _out_width = _out_height * film_ratio;
+               /* panel is more widescreen than the film; clamp height */
+               _out_size.height = _panel_size.height;
+               _out_size.width = _out_size.height * film_ratio;
+       }
+
+       /* Work out how much padding there is in terms of our display; this will be the x position
+          of our _display_frame.
+       */
+       _display_frame_x = 0;
+       if (format) {
+               _display_frame_x = static_cast<float> (format->dcp_padding (_film)) * _out_size.width / format->dcp_size().width;
+       }
+
+       _film_size = _out_size;
+       _film_size.width -= _display_frame_x * 2;
+
+       /* Catch silly values */
+       if (_out_size.width < 64) {
+               _out_size.width = 64;
        }
 }
 
index c6b5e7c0c5530ec871f4b04df919a48b97b83de8..456301eb4e0744d9162e60781e7034bf2ad90c4b 100644 (file)
@@ -69,14 +69,17 @@ private:
        boost::shared_ptr<Image> _raw_frame;
        boost::shared_ptr<Subtitle> _raw_sub;
        boost::shared_ptr<Image> _display_frame;
+       int _display_frame_x;
        boost::shared_ptr<RGBPlusAlphaImage> _display_sub;
        Position _display_sub_position;
        bool _got_frame;
 
-       int _out_width;
-       int _out_height;
-       int _panel_width;
-       int _panel_height;
+       /** Size of our output (including padding if we have any) */
+       libdcp::Size _out_size;
+       /** Size that we will make our film (equal to _out_size unless we have padding) */
+       libdcp::Size _film_size;
+       /** Size of the panel that we have available */
+       libdcp::Size _panel_size;
 
        bool _clear_required;
 };
index 4dbb04eeacaa4cc0da3155f09e6243e5934b7dbb..47272f697e2b7819959dc1447a66127d6f83d8ec 100644 (file)
@@ -14,7 +14,7 @@ def build(bld):
     obj.use = 'libdvdomatic'
     obj.source = """
                  config_dialog.cc
-                 dci_name_dialog.cc
+                 dci_metadata_dialog.cc
                  dir_picker_ctrl.cc
                  film_editor.cc
                  film_viewer.cc
index bc444e4bc2a6370ed54d100cb51f864f17345229..413071ea6989e0e395a5b5b64b23d2212f57dace 100644 (file)
@@ -138,22 +138,15 @@ checked_set (wxSpinCtrl* widget, int value)
 }
 
 void
-checked_set (wxComboBox* widget, int value)
+checked_set (wxChoice* widget, int value)
 {
        if (widget->GetSelection() != value) {
-               if (value == wxNOT_FOUND) {
-                       /* Work around an apparent wxWidgets bug; SetSelection (wxNOT_FOUND)
-                          appears not to work sometimes.
-                       */
-                       widget->SetValue (wxT (""));
-               } else {
-                       widget->SetSelection (value);
-               }
+               widget->SetSelection (value);
        }
 }
 
 void
-checked_set (wxComboBox* widget, string value)
+checked_set (wxChoice* widget, string value)
 {
        wxClientData* o = 0;
        if (widget->GetSelection() != -1) {
index 6cb7fd00290e8abf553ceade48d651818e440716..0c77735eb2abf985317fedcaf110c145311a5f8c 100644 (file)
@@ -58,8 +58,8 @@ extern std::string string_client_data (wxClientData* o);
 
 extern void checked_set (wxFilePickerCtrl* widget, std::string value);
 extern void checked_set (wxSpinCtrl* widget, int value);
-extern void checked_set (wxComboBox* widget, int value);
-extern void checked_set (wxComboBox* widget, std::string value);
+extern void checked_set (wxChoice* widget, int value);
+extern void checked_set (wxChoice* widget, std::string value);
 extern void checked_set (wxTextCtrl* widget, std::string value);
 extern void checked_set (wxCheckBox* widget, bool value);
 extern void checked_set (wxRadioButton* widget, bool value);
diff --git a/wscript b/wscript
index d8ec37667545a1ede15152237ef1a7a41e9b7a8e..bf5cf1daa282d0fefa40a4eef13bdc67407167c9 100644 (file)
--- a/wscript
+++ b/wscript
@@ -3,7 +3,7 @@ import os
 import sys
 
 APPNAME = 'dvdomatic'
-VERSION = '0.71beta2'
+VERSION = '0.73pre'
 
 def options(opt):
     opt.load('compiler_cxx')
@@ -89,21 +89,22 @@ def configure(conf):
 
     conf.check_cfg(package = 'sndfile', args = '--cflags --libs', uselib_store = 'SNDFILE', mandatory = True)
     conf.check_cfg(package = 'glib-2.0', args = '--cflags --libs', uselib_store = 'GLIB', mandatory = True)
+    conf.check_cfg(package = 'liblzma', args = '--cflags --libs', uselib_store = 'LZMA', mandatory = True)
     conf.check_cfg(package = '', path = 'Magick++-config', args = '--cppflags --cxxflags --libs', uselib_store = 'MAGICK', mandatory = True)
 
-    openjpeg_fragment = """
+    if conf.options.static:
+        conf.check_cc(fragment = """
                        #include <stdio.h>\n
                        #include <openjpeg.h>\n
                        int main () {\n
                        void* p = (void *) opj_image_create;\n
                        return 0;\n
                        }
-                       """
-
-    if conf.options.static:
-        conf.check_cc(fragment = openjpeg_fragment, msg = 'Checking for library openjpeg', stlib = 'openjpeg', uselib_store = 'OPENJPEG')
+                       """, msg = 'Checking for library openjpeg', stlib = 'openjpeg', uselib_store = 'OPENJPEG')
     else:
-        conf.check_cfg(package = 'libopenjpeg', args = '--cflags --libs', uselib_store = 'OPENJPEG', mandatory = True)
+        # Only 1.5.0 and 1.5.1 have been tested.
+        conf.check_cfg(package = 'libopenjpeg', args = '--cflags --libs', atleast_version = '1.5.0', uselib_store = 'OPENJPEG', mandatory = True)
+        conf.check_cfg(package = 'libopenjpeg', args = '--cflags --libs', max_version = '1.5.1', mandatory = True)
 
     conf.check_cc(fragment  = """
                               #include <libssh/libssh.h>\n
@@ -111,7 +112,7 @@ def configure(conf):
                               ssh_session s = ssh_new ();\n
                               return 0;\n
                               }
-                              """, msg = 'Checking for library libssh', mandatory = False, lib = 'ssh', uselib_store = 'SSH')
+                              """, msg = 'Checking for library libssh', mandatory = True, lib = 'ssh', uselib_store = 'SSH')
 
     conf.check_cxx(fragment = """
                              #include <boost/thread.hpp>\n