Make ContentChange into a generic ChangeSignaller and use it for Film v2.13.44
authorCarl Hetherington <cth@carlh.net>
Mon, 20 Aug 2018 22:01:14 +0000 (23:01 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 20 Aug 2018 22:29:21 +0000 (23:29 +0100)
changes, since we setup_pieces() in response to at least one of these and
hence we must know before it happens so we can suspend the butler and player.

14 files changed:
src/lib/audio_content.cc
src/lib/change_signaller.h [new file with mode: 0644]
src/lib/content.cc
src/lib/content.h
src/lib/content_change.cc [deleted file]
src/lib/content_change.h [deleted file]
src/lib/content_part.h
src/lib/dcp_content.cc
src/lib/ffmpeg_content.cc
src/lib/film.cc
src/lib/film.h
src/lib/text_content.cc
src/lib/video_content.cc
src/lib/wscript

index 703696a44d7d7accf1b71b2fa236306645a72e6d..f3212ca7a3dea3f3bb56c52d66a7b020a60b4179 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -146,7 +146,7 @@ AudioContent::technical_summary () const
 void
 AudioContent::set_mapping (AudioMapping mapping)
 {
-       ContentChange cc (_parent, AudioContentProperty::STREAMS);
+       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
 
        int c = 0;
        BOOST_FOREACH (AudioStreamPtr i, streams ()) {
@@ -341,7 +341,7 @@ AudioContent::add_properties (list<UserProperty>& p) const
 void
 AudioContent::set_streams (vector<AudioStreamPtr> streams)
 {
-       ContentChange cc (_parent, AudioContentProperty::STREAMS);
+       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -360,7 +360,7 @@ AudioContent::stream () const
 void
 AudioContent::add_stream (AudioStreamPtr stream)
 {
-       ContentChange cc (_parent, AudioContentProperty::STREAMS);
+       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -371,7 +371,7 @@ AudioContent::add_stream (AudioStreamPtr stream)
 void
 AudioContent::set_stream (AudioStreamPtr stream)
 {
-       ContentChange cc (_parent, AudioContentProperty::STREAMS);
+       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/change_signaller.h b/src/lib/change_signaller.h
new file mode 100644 (file)
index 0000000..ec1f14e
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    DCP-o-matic is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef DCPOMATIC_CHANGE_H
+#define DCPOMATIC_CHANGE_H
+
+#include <boost/noncopyable.hpp>
+
+template <class T>
+class ChangeSignaller : public boost::noncopyable
+{
+public:
+       ChangeSignaller (T* t, int p)
+               : _thing (t)
+               , _property (p)
+               , _done (true)
+       {
+               _thing->signal_change (CHANGE_TYPE_PENDING, _property);
+       }
+
+       ~ChangeSignaller ()
+       {
+               if (_done) {
+                       _thing->signal_change (CHANGE_TYPE_DONE, _property);
+               } else {
+                       _thing->signal_change (CHANGE_TYPE_CANCELLED, _property);
+               }
+       }
+
+       void abort ()
+       {
+               _done = false;
+       }
+
+private:
+       T* _thing;
+       int _property;
+       bool _done;
+};
+
+#endif
index ae0b08dccc241f24ba5f4d43f6cfadd658e5b583..04bdc8126cc4ddf898284d2ab8f1353d3ddd85b0 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include "content.h"
+#include "change_signaller.h"
 #include "util.h"
 #include "content_factory.h"
 #include "video_content.h"
@@ -205,7 +206,7 @@ Content::set_position (DCPTime p)
                audio->modify_position (p);
        }
 
-       ContentChange cc (this, ContentProperty::POSITION);
+       ChangeSignaller<Content> cc (this, ContentProperty::POSITION);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -231,7 +232,7 @@ Content::set_trim_start (ContentTime t)
                audio->modify_trim_start (t);
        }
 
-       ContentChange cc (this, ContentProperty::TRIM_START);
+       ChangeSignaller<Content> cc (this, ContentProperty::TRIM_START);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -242,7 +243,7 @@ Content::set_trim_start (ContentTime t)
 void
 Content::set_trim_end (ContentTime t)
 {
-       ContentChange cc (this, ContentProperty::TRIM_END);
+       ChangeSignaller<Content> cc (this, ContentProperty::TRIM_END);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -310,7 +311,7 @@ Content::paths_valid () const
 void
 Content::set_path (boost::filesystem::path path)
 {
-       ContentChange cc (this, ContentProperty::PATH);
+       ChangeSignaller<Content> cc (this, ContentProperty::PATH);
        _paths.clear ();
        _paths.push_back (path);
 }
@@ -318,7 +319,7 @@ Content::set_path (boost::filesystem::path path)
 void
 Content::set_paths (vector<boost::filesystem::path> paths)
 {
-       ContentChange cc (this, ContentProperty::PATH);
+       ChangeSignaller<Content> cc (this, ContentProperty::PATH);
        _paths = paths;
 }
 
@@ -369,7 +370,7 @@ Content::reel_split_points () const
 void
 Content::set_video_frame_rate (double r)
 {
-       ContentChange cc (this, ContentProperty::VIDEO_FRAME_RATE);
+       ChangeSignaller<Content> cc (this, ContentProperty::VIDEO_FRAME_RATE);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -385,7 +386,7 @@ Content::set_video_frame_rate (double r)
 void
 Content::unset_video_frame_rate ()
 {
-       ContentChange cc (this, ContentProperty::VIDEO_FRAME_RATE);
+       ChangeSignaller<Content> cc (this, ContentProperty::VIDEO_FRAME_RATE);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index e8710ccb7405b82a837eececb05e770457839f0a..d519dc52b49e964f7334fea59f0417d62696d6c4 100644 (file)
@@ -28,6 +28,7 @@
 #include "types.h"
 #include "signaller.h"
 #include "dcpomatic_time.h"
+#include "change_signaller.h"
 #include "user_property.h"
 #include <libcxml/cxml.h>
 #include <boost/filesystem.hpp>
@@ -207,7 +208,7 @@ private:
        friend struct best_dcp_frame_rate_test_single;
        friend struct best_dcp_frame_rate_test_double;
        friend struct audio_sampling_rate_test;
-       friend class ContentChange;
+       template<class> friend class ChangeSignaller;
 
        void signal_change (ChangeType, int);
 
diff --git a/src/lib/content_change.cc b/src/lib/content_change.cc
deleted file mode 100644 (file)
index 6e390dc..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    DCP-o-matic is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "content_change.h"
-#include "content.h"
-
-ContentChange::ContentChange (Content* c, int p)
-       : _content (c)
-       , _property (p)
-       , _done (true)
-{
-       _content->signal_change (CHANGE_TYPE_PENDING, _property);
-}
-
-
-ContentChange::~ContentChange ()
-{
-       if (_done) {
-               _content->signal_change (CHANGE_TYPE_DONE, _property);
-       } else {
-               _content->signal_change (CHANGE_TYPE_CANCELLED, _property);
-       }
-}
-
-void
-ContentChange::abort ()
-{
-       _done = false;
-}
diff --git a/src/lib/content_change.h b/src/lib/content_change.h
deleted file mode 100644 (file)
index 67012a7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    DCP-o-matic is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-class Content;
-
-class ContentChange
-{
-public:
-       ContentChange (Content* c, int p);
-       ~ContentChange ();
-
-       void abort ();
-
-private:
-       Content* _content;
-       int _property;
-       bool _done;
-};
index 58833655fb5dcb9d503b1e0fc2f87ef8f62c1f67..eb96b13710e210593ca47c8911225362d5bfb084 100644 (file)
@@ -23,7 +23,7 @@
 #define DCPOMATIC_CONTENT_PART_H
 
 #include "content.h"
-#include "content_change.h"
+#include "change_signaller.h"
 #include <boost/weak_ptr.hpp>
 #include <boost/thread/mutex.hpp>
 
@@ -42,7 +42,7 @@ protected:
        void
        maybe_set (T& member, T new_value, int property) const
        {
-               ContentChange cc (_parent, property);
+               ChangeSignaller<Content> cc (_parent, property);
                {
                        boost::mutex::scoped_lock lm (_mutex);
                        if (member == new_value) {
@@ -57,7 +57,7 @@ protected:
        void
        maybe_set (boost::optional<T>& member, T new_value, int property) const
        {
-               ContentChange cc (_parent, property);
+               ChangeSignaller<Content> cc (_parent, property);
                {
                        boost::mutex::scoped_lock lm (_mutex);
                        if (member && member.get() == new_value) {
index a527b1f809605a8435ebcece3738aebb01ec8983..0514ca6f7ddf411e658b0972ab1bf652f88bbfb2 100644 (file)
@@ -159,11 +159,11 @@ DCPContent::examine (shared_ptr<Job> job)
        string const old_name = name ();
        int const old_texts = text.size ();
 
-       ContentChange cc_texts (this, DCPContentProperty::TEXTS);
-       ContentChange cc_assets (this, DCPContentProperty::NEEDS_ASSETS);
-       ContentChange cc_kdm (this, DCPContentProperty::NEEDS_KDM);
-       ContentChange cc_name (this, DCPContentProperty::NAME);
-       ContentChange cc_streams (this, AudioContentProperty::STREAMS);
+       ChangeSignaller<Content> cc_texts (this, DCPContentProperty::TEXTS);
+       ChangeSignaller<Content> cc_assets (this, DCPContentProperty::NEEDS_ASSETS);
+       ChangeSignaller<Content> cc_kdm (this, DCPContentProperty::NEEDS_KDM);
+       ChangeSignaller<Content> cc_name (this, DCPContentProperty::NAME);
+       ChangeSignaller<Content> cc_streams (this, AudioContentProperty::STREAMS);
 
        if (job) {
                job->set_progress_unknown ();
@@ -182,7 +182,7 @@ DCPContent::examine (shared_ptr<Job> job)
        }
 
        if (examiner->has_audio()) {
-               ContentChange cc (this, AudioContentProperty::STREAMS);
+               ChangeSignaller<Content> cc (this, AudioContentProperty::STREAMS);
                {
                        boost::mutex::scoped_lock lm (_mutex);
                        audio.reset (new AudioContent (this));
@@ -401,7 +401,7 @@ DCPContent::set_default_colour_conversion ()
 void
 DCPContent::set_reference_video (bool r)
 {
-       ContentChange cc (this, DCPContentProperty::REFERENCE_VIDEO);
+       ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_VIDEO);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -412,7 +412,7 @@ DCPContent::set_reference_video (bool r)
 void
 DCPContent::set_reference_audio (bool r)
 {
-       ContentChange cc (this, DCPContentProperty::REFERENCE_AUDIO);
+       ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_AUDIO);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -423,7 +423,7 @@ DCPContent::set_reference_audio (bool r)
 void
 DCPContent::set_reference_text (TextType type, bool r)
 {
-       ContentChange cc (this, DCPContentProperty::REFERENCE_TEXT);
+       ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_TEXT);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -649,7 +649,7 @@ DCPContent::take_settings_from (shared_ptr<const Content> c)
 void
 DCPContent::set_cpl (string id)
 {
-       ContentChange cc (this, DCPContentProperty::CPL);
+       ChangeSignaller<Content> cc (this, DCPContentProperty::CPL);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 05b6ae8ea8a9105952c858d3ae3bc5a116be2030..961c0b0a39c77d9a63372f4fb34b870fa98fdc33 100644 (file)
@@ -251,8 +251,8 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
 void
 FFmpegContent::examine (shared_ptr<Job> job)
 {
-       ContentChange cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
-       ContentChange cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
+       ChangeSignaller<Content> cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
+       ChangeSignaller<Content> cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
 
        job->set_progress_unknown ();
 
@@ -369,7 +369,7 @@ FFmpegContent::technical_summary () const
 void
 FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
 {
-       ContentChange cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+       ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -410,7 +410,7 @@ FFmpegContent::full_length () const
 void
 FFmpegContent::set_filters (vector<Filter const *> const & filters)
 {
-       ContentChange cc (this, FFmpegContentProperty::FILTERS);
+       ChangeSignaller<Content> cc (this, FFmpegContentProperty::FILTERS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -630,7 +630,7 @@ void
 FFmpegContent::signal_subtitle_stream_changed ()
 {
        /* XXX: this is too late; really it should be before the change */
-       ContentChange cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+       ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
 }
 
 vector<shared_ptr<FFmpegAudioStream> >
index eaaa611afdbe52a762ccd957fd79f7d3c0c03508..8576c5a670a18eb11d90d143d286b7120f485f76 100644 (file)
@@ -51,6 +51,7 @@
 #include "dcp_content.h"
 #include "screen_kdm.h"
 #include "cinema.h"
+#include "change_signaller.h"
 #include <libcxml/cxml.h>
 #include <dcp/cpl.h>
 #include <dcp/certificate_chain.h>
@@ -824,141 +825,142 @@ Film::set_directory (boost::filesystem::path d)
 void
 Film::set_name (string n)
 {
+       ChangeSignaller<Film> ch (this, NAME);
        _name = n;
-       signal_changed (NAME);
 }
 
 void
 Film::set_use_isdcf_name (bool u)
 {
+       ChangeSignaller<Film> ch (this, USE_ISDCF_NAME);
        _use_isdcf_name = u;
-       signal_changed (USE_ISDCF_NAME);
 }
 
 void
 Film::set_dcp_content_type (DCPContentType const * t)
 {
+       ChangeSignaller<Film> ch (this, DCP_CONTENT_TYPE);
        _dcp_content_type = t;
-       signal_changed (DCP_CONTENT_TYPE);
 }
 
 void
 Film::set_container (Ratio const * c)
 {
+       ChangeSignaller<Film> ch (this, CONTAINER);
        _container = c;
-       signal_changed (CONTAINER);
 }
 
 void
 Film::set_resolution (Resolution r)
 {
+       ChangeSignaller<Film> ch (this, RESOLUTION);
        _resolution = r;
-       signal_changed (RESOLUTION);
 }
 
 void
 Film::set_j2k_bandwidth (int b)
 {
+       ChangeSignaller<Film> ch (this, J2K_BANDWIDTH);
        _j2k_bandwidth = b;
-       signal_changed (J2K_BANDWIDTH);
 }
 
 void
 Film::set_isdcf_metadata (ISDCFMetadata m)
 {
+       ChangeSignaller<Film> ch (this, ISDCF_METADATA);
        _isdcf_metadata = m;
-       signal_changed (ISDCF_METADATA);
 }
 
 void
 Film::set_video_frame_rate (int f)
 {
+       ChangeSignaller<Film> ch (this, VIDEO_FRAME_RATE);
        _video_frame_rate = f;
-       signal_changed (VIDEO_FRAME_RATE);
 }
 
 void
 Film::set_audio_channels (int c)
 {
+       ChangeSignaller<Film> ch (this, AUDIO_CHANNELS);
        _audio_channels = c;
-       signal_changed (AUDIO_CHANNELS);
 }
 
 void
 Film::set_three_d (bool t)
 {
+       ChangeSignaller<Film> ch (this, THREE_D);
        _three_d = t;
-       signal_changed (THREE_D);
 
        if (_three_d && _isdcf_metadata.two_d_version_of_three_d) {
+               ChangeSignaller<Film> ch (this, ISDCF_METADATA);
                _isdcf_metadata.two_d_version_of_three_d = false;
-               signal_changed (ISDCF_METADATA);
        }
 }
 
 void
 Film::set_interop (bool i)
 {
+       ChangeSignaller<Film> ch (this, INTEROP);
        _interop = i;
-       signal_changed (INTEROP);
 }
 
 void
 Film::set_audio_processor (AudioProcessor const * processor)
 {
+       ChangeSignaller<Film> ch1 (this, AUDIO_PROCESSOR);
+       ChangeSignaller<Film> ch2 (this, AUDIO_CHANNELS);
        _audio_processor = processor;
-       signal_changed (AUDIO_PROCESSOR);
-       signal_changed (AUDIO_CHANNELS);
 }
 
 void
 Film::set_reel_type (ReelType t)
 {
+       ChangeSignaller<Film> ch (this, REEL_TYPE);
        _reel_type = t;
-       signal_changed (REEL_TYPE);
 }
 
 /** @param r Desired reel length in bytes */
 void
 Film::set_reel_length (int64_t r)
 {
+       ChangeSignaller<Film> ch (this, REEL_LENGTH);
        _reel_length = r;
-       signal_changed (REEL_LENGTH);
 }
 
 void
 Film::set_upload_after_make_dcp (bool u)
 {
+       ChangeSignaller<Film> ch (this, UPLOAD_AFTER_MAKE_DCP);
        _upload_after_make_dcp = u;
-       signal_changed (UPLOAD_AFTER_MAKE_DCP);
 }
 
 void
-Film::signal_changed (Property p)
+Film::signal_change (ChangeType type, int p)
 {
-       _dirty = true;
-
-       Change (CHANGE_TYPE_PENDING, p);
-       bool changed = false;
+       signal_change (type, static_cast<Property>(p));
+}
 
-       switch (p) {
-       case Film::CONTENT:
-               set_video_frame_rate (_playlist->best_video_frame_rate ());
-               changed = true;
-               break;
-       case Film::VIDEO_FRAME_RATE:
-       case Film::SEQUENCE:
-               _playlist->maybe_sequence ();
-               changed = true;
-               break;
-       default:
-               break;
-       }
+void
+Film::signal_change (ChangeType type, Property p)
+{
+       if (type == CHANGE_TYPE_DONE) {
+               _dirty = true;
+
+               switch (p) {
+               case Film::CONTENT:
+                       set_video_frame_rate (_playlist->best_video_frame_rate ());
+                       break;
+               case Film::VIDEO_FRAME_RATE:
+               case Film::SEQUENCE:
+                       _playlist->maybe_sequence ();
+                       break;
+               default:
+                       break;
+               }
 
-       if (changed) {
-               emit (boost::bind (boost::ref (Change), CHANGE_TYPE_DONE, p));
+               emit (boost::bind (boost::ref (Change), type, p));
        } else {
-               Change (CHANGE_TYPE_CANCELLED, p);
+               Change (type, p);
        }
 }
 
@@ -1036,22 +1038,22 @@ Film::cpls () const
 void
 Film::set_signed (bool s)
 {
+       ChangeSignaller<Film> ch (this, SIGNED);
        _signed = s;
-       signal_changed (SIGNED);
 }
 
 void
 Film::set_encrypted (bool e)
 {
+       ChangeSignaller<Film> ch (this, ENCRYPTED);
        _encrypted = e;
-       signal_changed (ENCRYPTED);
 }
 
 void
 Film::set_key (dcp::Key key)
 {
+       ChangeSignaller<Film> ch (this, KEY);
        _key = key;
-       signal_changed (KEY);
 }
 
 ContentList
@@ -1165,34 +1167,31 @@ Film::active_frame_rate_change (DCPTime t) const
 void
 Film::playlist_content_change (ChangeType type, weak_ptr<Content> c, int p, bool frequent)
 {
-       if (type != CHANGE_TYPE_DONE) {
-               return;
-       }
-
-       _dirty = true;
-
        if (p == ContentProperty::VIDEO_FRAME_RATE) {
-               set_video_frame_rate (_playlist->best_video_frame_rate ());
+               signal_change (type, Film::CONTENT);
        } else if (p == AudioContentProperty::STREAMS) {
-               signal_changed (NAME);
+               signal_change (type, Film::NAME);
        }
 
-       emit (boost::bind (boost::ref (ContentChange), type, c, p, frequent));
+       if (type == CHANGE_TYPE_DONE) {
+               emit (boost::bind (boost::ref (ContentChange), type, c, p, frequent));
+       } else {
+               ContentChange (type, c, p, frequent);
+       }
 }
 
 void
 Film::playlist_change (ChangeType type)
 {
-       if (type == CHANGE_TYPE_DONE) {
-               signal_changed (CONTENT);
-               signal_changed (NAME);
-       }
+       signal_change (type, CONTENT);
+       signal_change (type, NAME);
 }
 
 void
 Film::playlist_order_changed ()
 {
-       signal_changed (CONTENT_ORDER);
+       /* XXX: missing PENDING */
+       signal_change (CHANGE_TYPE_DONE, CONTENT_ORDER);
 }
 
 int
@@ -1214,9 +1213,9 @@ Film::set_sequence (bool s)
                return;
        }
 
+       ChangeSignaller<Film> cc (this, SEQUENCE);
        _sequence = s;
        _playlist->set_sequence (s);
-       signal_changed (SEQUENCE);
 }
 
 /** @return Size of the largest possible image in whatever resolution we are using */
index 649768c7a620141c0ddb6d4ed7040d2c98b4fef4..26700323a43ba8d6167a3ef9e250cfb5761b53cd 100644 (file)
@@ -335,8 +335,10 @@ public:
 private:
 
        friend struct ::isdcf_name_test;
+       template <typename> friend class ChangeSignaller;
 
-       void signal_changed (Property);
+       void signal_change (ChangeType, Property);
+       void signal_change (ChangeType, int);
        std::string video_identifier () const;
        void playlist_change (ChangeType);
        void playlist_order_changed ();
index 35dee525adf9c94827842e2376411e875279f5a1..a077b2c463353556aad1e05f953b516f66420fb4 100644 (file)
@@ -427,7 +427,7 @@ void
 TextContent::font_changed ()
 {
        /* XXX: too late */
-       ContentChange cc (_parent, TextContentProperty::FONTS);
+       ChangeSignaller<Content> cc (_parent, TextContentProperty::FONTS);
 }
 
 void
index 81f4138fbef98248cf52aa16a7a8375c7d9a5adc..8cb30546371a7c43a19a3afd1529c7941ffbb0c4 100644 (file)
@@ -234,9 +234,9 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d)
        optional<double> const ar = d->sample_aspect_ratio ();
        bool const yuv = d->yuv ();
 
-       ContentChange cc1 (_parent, VideoContentProperty::SIZE);
-       ContentChange cc2 (_parent, VideoContentProperty::SCALE);
-       ContentChange cc3 (_parent, ContentProperty::LENGTH);
+       ChangeSignaller<Content> cc1 (_parent, VideoContentProperty::SIZE);
+       ChangeSignaller<Content> cc2 (_parent, VideoContentProperty::SCALE);
+       ChangeSignaller<Content> cc3 (_parent, ContentProperty::LENGTH);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 68e44ccd053608d7c79dd57e7bb8313237803b31..0cc3d782361fd3648b13bed645f69eb115e67c60 100644 (file)
@@ -47,7 +47,6 @@ sources = """
           colour_conversion.cc
           config.cc
           content.cc
-          content_change.cc
           content_factory.cc
           cross.cc
           curl_uploader.cc