+
+static void
+convert_dcp (boost::filesystem::path input, boost::filesystem::path output_file, optional<boost::filesystem::path> kdm, int crf)
+{
+ shared_ptr<Film> film (new Film(boost::optional<boost::filesystem::path>()));
+ shared_ptr<DCPContent> dcp (new DCPContent(input));
+ film->examine_and_add_content (dcp);
+
+ JobManager* jm = JobManager::instance ();
+ while (jm->work_to_do ()) {
+ while (signal_manager->ui_idle ()) {}
+ dcpomatic_sleep (1);
+ }
+ DCPOMATIC_ASSERT (!jm->errors());
+
+ string id = dcp::make_uuid ();
+ dcp::Key key (AES_CTR_KEY_SIZE);
+
+ shared_ptr<TranscodeJob> job (new TranscodeJob(film));
+ job->set_encoder (
+ shared_ptr<FFmpegEncoder>(
+ new FFmpegEncoder(film, job, output_file, EXPORT_FORMAT_H264, false, false, crf, key, id)
+ )
+ );
+ jm->add (job);
+ show_jobs_on_console (true);
+
+ write_kdm (id, output_file.filename().string(), key, kdm);
+}