diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-01-12 21:09:23 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-01-12 21:09:23 +0000 |
| commit | 61153e191b98a68e0ca6466ed260a632a584b619 (patch) | |
| tree | 9e43533f1a2849529d7f230ac38f356bf46e3b4f /src/lib/make_dcp_job.cc | |
| parent | ae118502865c95f15317716aef8d26641b9e9c3f (diff) | |
Untested support for splitting into multiple reels. Use J2K bandwidth and colour LUT in the J2K path.
Diffstat (limited to 'src/lib/make_dcp_job.cc')
| -rw-r--r-- | src/lib/make_dcp_job.cc | 88 |
1 files changed, 60 insertions, 28 deletions
diff --git a/src/lib/make_dcp_job.cc b/src/lib/make_dcp_job.cc index 5272d6bad..34b3e5124 100644 --- a/src/lib/make_dcp_job.cc +++ b/src/lib/make_dcp_job.cc @@ -37,6 +37,7 @@ extern "C" { #include "film.h" using std::string; +using std::cout; using boost::shared_ptr; /** @param f Film we are making the DCP for. @@ -57,9 +58,9 @@ MakeDCPJob::name () const /** @param f DCP frame index */ string -MakeDCPJob::j2c_path (int f) const +MakeDCPJob::j2c_path (int f, int offset) const { - SourceFrame const s = (f * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start(); + SourceFrame const s = ((f + offset) * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start(); return _opt->frame_out_path (s, false); } @@ -75,6 +76,8 @@ MakeDCPJob::run () if (!_film->dcp_length()) { throw EncodeError ("cannot make a DCP when the source length is not known"); } + + descend (0.9); string const dcp_path = _film->dir (_film->dcp_name()); @@ -103,45 +106,74 @@ 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 - ) - ); - - 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 ) ); + + 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()) + ) + ); + 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 (); } + ascend (); + descend (0.1); - cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ()))); dcp.write_xml (); ascend (); - + set_progress (1); set_state (FINISHED_OK); } |
