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);
}
/* 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;
}
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 ();
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;
+ }
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));
}
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;
}
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 ();
""", 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
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>