X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmake_dcp_job.cc;h=b0b8a2a1af0d5a959d1c74f26a53dbc79a273605;hb=21e682c5eb1e0957e8fdae155028be65532ed96e;hp=998d1f9c350dc8c91c375ebd452797c4f0bb1b6f;hpb=c7c8c894df8c2bb98aeed84011dd28da94afa392;p=dcpomatic.git diff --git a/src/lib/make_dcp_job.cc b/src/lib/make_dcp_job.cc index 998d1f9c3..b0b8a2a1a 100644 --- a/src/lib/make_dcp_job.cc +++ b/src/lib/make_dcp_job.cc @@ -22,6 +22,7 @@ */ #include +#include extern "C" { #include } @@ -29,6 +30,7 @@ extern "C" { #include "film_state.h" #include "dcp_content_type.h" #include "exceptions.h" +#include "options.h" using namespace std; using namespace boost; @@ -54,45 +56,43 @@ MakeDCPJob::name () const void MakeDCPJob::run () { - set_progress_unknown (); - string const dcp_path = _fs->dir (_fs->name); - - /* Check that we have our prerequisites */ - - if (!filesystem::exists (filesystem::path (_fs->file ("video.mxf")))) { - throw EncodeError ("missing video.mxf"); - } - - bool const have_audio = filesystem::exists (filesystem::path (_fs->file ("audio.mxf"))); /* Remove any old DCP */ filesystem::remove_all (dcp_path); - DCP dcp (_fs->dir (_fs->name())); - dcp.add_asset ( - shared_ptr (new MainPictureAsset ("video.mxf", rint (_fs->frames_per_second), _fs->length, _opt->out_size)) - ); + libdcp::DCP dcp (_fs->dir (_fs->name), _fs->name, _fs->dcp_content_type->libdcp_type (), rint (_fs->frames_per_second), _fs->length); + dcp.Progress.connect (sigc::mem_fun (*this, &MakeDCPJob::dcp_progress)); - if (filesystem::exists (filesystem::path (_fs->file ("audio.mxf")))) { - dcp.add_asset ( - shared_ptr (new MainSoundAsset ("audio.mxf", rint (_fs->frames_per_second), _fs->length)) - ); + list j2cs; + int f = _fs->dcp_frames ? _fs->dcp_frames : _fs->length; + for (int i = 0; i < f; ++i) { + j2cs.push_back (_opt->frame_out_path (i, false)); } - - dcp.write_xml (); - - add_pkl (); - add_cpl (pkl[0]); + descend (0.9); + dcp.add_picture_asset (j2cs, _opt->out_size.width, _opt->out_size.height); + ascend (); - add_reel (pkl[0].cpl[0]); + list wavs; + for (int i = 0; i < _fs->audio_channels; ++i) { + wavs.push_back (_opt->multichannel_audio_out_path (i, false)); + } - write_cpl (); - write_pkl (); - write_volindex (); - write_assetmap (); + if (!wavs.empty ()) { + descend (0.1); + dcp.add_sound_asset (wavs); + ascend (); + } + dcp.write_xml (); set_progress (1); + set_state (FINISHED_OK); +} + +void +MakeDCPJob::dcp_progress (float p) +{ + set_progress (p); }