Merge master.
authorCarl Hetherington <cth@carlh.net>
Tue, 11 Feb 2014 12:04:27 +0000 (12:04 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 11 Feb 2014 12:04:27 +0000 (12:04 +0000)
16 files changed:
1  2 
src/lib/ffmpeg.cc
src/lib/ffmpeg_content.h
src/lib/image.cc
src/lib/job.cc
src/lib/player.cc
src/lib/transcode_job.cc
src/lib/util.cc
src/lib/util.h
src/lib/wscript
src/tools/server_test.cc
src/wx/audio_plot.cc
src/wx/film_viewer.cc
src/wx/timeline.cc
test/resampler_test.cc
test/wscript
wscript

Simple merge
Simple merge
Simple merge
diff --cc src/lib/job.cc
Simple merge
index 3e6a1598d17e76559c64b7ca0cde2837ec905b64,59db923be79503d4425122f24c320690e3d961ed..48c75078e12a59c2bdfabab7f5a91bbf1ea085f0
@@@ -450,43 -455,31 +450,47 @@@ Player::setup_pieces (
  
        for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
  
+               if (!(*i)->paths_valid ()) {
+                       continue;
+               }
++              
 +              shared_ptr<Decoder> decoder;
 +              optional<FrameRateChange> frc;
 +
 +              /* Work out a FrameRateChange for the best overlap video for this content, in case we need it below */
 +              DCPTime best_overlap_t = 0;
 +              shared_ptr<VideoContent> best_overlap;
 +              for (ContentList::iterator j = content.begin(); j != content.end(); ++j) {
 +                      shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*j);
 +                      if (!vc) {
 +                              continue;
 +                      }
 +                      
 +                      DCPTime const overlap = max (vc->position(), (*i)->position()) - min (vc->end(), (*i)->end());
 +                      if (overlap > best_overlap_t) {
 +                              best_overlap = vc;
 +                              best_overlap_t = overlap;
 +                      }
 +              }
  
 -              shared_ptr<Piece> piece (new Piece (*i));
 -
 -              /* XXX: into content? */
 +              optional<FrameRateChange> best_overlap_frc;
 +              if (best_overlap) {
 +                      best_overlap_frc = FrameRateChange (best_overlap->video_frame_rate(), _film->video_frame_rate ());
 +              } else {
 +                      /* No video overlap; e.g. if the DCP is just audio */
 +                      best_overlap_frc = FrameRateChange (_film->video_frame_rate(), _film->video_frame_rate ());
 +              }
  
 +              /* FFmpeg */
                shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (*i);
                if (fc) {
 -                      shared_ptr<FFmpegDecoder> fd (new FFmpegDecoder (_film, fc, _video, _audio));
 -                      
 -                      fd->Video.connect (bind (&Player::process_video, this, weak_ptr<Piece> (piece), _1, _2, _3, _4, 0));
 -                      fd->Audio.connect (bind (&Player::process_audio, this, weak_ptr<Piece> (piece), _1, _2));
 -                      fd->Subtitle.connect (bind (&Player::process_subtitle, this, weak_ptr<Piece> (piece), _1, _2, _3, _4));
 -
 -                      fd->seek (fc->time_to_content_video_frames (fc->trim_start ()), true);
 -                      piece->decoder = fd;
 +                      decoder.reset (new FFmpegDecoder (_film, fc, _video, _audio));
 +                      frc = FrameRateChange (fc->video_frame_rate(), _film->video_frame_rate());
                }
 -              
 +
 +              /* ImageContent */
                shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (*i);
                if (ic) {
 -                      bool reusing = false;
 -                      
                        /* See if we can re-use an old ImageDecoder */
                        for (list<shared_ptr<Piece> >::const_iterator j = old_pieces.begin(); j != old_pieces.end(); ++j) {
                                shared_ptr<ImageDecoder> imd = dynamic_pointer_cast<ImageDecoder> ((*j)->decoder);
index 289259369d028652aa2fc684f7aabc4997c30971,5c195ee1b781227637068f58ff62bf5425ca1612..46fc97fb31b74bdf14f6093dd0d973e34fa78709
@@@ -111,6 -114,6 +114,6 @@@ TranscodeJob::remaining_time () cons
        }
  
        /* Compute approximate proposed length here, as it's only here that we need it */
-       VideoFrame const left = _film->time_to_video_frames (_film->length ()) - _transcoder->video_frames_out();
 -      OutputVideoFrame const left = _film->time_to_video_frames (_film->length ()) - t->video_frames_out();
++      VideoFrame const left = _film->time_to_video_frames (_film->length ()) - t->video_frames_out();
        return left / fps;
  }
diff --cc src/lib/util.cc
index ef203c2bdc82fae52119f0acef4b4d4c2ba27764,b2f8c4470e5af5ee5117489870f4899bd38367bb..418d7b3e0f6123810b2f482df524473d5abe2d55
@@@ -308,9 -337,10 +338,11 @@@ dcpomatic_setup (
        boost::filesystem::path lib = app_contents ();
        lib /= "lib";
        setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1);
- #endif        
+ #endif
+       set_terminate (terminate);
  
 +      Pango::init ();
        libdcp::init ();
        
        Ratio::setup_ratios ();
@@@ -920,9 -949,13 +952,19 @@@ fit_ratio_within (float ratio, libdcp::
        return libdcp::Size (full_frame.width, rint (full_frame.width / ratio));
  }
  
 -              
 +DCPTime
 +time_round_up (DCPTime t, DCPTime nearest)
 +{
 +      DCPTime const a = t + nearest - 1;
 +      return a - (a % nearest);
 +}
++
+ void *
+ wrapped_av_malloc (size_t s)
+ {
+       void* p = av_malloc (s);
+       if (!p) {
+               throw bad_alloc ();
+       }
+       return p;
+ }
diff --cc src/lib/util.h
Simple merge
diff --cc src/lib/wscript
Simple merge
Simple merge
Simple merge
index a4a293918df44cedec1b4c5ddc0a4f3ab5587d07,e24583d6cfa478ea62a6aefa7740d2fa1c022db2..deee65a5fca4dc07f7d401f0234386d9937257cf
@@@ -127,9 -127,15 +128,16 @@@ FilmViewer::set_film (shared_ptr<Film> 
                return;
        }
  
-       _player = f->make_player ();
+       try {
+               _player = f->make_player ();
+       } catch (bad_alloc) {
+               error_dialog (this, _("There is not enough free memory to do that."));
+               _film.reset ();
+               return;
+       }
+       
        _player->disable_audio ();
 +      _player->set_approximate_size ();
        _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _5));
        _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
  
index 2119e781322f2cedae4e3083ffd20b7ead4ffda2,4e306c4998a526081e4629f79c03ba5d4fcaa63d..ac26c77a9125d7ab31c2a34620831d980b5d6bc4
@@@ -471,10 -471,10 +471,10 @@@ DCPTimeline::tracks () cons
  }
  
  void
 -Timeline::setup_pixels_per_time_unit ()
 +DCPTimeline::setup_pixels_per_time_unit ()
  {
        shared_ptr<const Film> film = _film.lock ();
-       if (!film) {
+       if (!film || film->length() == 0) {
                return;
        }
  
index 5bee3603b2e8c71df95ab07cf5681a9dd8478a25,9247159a7065b1a46ecf06d49f74f8cfdbab6695..3be251b3a75129c0daa83f8182ab19f7df51dc42
@@@ -33,10 -33,8 +33,9 @@@ resampler_test_one (int from, int to
        int total_out = 0;
  
        /* 3 hours */
-       int64_t const N = from * 60 * 60 * 3;
+       int64_t const N = int64_t (from) * 60 * 60 * 3;
 -      
++              
 +      /* XXX: no longer checks anything */
-       
        for (int64_t i = 0; i < N; i += 1000) {
                shared_ptr<AudioBuffers> a (new AudioBuffers (1, 1000));
                a->make_silent ();
diff --cc test/wscript
index 24daa7762001dc3d0ee764d58030cd4f6625a180,676f471049cfcf835e5da2bde766ef3ee053f687..ec8dfd42c7efb53780e591308f2dd5319ff3fbff
@@@ -10,9 -10,9 +10,9 @@@ def configure(conf)
                                """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework%s' % boost_test_suffix, uselib_store = 'BOOST_TEST')
  
  def build(bld):
 -    obj = bld(features = 'cxx cxxprogram')
 +    obj = bld(features='cxx cxxprogram')
      obj.name   = 'unit-tests'
-     obj.uselib = 'BOOST_TEST DCP OPENJPEG AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML'
+     obj.uselib = 'BOOST_TEST BOOST_THREAD DCP OPENJPEG AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML'
      obj.use    = 'libdcpomatic'
      obj.source = """
                   4k_test.cc
diff --cc wscript
index 6c97047fcdf763ef7fceb72e424928d692801159,50d89f43443e321c289bfdd754347c837364a71e..86cddf7f2a39ff4d355d9ea8ebbe721566b12d78
+++ b/wscript
@@@ -202,13 -272,30 +272,32 @@@ def configure(conf)
                                  libpath='/usr/local/lib',
                                  lib=['boost_locale%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
                                  uselib_store='BOOST_LOCALE')
+         dynamic_quickmail(conf)
+         dynamic_boost(conf, boost_lib_suffix, boost_thread)
+         dynamic_ffmpeg(conf)
+         dynamic_openjpeg(conf)
+         dynamic_dcp(conf)
+         dynamic_ssh(conf)
  
-     conf.check_cxx(fragment="""
-                           #include <boost/signals2.hpp>\n
-                           int main() { boost::signals2::signal<void (int)> x; }\n
-                           """,
-                             msg='Checking for boost signals2 library',
-                             uselib_store='BOOST_SIGNALS2')
+     # Not packaging; just a straight build
+     if not conf.env.TARGET_WINDOWS and not conf.env.TARGET_DEBIAN and not conf.env.TARGET_CENTOS:
+         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs', uselib_store='CXML', mandatory=True)
+         conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XML++', mandatory=True)
+         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
+         dynamic_quickmail(conf)
+         dynamic_boost(conf, boost_lib_suffix, boost_thread)
+         dynamic_ffmpeg(conf)
+         dynamic_dcp(conf)
+         dynamic_openjpeg(conf)
+         dynamic_ssh(conf)
+     # Dependencies which are always dynamically linked
+     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= '', path=conf.options.magickpp_config, args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
+     conf.check_cfg(package='libzip', args='--cflags --libs', uselib_store='ZIP', mandatory=True)
++    conf.check_cfg(package='pangomm-1.4', args='--cflags --libs', uselib_store='PANGOMM', mandatory=True)
++    conf.check_cfg(package='cairomm-1.0', args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)
  
      conf.check_cc(fragment="""
                             #include <glib.h>