diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/analyse_audio_job.cc | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/film.cc | 28 | ||||
| -rw-r--r-- | src/lib/film.h | 9 | ||||
| -rw-r--r-- | src/lib/imagemagick_content.cc | 5 | ||||
| -rw-r--r-- | src/lib/player.cc | 2 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 58 | ||||
| -rw-r--r-- | src/lib/playlist.h | 15 | ||||
| -rw-r--r-- | src/lib/sndfile_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/transcode_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/writer.cc | 4 |
11 files changed, 45 insertions, 86 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 9a9116690..2848c1ed7 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -68,14 +68,14 @@ AnalyseAudioJob::run () player->Audio.connect (bind (&AnalyseAudioJob::audio, this, _1, _2)); - _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length_without_loop()) / _num_points); + _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length()) / _num_points); _current.resize (_film->dcp_audio_channels ()); _analysis.reset (new AudioAnalysis (_film->dcp_audio_channels ())); _done = 0; while (!player->pass ()) { - set_progress (double (_film->audio_frames_to_time (_done)) / _film->length_without_loop ()); + set_progress (double (_film->audio_frames_to_time (_done)) / _film->length ()); } _analysis->write (content->audio_analysis_path ()); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index ebad8c8bd..8419fd31f 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -165,7 +165,7 @@ FFmpegContent::examine (shared_ptr<Job> job) string FFmpegContent::summary () const { - return String::compose (_("Movie: %1"), file().filename().string()); + return String::compose (_("%1 [movie]"), file().filename().string()); } string diff --git a/src/lib/film.cc b/src/lib/film.cc index 2bb8b3155..172fd20ab 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -246,7 +246,7 @@ Film::make_dcp () throw MissingSettingError (_("container")); } - if (content_without_loop().empty()) { + if (content().empty()) { throw StringError (_("You must add some content to the DCP before creating it")); } @@ -729,9 +729,9 @@ Film::playlist () const } Playlist::ContentList -Film::content_without_loop () const +Film::content () const { - return _playlist->content_without_loop (); + return _playlist->content (); } void @@ -769,15 +769,9 @@ Film::remove_content (shared_ptr<Content> c) } Time -Film::length_with_loop () const +Film::length () const { - return _playlist->length_with_loop (); -} - -Time -Film::length_without_loop () const -{ - return _playlist->length_without_loop (); + return _playlist->length (); } bool @@ -810,18 +804,6 @@ Film::playlist_changed () signal_changed (CONTENT); } -int -Film::loop () const -{ - return _playlist->loop (); -} - -void -Film::set_loop (int c) -{ - _playlist->set_loop (c); -} - OutputAudioFrame Film::time_to_audio_frames (Time t) const { diff --git a/src/lib/film.h b/src/lib/film.h index 1f3899885..497320c5e 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -106,16 +106,12 @@ public: /* Proxies for some Playlist methods */ - Playlist::ContentList content_without_loop () const; + Playlist::ContentList content () const; - Time length_with_loop () const; - Time length_without_loop () const; + Time length () const; bool has_subtitles () const; OutputVideoFrame best_dcp_video_frame_rate () const; - void set_loop (int); - int loop () const; - void set_sequence_video (bool); /** Identifiers for the parts of our state; @@ -127,7 +123,6 @@ public: USE_DCI_NAME, /** The playlist's content list has changed (i.e. content has been added, moved around or removed) */ CONTENT, - LOOP, DCP_CONTENT_TYPE, CONTAINER, RESOLUTION, diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc index 79623b21c..0c4e84015 100644 --- a/src/lib/imagemagick_content.cc +++ b/src/lib/imagemagick_content.cc @@ -27,6 +27,7 @@ #include "i18n.h" using std::string; +using std::cout; using std::stringstream; using boost::shared_ptr; @@ -47,7 +48,7 @@ ImageMagickContent::ImageMagickContent (shared_ptr<const Film> f, shared_ptr<con string ImageMagickContent::summary () const { - return String::compose (_("Image: %1"), file().filename().string()); + return String::compose (_("%1 [still]"), file().filename().string()); } bool @@ -76,8 +77,8 @@ ImageMagickContent::examine (shared_ptr<Job> job) shared_ptr<ImageMagickExaminer> examiner (new ImageMagickExaminer (film, shared_from_this())); - set_video_length (Config::instance()->default_still_length() * video_frame_rate()); take_from_video_examiner (examiner); + set_video_length (Config::instance()->default_still_length() * video_frame_rate()); } void diff --git a/src/lib/player.cc b/src/lib/player.cc index f5212f8d0..ec20892ef 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -401,7 +401,7 @@ Player::setup_pieces () _pieces.clear (); - Playlist::ContentList content = _playlist->content_with_loop (); + Playlist::ContentList content = _playlist->content (); sort (content.begin(), content.end(), ContentSorter ()); for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) { diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 172b6fbb9..e4494acb0 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -42,6 +42,7 @@ using std::min; using std::max; using std::string; using std::stringstream; +using std::pair; using boost::optional; using boost::shared_ptr; using boost::weak_ptr; @@ -49,8 +50,7 @@ using boost::dynamic_pointer_cast; using boost::lexical_cast; Playlist::Playlist () - : _loop (1) - , _sequence_video (true) + : _sequence_video (true) , _sequencing_video (false) { @@ -109,8 +109,6 @@ Playlist::video_identifier () const } } - t += lexical_cast<string> (_loop); - return md5_digest (t.c_str(), t.length()); } @@ -124,7 +122,6 @@ Playlist::set_from_xml (shared_ptr<const Film> film, shared_ptr<const cxml::Node } reconnect (); - _loop = node->number_child<int> ("Loop"); _sequence_video = node->bool_child ("SequenceVideo"); } @@ -136,7 +133,6 @@ Playlist::as_xml (xmlpp::Node* node) (*i)->as_xml (node->add_child ("Content")); } - node->add_child("Loop")->add_child_text(lexical_cast<string> (_loop)); node->add_child("SequenceVideo")->add_child_text(_sequence_video ? "1" : "0"); } @@ -162,13 +158,6 @@ Playlist::remove (shared_ptr<Content> c) } } -void -Playlist::set_loop (int l) -{ - _loop = l; - Changed (); -} - bool Playlist::has_subtitles () const { @@ -246,7 +235,7 @@ Playlist::best_dcp_frame_rate () const } Time -Playlist::length_without_loop () const +Playlist::length () const { Time len = 0; for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { @@ -256,12 +245,6 @@ Playlist::length_without_loop () const return len; } -Time -Playlist::length_with_loop () const -{ - return length_without_loop() * _loop; -} - void Playlist::reconnect () { @@ -301,29 +284,34 @@ ContentSorter::operator() (shared_ptr<Content> a, shared_ptr<Content> b) return a->start() < b->start(); } -/** @return content in an undefined order, not taking looping into account */ +/** @return content in an undefined order */ Playlist::ContentList -Playlist::content_without_loop () const +Playlist::content () const { return _content; } -/** @return content in an undefined order, taking looping into account */ -Playlist::ContentList -Playlist::content_with_loop () const +void +Playlist::repeat (list<shared_ptr<Content> > c, int n) { - ContentList looped = _content; - Time const length = length_without_loop (); + pair<Time, Time> range (TIME_MAX, 0); + for (list<shared_ptr<Content> >::iterator i = c.begin(); i != c.end(); ++i) { + range.first = min (range.first, (*i)->start ()); + range.second = max (range.second, (*i)->start ()); + range.first = min (range.first, (*i)->end ()); + range.second = max (range.second, (*i)->end ()); + } - Time offset = length; - for (int i = 1; i < _loop; ++i) { - for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { + Time pos = range.second; + for (int i = 0; i < n; ++i) { + for (list<shared_ptr<Content> >::iterator i = c.begin(); i != c.end(); ++i) { shared_ptr<Content> copy = (*i)->clone (); - copy->set_start (copy->start() + offset); - looped.push_back (copy); + copy->set_start (pos + copy->start() - range.first); + _content.push_back (copy); } - offset += length; + pos += range.second - range.first; } - - return looped; + + reconnect (); + Changed (); } diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 330681c56..1d69c34ba 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -65,19 +65,11 @@ public: typedef std::vector<boost::shared_ptr<Content> > ContentList; - ContentList content_without_loop () const; - ContentList content_with_loop () const; + ContentList content () const; std::string video_identifier () const; - int loop () const { - return _loop; - } - - void set_loop (int l); - - Time length_without_loop () const; - Time length_with_loop () const; + Time length () const; int best_dcp_frame_rate () const; Time video_end () const; @@ -85,6 +77,8 @@ public: void set_sequence_video (bool); void maybe_sequence_video (); + void repeat (std::list<boost::shared_ptr<Content> >, int); + mutable boost::signals2::signal<void ()> Changed; /** Third parameter is true if signals are currently being emitted frequently */ mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> ContentChanged; @@ -94,7 +88,6 @@ private: void reconnect (); ContentList _content; - int _loop; bool _sequence_video; bool _sequencing_video; std::list<boost::signals2::connection> _content_connections; diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 7e6d56a9e..549af09b1 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -54,7 +54,7 @@ SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml: string SndfileContent::summary () const { - return String::compose (_("Sound file: %1"), file().filename().string()); + return String::compose (_("%1 [audio]"), file().filename().string()); } string diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index f0faf7c63..6d5edd7c0 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -111,6 +111,6 @@ TranscodeJob::remaining_time () const } /* Compute approximate proposed length here, as it's only here that we need it */ - OutputVideoFrame const left = _film->time_to_video_frames (_film->length_with_loop ()) - _transcoder->video_frames_out(); + OutputVideoFrame const left = _film->time_to_video_frames (_film->length ()) - _transcoder->video_frames_out(); return left / fps; } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index b3d2fdb1c..c5360a122 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -204,9 +204,9 @@ try } lock.lock (); - if (_film->length_with_loop()) { + if (_film->length()) { _job->set_progress ( - float (_full_written + _fake_written + _repeat_written) / _film->time_to_video_frames (_film->length_with_loop()) + float (_full_written + _fake_written + _repeat_written) / _film->time_to_video_frames (_film->length()) ); } |
