Merge master.
authorCarl Hetherington <cth@carlh.net>
Mon, 14 Jan 2013 20:33:50 +0000 (20:33 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 14 Jan 2013 20:33:50 +0000 (20:33 +0000)
1  2 
src/lib/config.cc
src/lib/config.h
src/lib/film.cc
src/lib/film.h
src/lib/make_dcp_job.cc
src/lib/util.cc
src/wx/film_editor.cc
src/wx/film_editor.h

Simple merge
Simple merge
diff --cc src/lib/film.cc
index 48677ba613848f419864efe0e4307a6842c5bea9,f0441c9e0b038733b86a7797cc32b3706cc5a028..fb3423bb42c1c35707798ca0c4f23c363e3e5c86
@@@ -104,7 -99,8 +104,9 @@@ Film::Film (string d, bool must_exist
        , _with_subtitles (false)
        , _subtitle_offset (0)
        , _subtitle_scale (1)
 +      , _encrypted (false)
+       , _colour_lut (0)
+       , _j2k_bandwidth (200000000)
        , _frames_per_second (0)
        , _dirty (false)
  {
@@@ -172,7 -169,8 +175,9 @@@ Film::Film (Film const & o
        , _with_subtitles    (o._with_subtitles)
        , _subtitle_offset   (o._subtitle_offset)
        , _subtitle_scale    (o._subtitle_scale)
 +      , _encrypted         (o._encrypted)
+       , _colour_lut        (o._colour_lut)
+       , _j2k_bandwidth     (o._j2k_bandwidth)
        , _audio_language    (o._audio_language)
        , _subtitle_language (o._subtitle_language)
        , _territory         (o._territory)
@@@ -427,7 -434,8 +441,9 @@@ Film::write_metadata () cons
        f << "with_subtitles " << _with_subtitles << "\n";
        f << "subtitle_offset " << _subtitle_offset << "\n";
        f << "subtitle_scale " << _subtitle_scale << "\n";
 +      f << "encrypted " << _encrypted << "\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";
@@@ -553,8 -563,10 +571,12 @@@ Film::read_metadata (
                        _subtitle_offset = atoi (v.c_str ());
                } else if (k == "subtitle_scale") {
                        _subtitle_scale = atof (v.c_str ());
 +              } else if (k == "encrypted") {
 +                      _encrypted = (v == "1");
+               } else if (k == "colour_lut") {
+                       _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") {
@@@ -1200,16 -1232,26 +1242,36 @@@ Film::set_subtitle_scale (float s
        signal_changed (SUBTITLE_SCALE);
  }
  
 +void
 +Film::set_encrypted (bool e)
 +{
 +      {
 +              boost::mutex::scoped_lock lm (_state_mutex);
 +              _encrypted = e;
 +      }
 +      signal_changed (ENCRYPTED);
 +}
 +
+ void
+ Film::set_colour_lut (int i)
+ {
+       {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               _colour_lut = i;
+       }
+       signal_changed (COLOUR_LUT);
+ }
+ void
+ Film::set_j2k_bandwidth (int b)
+ {
+       {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               _j2k_bandwidth = b;
+       }
+       signal_changed (J2K_BANDWIDTH);
+ }
  void
  Film::set_audio_language (string l)
  {
diff --cc src/lib/film.h
index b119d59a6e9cb2861b6157c974d13e0c9eeff6c4,3485dfaae8dd1eec33e7f9cb6527daf963390d04..1a78e9d34a606e62037c259316e01eeb47dac2b8
@@@ -46,12 -45,11 +46,12 @@@ class Filter
  class Log;
  class ExamineContentJob;
  class ExternalAudioStream;
 +class Screen;
  
  /** @class Film
-  *  @brief A representation of a video with sound.
+  *  @brief A representation of a video, maybe with sound.
   *
-  *  A representation of a piece of video (with sound), including naming,
+  *  A representation of a piece of video (maybe with sound), including naming,
   *  the source content file, and how it should be presented in a DCP.
   */
  class Film : public boost::enable_shared_from_this<Film>
@@@ -102,13 -100,9 +102,16 @@@ public
  
        void set_dci_date_today ();
  
 +      void make_kdms (
 +              std::list<boost::shared_ptr<Screen> >,
 +              boost::posix_time::ptime from,
 +              boost::posix_time::ptime until,
 +              std::string directory
 +              ) const;
 +
+       /** Identifiers for the parts of our state;
+           used for signalling changes.
+       */
        enum Property {
                NONE,
                NAME,
                WITH_SUBTITLES,
                SUBTITLE_OFFSET,
                SUBTITLE_SCALE,
 +              ENCRYPTED,
+               COLOUR_LUT,
+               J2K_BANDWIDTH,
                DCI_METADATA,
                SIZE,
                LENGTH,
                return _subtitle_scale;
        }
  
 +      bool encrypted () const {
 +              boost::mutex::scoped_lock lm (_state_mutex);
 +              return _encrypted;
 +      }
 +
+       int colour_lut () const {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               return _colour_lut;
+       }
+       int j2k_bandwidth () const {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               return _j2k_bandwidth;
+       }
        std::string audio_language () const {
                boost::mutex::scoped_lock lm (_state_mutex);
                return _audio_language;
        void set_with_subtitles (bool);
        void set_subtitle_offset (int);
        void set_subtitle_scale (float);
 +      void set_encrypted (bool);
+       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);
@@@ -460,8 -475,14 +491,16 @@@ private
        int _subtitle_offset;
        /** scale factor to apply to subtitles */
        float _subtitle_scale;
 +      bool _encrypted;
 +
+       /** index of colour LUT to use when converting RGB to XYZ.
+        *  0: sRGB
+        *  1: Rec 709
+        */
+       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;
index e42018ad5875b962a1ad07fafcfbc8bbed6b55c7,b9f0cacf3b2d9f62219fdf0eff111890f7d91ddb..37c9ca6206429d2a864e1f21e11c0c1f48805905
@@@ -103,39 -107,65 +107,67 @@@ MakeDCPJob::run (
        
        dcp.add_cpl (cpl);
  
-       descend (0.8);
-       shared_ptr<libdcp::MonoPictureAsset> pa (
-               new libdcp::MonoPictureAsset (
-                       boost::bind (&MakeDCPJob::j2c_path, this, _1),
-                       _film->dir (_film->dcp_name()),
-                       "video.mxf",
-                       &dcp.Progress,
-                       dfr.frames_per_second,
-                       frames,
-                       _opt->out_size.width,
-                       _opt->out_size.height,
-                       _film->encrypted ()
-                       )
-               );
-       
-       ascend ();
+       int frames_per_reel = 0;
+       if (_film->reel_size()) {
+               frames_per_reel = (_film->reel_size().get() / (_film->j2k_bandwidth() / 8)) * dfr.frames_per_second;
+       } else {
+               frames_per_reel = frames;
+       }
  
-       shared_ptr<libdcp::SoundAsset> sa;
+       int frames_done = 0;
+       int reel = 0;
  
-       if (_film->audio_channels() > 0) {
-               descend (0.1);
-               sa.reset (
-                       new libdcp::SoundAsset (
-                               boost::bind (&MakeDCPJob::wav_path, this, _1),
+       while (frames_done < frames) {
+               descend (float (frames_per_reel) / frames);
+               int this_time = std::min (frames_per_reel, (frames - frames_done));
+               descend (0.8);
+               shared_ptr<libdcp::MonoPictureAsset> pa (
+                       new libdcp::MonoPictureAsset (
+                               boost::bind (&MakeDCPJob::j2c_path, this, _1, frames_done),
                                _film->dir (_film->dcp_name()),
-                               "audio.mxf",
+                               String::compose ("video_%1.mxf", reel),
                                &dcp.Progress,
                                dfr.frames_per_second,
-                               frames,
-                               dcp_audio_channels (_film->audio_channels()),
+                               this_time,
+                               _opt->out_size.width,
 -                              _opt->out_size.height
++                              _opt->out_size.height,
 +                              _film->encrypted()
                                )
                        );
 -                                      dcp_audio_channels (_film->audio_channels())
+       
+               ascend ();
+               
+               shared_ptr<libdcp::SoundAsset> sa;
+               
+               if (_film->audio_channels() > 0) {
+                       descend (0.1);
+                       sa.reset (
+                               new libdcp::SoundAsset (
+                                       boost::bind (&MakeDCPJob::wav_path, this, _1),
+                                       _film->dir (_film->dcp_name()),
+                                       String::compose ("audio_%1.mxf", reel),
+                                       &dcp.Progress,
+                                       dfr.frames_per_second,
+                                       this_time,
+                                       frames_done,
++                                      dcp_audio_channels (_film->audio_channels()),
++                                      _film->encrypted()
+                                       )
+                               );
+                       ascend ();
+               }
+               descend (0.1);
+               cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ())));
+               ascend ();
+               
+               frames_done += frames_per_reel;
+               ++reel;
                ascend ();
        }
  
diff --cc src/lib/util.cc
Simple merge
index ea6055c94be1a95b611211bad91e0a03e3a213e5,17c40c83d0eb00ad21bee2c6fe412b1c8ae170d7..9326227a32b3c6baf333578bad5061d95549e4a2
@@@ -149,10 -149,17 +149,21 @@@ FilmEditor::make_film_panel (
                _film_sizer->Add (s);
        }
  
 +      _encrypted = new wxCheckBox (_film_panel, wxID_ANY, wxT ("Encrypted"));
 +      _film_sizer->Add (_encrypted, 1);
 +      _film_sizer->AddSpacer (0);
 +
+       _multiple_reels = new wxCheckBox (_film_panel, wxID_ANY, wxT ("Make multiple reels"));
+       _film_sizer->Add (_multiple_reels);
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               _reel_size = new wxSpinCtrl (_film_panel, wxID_ANY);
+               s->Add (_reel_size);
+               add_label_to_sizer (s, _film_panel, "Gb each");
+               _film_sizer->Add (s);
+       }
        _dcp_ab = new wxCheckBox (_film_panel, wxID_ANY, wxT ("A/B"));
        video_control (_dcp_ab);
        _film_sizer->Add (_dcp_ab, 1);
@@@ -635,9 -710,12 +725,15 @@@ FilmEditor::film_changed (Film::Propert
        case Film::SUBTITLE_SCALE:
                checked_set (_subtitle_scale, _film->subtitle_scale() * 100);
                break;
 +      case Film::ENCRYPTED:
 +              checked_set (_encrypted, _film->encrypted ());
 +              break;
+       case Film::COLOUR_LUT:
+               checked_set (_colour_lut, _film->colour_lut ());
+               break;
+       case Film::J2K_BANDWIDTH:
+               checked_set (_j2k_bandwidth, double (_film->j2k_bandwidth()) / 1e6);
+               break;
        case Film::USE_DCI_NAME:
                checked_set (_use_dci_name, _film->use_dci_name ());
                _dcp_name->SetLabel (std_to_wx (_film->dcp_name ()));
@@@ -745,7 -824,8 +842,9 @@@ FilmEditor::set_film (shared_ptr<Film> 
        film_changed (Film::WITH_SUBTITLES);
        film_changed (Film::SUBTITLE_OFFSET);
        film_changed (Film::SUBTITLE_SCALE);
 +      film_changed (Film::ENCRYPTED);
+       film_changed (Film::COLOUR_LUT);
+       film_changed (Film::J2K_BANDWIDTH);
        film_changed (Film::DCI_METADATA);
        film_changed (Film::SIZE);
        film_changed (Film::LENGTH);
@@@ -778,8 -858,11 +877,12 @@@ FilmEditor::set_things_sensitive (bool 
        _dcp_content_type->Enable (s);
        _dcp_trim_start->Enable (s);
        _dcp_trim_end->Enable (s);
+       _multiple_reels->Enable (s);
+       _reel_size->Enable (s);
        _dcp_ab->Enable (s);
 +      _encrypted->Enable (s);
+       _colour_lut->Enable (s);
+       _j2k_bandwidth->Enable (s);
        _audio_gain->Enable (s);
        _audio_gain_calculate_button->Enable (s);
        _audio_delay->Enable (s);
index c1284fe795d50b4103d5dbb212d51db5e9cf23dd,34e67eef13e8a7dc0e41a5d83dbc73806f4a462e..b990ec40db748ffdc202c01a398660f16a02907a
@@@ -65,8 -65,9 +65,10 @@@ private
        void format_changed (wxCommandEvent &);
        void dcp_trim_start_changed (wxCommandEvent &);
        void dcp_trim_end_changed (wxCommandEvent &);
+       void multiple_reels_toggled (wxCommandEvent &);
+       void reel_size_changed (wxCommandEvent &);
        void dcp_content_type_changed (wxCommandEvent &);
 +      void encrypted_toggled (wxCommandEvent &);
        void dcp_ab_toggled (wxCommandEvent &);
        void scaler_changed (wxCommandEvent &);
        void audio_gain_changed (wxCommandEvent &);
  
        wxSpinCtrl* _dcp_trim_start;
        wxSpinCtrl* _dcp_trim_end;
 +      wxCheckBox* _encrypted;
+       wxCheckBox* _multiple_reels;
+       wxSpinCtrl* _reel_size;
        /** Selector to generate an A/B comparison DCP */
        wxCheckBox* _dcp_ab;