diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-16 11:49:08 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-16 11:49:08 +0100 |
| commit | d5085584d82c021e924cec6ce00e682a8e63d800 (patch) | |
| tree | cfd1094beca5be9fd788d2ca264567e51cc729d1 /src/lib | |
| parent | 6f5d58eb442a7808e00c6431c6289e82cf333658 (diff) | |
Prevent viewer updates on timeline drag (#175).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content.cc | 7 | ||||
| -rw-r--r-- | src/lib/content.h | 8 | ||||
| -rw-r--r-- | src/lib/player.cc | 18 | ||||
| -rw-r--r-- | src/lib/player.h | 6 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 8 | ||||
| -rw-r--r-- | src/lib/playlist.h | 5 |
6 files changed, 33 insertions, 19 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 6a33e9f7e..49c579fb6 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -24,6 +24,7 @@ #include "util.h" using std::string; +using std::set; using boost::shared_ptr; using boost::lexical_cast; @@ -33,6 +34,7 @@ int const ContentProperty::LENGTH = 401; Content::Content (shared_ptr<const Film> f, Time s) : _film (f) , _start (s) + , _change_signals_frequent (false) { } @@ -41,12 +43,14 @@ Content::Content (shared_ptr<const Film> f, boost::filesystem::path p) : _film (f) , _file (p) , _start (0) + , _change_signals_frequent (false) { } Content::Content (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node) : _film (f) + , _change_signals_frequent (false) { _file = node->string_child ("File"); _digest = node->string_child ("Digest"); @@ -59,6 +63,7 @@ Content::Content (Content const & o) , _file (o._file) , _digest (o._digest) , _start (o._start) + , _change_signals_frequent (o._change_signals_frequent) { } @@ -83,7 +88,7 @@ Content::examine (shared_ptr<Job>) void Content::signal_changed (int p) { - Changed (shared_from_this (), p); + Changed (shared_from_this (), p, _change_signals_frequent); } void diff --git a/src/lib/content.h b/src/lib/content.h index a190a393f..cd8914cba 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -20,6 +20,7 @@ #ifndef DCPOMATIC_CONTENT_H #define DCPOMATIC_CONTENT_H +#include <set> #include <boost/filesystem.hpp> #include <boost/signals2.hpp> #include <boost/thread/mutex.hpp> @@ -79,7 +80,11 @@ public: return start() + length(); } - boost::signals2::signal<void (boost::weak_ptr<Content>, int)> Changed; + void set_change_signals_frequent (bool f) { + _change_signals_frequent = f; + } + + boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> Changed; protected: void signal_changed (int); @@ -91,6 +96,7 @@ private: boost::filesystem::path _file; std::string _digest; Time _start; + bool _change_signals_frequent; }; #endif diff --git a/src/lib/player.cc b/src/lib/player.cc index 6ee8c5029..50f401fb7 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -97,7 +97,7 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p) , _audio_buffers (f->dcp_audio_channels(), 0) { _playlist->Changed.connect (bind (&Player::playlist_changed, this)); - _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2)); + _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3)); _film->Changed.connect (bind (&Player::film_changed, this, _1)); set_video_container_size (_film->container()->size (_film->full_frame ())); } @@ -461,7 +461,7 @@ Player::setup_pieces () } void -Player::content_changed (weak_ptr<Content> w, int p) +Player::content_changed (weak_ptr<Content> w, int property, bool frequent) { shared_ptr<Content> c = w.lock (); if (!c) { @@ -469,16 +469,16 @@ Player::content_changed (weak_ptr<Content> w, int p) } if ( - p == ContentProperty::START || p == ContentProperty::LENGTH || - p == VideoContentProperty::VIDEO_CROP || p == VideoContentProperty::VIDEO_RATIO + property == ContentProperty::START || property == ContentProperty::LENGTH || + property == VideoContentProperty::VIDEO_CROP || property == VideoContentProperty::VIDEO_RATIO ) { _have_valid_pieces = false; - Changed (); + Changed (frequent); - } else if (p == SubtitleContentProperty::SUBTITLE_OFFSET || p == SubtitleContentProperty::SUBTITLE_SCALE) { + } else if (property == SubtitleContentProperty::SUBTITLE_OFFSET || property == SubtitleContentProperty::SUBTITLE_SCALE) { update_subtitle (); - Changed (); + Changed (frequent); } } @@ -486,7 +486,7 @@ void Player::playlist_changed () { _have_valid_pieces = false; - Changed (); + Changed (false); } void @@ -541,7 +541,7 @@ Player::film_changed (Film::Property p) */ if (p == Film::SCALER || p == Film::WITH_SUBTITLES || p == Film::CONTAINER) { - Changed (); + Changed (false); } } diff --git a/src/lib/player.h b/src/lib/player.h index 92a358043..2d8eca9b3 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -71,8 +71,10 @@ public: /** Emitted when something has changed such that if we went back and emitted * the last frame again it would look different. This is not emitted after * a seek. + * + * The parameter is true if these signals are currently likely to be frequent. */ - boost::signals2::signal<void ()> Changed; + boost::signals2::signal<void (bool)> Changed; private: friend class PlayerWrapper; @@ -82,7 +84,7 @@ private: void process_subtitle (boost::weak_ptr<Piece>, boost::shared_ptr<Image>, dcpomatic::Rect<double>, Time, Time); void setup_pieces (); void playlist_changed (); - void content_changed (boost::weak_ptr<Content>, int); + void content_changed (boost::weak_ptr<Content>, int, bool); void do_seek (Time, bool); void flush (); void emit_black (); diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 1535ad61f..5aa913bc7 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -70,13 +70,13 @@ Playlist::~Playlist () } void -Playlist::content_changed (weak_ptr<Content> c, int p) +Playlist::content_changed (weak_ptr<Content> content, int property, bool frequent) { - if (p == ContentProperty::LENGTH) { + if (property == ContentProperty::LENGTH) { maybe_sequence_video (); } - ContentChanged (c, p); + ContentChanged (content, property, frequent); } @@ -285,7 +285,7 @@ Playlist::reconnect () _content_connections.clear (); for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) { - _content_connections.push_back ((*i)->Changed.connect (bind (&Playlist::content_changed, this, _1, _2))); + _content_connections.push_back ((*i)->Changed.connect (bind (&Playlist::content_changed, this, _1, _2, _3))); } } diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 805df4d70..0b928fe51 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -89,10 +89,11 @@ public: void maybe_sequence_video (); mutable boost::signals2::signal<void ()> Changed; - mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int)> ContentChanged; + /** Third parameter is true if signals are currently being emitted frequently */ + mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> ContentChanged; private: - void content_changed (boost::weak_ptr<Content>, int); + void content_changed (boost::weak_ptr<Content>, int, bool); void reconnect (); ContentList _content; |
