diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-21 22:25:09 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-21 22:25:09 +0100 |
| commit | 02e4022f540915f8a38f9ab9576ac896fe39a1ab (patch) | |
| tree | 2301065f001f992c0c02f61fe2d2a321a0d5f7ce /src/lib | |
| parent | 237a0052c60af768f4d62b00321932918b7ba4d9 (diff) | |
Vaguely working new layout.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content.cc | 2 | ||||
| -rw-r--r-- | src/lib/content.h | 2 | ||||
| -rw-r--r-- | src/lib/examine_content_job.cc | 5 | ||||
| -rw-r--r-- | src/lib/examine_content_job.h | 3 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 18 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 2 | ||||
| -rw-r--r-- | src/lib/film.cc | 82 | ||||
| -rw-r--r-- | src/lib/film.h | 39 | ||||
| -rw-r--r-- | src/lib/imagemagick_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/imagemagick_content.h | 2 | ||||
| -rw-r--r-- | src/lib/sndfile_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/sndfile_content.h | 2 | ||||
| -rw-r--r-- | src/lib/writer.cc | 15 |
13 files changed, 19 insertions, 161 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 578dafd67..618dafee2 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -62,7 +62,7 @@ Content::as_xml (xmlpp::Node* node) const } void -Content::examine (shared_ptr<Film>, shared_ptr<Job>, bool) +Content::examine (shared_ptr<Film>, shared_ptr<Job>) { string const d = md5_digest (_file); boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/content.h b/src/lib/content.h index fd6288acc..b8062b280 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -43,7 +43,7 @@ public: Content (boost::shared_ptr<const cxml::Node>); Content (Content const &); - virtual void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool); + virtual void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>); virtual std::string summary () const = 0; virtual std::string information () const = 0; virtual void as_xml (xmlpp::Node *) const; diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index aad7f265e..21ab4a71d 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -27,10 +27,9 @@ using std::string; using boost::shared_ptr; -ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Content> c, bool q) +ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Content> c) : Job (f) , _content (c) - , _quick (q) { } @@ -48,7 +47,7 @@ ExamineContentJob::name () const void ExamineContentJob::run () { - _content->examine (_film, shared_from_this (), _quick); + _content->examine (_film, shared_from_this ()); set_progress (1); set_state (FINISHED_OK); } diff --git a/src/lib/examine_content_job.h b/src/lib/examine_content_job.h index dc0d53fff..86f1ab111 100644 --- a/src/lib/examine_content_job.h +++ b/src/lib/examine_content_job.h @@ -26,7 +26,7 @@ class Log; class ExamineContentJob : public Job { public: - ExamineContentJob (boost::shared_ptr<Film>, boost::shared_ptr<Content>, bool); + ExamineContentJob (boost::shared_ptr<Film>, boost::shared_ptr<Content>); ~ExamineContentJob (); std::string name () const; @@ -34,6 +34,5 @@ public: private: boost::shared_ptr<Content> _content; - bool _quick; }; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index fcc775f0a..2a4283353 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -112,26 +112,17 @@ FFmpegContent::as_xml (xmlpp::Node* node) const } void -FFmpegContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick) +FFmpegContent::examine (shared_ptr<Film> film, shared_ptr<Job> job) { job->set_progress_unknown (); - Content::examine (film, job, quick); + Content::examine (film, job); shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (film, shared_from_this (), true, false, false)); ContentVideoFrame video_length = 0; - if (quick) { - video_length = decoder->video_length (); - film->log()->log (String::compose ("Video length obtained from header as %1 frames", decoder->video_length ())); - } else { - while (!decoder->pass ()) { - /* keep going */ - } - - video_length = decoder->video_frame (); - film->log()->log (String::compose ("Video length examined as %1 frames", decoder->video_frame ())); - } + video_length = decoder->video_length (); + film->log()->log (String::compose ("Video length obtained from header as %1 frames", decoder->video_length ())); { boost::mutex::scoped_lock lm (_mutex); @@ -332,7 +323,6 @@ FFmpegContent::audio_mapping () const return AudioMapping (); } - cout << "returning am from stream " << _audio_stream.get() << ".\n"; return _audio_stream->mapping; } diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index d79e4ec35..9d842515e 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -88,7 +88,7 @@ public: return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ()); } - void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool); + void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>); std::string summary () const; std::string information () const; void as_xml (xmlpp::Node *) const; diff --git a/src/lib/film.cc b/src/lib/film.cc index 487499e32..ef67a2704 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -94,13 +94,9 @@ int const Film::state_version = 4; Film::Film (string d, bool must_exist) : _playlist (new Playlist) , _use_dci_name (true) - , _trust_content_headers (true) , _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) , _ab (false) , _audio_gain (0) , _audio_delay (0) @@ -163,15 +159,11 @@ Film::Film (Film const & o) , _directory (o._directory) , _name (o._name) , _use_dci_name (o._use_dci_name) - , _trust_content_headers (o._trust_content_headers) , _dcp_content_type (o._dcp_content_type) , _format (o._format) , _crop (o._crop) , _filters (o._filters) , _scaler (o._scaler) - , _trim_start (o._trim_start) - , _trim_end (o._trim_end) - , _trim_type (o._trim_type) , _ab (o._ab) , _audio_gain (o._audio_gain) , _audio_delay (o._audio_delay) @@ -355,7 +347,7 @@ Film::analyse_audio () void Film::examine_content (shared_ptr<Content> c) { - shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c, trust_content_headers ())); + shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c)); JobManager::instance()->add (j); } @@ -413,7 +405,6 @@ Film::write_metadata () const root->add_child("Version")->add_child_text (boost::lexical_cast<string> (state_version)); root->add_child("Name")->add_child_text (_name); root->add_child("UseDCIName")->add_child_text (_use_dci_name ? "1" : "0"); - root->add_child("TrustContentHeaders")->add_child_text (_trust_content_headers ? "1" : "0"); if (_dcp_content_type) { root->add_child("DCPContentType")->add_child_text (_dcp_content_type->dci_name ()); @@ -423,14 +414,6 @@ Film::write_metadata () const root->add_child("Format")->add_child_text (_format->id ()); } - switch (_trim_type) { - case CPL: - root->add_child("TrimType")->add_child_text ("CPL"); - break; - case ENCODE: - root->add_child("TrimType")->add_child_text ("Encode"); - } - root->add_child("LeftCrop")->add_child_text (boost::lexical_cast<string> (_crop.left)); root->add_child("RightCrop")->add_child_text (boost::lexical_cast<string> (_crop.right)); root->add_child("TopCrop")->add_child_text (boost::lexical_cast<string> (_crop.top)); @@ -441,8 +424,6 @@ Film::write_metadata () const } root->add_child("Scaler")->add_child_text (_scaler->id ()); - root->add_child("TrimStart")->add_child_text (boost::lexical_cast<string> (_trim_start)); - root->add_child("TrimEnd")->add_child_text (boost::lexical_cast<string> (_trim_end)); root->add_child("AB")->add_child_text (_ab ? "1" : "0"); root->add_child("AudioGain")->add_child_text (boost::lexical_cast<string> (_audio_gain)); root->add_child("AudioDelay")->add_child_text (boost::lexical_cast<string> (_audio_delay)); @@ -476,7 +457,6 @@ Film::read_metadata () _name = f.string_child ("Name"); _use_dci_name = f.bool_child ("UseDCIName"); - _trust_content_headers = f.bool_child ("TrustContentHeaders"); { optional<string> c = f.optional_string_child ("DCPContentType"); @@ -492,15 +472,6 @@ Film::read_metadata () } } - { - optional<string> c = f.optional_string_child ("TrimType"); - if (!c || c.get() == "CPL") { - _trim_type = CPL; - } else if (c && c.get() == "Encode") { - _trim_type = ENCODE; - } - } - _crop.left = f.number_child<int> ("LeftCrop"); _crop.right = f.number_child<int> ("RightCrop"); _crop.top = f.number_child<int> ("TopCrop"); @@ -514,8 +485,6 @@ Film::read_metadata () } _scaler = Scaler::from_id (f.string_child ("Scaler")); - _trim_start = f.number_child<int> ("TrimStart"); - _trim_end = f.number_child<int> ("TrimEnd"); _ab = f.bool_child ("AB"); _audio_gain = f.number_child<float> ("AudioGain"); _audio_delay = f.number_child<int> ("AudioDelay"); @@ -687,25 +656,6 @@ Film::set_use_dci_name (bool u) } void -Film::set_trust_content_headers (bool t) -{ - { - boost::mutex::scoped_lock lm (_state_mutex); - _trust_content_headers = t; - } - - signal_changed (TRUST_CONTENT_HEADERS); - - Playlist::ContentList content = _playlist->content (); - if (!_trust_content_headers && !content.empty()) { - /* We just said that we don't trust the content's header */ - for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) { - examine_content (*i); - } - } -} - -void Film::set_dcp_content_type (DCPContentType const * t) { { @@ -813,36 +763,6 @@ Film::set_scaler (Scaler const * s) } void -Film::set_trim_start (int t) -{ - { - boost::mutex::scoped_lock lm (_state_mutex); - _trim_start = t; - } - signal_changed (TRIM_START); -} - -void -Film::set_trim_end (int t) -{ - { - boost::mutex::scoped_lock lm (_state_mutex); - _trim_end = t; - } - 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_ab (bool a) { { diff --git a/src/lib/film.h b/src/lib/film.h index c0417382f..6dd2b446d 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -120,11 +120,6 @@ public: void set_loop (int); int loop () const; - enum TrimType { - CPL, - ENCODE - }; - /** Identifiers for the parts of our state; used for signalling changes. */ @@ -132,7 +127,6 @@ public: NONE, NAME, USE_DCI_NAME, - TRUST_CONTENT_HEADERS, /** The playlist's content list has changed (i.e. content has been added, moved around or removed) */ CONTENT, LOOP, @@ -141,10 +135,7 @@ public: CROP, FILTERS, SCALER, - TRIM_START, - TRIM_END, AB, - TRIM_TYPE, AUDIO_GAIN, AUDIO_DELAY, WITH_SUBTITLES, @@ -174,11 +165,6 @@ public: return _use_dci_name; } - bool trust_content_headers () const { - boost::mutex::scoped_lock lm (_state_mutex); - return _trust_content_headers; - } - DCPContentType const * dcp_content_type () const { boost::mutex::scoped_lock lm (_state_mutex); return _dcp_content_type; @@ -204,21 +190,6 @@ public: return _scaler; } - int trim_start () const { - boost::mutex::scoped_lock lm (_state_mutex); - return _trim_start; - } - - int trim_end () const { - boost::mutex::scoped_lock lm (_state_mutex); - return _trim_end; - } - - TrimType trim_type () const { - boost::mutex::scoped_lock lm (_state_mutex); - return _trim_type; - } - bool ab () const { boost::mutex::scoped_lock lm (_state_mutex); return _ab; @@ -275,7 +246,6 @@ public: void set_directory (std::string); void set_name (std::string); void set_use_dci_name (bool); - void set_trust_content_headers (bool); void add_content (boost::shared_ptr<Content>); void remove_content (boost::shared_ptr<Content>); void set_dcp_content_type (DCPContentType const *); @@ -287,10 +257,7 @@ public: void set_bottom_crop (int); void set_filters (std::vector<Filter const *>); void set_scaler (Scaler const *); - void set_trim_start (int); - void set_trim_end (int); void set_ab (bool); - void set_trim_type (TrimType); void set_audio_gain (float); void set_audio_delay (int); void set_with_subtitles (bool); @@ -340,7 +307,6 @@ private: std::string _name; /** True if a auto-generated DCI-compliant name should be used for our DCP */ bool _use_dci_name; - bool _trust_content_headers; /** The type of content that this Film represents (feature, trailer etc.) */ DCPContentType const * _dcp_content_type; /** The format to present this Film in (flat, scope, etc.) */ @@ -351,11 +317,6 @@ private: std::vector<Filter const *> _filters; /** Scaler algorithm to use */ Scaler const * _scaler; - /** Frames to trim off the start of the DCP */ - int _trim_start; - /** Frames to trim off the end of the DCP */ - int _trim_end; - TrimType _trim_type; /** 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. diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc index 2e42e25f3..f9daf204e 100644 --- a/src/lib/imagemagick_content.cc +++ b/src/lib/imagemagick_content.cc @@ -66,9 +66,9 @@ ImageMagickContent::as_xml (xmlpp::Node* node) const } void -ImageMagickContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick) +ImageMagickContent::examine (shared_ptr<Film> film, shared_ptr<Job> job) { - Content::examine (film, job, quick); + Content::examine (film, job); shared_ptr<ImageMagickDecoder> decoder (new ImageMagickDecoder (film, shared_from_this())); { diff --git a/src/lib/imagemagick_content.h b/src/lib/imagemagick_content.h index 366049002..b7f2cd2c3 100644 --- a/src/lib/imagemagick_content.h +++ b/src/lib/imagemagick_content.h @@ -34,7 +34,7 @@ public: return boost::dynamic_pointer_cast<ImageMagickContent> (Content::shared_from_this ()); }; - void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool); + void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>); std::string summary () const; void as_xml (xmlpp::Node *) const; boost::shared_ptr<Content> clone () const; diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 13b118fb2..758ae942d 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -93,10 +93,10 @@ SndfileContent::clone () const } void -SndfileContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick) +SndfileContent::examine (shared_ptr<Film> film, shared_ptr<Job> job) { job->set_progress_unknown (); - Content::examine (film, job, quick); + Content::examine (film, job); SndfileDecoder dec (film, shared_from_this()); diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h index 1ef4b3f02..bb7fa5f50 100644 --- a/src/lib/sndfile_content.h +++ b/src/lib/sndfile_content.h @@ -38,7 +38,7 @@ public: return boost::dynamic_pointer_cast<SndfileContent> (Content::shared_from_this ()); } - void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool); + void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>); std::string summary () const; std::string information () const; void as_xml (xmlpp::Node *) const; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index f1451763e..96c797c5a 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -264,15 +264,8 @@ Writer::finish () _sound_asset_writer->finalize (); int const frames = _last_written_frame + 1; - int duration = 0; - if (_film->trim_type() == Film::CPL) { - duration = frames - _film->trim_start() - _film->trim_end(); - _picture_asset->set_entry_point (_film->trim_start ()); - } else { - duration = frames; - } - _picture_asset->set_duration (duration); + _picture_asset->set_duration (frames); /* Hard-link the video MXF into the DCP */ @@ -296,11 +289,7 @@ Writer::finish () _picture_asset->set_directory (_film->dir (_film->dcp_name ())); _picture_asset->set_file_name (_film->dcp_video_mxf_filename ()); - - if (_film->trim_type() == Film::CPL) { - _sound_asset->set_entry_point (_film->trim_start ()); - } - _sound_asset->set_duration (duration); + _sound_asset->set_duration (frames); libdcp::DCP dcp (_film->dir (_film->dcp_name())); |
