Merge master.
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Jan 2014 22:18:42 +0000 (22:18 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 9 Jan 2014 22:18:42 +0000 (22:18 +0000)
13 files changed:
1  2 
src/lib/content.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_decoder.cc
src/lib/film.cc
src/lib/film.h
src/lib/image_content.cc
src/lib/image_content.h
src/lib/player.cc
src/lib/sndfile_content.cc
src/lib/video_content.h
src/wx/timecode.cc
src/wx/timecode.h
test/wscript

Simple merge
Simple merge
index a2b3e5d3bfdead6a8fe07a44489c87440bc228ab,d9b7796599b8c7cdf7687454fd6dc668db5195ef..8742c48ecd6360021bcb309636ba376a300ccc28
@@@ -561,11 -559,11 +561,11 @@@ FFmpegDecoder::decode_subtitle_packet (
        /* Subtitle PTS in seconds (within the source, not taking into account any of the
           source that we may have chopped off for the DCP)
        */
--      double const packet_time = (static_cast<double> (sub.pts ) / AV_TIME_BASE) + _video_pts_offset;
++      double const packet_time = (static_cast<double> (sub.pts ) / AV_TIME_BASE) + _pts_offset;
        
        /* hence start time for this sub */
 -      Time const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ;
 -      Time const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ;
 +      ContentTime const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ;
 +      ContentTime const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ;
  
        AVSubtitleRect const * rect = sub.rects[0];
  
diff --cc src/lib/film.cc
Simple merge
diff --cc src/lib/film.h
index 24ddad0bdc545ee8d55cae15ec9d390bbb8f03b7,0a747193eae4debd6fdab184328fbe2156ddcda5..5d83ec6edaa484c19192f1874448810711588741
@@@ -101,13 -101,16 +101,16 @@@ public
        boost::shared_ptr<Player> make_player () const;
        boost::shared_ptr<Playlist> playlist () const;
  
 -      OutputAudioFrame audio_frame_rate () const;
 +      AudioFrame audio_frame_rate () const;
  
 -      OutputAudioFrame time_to_audio_frames (Time) const;
 -      OutputVideoFrame time_to_video_frames (Time) const;
 -      Time video_frames_to_time (OutputVideoFrame) const;
 -      Time audio_frames_to_time (OutputAudioFrame) const;
 +      AudioFrame time_to_audio_frames (DCPTime) const;
 +      VideoFrame time_to_video_frames (DCPTime) const;
 +      DCPTime video_frames_to_time (VideoFrame) const;
 +      DCPTime audio_frames_to_time (AudioFrame) const;
  
+       uint64_t required_disk_space () const;
+       bool should_be_enough_disk_space (double &, double &) const;
+       
        /* Proxies for some Playlist methods */
  
        ContentList content () const;
Simple merge
index ef2bc0447c9262e13357154f5f3c313996bccfb3,e5a0311d97947f816f62dbfc5aefd67a8a9ef282..f929e2b6f15b72105a6a97880e6bef647eb98175
@@@ -45,8 -45,9 +45,9 @@@ public
  
        std::string identifier () const;
        
 -      void set_video_length (VideoContent::Frame);
 +      void set_video_length (VideoFrame);
        bool still () const;
+       void set_video_frame_rate (float);
  };
  
  #endif
index 3db2fe6c9eb19074be6f265f7fd4ffe6918ca61d,9f859969341fa65a1eacc22d0c3da9b7002387c0..260476242fcb91acacebb87a1cb50b61d90367bc
@@@ -326,18 -320,42 +326,25 @@@ Player::emit_audio (weak_ptr<Piece> wea
  
        /* Gain */
        if (content->audio_gain() != 0) {
 -              shared_ptr<AudioBuffers> gain (new AudioBuffers (audio));
 +              shared_ptr<AudioBuffers> gain (new AudioBuffers (audio->data));
                gain->apply_gain (content->audio_gain ());
 -              audio = gain;
 -      }
 -
 -      /* Resample */
 -      if (content->content_audio_frame_rate() != content->output_audio_frame_rate()) {
 -              shared_ptr<Resampler> r = resampler (content, true);
 -              pair<shared_ptr<const AudioBuffers>, AudioContent::Frame> ro = r->run (audio, frame);
 -              audio = ro.first;
 -              frame = ro.second;
 -      }
 -      
 -      Time const relative_time = _film->audio_frames_to_time (frame);
 -
 -      if (content->trimmed (relative_time)) {
 -              return;
 +              audio->data = gain;
        }
  
 -      Time time = content->position() + (content->audio_delay() * TIME_HZ / 1000) + relative_time - content->trim_start ();
 -      
        /* Remap channels */
 -      shared_ptr<AudioBuffers> dcp_mapped (new AudioBuffers (_film->audio_channels(), audio->frames()));
 +      shared_ptr<AudioBuffers> dcp_mapped (new AudioBuffers (_film->audio_channels(), audio->data->frames()));
        dcp_mapped->make_silent ();
-       list<pair<int, libdcp::Channel> > map = content->audio_mapping().content_to_dcp ();
-       for (list<pair<int, libdcp::Channel> >::iterator i = map.begin(); i != map.end(); ++i) {
-               if (i->first < audio->data->channels() && i->second < dcp_mapped->channels()) {
-                       dcp_mapped->accumulate_channel (audio->data.get(), i->first, i->second);
 -
+       AudioMapping map = content->audio_mapping ();
+       for (int i = 0; i < map.content_channels(); ++i) {
+               for (int j = 0; j < _film->audio_channels(); ++j) {
+                       if (map.get (i, static_cast<libdcp::Channel> (j)) > 0) {
+                               dcp_mapped->accumulate_channel (
 -                                      audio.get(),
++                                      audio->data.get(),
+                                       i,
+                                       static_cast<libdcp::Channel> (j),
+                                       map.get (i, static_cast<libdcp::Channel> (j))
+                                       );
+                       }
                }
        }
  
index 48bdb56ec9a149dbaaccbaf1fbcdec37e8193bf7,796229777f86374a05b60e0eb11f1bb0c9c34ba5..d3acc7d2e3662a4261d56e6d077e888da4a50ede
@@@ -43,13 -43,13 +43,13 @@@ SndfileContent::SndfileContent (shared_
  
  }
  
- SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int)
+ SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version)
        : Content (f, node)
        , AudioContent (f, node)
-       , _audio_mapping (node->node_child ("AudioMapping"))
+       , _audio_mapping (node->node_child ("AudioMapping"), version)
  {
        _audio_channels = node->number_child<int> ("AudioChannels");
 -      _audio_length = node->number_child<AudioContent::Frame> ("AudioLength");
 +      _audio_length = node->number_child<AudioFrame> ("AudioLength");
        _audio_frame_rate = node->number_child<int> ("AudioFrameRate");
  }
  
index d03aa9ce4ae326248e24f4abb57fa6acebcec5c1,141525e01b20b237184c32cf21bc49d7a21791d9..8d901cbcdfa2d8b0a06745da2e0eabb4ccbf0943
@@@ -128,7 -128,8 +128,8 @@@ public
  protected:
        void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
  
 -      VideoContent::Frame _video_length;
 +      VideoFrame _video_length;
+       float _video_frame_rate;
  
  private:
        friend class ffmpeg_pts_offset_test;
index b23ff2a39203842feac9805fb811d7b0e351bbfd,033bd2bd01e97f29965829c8c28c20bd37fa2a3b..493650aae857a0046d152b91bd95b46f8caa5675
@@@ -83,7 -83,7 +83,7 @@@ Timecode::Timecode (wxWindow* parent
  }
  
  void
- DCPTimecode::set (DCPTime t, int fps)
 -Timecode::set (Time t, int fps)
++Timecode::set (DCPTime t, int fps)
  {
        int const h = t / (3600 * TIME_HZ);
        t -= h * 3600 * TIME_HZ;
        _fixed->SetLabel (wxString::Format ("%02d:%02d:%02d.%02d", h, m, s, f));
  }
  
 -Time
 +DCPTime
DCPTimecode::get (int fps) const
+ Timecode::get (int fps) const
  {
 -      Time t = 0;
 +      DCPTime t = 0;
        string const h = wx_to_std (_hours->GetValue ());
        t += lexical_cast<int> (h.empty() ? "0" : h) * 3600 * TIME_HZ;
        string const m = wx_to_std (_minutes->GetValue());
index f95740255ea44ffe105860f76cc6669e3f69b1e4,880b44a31be8754ca54634e542d9e739e328b745..b13e8c3c084b9c35514e805f59e752927fe46ae1
  #include <wx/wx.h>
  #include "lib/types.h"
  
- class DCPTimecode : public wxPanel
+ class Timecode : public wxPanel
  {
  public:
-       DCPTimecode (wxWindow *);
+       Timecode (wxWindow *);
  
 -      void set (Time, int);
 -      Time get (int) const;
 +      void set (DCPTime, int);
 +      DCPTime get (int) const;
  
        void set_editable (bool);
  
diff --cc test/wscript
Simple merge