summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-31 23:47:14 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-31 23:47:14 +0100
commite0255a64d22440d718e5512f34a4f21f0d37a21b (patch)
tree61927018d28794c7c32c238bc37259bfddb2f01c /src/lib
parent8fedaaa75c4586a4cc7ffb393bd71d1fdb091dc8 (diff)
Use enum class for Film::Property.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_content.cc8
-rw-r--r--src/lib/butler.h13
-rw-r--r--src/lib/change_signaller.h24
-rw-r--r--src/lib/content.cc12
-rw-r--r--src/lib/content.h6
-rw-r--r--src/lib/content_part.h4
-rw-r--r--src/lib/dcp_content.cc16
-rw-r--r--src/lib/ffmpeg_content.cc10
-rw-r--r--src/lib/film.cc84
-rw-r--r--src/lib/film.h27
-rw-r--r--src/lib/player.cc10
-rw-r--r--src/lib/playlist.h3
-rw-r--r--src/lib/text_content.cc2
-rw-r--r--src/lib/types.h7
-rw-r--r--src/lib/video_content.cc8
15 files changed, 125 insertions, 109 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index c70afcda4..4f5fd8748 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -146,7 +146,7 @@ AudioContent::technical_summary () const
void
AudioContent::set_mapping (AudioMapping mapping)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
int c = 0;
for (auto i: streams()) {
@@ -328,7 +328,7 @@ AudioContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p
void
AudioContent::set_streams (vector<AudioStreamPtr> streams)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -347,7 +347,7 @@ AudioContent::stream () const
void
AudioContent::add_stream (AudioStreamPtr stream)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -358,7 +358,7 @@ AudioContent::add_stream (AudioStreamPtr stream)
void
AudioContent::set_stream (AudioStreamPtr stream)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/butler.h b/src/lib/butler.h
index 49a57a826..8c7f554cb 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,15 +18,16 @@
*/
-#include "video_ring_buffers.h"
-#include "audio_ring_buffers.h"
-#include "text_ring_buffers.h"
#include "audio_mapping.h"
+#include "audio_ring_buffers.h"
+#include "change_signaller.h"
#include "exception_store.h"
+#include "text_ring_buffers.h"
+#include "video_ring_buffers.h"
+#include <boost/asio.hpp>
+#include <boost/signals2.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
-#include <boost/signals2.hpp>
-#include <boost/asio.hpp>
class Player;
class PlayerVideo;
diff --git a/src/lib/change_signaller.h b/src/lib/change_signaller.h
index 55a5f2dc5..74965fc3e 100644
--- a/src/lib/change_signaller.h
+++ b/src/lib/change_signaller.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,16 +18,24 @@
*/
+
#ifndef DCPOMATIC_CHANGE_SIGNALLER_H
#define DCPOMATIC_CHANGE_SIGNALLER_H
-#include <boost/noncopyable.hpp>
-template <class T>
-class ChangeSignaller : public boost::noncopyable
+enum class ChangeType
+{
+ PENDING,
+ DONE,
+ CANCELLED
+};
+
+
+template <class T, class P>
+class ChangeSignaller
{
public:
- ChangeSignaller (T* t, int p)
+ ChangeSignaller (T* t, P p)
: _thing (t)
, _property (p)
, _done (true)
@@ -44,6 +52,9 @@ public:
}
}
+ ChangeSignaller (ChangeSignaller const&) = delete;
+ ChangeSignaller& operator== (ChangeSignaller const&) = delete;
+
void abort ()
{
_done = false;
@@ -51,8 +62,9 @@ public:
private:
T* _thing;
- int _property;
+ P _property;
bool _done;
};
+
#endif
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 40790bdc0..0171563ae 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -229,7 +229,7 @@ Content::set_position (shared_ptr<const Film> film, DCPTime p, bool force_emit)
audio->modify_position (film, p);
}
- ChangeSignaller<Content> cc (this, ContentProperty::POSITION);
+ ContentChangeSignaller cc (this, ContentProperty::POSITION);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -256,7 +256,7 @@ Content::set_trim_start (ContentTime t)
audio->modify_trim_start (t);
}
- ChangeSignaller<Content> cc (this, ContentProperty::TRIM_START);
+ ContentChangeSignaller cc (this, ContentProperty::TRIM_START);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -267,7 +267,7 @@ Content::set_trim_start (ContentTime t)
void
Content::set_trim_end (ContentTime t)
{
- ChangeSignaller<Content> cc (this, ContentProperty::TRIM_END);
+ ContentChangeSignaller cc (this, ContentProperty::TRIM_END);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -338,7 +338,7 @@ Content::paths_valid () const
void
Content::set_paths (vector<boost::filesystem::path> paths)
{
- ChangeSignaller<Content> cc (this, ContentProperty::PATH);
+ ContentChangeSignaller cc (this, ContentProperty::PATH);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -389,7 +389,7 @@ Content::reel_split_points (shared_ptr<const Film>) const
void
Content::set_video_frame_rate (double r)
{
- ChangeSignaller<Content> cc (this, ContentProperty::VIDEO_FRAME_RATE);
+ ContentChangeSignaller cc (this, ContentProperty::VIDEO_FRAME_RATE);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -408,7 +408,7 @@ Content::set_video_frame_rate (double r)
void
Content::unset_video_frame_rate ()
{
- ChangeSignaller<Content> cc (this, ContentProperty::VIDEO_FRAME_RATE);
+ ContentChangeSignaller cc (this, ContentProperty::VIDEO_FRAME_RATE);
{
boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/content.h b/src/lib/content.h
index 8a28762d3..eafadd3ec 100644
--- a/src/lib/content.h
+++ b/src/lib/content.h
@@ -212,7 +212,7 @@ private:
friend struct best_dcp_frame_rate_test_single;
friend struct best_dcp_frame_rate_test_double;
friend struct audio_sampling_rate_test;
- template<class> friend class ChangeSignaller;
+ template<class, class> friend class ChangeSignaller;
void signal_change (ChangeType, int);
@@ -232,4 +232,8 @@ private:
bool _change_signals_frequent;
};
+
+typedef ChangeSignaller<Content, int> ContentChangeSignaller;
+
+
#endif
diff --git a/src/lib/content_part.h b/src/lib/content_part.h
index a81334270..443c356b1 100644
--- a/src/lib/content_part.h
+++ b/src/lib/content_part.h
@@ -41,7 +41,7 @@ protected:
void
maybe_set (T& member, T new_value, int property) const
{
- ChangeSignaller<Content> cc (_parent, property);
+ ContentChangeSignaller cc (_parent, property);
{
boost::mutex::scoped_lock lm (_mutex);
if (member == new_value) {
@@ -56,7 +56,7 @@ protected:
void
maybe_set (boost::optional<T>& member, T new_value, int property) const
{
- ChangeSignaller<Content> cc (_parent, property);
+ ContentChangeSignaller cc (_parent, property);
{
boost::mutex::scoped_lock lm (_mutex);
if (member && member.get() == new_value) {
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 4bd718e96..156a1a205 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -219,10 +219,10 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
bool const needed_kdm = needs_kdm ();
string const old_name = name ();
- 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);
+ ContentChangeSignaller cc_texts (this, DCPContentProperty::TEXTS);
+ ContentChangeSignaller cc_assets (this, DCPContentProperty::NEEDS_ASSETS);
+ ContentChangeSignaller cc_kdm (this, DCPContentProperty::NEEDS_KDM);
+ ContentChangeSignaller cc_name (this, DCPContentProperty::NAME);
if (job) {
job->set_progress_unknown ();
@@ -509,7 +509,7 @@ DCPContent::set_default_colour_conversion ()
void
DCPContent::set_reference_video (bool r)
{
- ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_VIDEO);
+ ContentChangeSignaller cc (this, DCPContentProperty::REFERENCE_VIDEO);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -520,7 +520,7 @@ DCPContent::set_reference_video (bool r)
void
DCPContent::set_reference_audio (bool r)
{
- ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_AUDIO);
+ ContentChangeSignaller cc (this, DCPContentProperty::REFERENCE_AUDIO);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -531,7 +531,7 @@ DCPContent::set_reference_audio (bool r)
void
DCPContent::set_reference_text (TextType type, bool r)
{
- ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_TEXT);
+ ContentChangeSignaller cc (this, DCPContentProperty::REFERENCE_TEXT);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -788,7 +788,7 @@ DCPContent::take_settings_from (shared_ptr<const Content> c)
void
DCPContent::set_cpl (string id)
{
- ChangeSignaller<Content> cc (this, DCPContentProperty::CPL);
+ ContentChangeSignaller cc (this, DCPContentProperty::CPL);
{
boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 7f1c75a93..b1bb632b1 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -248,8 +248,8 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
void
FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
- ChangeSignaller<Content> cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
- ChangeSignaller<Content> cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
+ ContentChangeSignaller cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
+ ContentChangeSignaller cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
if (job) {
job->set_progress_unknown ();
@@ -375,7 +375,7 @@ FFmpegContent::technical_summary () const
void
FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
{
- ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+ ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -436,7 +436,7 @@ FFmpegContent::approximate_length () const
void
FFmpegContent::set_filters (vector<Filter const *> const & filters)
{
- ChangeSignaller<Content> cc (this, FFmpegContentProperty::FILTERS);
+ ContentChangeSignaller cc (this, FFmpegContentProperty::FILTERS);
{
boost::mutex::scoped_lock lm (_mutex);
@@ -658,7 +658,7 @@ void
FFmpegContent::signal_subtitle_stream_changed ()
{
/* XXX: this is too late; really it should be before the change */
- ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+ ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
}
vector<shared_ptr<FFmpegAudioStream> >
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 193dedf4c..772024902 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -1034,21 +1034,21 @@ Film::set_directory (boost::filesystem::path d)
void
Film::set_name (string n)
{
- ChangeSignaller<Film> ch (this, NAME);
+ FilmChangeSignaller ch (this, Property::NAME);
_name = n;
}
void
Film::set_use_isdcf_name (bool u)
{
- ChangeSignaller<Film> ch (this, USE_ISDCF_NAME);
+ FilmChangeSignaller ch (this, Property::USE_ISDCF_NAME);
_use_isdcf_name = u;
}
void
Film::set_dcp_content_type (DCPContentType const * t)
{
- ChangeSignaller<Film> ch (this, DCP_CONTENT_TYPE);
+ FilmChangeSignaller ch (this, Property::DCP_CONTENT_TYPE);
_dcp_content_type = t;
}
@@ -1060,7 +1060,7 @@ Film::set_dcp_content_type (DCPContentType const * t)
void
Film::set_container (Ratio const * c, bool explicit_user)
{
- ChangeSignaller<Film> ch (this, CONTAINER);
+ FilmChangeSignaller ch (this, Property::CONTAINER);
_container = c;
if (explicit_user) {
@@ -1076,7 +1076,7 @@ Film::set_container (Ratio const * c, bool explicit_user)
void
Film::set_resolution (Resolution r, bool explicit_user)
{
- ChangeSignaller<Film> ch (this, RESOLUTION);
+ FilmChangeSignaller ch (this, Property::RESOLUTION);
_resolution = r;
if (explicit_user) {
@@ -1088,14 +1088,14 @@ Film::set_resolution (Resolution r, bool explicit_user)
void
Film::set_j2k_bandwidth (int b)
{
- ChangeSignaller<Film> ch (this, J2K_BANDWIDTH);
+ FilmChangeSignaller ch (this, Property::J2K_BANDWIDTH);
_j2k_bandwidth = b;
}
void
Film::set_isdcf_metadata (ISDCFMetadata m)
{
- ChangeSignaller<Film> ch (this, ISDCF_METADATA);
+ FilmChangeSignaller ch (this, Property::ISDCF_METADATA);
_isdcf_metadata = m;
}
@@ -1106,7 +1106,7 @@ Film::set_isdcf_metadata (ISDCFMetadata m)
void
Film::set_video_frame_rate (int f, bool user_explicit)
{
- ChangeSignaller<Film> ch (this, VIDEO_FRAME_RATE);
+ FilmChangeSignaller ch (this, Property::VIDEO_FRAME_RATE);
_video_frame_rate = f;
if (user_explicit) {
_user_explicit_video_frame_rate = true;
@@ -1116,18 +1116,18 @@ Film::set_video_frame_rate (int f, bool user_explicit)
void
Film::set_audio_channels (int c)
{
- ChangeSignaller<Film> ch (this, AUDIO_CHANNELS);
+ FilmChangeSignaller ch (this, Property::AUDIO_CHANNELS);
_audio_channels = c;
}
void
Film::set_three_d (bool t)
{
- ChangeSignaller<Film> ch (this, THREE_D);
+ FilmChangeSignaller ch (this, Property::THREE_D);
_three_d = t;
if (_three_d && _isdcf_metadata.two_d_version_of_three_d) {
- ChangeSignaller<Film> ch (this, ISDCF_METADATA);
+ FilmChangeSignaller ch (this, Property::ISDCF_METADATA);
_isdcf_metadata.two_d_version_of_three_d = false;
}
}
@@ -1135,22 +1135,22 @@ Film::set_three_d (bool t)
void
Film::set_interop (bool i)
{
- ChangeSignaller<Film> ch (this, INTEROP);
+ FilmChangeSignaller ch (this, Property::INTEROP);
_interop = i;
}
void
Film::set_audio_processor (AudioProcessor const * processor)
{
- ChangeSignaller<Film> ch1 (this, AUDIO_PROCESSOR);
- ChangeSignaller<Film> ch2 (this, AUDIO_CHANNELS);
+ FilmChangeSignaller ch1 (this, Property::AUDIO_PROCESSOR);
+ FilmChangeSignaller ch2 (this, Property::AUDIO_CHANNELS);
_audio_processor = processor;
}
void
Film::set_reel_type (ReelType t)
{
- ChangeSignaller<Film> ch (this, REEL_TYPE);
+ FilmChangeSignaller ch (this, Property::REEL_TYPE);
_reel_type = t;
}
@@ -1158,14 +1158,14 @@ Film::set_reel_type (ReelType t)
void
Film::set_reel_length (int64_t r)
{
- ChangeSignaller<Film> ch (this, REEL_LENGTH);
+ FilmChangeSignaller ch (this, Property::REEL_LENGTH);
_reel_length = r;
}
void
Film::set_reencode_j2k (bool r)
{
- ChangeSignaller<Film> ch (this, REENCODE_J2K);
+ FilmChangeSignaller ch (this, Property::REENCODE_J2K);
_reencode_j2k = r;
}
@@ -1181,7 +1181,7 @@ Film::signal_change (ChangeType type, Property p)
if (type == ChangeType::DONE) {
_dirty = true;
- if (p == Film::CONTENT) {
+ if (p == Property::CONTENT) {
if (!_user_explicit_video_frame_rate) {
set_video_frame_rate (best_video_frame_rate());
}
@@ -1189,7 +1189,7 @@ Film::signal_change (ChangeType type, Property p)
emit (boost::bind (boost::ref (Change), type, p));
- if (p == Film::VIDEO_FRAME_RATE || p == Film::SEQUENCE) {
+ if (p == Property::VIDEO_FRAME_RATE || p == Property::SEQUENCE) {
/* We want to call Playlist::maybe_sequence but this must happen after the
main signal emission (since the butler will see that emission and un-suspend itself).
*/
@@ -1275,7 +1275,7 @@ Film::cpls () const
void
Film::set_encrypted (bool e)
{
- ChangeSignaller<Film> ch (this, ENCRYPTED);
+ FilmChangeSignaller ch (this, Property::ENCRYPTED);
_encrypted = e;
}
@@ -1444,9 +1444,9 @@ void
Film::playlist_content_change (ChangeType type, weak_ptr<Content> c, int p, bool frequent)
{
if (p == ContentProperty::VIDEO_FRAME_RATE) {
- signal_change (type, Film::CONTENT);
+ signal_change (type, Property::CONTENT);
} else if (p == AudioContentProperty::STREAMS) {
- signal_change (type, Film::NAME);
+ signal_change (type, Property::NAME);
}
if (type == ChangeType::DONE) {
@@ -1470,8 +1470,8 @@ Film::playlist_length_change ()
void
Film::playlist_change (ChangeType type)
{
- signal_change (type, CONTENT);
- signal_change (type, NAME);
+ signal_change (type, Property::CONTENT);
+ signal_change (type, Property::NAME);
if (type == ChangeType::DONE) {
check_settings_consistency ();
@@ -1536,7 +1536,7 @@ void
Film::playlist_order_changed ()
{
/* XXX: missing PENDING */
- signal_change (ChangeType::DONE, CONTENT_ORDER);
+ signal_change (ChangeType::DONE, Property::CONTENT_ORDER);
}
int
@@ -1555,7 +1555,7 @@ Film::set_sequence (bool s)
return;
}
- ChangeSignaller<Film> cc (this, SEQUENCE);
+ FilmChangeSignaller cc (this, Property::SEQUENCE);
_sequence = s;
_playlist->set_sequence (s);
}
@@ -1924,14 +1924,14 @@ Film::closed_caption_tracks () const
void
Film::set_marker (dcp::Marker type, DCPTime time)
{
- ChangeSignaller<Film> ch (this, MARKERS);
+ FilmChangeSignaller ch (this, Property::MARKERS);
_markers[type] = time;
}
void
Film::unset_marker (dcp::Marker type)
{
- ChangeSignaller<Film> ch (this, MARKERS);
+ FilmChangeSignaller ch (this, Property::MARKERS);
_markers.erase (type);
}
@@ -1939,7 +1939,7 @@ Film::unset_marker (dcp::Marker type)
void
Film::clear_markers ()
{
- ChangeSignaller<Film> ch (this, MARKERS);
+ FilmChangeSignaller ch (this, Property::MARKERS);
_markers.clear ();
}
@@ -1947,14 +1947,14 @@ Film::clear_markers ()
void
Film::set_ratings (vector<dcp::Rating> r)
{
- ChangeSignaller<Film> ch (this, RATINGS);
+ FilmChangeSignaller ch (this, Property::RATINGS);
_ratings = r;
}
void
Film::set_content_versions (vector<string> v)
{
- ChangeSignaller<Film> ch (this, CONTENT_VERSIONS);
+ FilmChangeSignaller ch (this, Property::CONTENT_VERSIONS);
_content_versions = v;
}
@@ -1962,7 +1962,7 @@ Film::set_content_versions (vector<string> v)
void
Film::set_name_language (dcp::LanguageTag lang)
{
- ChangeSignaller<Film> ch (this, NAME_LANGUAGE);
+ FilmChangeSignaller ch (this, Property::NAME_LANGUAGE);
_name_language = lang;
}
@@ -1970,7 +1970,7 @@ Film::set_name_language (dcp::LanguageTag lang)
void
Film::set_audio_language (dcp::LanguageTag lang)
{
- ChangeSignaller<Film> ch (this, AUDIO_LANGUAGE);
+ FilmChangeSignaller ch (this, Property::AUDIO_LANGUAGE);
_audio_language = lang;
}
@@ -1978,7 +1978,7 @@ Film::set_audio_language (dcp::LanguageTag lang)
void
Film::set_release_territory (dcp::LanguageTag::RegionSubtag region)
{
- ChangeSignaller<Film> ch (this, RELEASE_TERRITORY);
+ FilmChangeSignaller ch (this, Property::RELEASE_TERRITORY);
_release_territory = region;
}
@@ -1986,7 +1986,7 @@ Film::set_release_territory (dcp::LanguageTag::RegionSubtag region)
void
Film::set_status (dcp::Status s)
{
- ChangeSignaller<Film> ch (this, STATUS);
+ FilmChangeSignaller ch (this, Property::STATUS);
_status = s;
}
@@ -1994,7 +1994,7 @@ Film::set_status (dcp::Status s)
void
Film::set_version_number (int v)
{
- ChangeSignaller<Film> ch (this, VERSION_NUMBER);
+ FilmChangeSignaller ch (this, Property::VERSION_NUMBER);
_version_number = v;
}
@@ -2002,7 +2002,7 @@ Film::set_version_number (int v)
void
Film::set_chain (string c)
{
- ChangeSignaller<Film> ch (this, CHAIN);
+ FilmChangeSignaller ch (this, Property::CHAIN);
_chain = c;
}
@@ -2010,7 +2010,7 @@ Film::set_chain (string c)
void
Film::set_distributor (string d)
{
- ChangeSignaller<Film> ch (this, DISTRIBUTOR);
+ FilmChangeSignaller ch (this, Property::DISTRIBUTOR);
_distributor = d;
}
@@ -2018,7 +2018,7 @@ Film::set_distributor (string d)
void
Film::set_luminance (dcp::Luminance l)
{
- ChangeSignaller<Film> ch (this, LUMINANCE);
+ FilmChangeSignaller ch (this, Property::LUMINANCE);
_luminance = l;
}
@@ -2033,7 +2033,7 @@ Film::set_subtitle_language (dcp::LanguageTag language)
void
Film::unset_subtitle_language ()
{
- ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+ FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES);
_subtitle_languages.clear();
}
@@ -2041,7 +2041,7 @@ Film::unset_subtitle_language ()
void
Film::set_subtitle_languages (vector<dcp::LanguageTag> languages)
{
- ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+ FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES);
_subtitle_languages = languages;
}
@@ -2049,7 +2049,7 @@ Film::set_subtitle_languages (vector<dcp::LanguageTag> languages)
void
Film::set_facility (string f)
{
- ChangeSignaller<Film> ch (this, FACILITY);
+ FilmChangeSignaller ch (this, Property::FACILITY);
_facility = f;
}
diff --git a/src/lib/film.h b/src/lib/film.h
index 6828df21a..c354b646c 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -26,22 +26,23 @@
#ifndef DCPOMATIC_FILM_H
#define DCPOMATIC_FILM_H
-#include "util.h"
-#include "types.h"
-#include "isdcf_metadata.h"
+#include "change_signaller.h"
+#include "dcp_text_track.h"
#include "frame_rate_change.h"
+#include "isdcf_metadata.h"
#include "signaller.h"
-#include "dcp_text_track.h"
-#include <dcp/language_tag.h>
-#include <dcp/key.h>
+#include "types.h"
+#include "util.h"
#include <dcp/encrypted_kdm.h>
+#include <dcp/key.h>
+#include <dcp/language_tag.h>
+#include <boost/filesystem.hpp>
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
-#include <boost/filesystem.hpp>
#include <boost/thread/mutex.hpp>
+#include <inttypes.h>
#include <string>
#include <vector>
-#include <inttypes.h>
namespace xmlpp {
class Document;
@@ -201,7 +202,7 @@ public:
/** Identifiers for the parts of our state;
used for signalling changes.
*/
- enum Property {
+ enum class Property {
NONE,
NAME,
USE_ISDCF_NAME,
@@ -448,7 +449,7 @@ private:
friend struct ::isdcf_name_test;
friend struct ::recover_test_2d_encrypted;
friend struct ::atmos_encrypted_passthrough_test;
- template <typename> friend class ChangeSignaller;
+ template <class, class> friend class ChangeSignaller;
boost::filesystem::path info_file (dcpomatic::DCPTimePeriod p) const;
@@ -555,4 +556,8 @@ private:
friend struct film_metadata_test;
};
+
+typedef ChangeSignaller<Film, Film::Property> FilmChangeSignaller;
+
+
#endif
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 74e7480f5..b696f04c1 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -120,7 +120,7 @@ Player::construct ()
_playlist_content_change_connection = playlist()->ContentChange.connect (bind(&Player::playlist_content_change, this, _1, _3, _4));
set_video_container_size (_film->frame_size ());
- film_change (ChangeType::DONE, Film::AUDIO_PROCESSOR);
+ film_change (ChangeType::DONE, Film::Property::AUDIO_PROCESSOR);
setup_pieces ();
seek (DCPTime (), true);
@@ -333,9 +333,9 @@ Player::film_change (ChangeType type, Film::Property p)
last time we were run.
*/
- if (p == Film::CONTAINER) {
+ if (p == Film::Property::CONTAINER) {
Change (type, PlayerProperty::FILM_CONTAINER, false);
- } else if (p == Film::VIDEO_FRAME_RATE) {
+ } else if (p == Film::Property::VIDEO_FRAME_RATE) {
/* Pieces contain a FrameRateChange which contains the DCP frame rate,
so we need new pieces here.
*/
@@ -343,12 +343,12 @@ Player::film_change (ChangeType type, Film::Property p)
setup_pieces ();
}
Change (type, PlayerProperty::FILM_VIDEO_FRAME_RATE, false);
- } else if (p == Film::AUDIO_PROCESSOR) {
+ } else if (p == Film::Property::AUDIO_PROCESSOR) {
if (type == ChangeType::DONE && _film->audio_processor ()) {
boost::mutex::scoped_lock lm (_mutex);
_audio_processor = _film->audio_processor()->clone (_film->audio_frame_rate ());
}
- } else if (p == Film::AUDIO_CHANNELS) {
+ } else if (p == Film::Property::AUDIO_CHANNELS) {
if (type == ChangeType::DONE) {
boost::mutex::scoped_lock lm (_mutex);
_audio_merger.clear ();
diff --git a/src/lib/playlist.h b/src/lib/playlist.h
index b49baa430..91f39bf6b 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -21,8 +21,9 @@
#ifndef DCPOMATIC_PLAYLIST_H
#define DCPOMATIC_PLAYLIST_H
-#include "util.h"
+#include "change_signaller.h"
#include "frame_rate_change.h"
+#include "util.h"
#include <libcxml/cxml.h>
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc
index 79ac42f43..0c25e5696 100644
--- a/src/lib/text_content.cc
+++ b/src/lib/text_content.cc
@@ -430,7 +430,7 @@ void
TextContent::font_changed ()
{
/* XXX: too late */
- ChangeSignaller<Content> cc (_parent, TextContentProperty::FONTS);
+ ContentChangeSignaller cc (_parent, TextContentProperty::FONTS);
}
void
diff --git a/src/lib/types.h b/src/lib/types.h
index 3cd8768e8..6fbad2188 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -131,13 +131,6 @@ enum class ReelType
BY_LENGTH
};
-enum class ChangeType
-{
- PENDING,
- DONE,
- CANCELLED
-};
-
enum class VideoRange
{
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 216ad6784..fed28b5e4 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -284,10 +284,10 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d)
auto const yuv = d->yuv ();
auto const range = d->range ();
- ChangeSignaller<Content> cc1 (_parent, VideoContentProperty::SIZE);
- ChangeSignaller<Content> cc2 (_parent, VideoContentProperty::SCALE);
- ChangeSignaller<Content> cc3 (_parent, ContentProperty::LENGTH);
- ChangeSignaller<Content> cc4 (_parent, VideoContentProperty::RANGE);
+ ContentChangeSignaller cc1 (_parent, VideoContentProperty::SIZE);
+ ContentChangeSignaller cc2 (_parent, VideoContentProperty::SCALE);
+ ContentChangeSignaller cc3 (_parent, ContentProperty::LENGTH);
+ ContentChangeSignaller cc4 (_parent, VideoContentProperty::RANGE);
{
boost::mutex::scoped_lock lm (_mutex);