#include <iostream>
#include <iomanip>
#include "transcode_job.h"
-#include "j2k_wav_encoder.h"
#include "film.h"
#include "format.h"
#include "transcoder.h"
#include "log.h"
-#include "encoder_factory.h"
+#include "encoder.h"
using std::string;
using std::stringstream;
/** @param s Film to use.
* @param o Options.
+ * @param req Job that must be completed before this job is run.
*/
-TranscodeJob::TranscodeJob (shared_ptr<Film> f, shared_ptr<const Options> o, shared_ptr<Job> req)
+TranscodeJob::TranscodeJob (shared_ptr<Film> f, shared_ptr<const DecodeOptions> od, shared_ptr<const EncodeOptions> oe, shared_ptr<Job> req)
: Job (f, req)
- , _opt (o)
+ , _decode_opt (od)
+ , _encode_opt (oe)
{
}
_film->log()->log ("Transcode job starting");
_film->log()->log (String::compose ("Audio delay is %1ms", _film->audio_delay()));
- _encoder = encoder_factory (_film, _opt);
- Transcoder w (_film, _opt, this, _encoder);
+ _encoder.reset (new Encoder (_film, _encode_opt));
+ Transcoder w (_film, _decode_opt, this, _encoder);
w.go ();
set_progress (1);
set_state (FINISHED_OK);
return 0;
}
- /* We assume that dcp_length() is valid */
+ if (!_film->dcp_length()) {
+ return 0;
+ }
+
+ /* We assume that dcp_length() is valid, if it is set */
SourceFrame const left = _film->dcp_trim_start() + _film->dcp_length().get() - _encoder->video_frame();
return left / fps;
}