#include "options.h"
#include "imagemagick_decoder.h"
#include "film.h"
-#include "format.h"
using std::string;
using std::cout;
/** @param f Film we are making the DCP for.
* @param o Options.
*/
-MakeDCPJob::MakeDCPJob (shared_ptr<Film> f, shared_ptr<Job> req)
+MakeDCPJob::MakeDCPJob (shared_ptr<Film> f, shared_ptr<const EncodeOptions> o, shared_ptr<Job> req)
: Job (f, req)
+ , _opt (o)
{
}
string
MakeDCPJob::j2c_path (int f, int offset) const
{
- return _film->frame_out_path (f + offset, false);
+ SourceFrame const s = ((f + offset) * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start();
+ return _opt->frame_out_path (s, false);
}
string
MakeDCPJob::wav_path (libdcp::Channel c) const
{
- return _film->multichannel_audio_out_path (int (c), false);
+ return _opt->multichannel_audio_out_path (int (c), false);
}
void
MakeDCPJob::run ()
{
- if (!_film->dcp_intrinsic_duration()) {
- throw EncodeError ("cannot make a DCP when its intrinsic duration is not known");
+ if (!_film->dcp_length()) {
+ throw EncodeError ("cannot make a DCP when the source length is not known");
}
descend (0.9);
/* Remove any old DCP */
boost::filesystem::remove_all (dcp_path);
- int const frames = _film->dcp_intrinsic_duration().get();
- int const duration = frames - _film->trim_start() - _film->trim_end();
- DCPFrameRate const dfr (_film->frames_per_second ());
+ DCPFrameRate const dfr = dcp_frame_rate (_film->frames_per_second ());
+
+ int frames = 0;
+ switch (_film->content_type ()) {
+ case VIDEO:
+ /* Source frames -> DCP frames */
+ frames = _film->dcp_length().get() / dfr.skip;
+ break;
+ case STILL:
+ frames = _film->still_duration() * 24;
+ break;
+ }
libdcp::DCP dcp (_film->dir (_film->dcp_name()));
dcp.Progress.connect (boost::bind (&MakeDCPJob::dcp_progress, this, _1));
&dcp.Progress,
dfr.frames_per_second,
this_time,
- _film->format()->dcp_size()
+ _opt->out_size.width,
+ _opt->out_size.height,
+ _film->encrypted()
)
);
-
- pa->set_entry_point (_film->trim_start ());
- pa->set_duration (duration);
ascend ();
dfr.frames_per_second,
this_time,
frames_done,
- dcp_audio_channels (_film->audio_channels())
+ dcp_audio_channels (_film->audio_channels()),
+ _film->encrypted()
)
);
-
- sa->set_entry_point (_film->trim_start ());
- sa->set_duration (duration);
-
ascend ();
}