diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-01-14 20:33:50 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-01-14 20:33:50 +0000 |
| commit | 3031638f0ddf23654b72af2088a7616791307310 (patch) | |
| tree | 4d0bbdaf3e2a5317c8e5d36a08241e5ba2b63f09 /src | |
| parent | fad726e94700bccdae0d301d54cdb1eab51cc71f (diff) | |
| parent | b9ee74b24dad91e3fee9ead44ea9a52328b20f25 (diff) | |
Merge master.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/config.cc | 8 | ||||
| -rw-r--r-- | src/lib/config.h | 29 | ||||
| -rw-r--r-- | src/lib/dcp_video_frame.cc | 30 | ||||
| -rw-r--r-- | src/lib/dcp_video_frame.h | 4 | ||||
| -rw-r--r-- | src/lib/encoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/examine_content_job.h | 4 | ||||
| -rw-r--r-- | src/lib/film.cc | 94 | ||||
| -rw-r--r-- | src/lib/film.h | 45 | ||||
| -rw-r--r-- | src/lib/filter_graph.cc | 2 | ||||
| -rw-r--r-- | src/lib/make_dcp_job.cc | 91 | ||||
| -rw-r--r-- | src/lib/make_dcp_job.h | 2 | ||||
| -rw-r--r-- | src/lib/util.cc | 26 | ||||
| -rw-r--r-- | src/lib/util.h | 1 | ||||
| -rw-r--r-- | src/tools/makedcp.cc | 13 | ||||
| -rw-r--r-- | src/wx/config_dialog.cc | 32 | ||||
| -rw-r--r-- | src/wx/config_dialog.h | 4 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 110 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 9 | ||||
| -rw-r--r-- | src/wx/properties_dialog.cc | 2 |
19 files changed, 353 insertions, 155 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index fe50a5cc2..848e466a6 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -42,8 +42,6 @@ Config* Config::_instance = 0; Config::Config () : _num_local_encoding_threads (2) , _server_port (6192) - , _colour_lut_index (0) - , _j2k_bandwidth (250000000) , _reference_scaler (Scaler::from_id ("bicubic")) , _tms_path (".") , _sound_processor (SoundProcessor::from_id ("dolby_cp750")) @@ -76,10 +74,6 @@ Config::Config () _default_directory = v; } else if (k == "server_port") { _server_port = atoi (v.c_str ()); - } else if (k == "colour_lut_index") { - _colour_lut_index = atoi (v.c_str ()); - } else if (k == "j2k_bandwidth") { - _j2k_bandwidth = atoi (v.c_str ()); } else if (k == "reference_scaler") { _reference_scaler = Scaler::from_id (v); } else if (k == "reference_filter") { @@ -170,8 +164,6 @@ Config::write () const f << "num_local_encoding_threads " << _num_local_encoding_threads << "\n" << "default_directory " << _default_directory << "\n" << "server_port " << _server_port << "\n" - << "colour_lut_index " << _colour_lut_index << "\n" - << "j2k_bandwidth " << _j2k_bandwidth << "\n" << "reference_scaler " << _reference_scaler->id () << "\n"; for (vector<Filter const *>::const_iterator i = _reference_filters.begin(); i != _reference_filters.end(); ++i) { diff --git a/src/lib/config.h b/src/lib/config.h index 785fff137..ee4e4eaec 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -57,19 +57,6 @@ public: return _server_port; } - /** @return index of colour LUT to use when converting RGB to XYZ. - * 0: sRGB - * 1: Rec 709 - */ - int colour_lut_index () const { - return _colour_lut_index; - } - - /** @return bandwidth for J2K files in bits per second */ - int j2k_bandwidth () const { - return _j2k_bandwidth; - } - /** @return J2K encoding servers to use */ std::vector<ServerDescription*> servers () const { return _servers; @@ -126,16 +113,6 @@ public: _server_port = p; } - /** @param i New colour LUT index */ - void set_colour_lut_index (int i) { - _colour_lut_index = i; - } - - /** @param b New J2K bandwidth */ - void set_j2k_bandwidth (int b) { - _j2k_bandwidth = b; - } - /** @param s New list of servers */ void set_servers (std::vector<ServerDescription*> s) { _servers = s; @@ -194,12 +171,6 @@ private: std::string _default_directory; /** port to use for J2K encoding servers */ int _server_port; - /** index of colour LUT to use when converting RGB to XYZ - * (see colour_lut_index ()) - */ - int _colour_lut_index; - /** bandwidth for J2K files in bits per second */ - int _j2k_bandwidth; /** J2K encoding servers to use */ std::vector<ServerDescription *> _servers; diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc index 8b70b0aa4..c6b29ba41 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video_frame.cc @@ -88,7 +88,7 @@ DCPVideoFrame::DCPVideoFrame ( , _frame (f) , _frames_per_second (dcp_frame_rate(fps).frames_per_second) , _post_process (pp) - , _colour_lut_index (clut) + , _colour_lut (clut) , _j2k_bandwidth (bw) , _log (l) , _image (0) @@ -188,22 +188,22 @@ DCPVideoFrame::encode_locally () for (int x = 0; x < _out_size.width; ++x) { /* In gamma LUT (converting 8-bit input to 12-bit) */ - s.r = lut_in[_colour_lut_index][*p++ << 4]; - s.g = lut_in[_colour_lut_index][*p++ << 4]; - s.b = lut_in[_colour_lut_index][*p++ << 4]; + s.r = lut_in[_colour_lut][*p++ << 4]; + s.g = lut_in[_colour_lut][*p++ << 4]; + s.b = lut_in[_colour_lut][*p++ << 4]; /* RGB to XYZ Matrix */ - d.x = ((s.r * color_matrix[_colour_lut_index][0][0]) + - (s.g * color_matrix[_colour_lut_index][0][1]) + - (s.b * color_matrix[_colour_lut_index][0][2])); + d.x = ((s.r * color_matrix[_colour_lut][0][0]) + + (s.g * color_matrix[_colour_lut][0][1]) + + (s.b * color_matrix[_colour_lut][0][2])); - d.y = ((s.r * color_matrix[_colour_lut_index][1][0]) + - (s.g * color_matrix[_colour_lut_index][1][1]) + - (s.b * color_matrix[_colour_lut_index][1][2])); + d.y = ((s.r * color_matrix[_colour_lut][1][0]) + + (s.g * color_matrix[_colour_lut][1][1]) + + (s.b * color_matrix[_colour_lut][1][2])); - d.z = ((s.r * color_matrix[_colour_lut_index][2][0]) + - (s.g * color_matrix[_colour_lut_index][2][1]) + - (s.b * color_matrix[_colour_lut_index][2][2])); + d.z = ((s.r * color_matrix[_colour_lut][2][0]) + + (s.g * color_matrix[_colour_lut][2][1]) + + (s.b * color_matrix[_colour_lut][2][2])); /* DCI companding */ d.x = d.x * DCI_COEFFICENT * (DCI_LUT_SIZE - 1); @@ -334,8 +334,8 @@ DCPVideoFrame::encode_remotely (ServerDescription const * serv) s << "post_process " << _post_process << "\n"; } - s << "colour_lut " << Config::instance()->colour_lut_index () << "\n" - << "j2k_bandwidth " << Config::instance()->j2k_bandwidth () << "\n"; + s << "colour_lut " << _colour_lut << "\n" + << "j2k_bandwidth " << _j2k_bandwidth << "\n"; if (_subtitle) { s << "subtitle_x " << _subtitle->position().x << "\n" diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h index 57e7e6203..134720da8 100644 --- a/src/lib/dcp_video_frame.h +++ b/src/lib/dcp_video_frame.h @@ -133,8 +133,8 @@ private: SourceFrame _frame; ///< frame index within the Film's source int _frames_per_second; ///< Frames per second that we will use for the DCP (rounded) std::string _post_process; ///< FFmpeg post-processing string to use - int _colour_lut_index; ///< Colour look-up table to use (see Config::colour_lut_index ()) - int _j2k_bandwidth; ///< J2K bandwidth to use (see Config::j2k_bandwidth ()) + int _colour_lut; ///< Colour look-up table to use + int _j2k_bandwidth; ///< J2K bandwidth to use Log* _log; ///< log diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 693bd5bc8..efedfcfef 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -325,7 +325,7 @@ Encoder::process_video (shared_ptr<Image> image, bool same, boost::shared_ptr<Su new DCPVideoFrame ( image, sub, _opt->out_size, _opt->padding, _film->subtitle_offset(), _film->subtitle_scale(), _film->scaler(), _video_frame, _film->frames_per_second(), s.second, - Config::instance()->colour_lut_index (), Config::instance()->j2k_bandwidth (), + _film->colour_lut(), _film->j2k_bandwidth(), _film->log() ) )); diff --git a/src/lib/examine_content_job.h b/src/lib/examine_content_job.h index 2004aca83..729c287b5 100644 --- a/src/lib/examine_content_job.h +++ b/src/lib/examine_content_job.h @@ -18,13 +18,13 @@ */ /** @file src/examine_content_job.h - * @brief A class to run through content at high speed to find its length. + * @brief A class to obtain the length and MD5 digest of a content file. */ #include "job.h" /** @class ExamineContentJob - * @brief A class to run through content at high speed to find its length. + * @brief A class to obtain the length and MD5 digest of a content file. */ class ExamineContentJob : public Job { diff --git a/src/lib/film.cc b/src/lib/film.cc index 48677ba61..fb3423bb4 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -105,6 +105,8 @@ Film::Film (string d, bool must_exist) , _subtitle_offset (0) , _subtitle_scale (1) , _encrypted (false) + , _colour_lut (0) + , _j2k_bandwidth (200000000) , _frames_per_second (0) , _dirty (false) { @@ -161,6 +163,7 @@ Film::Film (Film const & o) , _scaler (o._scaler) , _dcp_trim_start (o._dcp_trim_start) , _dcp_trim_end (o._dcp_trim_end) + , _reel_size (o._reel_size) , _dcp_ab (o._dcp_ab) , _content_audio_stream (o._content_audio_stream) , _external_audio (o._external_audio) @@ -173,6 +176,8 @@ Film::Film (Film const & o) , _subtitle_offset (o._subtitle_offset) , _subtitle_scale (o._subtitle_scale) , _encrypted (o._encrypted) + , _colour_lut (o._colour_lut) + , _j2k_bandwidth (o._j2k_bandwidth) , _audio_language (o._audio_language) , _subtitle_language (o._subtitle_language) , _territory (o._territory) @@ -219,7 +224,9 @@ Film::j2k_dir () const << "_" << content_digest() << "_" << crop().left << "_" << crop().right << "_" << crop().top << "_" << crop().bottom << "_" << f.first << "_" << f.second - << "_" << scaler()->id(); + << "_" << scaler()->id() + << "_" << j2k_bandwidth() + << "_" << boost::lexical_cast<int> (colour_lut()); p /= s.str (); @@ -252,10 +259,26 @@ Film::make_dcp (bool transcode) char buffer[128]; gethostname (buffer, sizeof (buffer)); log()->log (String::compose ("Starting to make DCP on %1", buffer)); - log()->log (String::compose ("Content is %1; type %2", content_path(), (content_type() == STILL ? "still" : "video"))); - log()->log (String::compose ("Content length %1", length())); } - + + log()->log (String::compose ("Content is %1; type %2", content_path(), (content_type() == STILL ? "still" : "video"))); + log()->log (String::compose ("Content length %1", length().get())); + log()->log (String::compose ("Content digest %1", content_digest())); + log()->log (String::compose ("%1 threads", Config::instance()->num_local_encoding_threads())); + log()->log (String::compose ("J2K bandwidth %1", j2k_bandwidth())); +#ifdef DVDOMATIC_DEBUG + log()->log ("DVD-o-matic built in debug mode."); +#else + log()->log ("DVD-o-matic built in optimised mode."); +#endif +#ifdef LIBDCP_DEBUG + log()->log ("libdcp built in debug mode."); +#else + log()->log ("libdcp built in optimised mode."); +#endif + pair<string, int> const c = cpu_info (); + log()->log (String::compose ("CPU: %1, %2 processors", c.first, c.second)); + if (format() == 0) { throw MissingSettingError ("format"); } @@ -334,18 +357,6 @@ Film::examine_content_finished () _examine_content_job.reset (); } -/** @return full paths to any audio files that this Film has */ -vector<string> -Film::audio_files () const -{ - vector<string> f; - for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dir("wavs")); i != boost::filesystem::directory_iterator(); ++i) { - f.push_back (i->path().string ()); - } - - return f; -} - /** Start a job to send our DCP to the configured TMS */ void Film::send_dcp_to_tms () @@ -410,6 +421,9 @@ Film::write_metadata () const f << "scaler " << _scaler->id () << "\n"; f << "dcp_trim_start " << _dcp_trim_start << "\n"; f << "dcp_trim_end " << _dcp_trim_end << "\n"; + if (_reel_size) { + f << "reel_size " << _reel_size.get() << "\n"; + } f << "dcp_ab " << (_dcp_ab ? "1" : "0") << "\n"; if (_content_audio_stream) { f << "selected_content_audio_stream " << _content_audio_stream->to_string() << "\n"; @@ -428,6 +442,8 @@ Film::write_metadata () const f << "subtitle_offset " << _subtitle_offset << "\n"; f << "subtitle_scale " << _subtitle_scale << "\n"; f << "encrypted " << _encrypted << "\n"; + f << "colour_lut " << _colour_lut << "\n"; + f << "j2k_bandwidth " << _j2k_bandwidth << "\n"; f << "audio_language " << _audio_language << "\n"; f << "subtitle_language " << _subtitle_language << "\n"; f << "territory " << _territory << "\n"; @@ -523,6 +539,8 @@ Film::read_metadata () _dcp_trim_start = atoi (v.c_str ()); } else if (k == "dcp_trim_end") { _dcp_trim_end = atoi (v.c_str ()); + } else if (k == "reel_size") { + _reel_size = boost::lexical_cast<uint64_t> (v); } else if (k == "dcp_ab") { _dcp_ab = (v == "1"); } else if (k == "selected_content_audio_stream" || (!version && k == "selected_audio_stream")) { @@ -555,6 +573,10 @@ Film::read_metadata () _subtitle_scale = atof (v.c_str ()); } else if (k == "encrypted") { _encrypted = (v == "1"); + } else if (k == "colour_lut") { + _colour_lut = atoi (v.c_str ()); + } else if (k == "j2k_bandwidth") { + _j2k_bandwidth = atoi (v.c_str ()); } else if (k == "audio_language") { _audio_language = v; } else if (k == "subtitle_language") { @@ -1083,6 +1105,26 @@ Film::set_dcp_trim_end (int t) } void +Film::set_reel_size (uint64_t s) +{ + { + boost::mutex::scoped_lock lm (_state_mutex); + _reel_size = s; + } + signal_changed (REEL_SIZE); +} + +void +Film::unset_reel_size () +{ + { + boost::mutex::scoped_lock lm (_state_mutex); + _reel_size = boost::optional<uint64_t> (); + } + signal_changed (REEL_SIZE); +} + +void Film::set_dcp_ab (bool a) { { @@ -1211,6 +1253,26 @@ Film::set_encrypted (bool e) } void +Film::set_colour_lut (int i) +{ + { + boost::mutex::scoped_lock lm (_state_mutex); + _colour_lut = i; + } + signal_changed (COLOUR_LUT); +} + +void +Film::set_j2k_bandwidth (int b) +{ + { + boost::mutex::scoped_lock lm (_state_mutex); + _j2k_bandwidth = b; + } + signal_changed (J2K_BANDWIDTH); +} + +void Film::set_audio_language (string l) { { diff --git a/src/lib/film.h b/src/lib/film.h index b119d59a6..1a78e9d34 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -49,9 +49,9 @@ class ExternalAudioStream; class Screen; /** @class Film - * @brief A representation of a video with sound. + * @brief A representation of a video, maybe with sound. * - * A representation of a piece of video (with sound), including naming, + * A representation of a piece of video (maybe with sound), including naming, * the source content file, and how it should be presented in a DCP. */ class Film : public boost::enable_shared_from_this<Film> @@ -62,7 +62,6 @@ public: ~Film (); std::string j2k_dir () const; - std::vector<std::string> audio_files () const; void examine_content (); void send_dcp_to_tms (); @@ -94,6 +93,7 @@ public: std::string dci_name () const; std::string dcp_name () const; + /** @return true if our state has changed since we last saved it */ bool dirty () const { return _dirty; } @@ -109,6 +109,9 @@ public: std::string directory ) const; + /** Identifiers for the parts of our state; + used for signalling changes. + */ enum Property { NONE, NAME, @@ -122,6 +125,7 @@ public: SCALER, DCP_TRIM_START, DCP_TRIM_END, + REEL_SIZE, DCP_AB, CONTENT_AUDIO_STREAM, EXTERNAL_AUDIO, @@ -134,6 +138,8 @@ public: SUBTITLE_OFFSET, SUBTITLE_SCALE, ENCRYPTED, + COLOUR_LUT, + J2K_BANDWIDTH, DCI_METADATA, SIZE, LENGTH, @@ -204,6 +210,11 @@ public: boost::mutex::scoped_lock lm (_state_mutex); return _dcp_trim_end; } + + boost::optional<uint64_t> reel_size () const { + boost::mutex::scoped_lock lm (_state_mutex); + return _reel_size; + } bool dcp_ab () const { boost::mutex::scoped_lock lm (_state_mutex); @@ -265,6 +276,16 @@ public: return _encrypted; } + int colour_lut () const { + boost::mutex::scoped_lock lm (_state_mutex); + return _colour_lut; + } + + int j2k_bandwidth () const { + boost::mutex::scoped_lock lm (_state_mutex); + return _j2k_bandwidth; + } + std::string audio_language () const { boost::mutex::scoped_lock lm (_state_mutex); return _audio_language; @@ -355,6 +376,8 @@ public: void set_scaler (Scaler const *); void set_dcp_trim_start (int); void set_dcp_trim_end (int); + void set_reel_size (uint64_t); + void unset_reel_size (); void set_dcp_ab (bool); void set_content_audio_stream (boost::shared_ptr<AudioStream>); void set_external_audio (std::vector<std::string>); @@ -367,6 +390,8 @@ public: void set_subtitle_offset (int); void set_subtitle_scale (float); void set_encrypted (bool); + void set_colour_lut (int); + void set_j2k_bandwidth (int); void set_audio_language (std::string); void set_subtitle_language (std::string); void set_territory (std::string); @@ -417,6 +442,10 @@ private: * or an absolute path. */ std::string _content; + /** If this is true, we will believe the length specified by the content + * file's header; if false, we will run through the whole content file + * the first time we see it in order to obtain the length. + */ bool _trust_content_header; /** The type of content that this Film represents (feature, trailer etc.) */ DCPContentType const * _dcp_content_type; @@ -432,6 +461,8 @@ private: int _dcp_trim_start; /** Frames to trim off the end of the DCP */ int _dcp_trim_end; + /** Approximate target reel size in bytes; if not set, use a single reel */ + boost::optional<uint64_t> _reel_size; /** true to create an A/B comparison DCP, where the left half of the image is the video without any filters or post-processing, and the right half has the specified filters and post-processing. @@ -462,6 +493,14 @@ private: float _subtitle_scale; bool _encrypted; + /** index of colour LUT to use when converting RGB to XYZ. + * 0: sRGB + * 1: Rec 709 + */ + int _colour_lut; + /** bandwidth for J2K files in bits per second */ + int _j2k_bandwidth; + /* DCI naming stuff */ std::string _audio_language; std::string _subtitle_language; diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index 17107a05b..376ab404f 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -23,7 +23,9 @@ extern "C" { #include <libavfilter/avfiltergraph.h> +#ifdef HAVE_BUFFERSRC_H #include <libavfilter/buffersrc.h> +#endif #if (LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR >= 53 && LIBAVFILTER_VERSION_MINOR <= 77) || LIBAVFILTER_VERSION_MAJOR == 3 #include <libavfilter/avcodec.h> #include <libavfilter/buffersink.h> diff --git a/src/lib/make_dcp_job.cc b/src/lib/make_dcp_job.cc index e42018ad5..37c9ca620 100644 --- a/src/lib/make_dcp_job.cc +++ b/src/lib/make_dcp_job.cc @@ -21,6 +21,7 @@ * @brief A job to create DCPs. */ +#include <iostream> #include <boost/filesystem.hpp> #include <libdcp/dcp.h> #include <libdcp/picture_asset.h> @@ -37,6 +38,7 @@ extern "C" { #include "film.h" using std::string; +using std::cout; using boost::shared_ptr; /** @param f Film we are making the DCP for. @@ -57,9 +59,9 @@ MakeDCPJob::name () const /** @param f DCP frame index */ string -MakeDCPJob::j2c_path (int f) const +MakeDCPJob::j2c_path (int f, int offset) const { - SourceFrame const s = (f * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start(); + SourceFrame const s = ((f + offset) * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start(); return _opt->frame_out_path (s, false); } @@ -75,6 +77,8 @@ MakeDCPJob::run () if (!_film->dcp_length()) { throw EncodeError ("cannot make a DCP when the source length is not known"); } + + descend (0.9); string const dcp_path = _film->dir (_film->dcp_name()); @@ -103,47 +107,76 @@ MakeDCPJob::run () dcp.add_cpl (cpl); - descend (0.8); - shared_ptr<libdcp::MonoPictureAsset> pa ( - new libdcp::MonoPictureAsset ( - boost::bind (&MakeDCPJob::j2c_path, this, _1), - _film->dir (_film->dcp_name()), - "video.mxf", - &dcp.Progress, - dfr.frames_per_second, - frames, - _opt->out_size.width, - _opt->out_size.height, - _film->encrypted () - ) - ); - - ascend (); + int frames_per_reel = 0; + if (_film->reel_size()) { + frames_per_reel = (_film->reel_size().get() / (_film->j2k_bandwidth() / 8)) * dfr.frames_per_second; + } else { + frames_per_reel = frames; + } - shared_ptr<libdcp::SoundAsset> sa; + int frames_done = 0; + int reel = 0; - if (_film->audio_channels() > 0) { - descend (0.1); - sa.reset ( - new libdcp::SoundAsset ( - boost::bind (&MakeDCPJob::wav_path, this, _1), + while (frames_done < frames) { + + descend (float (frames_per_reel) / frames); + + int this_time = std::min (frames_per_reel, (frames - frames_done)); + + descend (0.8); + + shared_ptr<libdcp::MonoPictureAsset> pa ( + new libdcp::MonoPictureAsset ( + boost::bind (&MakeDCPJob::j2c_path, this, _1, frames_done), _film->dir (_film->dcp_name()), - "audio.mxf", + String::compose ("video_%1.mxf", reel), &dcp.Progress, dfr.frames_per_second, - frames, - dcp_audio_channels (_film->audio_channels()), + this_time, + _opt->out_size.width, + _opt->out_size.height, _film->encrypted() ) ); + + ascend (); + + shared_ptr<libdcp::SoundAsset> sa; + + if (_film->audio_channels() > 0) { + descend (0.1); + sa.reset ( + new libdcp::SoundAsset ( + boost::bind (&MakeDCPJob::wav_path, this, _1), + _film->dir (_film->dcp_name()), + String::compose ("audio_%1.mxf", reel), + &dcp.Progress, + dfr.frames_per_second, + this_time, + frames_done, + dcp_audio_channels (_film->audio_channels()), + _film->encrypted() + ) + ); + ascend (); + } + + descend (0.1); + cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ()))); + ascend (); + + frames_done += frames_per_reel; + ++reel; + ascend (); } + ascend (); + descend (0.1); - cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ()))); dcp.write_xml (); ascend (); - + set_progress (1); set_state (FINISHED_OK); } diff --git a/src/lib/make_dcp_job.h b/src/lib/make_dcp_job.h index 1aa906b0a..5e4f78a25 100644 --- a/src/lib/make_dcp_job.h +++ b/src/lib/make_dcp_job.h @@ -38,7 +38,7 @@ public: private: void dcp_progress (float); - std::string j2c_path (int) const; + std::string j2c_path (int, int) const; std::string wav_path (libdcp::Channel) const; boost::shared_ptr<const EncodeOptions> _opt; diff --git a/src/lib/util.cc b/src/lib/util.cc index 987c2b9e5..ef6f46575 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -878,3 +878,29 @@ still_image_file (string f) return (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png"); } + +/** @return A pair containing CPU model name and the number of processors */ +pair<string, int> +cpu_info () +{ + pair<string, int> info; + info.second = 0; + +#ifdef DVDOMATIC_POSIX + ifstream f ("/proc/cpuinfo"); + while (f.good ()) { + string l; + getline (f, l); + if (boost::algorithm::starts_with (l, "model name")) { + string::size_type const c = l.find (':'); + if (c != string::npos) { + info.first = l.substr (c + 2); + } + } else if (boost::algorithm::starts_with (l, "processor")) { + ++info.second; + } + } +#endif + + return info; +} diff --git a/src/lib/util.h b/src/lib/util.h index 0744d9c09..024c40fb5 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -280,6 +280,7 @@ private: extern int64_t video_frames_to_audio_frames (SourceFrame v, float audio_sample_rate, float frames_per_second); extern bool still_image_file (std::string); +extern std::pair<std::string, int> cpu_info (); #endif diff --git a/src/tools/makedcp.cc b/src/tools/makedcp.cc index c0fb7ccee..900c31bfc 100644 --- a/src/tools/makedcp.cc +++ b/src/tools/makedcp.cc @@ -51,7 +51,6 @@ help (string n) << " -v, --version show DVD-o-matic version\n" << " -h, --help show this help\n" << " -d, --deps list DVD-o-matic dependency details and quit\n" - << " -c, --config list configuration settings that affect output and quit\n" << " -t, --test run in test mode (repeatable UUID generation, timestamps etc.)\n" << " -n, --no-progress do not print progress to stdout\n" << " -r, --no-remote do not use any remote servers\n" @@ -74,7 +73,6 @@ main (int argc, char* argv[]) { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, { "deps", no_argument, 0, 'd'}, - { "config", no_argument, 0, 'c'}, { "test", no_argument, 0, 't'}, { "no-progress", no_argument, 0, 'n'}, { "no-remote", no_argument, 0, 'r'}, @@ -82,7 +80,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vhdctnrl:", long_options, &option_index); + int c = getopt_long (argc, argv, "vhdtnrl:", long_options, &option_index); if (c == -1) { break; @@ -107,15 +105,6 @@ main (int argc, char* argv[]) case 'r': no_remote = true; break; - case 'c': - cout << "Colour LUT " << colour_lut_index_to_name (Config::instance()->colour_lut_index()) << "; " - << "J2K bandwidth " << Config::instance()->j2k_bandwidth() << "; "; -#ifdef DVDOMATIC_DEBUG - cout << "built in debug mode\n"; -#else - cout << "built in optimised mode\n"; -#endif - exit (EXIT_SUCCESS); case 'l': log_level = atoi (optarg); break; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index adf039e41..9de8e7001 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -79,20 +79,6 @@ ConfigDialog::ConfigDialog (wxWindow* parent) table->Add (_default_directory, 1, wxEXPAND); table->AddSpacer (0); - add_label_to_sizer (table, this, "Colour look-up table"); - _colour_lut = new wxComboBox (this, wxID_ANY); - for (int i = 0; i < 2; ++i) { - _colour_lut->Append (std_to_wx (colour_lut_index_to_name (i))); - } - _colour_lut->SetSelection (0); - table->Add (_colour_lut, 1, wxEXPAND); - table->AddSpacer (0); - - add_label_to_sizer (table, this, "JPEG2000 bandwidth"); - _j2k_bandwidth = new wxSpinCtrl (this, wxID_ANY); - table->Add (_j2k_bandwidth, 1, wxEXPAND); - add_label_to_sizer (table, this, "MBps"); - add_label_to_sizer (table, this, "Reference scaler for A/B"); _reference_scaler = new wxComboBox (this, wxID_ANY); vector<Scaler const *> const sc = Scaler::all (); @@ -156,12 +142,6 @@ ConfigDialog::ConfigDialog (wxWindow* parent) _default_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())))); _default_directory->Connect (wxID_ANY, wxEVT_COMMAND_DIRPICKER_CHANGED, wxCommandEventHandler (ConfigDialog::default_directory_changed), 0, this); - _colour_lut->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (ConfigDialog::colour_lut_changed), 0, this); - - _j2k_bandwidth->SetRange (50, 250); - _j2k_bandwidth->SetValue (rint ((double) config->j2k_bandwidth() / 1e6)); - _j2k_bandwidth->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (ConfigDialog::j2k_bandwidth_changed), 0, this); - _reference_scaler->SetSelection (Scaler::as_index (config->reference_scaler ())); _reference_scaler->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (ConfigDialog::reference_scaler_changed), 0, this); @@ -233,18 +213,6 @@ ConfigDialog::default_directory_changed (wxCommandEvent &) } void -ConfigDialog::colour_lut_changed (wxCommandEvent &) -{ - Config::instance()->set_colour_lut_index (_colour_lut->GetSelection ()); -} - -void -ConfigDialog::j2k_bandwidth_changed (wxCommandEvent &) -{ - Config::instance()->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1e6); -} - -void ConfigDialog::add_server_to_control (ServerDescription* s) { wxListItem item; diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 615d36f83..32123a0d7 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -45,8 +45,6 @@ private: void tms_password_changed (wxCommandEvent &); void num_local_encoding_threads_changed (wxCommandEvent &); void default_directory_changed (wxCommandEvent &); - void colour_lut_changed (wxCommandEvent &); - void j2k_bandwidth_changed (wxCommandEvent &); void reference_scaler_changed (wxCommandEvent &); void edit_reference_filters_clicked (wxCommandEvent &); void reference_filters_changed (std::vector<Filter const *>); @@ -67,8 +65,6 @@ private: #else wxDirPickerCtrl* _default_directory; #endif - wxComboBox* _colour_lut; - wxSpinCtrl* _j2k_bandwidth; wxComboBox* _reference_scaler; wxStaticText* _reference_filters; wxButton* _reference_filters_button; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index ea6055c94..9326227a3 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -153,6 +153,17 @@ FilmEditor::make_film_panel () _film_sizer->Add (_encrypted, 1); _film_sizer->AddSpacer (0); + _multiple_reels = new wxCheckBox (_film_panel, wxID_ANY, wxT ("Make multiple reels")); + _film_sizer->Add (_multiple_reels); + + { + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _reel_size = new wxSpinCtrl (_film_panel, wxID_ANY); + s->Add (_reel_size); + add_label_to_sizer (s, _film_panel, "Gb each"); + _film_sizer->Add (s); + } + _dcp_ab = new wxCheckBox (_film_panel, wxID_ANY, wxT ("A/B")); video_control (_dcp_ab); _film_sizer->Add (_dcp_ab, 1); @@ -173,6 +184,8 @@ FilmEditor::make_film_panel () for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) { _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); } + + _reel_size->SetRange(1, 1000); } void @@ -196,9 +209,13 @@ FilmEditor::connect_to_widgets () _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this); _dcp_trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_start_changed), 0, this); _dcp_trim_end->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_end_changed), 0, this); + _multiple_reels->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::multiple_reels_toggled), 0, this); + _reel_size->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::reel_size_changed), 0, this); _with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this); _subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this); _subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this); + _colour_lut->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::colour_lut_changed), 0, this); + _j2k_bandwidth->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this); _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::subtitle_stream_changed), 0, this); _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::audio_stream_changed), 0, this); _audio_gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this); @@ -270,6 +287,23 @@ FilmEditor::make_video_panel () _scaler->Append (std_to_wx ((*i)->name())); } + add_label_to_sizer (_video_sizer, _video_panel, "Colour look-up table"); + _colour_lut = new wxComboBox (_video_panel, wxID_ANY); + for (int i = 0; i < 2; ++i) { + _colour_lut->Append (std_to_wx (colour_lut_index_to_name (i))); + } + _colour_lut->SetSelection (0); + _video_sizer->Add (_colour_lut, 1, wxEXPAND); + + { + add_label_to_sizer (_video_sizer, _video_panel, "JPEG2000 bandwidth"); + wxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _j2k_bandwidth = new wxSpinCtrl (_video_panel, wxID_ANY); + s->Add (_j2k_bandwidth, 1); + add_label_to_sizer (s, _video_panel, "MBps"); + _video_sizer->Add (s, 1); + } + _left_crop->SetRange (0, 1024); _top_crop->SetRange (0, 1024); _right_crop->SetRange (0, 1024); @@ -277,6 +311,7 @@ FilmEditor::make_video_panel () _still_duration->SetRange (1, 60 * 60); _dcp_trim_start->SetRange (0, 100); _dcp_trim_end->SetRange (0, 100); + _j2k_bandwidth->SetRange (50, 250); } void @@ -448,6 +483,32 @@ FilmEditor::trust_content_header_changed (wxCommandEvent &) _film->set_trust_content_header (_trust_content_header->GetValue ()); } +void +FilmEditor::multiple_reels_toggled (wxCommandEvent &) +{ + if (!_film) { + return; + } + + if (_multiple_reels->GetValue()) { + _film->set_reel_size (_reel_size->GetValue() * 1e9); + } else { + _film->unset_reel_size (); + } + + setup_reel_control_sensitivity (); +} + +void +FilmEditor::reel_size_changed (wxCommandEvent &) +{ + if (!_film) { + return; + } + + _film->set_reel_size (static_cast<uint64_t> (_reel_size->GetValue()) * 1e9); +} + /** Called when the DCP A/B switch has been toggled */ void FilmEditor::dcp_ab_toggled (wxCommandEvent &) @@ -500,6 +561,26 @@ FilmEditor::subtitle_scale_changed (wxCommandEvent &) _film->set_subtitle_scale (_subtitle_scale->GetValue() / 100.0); } +void +FilmEditor::colour_lut_changed (wxCommandEvent &) +{ + if (!_film) { + return; + } + + _film->set_colour_lut (_colour_lut->GetSelection ()); +} + +void +FilmEditor::j2k_bandwidth_changed (wxCommandEvent &) +{ + if (!_film) { + return; + } + + _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1e6); +} + /** Called when the metadata stored in the Film object has changed; * so that we can update the GUI. @@ -615,6 +696,15 @@ FilmEditor::film_changed (Film::Property p) case Film::DCP_TRIM_END: checked_set (_dcp_trim_end, _film->dcp_trim_end()); break; + case Film::REEL_SIZE: + if (_film->reel_size()) { + checked_set (_multiple_reels, true); + checked_set (_reel_size, _film->reel_size().get() / 1e9); + } else { + checked_set (_multiple_reels, false); + } + setup_reel_control_sensitivity (); + break; case Film::AUDIO_GAIN: checked_set (_audio_gain, _film->audio_gain ()); break; @@ -638,6 +728,12 @@ FilmEditor::film_changed (Film::Property p) case Film::ENCRYPTED: checked_set (_encrypted, _film->encrypted ()); break; + case Film::COLOUR_LUT: + checked_set (_colour_lut, _film->colour_lut ()); + break; + case Film::J2K_BANDWIDTH: + checked_set (_j2k_bandwidth, double (_film->j2k_bandwidth()) / 1e6); + break; case Film::USE_DCI_NAME: checked_set (_use_dci_name, _film->use_dci_name ()); _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); @@ -735,6 +831,7 @@ FilmEditor::set_film (shared_ptr<Film> f) film_changed (Film::SCALER); film_changed (Film::DCP_TRIM_START); film_changed (Film::DCP_TRIM_END); + film_changed (Film::REEL_SIZE); film_changed (Film::DCP_AB); film_changed (Film::CONTENT_AUDIO_STREAM); film_changed (Film::EXTERNAL_AUDIO); @@ -746,6 +843,8 @@ FilmEditor::set_film (shared_ptr<Film> f) film_changed (Film::SUBTITLE_OFFSET); film_changed (Film::SUBTITLE_SCALE); film_changed (Film::ENCRYPTED); + film_changed (Film::COLOUR_LUT); + film_changed (Film::J2K_BANDWIDTH); film_changed (Film::DCI_METADATA); film_changed (Film::SIZE); film_changed (Film::LENGTH); @@ -778,8 +877,12 @@ FilmEditor::set_things_sensitive (bool s) _dcp_content_type->Enable (s); _dcp_trim_start->Enable (s); _dcp_trim_end->Enable (s); + _multiple_reels->Enable (s); + _reel_size->Enable (s); _dcp_ab->Enable (s); _encrypted->Enable (s); + _colour_lut->Enable (s); + _j2k_bandwidth->Enable (s); _audio_gain->Enable (s); _audio_gain_calculate_button->Enable (s); _audio_delay->Enable (s); @@ -787,6 +890,7 @@ FilmEditor::set_things_sensitive (bool s) setup_subtitle_control_sensitivity (); setup_audio_control_sensitivity (); + setup_reel_control_sensitivity (); } /** Called when the `Edit filters' button has been clicked */ @@ -1127,3 +1231,9 @@ FilmEditor::external_audio_changed (wxCommandEvent &) _film->set_external_audio (a); } + +void +FilmEditor::setup_reel_control_sensitivity () +{ + _reel_size->Enable (_multiple_reels->GetValue ()); +} diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index c1284fe79..b990ec40d 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -65,6 +65,8 @@ private: void format_changed (wxCommandEvent &); void dcp_trim_start_changed (wxCommandEvent &); void dcp_trim_end_changed (wxCommandEvent &); + void multiple_reels_toggled (wxCommandEvent &); + void reel_size_changed (wxCommandEvent &); void dcp_content_type_changed (wxCommandEvent &); void encrypted_toggled (wxCommandEvent &); void dcp_ab_toggled (wxCommandEvent &); @@ -75,6 +77,8 @@ private: void with_subtitles_toggled (wxCommandEvent &); void subtitle_offset_changed (wxCommandEvent &); void subtitle_scale_changed (wxCommandEvent &); + void colour_lut_changed (wxCommandEvent &); + void j2k_bandwidth_changed (wxCommandEvent &); void still_duration_changed (wxCommandEvent &); void audio_stream_changed (wxCommandEvent &); void subtitle_stream_changed (wxCommandEvent &); @@ -91,6 +95,7 @@ private: void setup_formats (); void setup_subtitle_control_sensitivity (); void setup_audio_control_sensitivity (); + void setup_reel_control_sensitivity (); void setup_streams (); void setup_audio_details (); @@ -149,6 +154,8 @@ private: wxComboBox* _subtitle_stream; wxSpinCtrl* _subtitle_offset; wxSpinCtrl* _subtitle_scale; + wxComboBox* _colour_lut; + wxSpinCtrl* _j2k_bandwidth; /** The Film's DCP content type */ wxComboBox* _dcp_content_type; /** The Film's frames per second */ @@ -165,6 +172,8 @@ private: wxSpinCtrl* _dcp_trim_start; wxSpinCtrl* _dcp_trim_end; wxCheckBox* _encrypted; + wxCheckBox* _multiple_reels; + wxSpinCtrl* _reel_size; /** Selector to generate an A/B comparison DCP */ wxCheckBox* _dcp_ab; diff --git a/src/wx/properties_dialog.cc b/src/wx/properties_dialog.cc index 61e1f34f0..b03c6b32c 100644 --- a/src/wx/properties_dialog.cc +++ b/src/wx/properties_dialog.cc @@ -56,7 +56,7 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film) if (_film->length()) { _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->length().get()))); - double const disk = ((double) Config::instance()->j2k_bandwidth() / 8) * _film->length().get() / (_film->frames_per_second () * 1073741824); + double const disk = ((double) _film->j2k_bandwidth() / 8) * _film->length().get() / (_film->frames_per_second () * 1073741824); stringstream s; s << fixed << setprecision (1) << disk << "Gb"; _disk_for_frames->SetLabel (std_to_wx (s.str ())); |
