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/lib | |
| parent | fad726e94700bccdae0d301d54cdb1eab51cc71f (diff) | |
| parent | b9ee74b24dad91e3fee9ead44ea9a52328b20f25 (diff) | |
Merge master.
Diffstat (limited to 'src/lib')
| -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 |
13 files changed, 232 insertions, 106 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 |
