void
AudioContent::set_mapping (AudioMapping mapping)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
int c = 0;
for (auto i: streams()) {
void
AudioContent::set_streams (vector<AudioStreamPtr> streams)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
void
AudioContent::add_stream (AudioStreamPtr stream)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
void
AudioContent::set_stream (AudioStreamPtr stream)
{
- ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+ ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
/*
- 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.
*/
-#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;
/*
- 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.
*/
+
#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)
}
}
+ ChangeSignaller (ChangeSignaller const&) = delete;
+ ChangeSignaller& operator== (ChangeSignaller const&) = delete;
+
void abort ()
{
_done = false;
private:
T* _thing;
- int _property;
+ P _property;
bool _done;
};
+
#endif
audio->modify_position (film, p);
}
- ChangeSignaller<Content> cc (this, ContentProperty::POSITION);
+ ContentChangeSignaller cc (this, ContentProperty::POSITION);
{
boost::mutex::scoped_lock lm (_mutex);
audio->modify_trim_start (t);
}
- ChangeSignaller<Content> cc (this, ContentProperty::TRIM_START);
+ ContentChangeSignaller cc (this, ContentProperty::TRIM_START);
{
boost::mutex::scoped_lock lm (_mutex);
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);
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);
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);
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);
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);
bool _change_signals_frequent;
};
+
+typedef ChangeSignaller<Content, int> ContentChangeSignaller;
+
+
#endif
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) {
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) {
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 ();
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);
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);
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);
void
DCPContent::set_cpl (string id)
{
- ChangeSignaller<Content> cc (this, DCPContentProperty::CPL);
+ ContentChangeSignaller cc (this, DCPContentProperty::CPL);
{
boost::mutex::scoped_lock lm (_mutex);
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 ();
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);
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);
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> >
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;
}
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) {
void
Film::set_resolution (Resolution r, bool explicit_user)
{
- ChangeSignaller<Film> ch (this, RESOLUTION);
+ FilmChangeSignaller ch (this, Property::RESOLUTION);
_resolution = r;
if (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;
}
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;
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;
}
}
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;
}
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;
}
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());
}
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).
*/
void
Film::set_encrypted (bool e)
{
- ChangeSignaller<Film> ch (this, ENCRYPTED);
+ FilmChangeSignaller ch (this, Property::ENCRYPTED);
_encrypted = e;
}
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) {
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 ();
Film::playlist_order_changed ()
{
/* XXX: missing PENDING */
- signal_change (ChangeType::DONE, CONTENT_ORDER);
+ signal_change (ChangeType::DONE, Property::CONTENT_ORDER);
}
int
return;
}
- ChangeSignaller<Film> cc (this, SEQUENCE);
+ FilmChangeSignaller cc (this, Property::SEQUENCE);
_sequence = s;
_playlist->set_sequence (s);
}
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);
}
void
Film::clear_markers ()
{
- ChangeSignaller<Film> ch (this, MARKERS);
+ FilmChangeSignaller ch (this, Property::MARKERS);
_markers.clear ();
}
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;
}
void
Film::set_name_language (dcp::LanguageTag lang)
{
- ChangeSignaller<Film> ch (this, NAME_LANGUAGE);
+ FilmChangeSignaller ch (this, Property::NAME_LANGUAGE);
_name_language = lang;
}
void
Film::set_audio_language (dcp::LanguageTag lang)
{
- ChangeSignaller<Film> ch (this, AUDIO_LANGUAGE);
+ FilmChangeSignaller ch (this, Property::AUDIO_LANGUAGE);
_audio_language = 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;
}
void
Film::set_status (dcp::Status s)
{
- ChangeSignaller<Film> ch (this, STATUS);
+ FilmChangeSignaller ch (this, Property::STATUS);
_status = s;
}
void
Film::set_version_number (int v)
{
- ChangeSignaller<Film> ch (this, VERSION_NUMBER);
+ FilmChangeSignaller ch (this, Property::VERSION_NUMBER);
_version_number = v;
}
void
Film::set_chain (string c)
{
- ChangeSignaller<Film> ch (this, CHAIN);
+ FilmChangeSignaller ch (this, Property::CHAIN);
_chain = c;
}
void
Film::set_distributor (string d)
{
- ChangeSignaller<Film> ch (this, DISTRIBUTOR);
+ FilmChangeSignaller ch (this, Property::DISTRIBUTOR);
_distributor = d;
}
void
Film::set_luminance (dcp::Luminance l)
{
- ChangeSignaller<Film> ch (this, LUMINANCE);
+ FilmChangeSignaller ch (this, Property::LUMINANCE);
_luminance = l;
}
void
Film::unset_subtitle_language ()
{
- ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+ FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES);
_subtitle_languages.clear();
}
void
Film::set_subtitle_languages (vector<dcp::LanguageTag> languages)
{
- ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+ FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES);
_subtitle_languages = languages;
}
void
Film::set_facility (string f)
{
- ChangeSignaller<Film> ch (this, FACILITY);
+ FilmChangeSignaller ch (this, Property::FACILITY);
_facility = f;
}
/*
- 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.
#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;
/** Identifiers for the parts of our state;
used for signalling changes.
*/
- enum Property {
+ enum class Property {
NONE,
NAME,
USE_ISDCF_NAME,
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;
friend struct film_metadata_test;
};
+
+typedef ChangeSignaller<Film, Film::Property> FilmChangeSignaller;
+
+
#endif
_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);
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.
*/
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 ();
#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>
TextContent::font_changed ()
{
/* XXX: too late */
- ChangeSignaller<Content> cc (_parent, TextContentProperty::FONTS);
+ ContentChangeSignaller cc (_parent, TextContentProperty::FONTS);
}
void
BY_LENGTH
};
-enum class ChangeType
-{
- PENDING,
- DONE,
- CANCELLED
-};
-
enum class VideoRange
{
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);
void film_changed (ChangeType type, Film::Property property)
{
- if (type != ChangeType::DONE || property != Film::CONTENT) {
+ if (type != ChangeType::DONE || property != Film::Property::CONTENT) {
return;
}
wxBoxSizer* right = new wxBoxSizer (wxVERTICAL);
{
- wxStaticText* m = new StaticText (this, _("Channels"));
+ auto m = new StaticText (this, _("Channels"));
m->SetFont (subheading_font);
right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 16);
}
show_or_hide_channel_checkboxes ();
{
- wxStaticText* m = new StaticText (this, _("Type"));
+ auto m = new StaticText (this, _("Type"));
m->SetFont (subheading_font);
right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
}
}
{
- wxStaticText* m = new StaticText (this, _("Smoothing"));
+ auto m = new StaticText (this, _("Smoothing"));
m->SetFont (subheading_font);
right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
}
}
void
-AudioDialog::film_change (ChangeType type, int p)
+AudioDialog::film_change (ChangeType type, Film::Property p)
{
if (type != ChangeType::DONE) {
return;
}
- if (p == Film::AUDIO_CHANNELS) {
+ if (p == Film::Property::AUDIO_CHANNELS) {
auto film = _film.lock ();
if (film) {
_channels = film->audio_channels ();
void set_cursor (boost::optional<dcpomatic::DCPTime> time, boost::optional<float> db);
private:
- void film_change (ChangeType, int);
+ void film_change (ChangeType, Film::Property);
void content_change (ChangeType, int);
void channel_clicked (wxCommandEvent &);
void type_clicked (wxCommandEvent &);
_delay->wrapped()->SetRange (-1000, 1000);
content_selection_changed ();
- film_changed (Film::AUDIO_CHANNELS);
- film_changed (Film::VIDEO_FRAME_RATE);
- film_changed (Film::REEL_TYPE);
+ film_changed (Film::Property::AUDIO_CHANNELS);
+ film_changed (Film::Property::VIDEO_FRAME_RATE);
+ film_changed (Film::Property::REEL_TYPE);
_reference->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::reference_clicked, this));
_show->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::show_clicked, this));
}
switch (property) {
- case Film::AUDIO_CHANNELS:
- case Film::AUDIO_PROCESSOR:
+ case Film::Property::AUDIO_CHANNELS:
+ case Film::Property::AUDIO_PROCESSOR:
_mapping->set_output_channels (_parent->film()->audio_output_names ());
setup_peak ();
break;
- case Film::VIDEO_FRAME_RATE:
+ case Film::Property::VIDEO_FRAME_RATE:
setup_description ();
break;
- case Film::REEL_TYPE:
- case Film::INTEROP:
+ case Film::Property::REEL_TYPE:
+ case Film::Property::INTEROP:
setup_sensitivity ();
break;
default:
ContentPanel::film_changed (Film::Property p)
{
switch (p) {
- case Film::CONTENT:
- case Film::CONTENT_ORDER:
+ case Film::Property::CONTENT:
+ case Film::Property::CONTENT_ORDER:
setup ();
break;
default:
_film = film;
- film_changed (Film::CONTENT);
- film_changed (Film::AUDIO_CHANNELS);
+ film_changed (Film::Property::CONTENT);
+ film_changed (Film::Property::AUDIO_CHANNELS);
if (_film) {
check_selection ();
Controls::film_change (ChangeType type, Film::Property p)
{
if (type == ChangeType::DONE) {
- if (p == Film::CONTENT) {
+ if (p == Film::Property::CONTENT) {
setup_sensitivity ();
update_position_label ();
update_position_slider ();
- } else if (p == Film::THREE_D) {
+ } else if (p == Film::Property::THREE_D) {
setup_sensitivity ();
}
}
}
void
-DCPPanel::film_changed (int p)
+DCPPanel::film_changed (Film::Property p)
{
switch (p) {
- case Film::NONE:
+ case Film::Property::NONE:
break;
- case Film::CONTAINER:
+ case Film::Property::CONTAINER:
setup_container ();
break;
- case Film::NAME:
+ case Film::Property::NAME:
checked_set (_name, _film->name());
setup_dcp_name ();
break;
- case Film::DCP_CONTENT_TYPE:
+ case Film::Property::DCP_CONTENT_TYPE:
checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
setup_dcp_name ();
break;
- case Film::ENCRYPTED:
+ case Film::Property::ENCRYPTED:
checked_set (_encrypted, _film->encrypted ());
break;
- case Film::RESOLUTION:
+ case Film::Property::RESOLUTION:
checked_set (_resolution, _film->resolution() == Resolution::TWO_K ? 0 : 1);
setup_container ();
setup_dcp_name ();
break;
- case Film::J2K_BANDWIDTH:
+ case Film::Property::J2K_BANDWIDTH:
checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
break;
- case Film::USE_ISDCF_NAME:
+ case Film::Property::USE_ISDCF_NAME:
{
checked_set (_use_isdcf_name, _film->use_isdcf_name ());
if (_film->use_isdcf_name()) {
_edit_isdcf_button->Enable (_film->use_isdcf_name ());
break;
}
- case Film::ISDCF_METADATA:
- case Film::SUBTITLE_LANGUAGES:
+ case Film::Property::ISDCF_METADATA:
+ case Film::Property::SUBTITLE_LANGUAGES:
setup_dcp_name ();
break;
- case Film::VIDEO_FRAME_RATE:
+ case Film::Property::VIDEO_FRAME_RATE:
{
bool done = false;
for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
setup_dcp_name ();
break;
}
- case Film::AUDIO_CHANNELS:
+ case Film::Property::AUDIO_CHANNELS:
if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
_film->set_audio_channels (minimum_allowed_audio_channels ());
} else {
setup_dcp_name ();
}
break;
- case Film::THREE_D:
+ case Film::Property::THREE_D:
checked_set (_three_d, _film->three_d ());
setup_dcp_name ();
break;
- case Film::REENCODE_J2K:
+ case Film::Property::REENCODE_J2K:
checked_set (_reencode_j2k, _film->reencode_j2k());
break;
- case Film::INTEROP:
+ case Film::Property::INTEROP:
checked_set (_standard, _film->interop() ? 1 : 0);
setup_dcp_name ();
_markers->Enable (!_film->interop());
break;
- case Film::AUDIO_PROCESSOR:
+ case Film::Property::AUDIO_PROCESSOR:
if (_film->audio_processor ()) {
checked_set (_audio_processor, _film->audio_processor()->id());
} else {
checked_set (_audio_processor, 0);
}
setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
- film_changed (Film::AUDIO_CHANNELS);
+ film_changed (Film::Property::AUDIO_CHANNELS);
break;
- case Film::REEL_TYPE:
+ case Film::Property::REEL_TYPE:
checked_set (_reel_type, static_cast<int>(_film->reel_type()));
_reel_length->Enable (_film->reel_type() == ReelType::BY_LENGTH);
break;
- case Film::REEL_LENGTH:
+ case Film::Property::REEL_LENGTH:
checked_set (_reel_length, _film->reel_length() / 1000000000LL);
break;
- case Film::CONTENT:
+ case Film::Property::CONTENT:
setup_dcp_name ();
setup_sensitivity ();
break;
return;
}
- film_changed (Film::NAME);
- film_changed (Film::USE_ISDCF_NAME);
- film_changed (Film::CONTENT);
- film_changed (Film::DCP_CONTENT_TYPE);
- film_changed (Film::CONTAINER);
- film_changed (Film::RESOLUTION);
- film_changed (Film::ENCRYPTED);
- film_changed (Film::J2K_BANDWIDTH);
- film_changed (Film::ISDCF_METADATA);
- film_changed (Film::VIDEO_FRAME_RATE);
- film_changed (Film::AUDIO_CHANNELS);
- film_changed (Film::SEQUENCE);
- film_changed (Film::THREE_D);
- film_changed (Film::INTEROP);
- film_changed (Film::AUDIO_PROCESSOR);
- film_changed (Film::REEL_TYPE);
- film_changed (Film::REEL_LENGTH);
- film_changed (Film::REENCODE_J2K);
+ film_changed (Film::Property::NAME);
+ film_changed (Film::Property::USE_ISDCF_NAME);
+ film_changed (Film::Property::CONTENT);
+ film_changed (Film::Property::DCP_CONTENT_TYPE);
+ film_changed (Film::Property::CONTAINER);
+ film_changed (Film::Property::RESOLUTION);
+ film_changed (Film::Property::ENCRYPTED);
+ film_changed (Film::Property::J2K_BANDWIDTH);
+ film_changed (Film::Property::ISDCF_METADATA);
+ film_changed (Film::Property::VIDEO_FRAME_RATE);
+ film_changed (Film::Property::AUDIO_CHANNELS);
+ film_changed (Film::Property::SEQUENCE);
+ film_changed (Film::Property::THREE_D);
+ film_changed (Film::Property::INTEROP);
+ film_changed (Film::Property::AUDIO_PROCESSOR);
+ film_changed (Film::Property::REEL_TYPE);
+ film_changed (Film::Property::REEL_LENGTH);
+ film_changed (Film::Property::REENCODE_J2K);
set_general_sensitivity(static_cast<bool>(_film));
}
_audio_processor->Clear ();
add_audio_processors ();
if (_film) {
- film_changed (Film::AUDIO_PROCESSOR);
+ film_changed (Film::Property::AUDIO_PROCESSOR);
}
}
}
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/config.h"
-#include <boost/noncopyable.hpp>
+#include "lib/film.h"
+
class wxNotebook;
class wxPanel;
class FilmViewer;
class Ratio;
-class DCPPanel : public boost::noncopyable
+class DCPPanel
{
public:
DCPPanel (wxNotebook *, std::shared_ptr<Film>, std::weak_ptr<FilmViewer> viewer);
+ DCPPanel (DCPPanel const&) = delete;
+ DCPPanel& operator= (DCPPanel const&) = delete;
+
void set_film (std::shared_ptr<Film>);
void set_general_sensitivity (bool);
- void film_changed (int);
+ void film_changed (Film::Property);
void film_content_changed (int);
wxPanel* panel () const {
_content_panel->film_changed (p);
_dcp_panel->film_changed (p);
- if (p == Film::CONTENT && !_film->content().empty ()) {
+ if (p == Film::Property::CONTENT && !_film->content().empty()) {
/* Select newly-added content */
_content_panel->set_selection (_film->content().back ());
}
_film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
_player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
- film_change (ChangeType::DONE, Film::VIDEO_FRAME_RATE);
- film_change (ChangeType::DONE, Film::THREE_D);
+ film_change (ChangeType::DONE, Film::Property::VIDEO_FRAME_RATE);
+ film_change (ChangeType::DONE, Film::Property::THREE_D);
film_length_change ();
/* Keep about 1 second's worth of history samples */
return;
}
- if (p == Film::AUDIO_CHANNELS) {
+ if (p == Film::Property::AUDIO_CHANNELS) {
recreate_butler ();
- } else if (p == Film::VIDEO_FRAME_RATE) {
+ } else if (p == Film::Property::VIDEO_FRAME_RATE) {
_video_view->set_video_frame_rate (_film->video_frame_rate());
- } else if (p == Film::THREE_D) {
+ } else if (p == Film::Property::THREE_D) {
_video_view->set_three_d (_film->three_d());
- } else if (p == Film::CONTENT) {
+ } else if (p == Film::Property::CONTENT) {
_closed_captions_dialog->update_tracks (_film);
}
}
*/
-#include "lib/types.h"
+
+#include "lib/change_signaller.h"
#include "lib/warnings.h"
DCPOMATIC_DISABLE_WARNINGS
#include <wx/wx.h>
DCPOMATIC_ENABLE_WARNINGS
#include <boost/signals2.hpp>
+
class wxRichTextCtrl;
class Film;
class Hints;
_film_changed_connection = film()->Change.connect(boost::bind(&SMPTEMetadataDialog::film_changed, this, _1, _2));
- film_changed (ChangeType::DONE, Film::NAME_LANGUAGE);
- film_changed (ChangeType::DONE, Film::RELEASE_TERRITORY);
- film_changed (ChangeType::DONE, Film::VERSION_NUMBER);
- film_changed (ChangeType::DONE, Film::STATUS);
- film_changed (ChangeType::DONE, Film::CHAIN);
- film_changed (ChangeType::DONE, Film::DISTRIBUTOR);
- film_changed (ChangeType::DONE, Film::FACILITY);
- film_changed (ChangeType::DONE, Film::CONTENT_VERSIONS);
- film_changed (ChangeType::DONE, Film::LUMINANCE);
- film_changed (ChangeType::DONE, Film::SUBTITLE_LANGUAGES);
+ film_changed (ChangeType::DONE, Film::Property::NAME_LANGUAGE);
+ film_changed (ChangeType::DONE, Film::Property::RELEASE_TERRITORY);
+ film_changed (ChangeType::DONE, Film::Property::VERSION_NUMBER);
+ film_changed (ChangeType::DONE, Film::Property::STATUS);
+ film_changed (ChangeType::DONE, Film::Property::CHAIN);
+ film_changed (ChangeType::DONE, Film::Property::DISTRIBUTOR);
+ film_changed (ChangeType::DONE, Film::Property::FACILITY);
+ film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS);
+ film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
+ film_changed (ChangeType::DONE, Film::Property::SUBTITLE_LANGUAGES);
setup_sensitivity ();
}
return;
}
- if (property == Film::NAME_LANGUAGE) {
+ if (property == Film::Property::NAME_LANGUAGE) {
_name_language->set (film()->name_language());
- } else if (property == Film::RELEASE_TERRITORY) {
+ } else if (property == Film::Property::RELEASE_TERRITORY) {
checked_set (_release_territory, std_to_wx(*dcp::LanguageTag::get_subtag_description(dcp::LanguageTag::SubtagType::REGION, film()->release_territory().subtag())));
- } else if (property == Film::VERSION_NUMBER) {
+ } else if (property == Film::Property::VERSION_NUMBER) {
checked_set (_version_number, film()->version_number());
- } else if (property == Film::STATUS) {
+ } else if (property == Film::Property::STATUS) {
switch (film()->status()) {
case dcp::Status::TEMP:
checked_set (_status, 0);
checked_set (_status, 2);
break;
}
- } else if (property == Film::CHAIN) {
+ } else if (property == Film::Property::CHAIN) {
checked_set (_chain, film()->chain());
- } else if (property == Film::DISTRIBUTOR) {
+ } else if (property == Film::Property::DISTRIBUTOR) {
checked_set (_distributor, film()->distributor());
- } else if (property == Film::FACILITY) {
+ } else if (property == Film::Property::FACILITY) {
checked_set (_facility, film()->facility());
- } else if (property == Film::LUMINANCE) {
+ } else if (property == Film::Property::LUMINANCE) {
checked_set (_luminance_value, film()->luminance().value());
switch (film()->luminance().unit()) {
case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
checked_set (_luminance_unit, 1);
break;
}
- } else if (property == Film::SUBTITLE_LANGUAGES) {
+ } else if (property == Film::Property::SUBTITLE_LANGUAGES) {
vector<dcp::LanguageTag> languages = film()->subtitle_languages();
checked_set (_enable_main_subtitle_language, !languages.empty());
if (!languages.empty()) {
void
SMPTEMetadataDialog::edit_release_territory ()
{
- RegionSubtagDialog* d = new RegionSubtagDialog(this, film()->release_territory());
+ auto d = new RegionSubtagDialog(this, film()->release_territory());
d->ShowModal ();
- optional<dcp::LanguageTag::RegionSubtag> tag = d->get();
+ auto tag = d->get();
if (tag) {
- film()->set_release_territory (*tag);
+ film()->set_release_territory(*tag);
}
d->Destroy ();
}
*/
#include "timecode.h"
+#include "lib/change_signaller.h"
#include "lib/rgba.h"
#include "lib/warnings.h"
DCPOMATIC_DISABLE_WARNINGS
void
TextPanel::film_changed (Film::Property property)
{
- if (property == Film::CONTENT || property == Film::REEL_TYPE || property == Film::INTEROP) {
+ if (property == Film::Property::CONTENT || property == Film::Property::REEL_TYPE || property == Film::Property::INTEROP) {
setup_sensitivity ();
}
}
_main_canvas->Bind (wxEVT_SCROLLWIN_PAGEDOWN, boost::bind (&Timeline::scrolled, this, _1));
_main_canvas->Bind (wxEVT_SCROLLWIN_THUMBTRACK, boost::bind (&Timeline::scrolled, this, _1));
- film_change (ChangeType::DONE, Film::CONTENT);
+ film_change (ChangeType::DONE, Film::Property::CONTENT);
SetMinSize (wxSize (640, 4 * pixels_per_track() + 96));
return;
}
- if (p == Film::CONTENT || p == Film::REEL_TYPE || p == Film::REEL_LENGTH) {
+ if (p == Film::Property::CONTENT || p == Film::Property::REEL_TYPE || p == Film::Property::REEL_LENGTH) {
ensure_ui_thread ();
recreate_views ();
- } else if (p == Film::CONTENT_ORDER) {
+ } else if (p == Film::Property::CONTENT_ORDER) {
Refresh ();
}
}
TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr<Content> c)
: TimelineView (tl)
, _content (c)
- , _selected (false)
{
_content_connection = c->Change.connect (bind (&TimelineContentView::content_change, this, _1, _3));
}
/*
- Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#ifndef DCPOMATIC_TIMELINE_CONTENT_VIEW_H
#define DCPOMATIC_TIMELINE_CONTENT_VIEW_H
+#include "lib/change_signaller.h"
#include "lib/types.h"
#include "lib/warnings.h"
#include "timeline_view.h"
void content_change (ChangeType type, int p);
boost::optional<int> _track;
- bool _selected;
+ bool _selected = false;
boost::signals2::scoped_connection _content_connection;
};
sizer->SetSizeHints (this);
_toolbar->ToggleTool ((int) Timeline::SNAP, _timeline.snap ());
- film_change (ChangeType::DONE, Film::SEQUENCE);
+ film_change (ChangeType::DONE, Film::Property::SEQUENCE);
_film_changed_connection = film->Change.connect (bind (&TimelineDialog::film_change, this, _1, _2));
}
return;
}
- if (p == Film::SEQUENCE) {
+ if (p == Film::Property::SEQUENCE) {
_toolbar->ToggleTool ((int) Timeline::SEQUENCE, film->sequence ());
}
}
void
TimingPanel::film_changed (Film::Property p)
{
- if (p == Film::VIDEO_FRAME_RATE) {
+ if (p == Film::Property::VIDEO_FRAME_RATE) {
update_full_length ();
update_play_length ();
}
VideoPanel::film_changed (Film::Property property)
{
switch (property) {
- case Film::VIDEO_FRAME_RATE:
- case Film::CONTAINER:
- case Film::RESOLUTION:
+ case Film::Property::VIDEO_FRAME_RATE:
+ case Film::Property::CONTAINER:
+ case Film::Property::RESOLUTION:
setup_description ();
setup_sensitivity ();
break;
- case Film::REEL_TYPE:
- case Film::INTEROP:
+ case Film::Property::REEL_TYPE:
+ case Film::Property::INTEROP:
setup_sensitivity ();
break;
default: