#include "audio_decoder.h"
#include "sndfile_decoder.h"
#include "analyse_audio_job.h"
+#include "cross.h"
#include "i18n.h"
Film::Film (string d, bool must_exist)
: _use_dci_name (true)
, _trust_content_header (true)
- , _dcp_content_type (0)
- , _format (0)
+ , _dcp_content_type (Config::instance()->default_dcp_content_type ())
+ , _format (Config::instance()->default_format ())
, _scaler (Scaler::from_id ("bicubic"))
, _trim_start (0)
, _trim_end (0)
+ , _trim_type (CPL)
, _dcp_ab (false)
, _use_content_audio (true)
, _audio_gain (0)
if (must_exist) {
read_metadata ();
+ } else {
+ write_metadata ();
}
_log.reset (new FileLog (file ("log")));
, _scaler (o._scaler)
, _trim_start (o._trim_start)
, _trim_end (o._trim_end)
+ , _trim_type (o._trim_type)
, _dcp_ab (o._dcp_ab)
, _content_audio_stream (o._content_audio_stream)
, _external_audio (o._external_audio)
Film::video_state_identifier () const
{
assert (format ());
+ LocaleGuard lg;
pair<string, string> f = Filter::ffmpeg_strings (filters());
<< "_" << j2k_bandwidth()
<< "_" << boost::lexical_cast<int> (colour_lut());
+ if (trim_type() == ENCODE) {
+ s << "_" << trim_start() << "_" << trim_end();
+ }
+
if (dcp_ab()) {
pair<string, string> fa = Filter::ffmpeg_strings (Config::instance()->reference_filters());
s << "ab_" << Config::instance()->reference_scaler()->id() << "_" << fa.first << "_" << fa.second;
Film::write_metadata () const
{
boost::mutex::scoped_lock lm (_state_mutex);
+ LocaleGuard lg;
boost::filesystem::create_directories (directory());
f << "scaler " << _scaler->id () << endl;
f << "trim_start " << _trim_start << endl;
f << "trim_end " << _trim_end << endl;
+ switch (_trim_type) {
+ case CPL:
+ f << "trim_type cpl\n";
+ break;
+ case ENCODE:
+ f << "trim_type encode\n";
+ break;
+ }
f << "dcp_ab " << (_dcp_ab ? "1" : "0") << endl;
if (_content_audio_stream) {
f << "selected_content_audio_stream " << _content_audio_stream->to_string() << endl;
Film::read_metadata ()
{
boost::mutex::scoped_lock lm (_state_mutex);
+ LocaleGuard lg;
_external_audio.clear ();
_content_audio_streams.clear ();
_trim_start = atoi (v.c_str ());
} else if ( ((!version || version < 2) && k == "dcp_trim_end") || k == "trim_end") {
_trim_end = atoi (v.c_str ());
+ } else if (k == "trim_type") {
+ if (v == "cpl") {
+ _trim_type = CPL;
+ } else if (v == "encode") {
+ _trim_type = ENCODE;
+ }
} else if (k == "dcp_ab") {
_dcp_ab = (v == "1");
} else if (k == "selected_content_audio_stream" || (!version && k == "selected_audio_stream")) {
}
/* Default format */
- switch (content_type()) {
- case STILL:
- set_format (Format::from_id ("var-185"));
- break;
- case VIDEO:
- set_format (Format::from_id ("185"));
- break;
- }
+ set_format (Config::instance()->default_format ());
/* Still image DCPs must use external audio */
if (content_type() == STILL) {
signal_changed (TRIM_END);
}
+void
+Film::set_trim_type (TrimType t)
+{
+ {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ _trim_type = t;
+ }
+ signal_changed (TRIM_TYPE);
+}
+
void
Film::set_dcp_ab (bool a)
{