*/
/** @file src/film.cc
- * @brief A representation of some audio and video content, and details of
+ * @brief A representation of some audio, video and subtitle content, and details of
* how they should be presented in a DCP.
*/
#include "job.h"
#include "util.h"
#include "job_manager.h"
+#include "dcp_encoder.h"
#include "transcode_job.h"
#include "upload_job.h"
#include "null_log.h"
#define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
#define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
+string const Film::metadata_file = "metadata.xml";
+
/* 5 -> 6
* AudioMapping XML changed.
* 6 -> 7
if (Config::instance()->only_servers_encode ()) {
LOG_GENERAL_NC ("0 threads: ONLY SERVERS SET TO ENCODE");
} else {
- LOG_GENERAL ("%1 threads", Config::instance()->num_local_encoding_threads());
+ LOG_GENERAL ("%1 threads", Config::instance()->master_encoding_threads());
}
LOG_GENERAL ("J2K bandwidth %1", j2k_bandwidth());
- JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this())));
+ shared_ptr<TranscodeJob> tj (new TranscodeJob (shared_from_this()));
+ tj->set_encoder (shared_ptr<Encoder> (new DCPEncoder (shared_from_this(), tj)));
+ JobManager::instance()->add (tj);
}
/** Start a job to send our DCP to the configured TMS */
DCPOMATIC_ASSERT (directory());
boost::filesystem::create_directories (directory().get());
shared_ptr<xmlpp::Document> doc = metadata ();
- doc->write_to_file_formatted (file("metadata.xml").string ());
+ doc->write_to_file_formatted (file(metadata_file).string ());
_dirty = false;
}
Film::read_metadata (optional<boost::filesystem::path> path)
{
if (!path) {
- if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file ("metadata.xml"))) {
+ if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file (metadata_file))) {
throw runtime_error (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version. You will need to create a new Film, re-add your content and set it up again. Sorry!"));
}
- path = file ("metadata.xml");
+ path = file (metadata_file);
}
cxml::Document f ("Metadata");
/* Count mapped audio channels */
- int non_lfe = 0;
- int lfe = 0;
-
- BOOST_FOREACH (int i, mapped_audio_channels ()) {
- if (i >= audio_channels()) {
- /* This channel is mapped but is not included in the DCP */
- continue;
- }
-
- if (static_cast<dcp::Channel> (i) == dcp::LFE) {
- ++lfe;
- } else {
- ++non_lfe;
- }
- }
-
- if (non_lfe) {
- d += String::compose("_%1%2", non_lfe, lfe);
+ pair<int, int> ch = audio_channel_types (mapped_audio_channels(), audio_channels());
+ if (ch.first) {
+ d += String::compose("_%1%2", ch.first, ch.second);
}
/* XXX: HI/VI */
return fit_ratio_within (container()->ratio(), full_frame ());
}
-/** @param from KDM from time expressed as a local time with an offset from UTC
- * @param to KDM to time expressed as a local time with an offset from UTC
+/** @param recipient KDM recipient certificate.
+ * @param trusted_devices Certificates of other trusted devices (can be empty).
+ * @param cpl_file CPL filename.
+ * @param from KDM from time expressed as a local time with an offset from UTC.
+ * @param until KDM to time expressed as a local time with an offset from UTC.
+ * @param formulation KDM formulation to use.
*/
dcp::EncryptedKDM
Film::make_kdm (
).encrypt (signer, recipient, trusted_devices, formulation);
}
-/** @param from KDM from time expressed as a local time in the time zone of the Screen's Cinema.
- * @param to KDM to time expressed as a local time in the time zone of the Screen's Cinema.
+/** @param screens Screens to make KDMs for.
+ * @param cpl_file Path to CPL to make KDMs for.
+ * @param from KDM from time expressed as a local time in the time zone of the Screen's Cinema.
+ * @param until KDM to time expressed as a local time in the time zone of the Screen's Cinema.
+ * @param formulation KDM formulation to use.
*/
list<ScreenKDM>
Film::make_kdms (
list<shared_ptr<Screen> > screens,
- boost::filesystem::path dcp,
+ boost::filesystem::path cpl_file,
boost::posix_time::ptime from,
boost::posix_time::ptime until,
dcp::Formulation formulation
dcp::EncryptedKDM const kdm = make_kdm (
i->recipient.get(),
i->trusted_devices,
- dcp,
+ cpl_file,
dcp::LocalTime (from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
dcp::LocalTime (until, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
formulation
return p;
}
+/** @param period A period within the DCP
+ * @return Name of the content which most contributes to the given period.
+ */
string
Film::content_summary (DCPTimePeriod period) const
{
_reel_length = _template_film->_reel_length;
_upload_after_make_dcp = _template_film->_upload_after_make_dcp;
}
+
+pair<double, double>
+Film::speed_up_range (int dcp_frame_rate) const
+{
+ return _playlist->speed_up_range (dcp_frame_rate);
+}
+
+void
+Film::copy_from (shared_ptr<const Film> film)
+{
+ read_metadata (film->file (metadata_file));
+}