diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cross.cc | 11 | ||||
| -rw-r--r-- | src/lib/cross.h | 1 | ||||
| -rw-r--r-- | src/lib/film.cc | 9 | ||||
| -rw-r--r-- | src/lib/film.h | 7 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 13 | ||||
| -rw-r--r-- | src/lib/playlist.h | 4 |
6 files changed, 41 insertions, 4 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 8d82f7a51..5d35d5a4b 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -75,6 +75,17 @@ dcpomatic_sleep_seconds (int s) #endif } +void +dcpomatic_sleep_milliseconds (int ms) +{ +#ifdef DCPOMATIC_POSIX + usleep (ms * 1000); +#endif +#ifdef DCPOMATIC_WINDOWS + Sleep (ms); +#endif +} + /** @return A string of CPU information (model name etc.) */ string cpu_info () diff --git a/src/lib/cross.h b/src/lib/cross.h index 67709463a..584fa2b42 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -39,6 +39,7 @@ class Log; struct AVIOContext; void dcpomatic_sleep_seconds (int); +void dcpomatic_sleep_milliseconds (int); extern std::string cpu_info (); extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path); extern std::list<std::pair<std::string, std::string> > mount_info (); diff --git a/src/lib/film.cc b/src/lib/film.cc index 2a50e8c81..90b18ea70 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -167,8 +167,9 @@ Film::Film (optional<boost::filesystem::path> dir) set_isdcf_date_today (); _playlist_change_connection = _playlist->Change.connect (bind (&Film::playlist_change, this, _1)); - _playlist_order_changed_connection = _playlist->OrderChanged.connect (bind (&Film::playlist_order_changed, this)); + _playlist_order_changed_connection = _playlist->OrderChange.connect (bind (&Film::playlist_order_changed, this)); _playlist_content_change_connection = _playlist->ContentChange.connect (bind (&Film::playlist_content_change, this, _1, _2, _3, _4)); + _playlist_length_change_connection = _playlist->LengthChange.connect (bind(&Film::playlist_length_change, this)); if (dir) { /* Make state.directory a complete path without ..s (where possible) @@ -1293,6 +1294,12 @@ Film::playlist_content_change (ChangeType type, weak_ptr<Content> c, int p, bool } void +Film::playlist_length_change () +{ + LengthChange (); +} + +void Film::playlist_change (ChangeType type) { signal_change (type, CONTENT); diff --git a/src/lib/film.h b/src/lib/film.h index 68f8b5334..c72251880 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -390,6 +390,11 @@ public: /** Emitted when some property of our content has changed */ mutable boost::signals2::signal<void (ChangeType, boost::weak_ptr<Content>, int, bool)> ContentChange; + /** Emitted when the film's length might have changed; this is not like a normal + property as its value is derived from the playlist, so it has its own signal. + */ + mutable boost::signals2::signal<void ()> LengthChange; + /** Emitted when we have something important to tell the user */ boost::signals2::signal<void (std::string)> Message; @@ -409,6 +414,7 @@ private: void playlist_change (ChangeType); void playlist_order_changed (); void playlist_content_change (ChangeType type, boost::weak_ptr<Content>, int, bool frequent); + void playlist_length_change (); void maybe_add_content (boost::weak_ptr<Job>, boost::weak_ptr<Content>, bool disable_audio_analysis); void audio_analysis_finished (); void check_settings_consistency (); @@ -486,6 +492,7 @@ private: boost::signals2::scoped_connection _playlist_change_connection; boost::signals2::scoped_connection _playlist_order_changed_connection; boost::signals2::scoped_connection _playlist_content_change_connection; + boost::signals2::scoped_connection _playlist_length_change_connection; std::list<boost::signals2::connection> _job_connections; std::list<boost::signals2::connection> _audio_analysis_connections; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 9e96c693a..48053bbf4 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -111,8 +111,11 @@ Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ } if (changed) { - OrderChanged (); + OrderChange (); } + + /* The length might have changed, and that's good enough for this signal */ + LengthChange (); } } @@ -281,6 +284,8 @@ Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c) } Change (CHANGE_TYPE_DONE); + + LengthChange (); } void @@ -312,6 +317,8 @@ Playlist::remove (shared_ptr<Content> c) } /* This won't change order, so it does not need a sort */ + + LengthChange (); } void @@ -334,9 +341,11 @@ Playlist::remove (ContentList c) } } + Change (CHANGE_TYPE_DONE); + /* This won't change order, so it does not need a sort */ - Change (CHANGE_TYPE_DONE); + LengthChange (); } class FrameRateCandidate diff --git a/src/lib/playlist.h b/src/lib/playlist.h index d7db75d0f..dc984aacf 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -77,7 +77,9 @@ public: /** Emitted when content has been added to or removed from the playlist; implies OrderChanged */ mutable boost::signals2::signal<void (ChangeType)> Change; - mutable boost::signals2::signal<void ()> OrderChanged; + mutable boost::signals2::signal<void ()> OrderChange; + /** Emitted when the length might have changed; may sometimes be emitted when it has not */ + mutable boost::signals2::signal<void ()> LengthChange; mutable boost::signals2::signal<void (ChangeType, boost::weak_ptr<Content>, int, bool)> ContentChange; |
