summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/active_text.cc46
-rw-r--r--src/lib/active_text.h26
-rw-r--r--src/lib/analyse_subtitles_job.cc46
-rw-r--r--src/lib/analyse_subtitles_job.h10
-rw-r--r--src/lib/audio_mapping.cc84
-rw-r--r--src/lib/audio_mapping.h32
-rw-r--r--src/lib/cinema_sound_processor.cc44
-rw-r--r--src/lib/cinema_sound_processor.h20
-rw-r--r--src/lib/create_cli.cc32
-rw-r--r--src/lib/create_cli.h1
-rw-r--r--src/lib/dcp_subtitle_content.cc39
-rw-r--r--src/lib/dcp_subtitle_content.h14
-rw-r--r--src/lib/dcp_video.cc34
-rw-r--r--src/lib/dcpomatic_socket.cc8
-rw-r--r--src/lib/encode_server_finder.cc114
-rw-r--r--src/lib/encode_server_finder.h24
-rw-r--r--src/lib/ffmpeg.cc94
-rw-r--r--src/lib/ffmpeg.h24
-rw-r--r--src/lib/file_group.cc44
-rw-r--r--src/lib/file_group.h20
-rw-r--r--src/lib/hints.cc49
-rw-r--r--src/lib/image_content.cc66
-rw-r--r--src/lib/image_content.h28
-rw-r--r--src/lib/image_decoder.cc18
-rw-r--r--src/lib/image_decoder.h8
-rw-r--r--src/lib/image_examiner.cc22
-rw-r--r--src/lib/image_examiner.h14
-rw-r--r--src/lib/j2k_image_proxy.cc96
-rw-r--r--src/lib/j2k_image_proxy.h28
-rw-r--r--src/lib/nanomsg.cc39
-rw-r--r--src/lib/nanomsg.h16
-rw-r--r--src/lib/text_ring_buffers.cc14
-rw-r--r--src/lib/text_ring_buffers.h14
-rw-r--r--src/lib/util.cc22
-rw-r--r--src/lib/util.h1
-rw-r--r--src/lib/video_mxf_content.cc38
-rw-r--r--src/lib/video_mxf_content.h22
-rw-r--r--src/tools/dcpomatic_verifier.cc82
-rw-r--r--src/wx/audio_dialog.cc238
-rw-r--r--src/wx/audio_dialog.h20
-rw-r--r--src/wx/controls.cc2
-rw-r--r--src/wx/editable_list.h142
-rw-r--r--src/wx/full_language_tag_dialog.cc155
-rw-r--r--src/wx/full_language_tag_dialog.h26
-rw-r--r--src/wx/standard_controls.cc1
-rw-r--r--src/wx/supporters.cc2
-rw-r--r--src/wx/verify_dcp_result_panel.cc8
-rw-r--r--src/wx/wx_util.cc212
-rw-r--r--src/wx/wx_util.h76
49 files changed, 1168 insertions, 1047 deletions
diff --git a/src/lib/active_text.cc b/src/lib/active_text.cc
index 2a5c4d836..19c17d6a8 100644
--- a/src/lib/active_text.cc
+++ b/src/lib/active_text.cc
@@ -54,15 +54,15 @@ ActiveText::operator=(ActiveText&& other)
* @param always_burn_captions Always burn captions even if their content is not set to burn.
*/
list<PlayerText>
-ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const
+ActiveText::get_burnt(DCPTimePeriod period, bool always_burn_captions) const
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
list<PlayerText> ps;
for (auto const& i: _data) {
- auto caption = i.first.lock ();
+ auto caption = i.first.lock();
if (!caption) {
continue;
}
@@ -73,10 +73,10 @@ ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const
}
for (auto j: i.second) {
- DCPTimePeriod test (j.from, j.to.get_value_or(DCPTime::max()));
- auto overlap = period.overlap (test);
+ DCPTimePeriod test(j.from, j.to.get_value_or(DCPTime::max()));
+ auto overlap = period.overlap(test);
if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) {
- ps.push_back (j.subs);
+ ps.push_back(j.subs);
}
}
}
@@ -89,19 +89,19 @@ ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const
* @param time Time to remove before.
*/
void
-ActiveText::clear_before (DCPTime time)
+ActiveText::clear_before(DCPTime time)
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
Map updated;
for (auto const& i: _data) {
list<Period> as;
for (auto j: i.second) {
if (!j.to || j.to.get() >= time) {
- as.push_back (j);
+ as.push_back(j);
}
}
- if (!as.empty ()) {
+ if (!as.empty()) {
updated[i.first] = as;
}
}
@@ -115,14 +115,14 @@ ActiveText::clear_before (DCPTime time)
* @param from From time for these subtitles.
*/
void
-ActiveText::add_from (weak_ptr<const TextContent> content, PlayerText ps, DCPTime from)
+ActiveText::add_from(weak_ptr<const TextContent> content, PlayerText ps, DCPTime from)
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
if (_data.find(content) == _data.end()) {
_data[content] = list<Period>();
}
- _data[content].push_back (Period (ps, from));
+ _data[content].push_back(Period(ps, from));
}
@@ -132,19 +132,19 @@ ActiveText::add_from (weak_ptr<const TextContent> content, PlayerText ps, DCPTim
* @return Return the corresponding subtitles and their from time.
*/
pair<PlayerText, DCPTime>
-ActiveText::add_to (weak_ptr<const TextContent> content, DCPTime to)
+ActiveText::add_to(weak_ptr<const TextContent> content, DCPTime to)
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
- DCPOMATIC_ASSERT (_data.find(content) != _data.end());
+ DCPOMATIC_ASSERT(_data.find(content) != _data.end());
_data[content].back().to = to;
for (auto& i: _data[content].back().subs.string) {
- i.set_out (dcp::Time(to.seconds(), 1000));
+ i.set_out(dcp::Time(to.seconds(), 1000));
}
- return make_pair (_data[content].back().subs, _data[content].back().from);
+ return make_pair(_data[content].back().subs, _data[content].back().from);
}
@@ -152,9 +152,9 @@ ActiveText::add_to (weak_ptr<const TextContent> content, DCPTime to)
* @return true if we have any active subtitles from this content.
*/
bool
-ActiveText::have (weak_ptr<const TextContent> content) const
+ActiveText::have(weak_ptr<const TextContent> content) const
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
auto i = _data.find(content);
if (i == _data.end()) {
@@ -166,8 +166,8 @@ ActiveText::have (weak_ptr<const TextContent> content) const
void
-ActiveText::clear ()
+ActiveText::clear()
{
- boost::mutex::scoped_lock lm (_mutex);
- _data.clear ();
+ boost::mutex::scoped_lock lm(_mutex);
+ _data.clear();
}
diff --git a/src/lib/active_text.h b/src/lib/active_text.h
index 5430f9681..edbe23242 100644
--- a/src/lib/active_text.h
+++ b/src/lib/active_text.h
@@ -40,30 +40,30 @@ class TextContent;
class ActiveText
{
public:
- ActiveText () {}
+ ActiveText() {}
- ActiveText (ActiveText const&) = delete;
- ActiveText& operator= (ActiveText const&) = delete;
+ ActiveText(ActiveText const&) = delete;
+ ActiveText& operator=(ActiveText const&) = delete;
ActiveText(ActiveText&& other);
ActiveText& operator=(ActiveText&& other);
- std::list<PlayerText> get_burnt (dcpomatic::DCPTimePeriod period, bool always_burn_captions) const;
- void clear_before (dcpomatic::DCPTime time);
- void clear ();
- void add_from (std::weak_ptr<const TextContent> content, PlayerText ps, dcpomatic::DCPTime from);
- std::pair<PlayerText, dcpomatic::DCPTime> add_to (std::weak_ptr<const TextContent> content, dcpomatic::DCPTime to);
- bool have (std::weak_ptr<const TextContent> content) const;
+ std::list<PlayerText> get_burnt(dcpomatic::DCPTimePeriod period, bool always_burn_captions) const;
+ void clear_before(dcpomatic::DCPTime time);
+ void clear();
+ void add_from(std::weak_ptr<const TextContent> content, PlayerText ps, dcpomatic::DCPTime from);
+ std::pair<PlayerText, dcpomatic::DCPTime> add_to(std::weak_ptr<const TextContent> content, dcpomatic::DCPTime to);
+ bool have(std::weak_ptr<const TextContent> content) const;
private:
class Period
{
public:
- Period () {}
+ Period() {}
- Period (PlayerText s, dcpomatic::DCPTime f)
- : subs (s)
- , from (f)
+ Period(PlayerText s, dcpomatic::DCPTime f)
+ : subs(s)
+ , from(f)
{}
PlayerText subs;
diff --git a/src/lib/analyse_subtitles_job.cc b/src/lib/analyse_subtitles_job.cc
index 66db25f04..c30ff0c30 100644
--- a/src/lib/analyse_subtitles_job.cc
+++ b/src/lib/analyse_subtitles_job.cc
@@ -42,10 +42,10 @@ using namespace boost::placeholders;
#endif
-AnalyseSubtitlesJob::AnalyseSubtitlesJob (shared_ptr<const Film> film, shared_ptr<Content> content)
- : Job (film)
- , _content (content)
- , _path (_film->subtitle_analysis_path(content))
+AnalyseSubtitlesJob::AnalyseSubtitlesJob(shared_ptr<const Film> film, shared_ptr<Content> content)
+ : Job(film)
+ , _content(content)
+ , _path(_film->subtitle_analysis_path(content))
{
}
@@ -57,46 +57,46 @@ AnalyseSubtitlesJob::~AnalyseSubtitlesJob()
string
-AnalyseSubtitlesJob::name () const
+AnalyseSubtitlesJob::name() const
{
return _("Analysing subtitles");
}
string
-AnalyseSubtitlesJob::json_name () const
+AnalyseSubtitlesJob::json_name() const
{
return N_("analyse_subtitles");
}
void
-AnalyseSubtitlesJob::run ()
+AnalyseSubtitlesJob::run()
{
auto playlist = make_shared<Playlist>();
- auto content = _content.lock ();
- DCPOMATIC_ASSERT (content);
- playlist->add (_film, content);
+ auto content = _content.lock();
+ DCPOMATIC_ASSERT(content);
+ playlist->add(_film, content);
auto player = make_shared<Player>(_film, playlist, false);
- player->set_ignore_audio ();
- player->set_fast ();
- player->set_play_referenced ();
- player->Text.connect (bind(&AnalyseSubtitlesJob::analyse, this, _1, _2));
+ player->set_ignore_audio();
+ player->set_fast();
+ player->set_play_referenced();
+ player->Text.connect(bind(&AnalyseSubtitlesJob::analyse, this, _1, _2));
- set_progress_unknown ();
+ set_progress_unknown();
if (!content->text.empty()) {
- while (!player->pass ()) {
+ while (!player->pass()) {
boost::this_thread::interruption_point();
}
}
- SubtitleAnalysis analysis (_bounding_box, content->text.front()->x_offset(), content->text.front()->y_offset());
- analysis.write (_path);
+ SubtitleAnalysis analysis(_bounding_box, content->text.front()->x_offset(), content->text.front()->y_offset());
+ analysis.write(_path);
- set_progress (1);
- set_state (FINISHED_OK);
+ set_progress(1);
+ set_state(FINISHED_OK);
}
@@ -111,7 +111,7 @@ AnalyseSubtitlesJob::analyse(PlayerText const& text, TextType type)
if (!_bounding_box) {
_bounding_box = i.rectangle;
} else {
- _bounding_box->extend (i.rectangle);
+ _bounding_box->extend(i.rectangle);
}
}
@@ -139,14 +139,14 @@ AnalyseSubtitlesJob::analyse(PlayerText const& text, TextType type)
for (auto standard: override_standard) {
for (auto i: bounding_box(text.string, frame, standard)) {
- dcpomatic::Rect<double> rect (
+ dcpomatic::Rect<double> rect(
double(i.x) / frame.width, double(i.y) / frame.height,
double(i.width) / frame.width, double(i.height) / frame.height
);
if (!_bounding_box) {
_bounding_box = rect;
} else {
- _bounding_box->extend (rect);
+ _bounding_box->extend(rect);
}
}
}
diff --git a/src/lib/analyse_subtitles_job.h b/src/lib/analyse_subtitles_job.h
index ea425763f..bb6aa3f31 100644
--- a/src/lib/analyse_subtitles_job.h
+++ b/src/lib/analyse_subtitles_job.h
@@ -31,14 +31,14 @@ class Content;
class AnalyseSubtitlesJob : public Job
{
public:
- AnalyseSubtitlesJob (std::shared_ptr<const Film> film, std::shared_ptr<Content> content);
+ AnalyseSubtitlesJob(std::shared_ptr<const Film> film, std::shared_ptr<Content> content);
~AnalyseSubtitlesJob();
- std::string name () const override;
- std::string json_name () const override;
- void run () override;
+ std::string name() const override;
+ std::string json_name() const override;
+ void run() override;
- boost::filesystem::path path () const {
+ boost::filesystem::path path() const {
return _path;
}
diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc
index 939a03414..4e13d1adb 100644
--- a/src/lib/audio_mapping.cc
+++ b/src/lib/audio_mapping.cc
@@ -54,26 +54,26 @@ using dcp::raw_convert;
* @param input_channels Number of input channels.
* @param output_channels Number of output channels.
*/
-AudioMapping::AudioMapping (int input_channels, int output_channels)
+AudioMapping::AudioMapping(int input_channels, int output_channels)
{
- setup (input_channels, output_channels);
+ setup(input_channels, output_channels);
}
void
-AudioMapping::setup (int input_channels, int output_channels)
+AudioMapping::setup(int input_channels, int output_channels)
{
_gain.resize(input_channels);
for (int i = 0; i < input_channels; ++i) {
_gain[i].resize(output_channels);
}
- make_zero ();
+ make_zero();
}
void
-AudioMapping::make_zero ()
+AudioMapping::make_zero()
{
for (auto& input: _gain) {
for (auto& output: input) {
@@ -85,9 +85,9 @@ AudioMapping::make_zero ()
struct ChannelRegex
{
- ChannelRegex (string regex_, int channel_)
- : regex (regex_)
- , channel (channel_)
+ ChannelRegex(string regex_, int channel_)
+ : regex(regex_)
+ , channel(channel_)
{}
string regex;
@@ -96,7 +96,7 @@ struct ChannelRegex
void
-AudioMapping::make_default (AudioProcessor const * processor, optional<boost::filesystem::path> filename)
+AudioMapping::make_default(AudioProcessor const * processor, optional<boost::filesystem::path> filename)
{
static ChannelRegex const regex[] = {
ChannelRegex(".*[\\._-]L[\\._-].*", 0),
@@ -117,18 +117,18 @@ AudioMapping::make_default (AudioProcessor const * processor, optional<boost::fi
static int const regexes = sizeof(regex) / sizeof(*regex);
if (processor) {
- processor->make_audio_mapping_default (*this);
+ processor->make_audio_mapping_default(*this);
} else {
- make_zero ();
+ make_zero();
if (input_channels() == 1) {
bool guessed = false;
/* See if we can guess where this stream should go */
if (filename) {
for (int i = 0; i < regexes; ++i) {
- boost::regex e (regex[i].regex, boost::regex::icase);
+ boost::regex e(regex[i].regex, boost::regex::icase);
if (boost::regex_match(filename->filename().string(), e) && regex[i].channel < output_channels()) {
- set (0, regex[i].channel, 1);
+ set(0, regex[i].channel, 1);
guessed = true;
}
}
@@ -136,41 +136,41 @@ AudioMapping::make_default (AudioProcessor const * processor, optional<boost::fi
if (!guessed) {
/* If we have no idea, just put it on centre */
- set (0, static_cast<int>(dcp::Channel::CENTRE), 1);
+ set(0, static_cast<int>(dcp::Channel::CENTRE), 1);
}
} else {
/* 1:1 mapping */
- for (int i = 0; i < min (input_channels(), output_channels()); ++i) {
- set (i, i, 1);
+ for (int i = 0; i < min(input_channels(), output_channels()); ++i) {
+ set(i, i, 1);
}
}
}
}
-AudioMapping::AudioMapping (cxml::ConstNodePtr node, int state_version)
+AudioMapping::AudioMapping(cxml::ConstNodePtr node, int state_version)
{
if (state_version < 32) {
- setup (node->number_child<int>("ContentChannels"), MAX_DCP_AUDIO_CHANNELS);
+ setup(node->number_child<int>("ContentChannels"), MAX_DCP_AUDIO_CHANNELS);
} else {
- setup (node->number_child<int>("InputChannels"), node->number_child<int>("OutputChannels"));
+ setup(node->number_child<int>("InputChannels"), node->number_child<int>("OutputChannels"));
}
if (state_version <= 5) {
/* Old-style: on/off mapping */
- for (auto i: node->node_children ("Map")) {
- set (i->number_child<int>("ContentIndex"), i->number_child<int>("DCP"), 1);
+ for (auto i: node->node_children("Map")) {
+ set(i->number_child<int>("ContentIndex"), i->number_child<int>("DCP"), 1);
}
} else {
for (auto i: node->node_children("Gain")) {
if (state_version < 32) {
- set (
+ set(
i->number_attribute<int>("Content"),
i->number_attribute<int>("DCP"),
raw_convert<float>(i->content())
);
} else {
- set (
+ set(
number_attribute<int>(i, "Input", "input"),
number_attribute<int>(i, "Output", "output"),
raw_convert<float>(i->content())
@@ -182,40 +182,40 @@ AudioMapping::AudioMapping (cxml::ConstNodePtr node, int state_version)
void
-AudioMapping::set (dcp::Channel input_channel, int output_channel, float g)
+AudioMapping::set(dcp::Channel input_channel, int output_channel, float g)
{
- set (static_cast<int>(input_channel), output_channel, g);
+ set(static_cast<int>(input_channel), output_channel, g);
}
void
-AudioMapping::set (int input_channel, dcp::Channel output_channel, float g)
+AudioMapping::set(int input_channel, dcp::Channel output_channel, float g)
{
- set (input_channel, static_cast<int>(output_channel), g);
+ set(input_channel, static_cast<int>(output_channel), g);
}
void
-AudioMapping::set (int input_channel, int output_channel, float g)
+AudioMapping::set(int input_channel, int output_channel, float g)
{
- DCPOMATIC_ASSERT (input_channel < int(_gain.size()));
- DCPOMATIC_ASSERT (output_channel < int(_gain[0].size()));
+ DCPOMATIC_ASSERT(input_channel < int(_gain.size()));
+ DCPOMATIC_ASSERT(output_channel < int(_gain[0].size()));
_gain[input_channel][output_channel] = g;
}
float
-AudioMapping::get (int input_channel, dcp::Channel output_channel) const
+AudioMapping::get(int input_channel, dcp::Channel output_channel) const
{
- return get (input_channel, static_cast<int>(output_channel));
+ return get(input_channel, static_cast<int>(output_channel));
}
float
-AudioMapping::get (int input_channel, int output_channel) const
+AudioMapping::get(int input_channel, int output_channel) const
{
- DCPOMATIC_ASSERT (input_channel < int (_gain.size()));
- DCPOMATIC_ASSERT (output_channel < int (_gain[0].size()));
+ DCPOMATIC_ASSERT(input_channel < int(_gain.size()));
+ DCPOMATIC_ASSERT(output_channel < int(_gain[0].size()));
return _gain[input_channel][output_channel];
}
@@ -244,7 +244,7 @@ AudioMapping::as_xml(xmlpp::Element* element) const
* differentiation between different AudioMappings.
*/
string
-AudioMapping::digest () const
+AudioMapping::digest() const
{
Digester digester;
digester.add(input_channels());
@@ -255,12 +255,12 @@ AudioMapping::digest () const
}
}
- return digester.get ();
+ return digester.get();
}
list<int>
-AudioMapping::mapped_output_channels () const
+AudioMapping::mapped_output_channels() const
{
static float const minus_96_db = 0.000015849;
@@ -269,20 +269,20 @@ AudioMapping::mapped_output_channels () const
for (auto const& i: _gain) {
for (auto j: dcp::used_audio_channels()) {
if (abs(i[static_cast<int>(j)]) > minus_96_db) {
- mapped.push_back (static_cast<int>(j));
+ mapped.push_back(static_cast<int>(j));
}
}
}
- mapped.sort ();
- mapped.unique ();
+ mapped.sort();
+ mapped.unique();
return mapped;
}
void
-AudioMapping::unmap_all ()
+AudioMapping::unmap_all()
{
for (auto& i: _gain) {
for (auto& j: i) {
diff --git a/src/lib/audio_mapping.h b/src/lib/audio_mapping.h
index 68487d908..0dc80193b 100644
--- a/src/lib/audio_mapping.h
+++ b/src/lib/audio_mapping.h
@@ -46,40 +46,40 @@ class AudioProcessor;
class AudioMapping
{
public:
- AudioMapping () {}
- AudioMapping (int input_channels, int output_channels);
- AudioMapping (cxml::ConstNodePtr, int);
+ AudioMapping() {}
+ AudioMapping(int input_channels, int output_channels);
+ AudioMapping(cxml::ConstNodePtr, int);
/* Default copy constructor is fine */
void as_xml(xmlpp::Element*) const;
- void make_zero ();
- void make_default (AudioProcessor const * processor, boost::optional<boost::filesystem::path> filename = boost::optional<boost::filesystem::path>());
+ void make_zero();
+ void make_default(AudioProcessor const * processor, boost::optional<boost::filesystem::path> filename = boost::optional<boost::filesystem::path>());
- void set (dcp::Channel input_channel, int output_channel, float);
- void set (int input_channel, int output_channel, float);
- void set (int input_channel, dcp::Channel output_channel, float);
- float get (int input_channel, int output_channel) const;
- float get (int input_channel, dcp::Channel output_channel) const;
+ void set(dcp::Channel input_channel, int output_channel, float);
+ void set(int input_channel, int output_channel, float);
+ void set(int input_channel, dcp::Channel output_channel, float);
+ float get(int input_channel, int output_channel) const;
+ float get(int input_channel, dcp::Channel output_channel) const;
- int input_channels () const {
+ int input_channels() const {
return _gain.size();
}
- int output_channels () const {
+ int output_channels() const {
return _gain.empty() ? 0 : _gain[0].size();
}
- std::string digest () const;
+ std::string digest() const;
- std::list<int> mapped_output_channels () const;
- void unmap_all ();
+ std::list<int> mapped_output_channels() const;
+ void unmap_all();
void take_from(AudioMapping const& other);
private:
- void setup (int input_channels, int output_channels);
+ void setup(int input_channels, int output_channels);
/** Linear gains */
std::vector<std::vector<float>> _gain;
diff --git a/src/lib/cinema_sound_processor.cc b/src/lib/cinema_sound_processor.cc
index 434fdd1cf..2ddbb9086 100644
--- a/src/lib/cinema_sound_processor.cc
+++ b/src/lib/cinema_sound_processor.cc
@@ -42,12 +42,12 @@ vector<unique_ptr<const CinemaSoundProcessor>> CinemaSoundProcessor::_cinema_sou
/** @param i Our id.
* @param n User-visible name.
*/
-CinemaSoundProcessor::CinemaSoundProcessor (string i, string n, float knee, float below, float above)
- : _id (i)
- , _name (n)
- , _knee (knee)
- , _below (below)
- , _above (above)
+CinemaSoundProcessor::CinemaSoundProcessor(string i, string n, float knee, float below, float above)
+ : _id(i)
+ , _name(n)
+ , _knee(knee)
+ , _below(below)
+ , _above(above)
{
}
@@ -55,11 +55,11 @@ CinemaSoundProcessor::CinemaSoundProcessor (string i, string n, float knee, floa
/** @return All available sound processors */
vector<CinemaSoundProcessor const *>
-CinemaSoundProcessor::all ()
+CinemaSoundProcessor::all()
{
vector<CinemaSoundProcessor const *> raw;
for (auto& processor: _cinema_sound_processors) {
- raw.push_back (processor.get());
+ raw.push_back(processor.get());
}
return raw;
}
@@ -69,11 +69,11 @@ CinemaSoundProcessor::all ()
* methods are used.
*/
void
-CinemaSoundProcessor::setup_cinema_sound_processors ()
+CinemaSoundProcessor::setup_cinema_sound_processors()
{
- _cinema_sound_processors.push_back (unique_ptr<CinemaSoundProcessor>(new DolbyCP750));
- _cinema_sound_processors.push_back (unique_ptr<CinemaSoundProcessor>(new USL));
- _cinema_sound_processors.push_back (unique_ptr<CinemaSoundProcessor>(new DatasatAP2x));
+ _cinema_sound_processors.push_back(unique_ptr<CinemaSoundProcessor>(new DolbyCP750));
+ _cinema_sound_processors.push_back(unique_ptr<CinemaSoundProcessor>(new USL));
+ _cinema_sound_processors.push_back(unique_ptr<CinemaSoundProcessor>(new DatasatAP2x));
}
@@ -81,14 +81,14 @@ CinemaSoundProcessor::setup_cinema_sound_processors ()
* @return Corresponding sound processor, or 0.
*/
CinemaSoundProcessor const *
-CinemaSoundProcessor::from_id (string id)
+CinemaSoundProcessor::from_id(string id)
{
- auto i = _cinema_sound_processors.begin ();
+ auto i = _cinema_sound_processors.begin();
while (i != _cinema_sound_processors.end() && (*i)->id() != id) {
++i;
}
- if (i == _cinema_sound_processors.end ()) {
+ if (i == _cinema_sound_processors.end()) {
return nullptr;
}
@@ -100,36 +100,36 @@ CinemaSoundProcessor::from_id (string id)
* @return Corresponding sound processor.
*/
CinemaSoundProcessor const *
-CinemaSoundProcessor::from_index (int i)
+CinemaSoundProcessor::from_index(int i)
{
- DCPOMATIC_ASSERT (i >= 0 && i < int(_cinema_sound_processors.size()));
+ DCPOMATIC_ASSERT(i >= 0 && i < int(_cinema_sound_processors.size()));
return _cinema_sound_processors[i].get();
}
float
-CinemaSoundProcessor::db_for_fader_change (float from, float to) const
+CinemaSoundProcessor::db_for_fader_change(float from, float to) const
{
float db = 0;
if (from < to) {
if (from <= _knee) {
- float const t = min (to, _knee);
+ float const t = min(to, _knee);
db += (t - from) * _below;
}
if (to > 4) {
- float const t = max (from, _knee);
+ float const t = max(from, _knee);
db += (to - t) * _above;
}
} else {
if (from >= _knee) {
- float const t = max (to, _knee);
+ float const t = max(to, _knee);
db -= (from - t) * _above;
}
if (to < _knee) {
- float const t = min (from, _knee);
+ float const t = min(from, _knee);
db -= (t - to) * _below;
}
}
diff --git a/src/lib/cinema_sound_processor.h b/src/lib/cinema_sound_processor.h
index 3ccaa5c9b..411a70366 100644
--- a/src/lib/cinema_sound_processor.h
+++ b/src/lib/cinema_sound_processor.h
@@ -43,28 +43,28 @@
class CinemaSoundProcessor
{
public:
- CinemaSoundProcessor (std::string i, std::string n, float knee, float below, float above);
- virtual ~CinemaSoundProcessor () {}
+ CinemaSoundProcessor(std::string i, std::string n, float knee, float below, float above);
+ virtual ~CinemaSoundProcessor() {}
- CinemaSoundProcessor (CinemaSoundProcessor const&) = delete;
+ CinemaSoundProcessor(CinemaSoundProcessor const&) = delete;
CinemaSoundProcessor& operator=(CinemaSoundProcessor const&) = delete;
- float db_for_fader_change (float from, float to) const;
+ float db_for_fader_change(float from, float to) const;
/** @return id for our use */
- std::string id () const {
+ std::string id() const {
return _id;
}
/** @return user-visible name for this sound processor */
- std::string name () const {
+ std::string name() const {
return _name;
}
- static std::vector<CinemaSoundProcessor const *> all ();
- static void setup_cinema_sound_processors ();
- static CinemaSoundProcessor const * from_id (std::string id);
- static CinemaSoundProcessor const * from_index (int);
+ static std::vector<CinemaSoundProcessor const *> all();
+ static void setup_cinema_sound_processors();
+ static CinemaSoundProcessor const * from_id(std::string id);
+ static CinemaSoundProcessor const * from_index(int);
private:
/** id for our use */
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc
index 32834be23..3ef61fe11 100644
--- a/src/lib/create_cli.cc
+++ b/src/lib/create_cli.cc
@@ -85,6 +85,8 @@ help()
" --left-eye next piece of content is for the left eye\n"
" --right-eye next piece of content is for the right eye\n"
" --auto-crop next piece of content should be auto-cropped\n"
+ " --fill-crop next piece of content should be cropped to fit the container\n"
+ " (e.g. to crop the letterboxing from a scope-in-flat image)\n"
" --colourspace next piece of content is in the given colourspace: " + colour_conversions + "\n"
" --colorspace same as --colourspace\n"
" --channel <channel> next piece of content should be mapped to audio channel L, R, C, Lfe, Ls, Rs, BsL, BsR, HI, VI\n"
@@ -184,6 +186,7 @@ CreateCLI::CreateCLI(int argc, char* argv[])
optional<string> next_colour_conversion;
auto next_frame_type = VideoFrameType::TWO_D;
auto next_auto_crop = false;
+ auto next_fill_crop = false;
optional<dcp::Channel> channel;
optional<float> gain;
optional<float> fade_in;
@@ -225,6 +228,9 @@ CreateCLI::CreateCLI(int argc, char* argv[])
} else if (a == "--auto-crop") {
next_auto_crop = true;
claimed = true;
+ } else if (a == "--fill-crop") {
+ next_fill_crop = true;
+ claimed = true;
} else if (a == "--twok") {
_twok = true;
claimed = true;
@@ -331,6 +337,7 @@ CreateCLI::CreateCLI(int argc, char* argv[])
c.path = a;
c.frame_type = next_frame_type;
c.auto_crop = next_auto_crop;
+ c.fill_crop = next_fill_crop;
c.colour_conversion = next_colour_conversion;
c.channel = channel;
c.gain = gain;
@@ -341,6 +348,7 @@ CreateCLI::CreateCLI(int argc, char* argv[])
content.push_back(c);
next_frame_type = VideoFrameType::TWO_D;
next_auto_crop = false;
+ next_fill_crop = false;
next_colour_conversion = {};
channel = {};
gain = {};
@@ -555,6 +563,30 @@ CreateCLI::make_film(function<void (string)> error) const
video->set_crop(crop);
}
+ if (cli_content.fill_crop && video->size()) {
+ auto const source_ratio = video->size()->ratio();
+ Crop crop;
+ if (source_ratio < film->container().ratio()) {
+ /* Part to extract is wider than the source */
+ auto const height = video->size()->width / film->container().ratio();
+ crop.top = crop.bottom = (video->size()->height - height) / 2;
+ } else {
+ /* Container is wider than the source */
+ auto const width = video->size()->height * film->container().ratio();
+ crop.left = crop.right = (video->size()->width - width) / 2;
+ }
+
+ error(fmt::format(
+ "Cropped {} to {} left, {} right, {} top and {} bottom",
+ film_content->path(0).string(),
+ crop.left,
+ crop.right,
+ crop.top,
+ crop.bottom
+ ));
+
+ video->set_crop(crop);
+ }
if (cli_content.colour_conversion) {
video->set_colour_conversion(PresetColourConversion::from_id(*cli_content.colour_conversion).conversion);
}
diff --git a/src/lib/create_cli.h b/src/lib/create_cli.h
index 00abf85e5..cde8598cd 100644
--- a/src/lib/create_cli.h
+++ b/src/lib/create_cli.h
@@ -42,6 +42,7 @@ public:
boost::filesystem::path path;
VideoFrameType frame_type = VideoFrameType::TWO_D;
bool auto_crop = false;
+ bool fill_crop = false;
boost::optional<std::string> colour_conversion;
boost::optional<dcp::Channel> channel;
boost::optional<float> gain;
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index 21159fcac..ac8c4245b 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -38,22 +38,25 @@ using std::list;
using std::make_shared;
using std::shared_ptr;
using std::string;
+using std::vector;
using boost::optional;
using namespace dcpomatic;
-DCPSubtitleContent::DCPSubtitleContent (boost::filesystem::path path)
- : Content (path)
+DCPSubtitleContent::DCPSubtitleContent(boost::filesystem::path path)
+ : Content(path)
{
- text.push_back (make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE));
+ text = vector<shared_ptr<TextContent>>{make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE)};
+ /* Default to turning these subtitles on */
+ only_text()->set_use(true);
}
DCPSubtitleContent::DCPSubtitleContent(cxml::ConstNodePtr node, boost::optional<boost::filesystem::path> film_directory, int version)
- : Content (node, film_directory)
- , _length (node->number_child<ContentTime::Type> ("Length"))
+ : Content(node, film_directory)
+ , _length(node->number_child<ContentTime::Type>("Length"))
{
list<string> notes;
- text = TextContent::from_xml (this, node, version, notes);
+ text = TextContent::from_xml(this, node, version, notes);
}
void
@@ -63,20 +66,16 @@ DCPSubtitleContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bo
auto subtitle_asset = load(path(0));
- auto iop = dynamic_pointer_cast<dcp::InteropTextAsset>(subtitle_asset);
- auto smpte = dynamic_pointer_cast<dcp::SMPTETextAsset>(subtitle_asset);
- if (smpte) {
+ if (auto smpte = dynamic_pointer_cast<dcp::SMPTETextAsset>(subtitle_asset)) {
set_video_frame_rate(film, smpte->edit_rate().numerator);
}
- boost::mutex::scoped_lock lm (_mutex);
-
- /* Default to turning these subtitles on */
- only_text()->set_use (true);
+ boost::mutex::scoped_lock lm(_mutex);
_length = ContentTime::from_seconds(subtitle_asset->latest_text_out().as_seconds());
subtitle_asset->fix_empty_font_ids();
+ only_text()->clear_fonts();
add_fonts(only_text(), subtitle_asset);
}
@@ -115,26 +114,26 @@ DCPSubtitleContent::add_fonts(shared_ptr<TextContent> content, shared_ptr<dcp::T
DCPTime
-DCPSubtitleContent::full_length (shared_ptr<const Film> film) const
+DCPSubtitleContent::full_length(shared_ptr<const Film> film) const
{
- FrameRateChange const frc (film, shared_from_this());
- return DCPTime (_length, frc);
+ FrameRateChange const frc(film, shared_from_this());
+ return DCPTime(_length, frc);
}
DCPTime
-DCPSubtitleContent::approximate_length () const
+DCPSubtitleContent::approximate_length() const
{
- return DCPTime (_length, FrameRateChange());
+ return DCPTime(_length, FrameRateChange());
}
string
-DCPSubtitleContent::summary () const
+DCPSubtitleContent::summary() const
{
return path_summary() + " " + _("[subtitles]");
}
string
-DCPSubtitleContent::technical_summary () const
+DCPSubtitleContent::technical_summary() const
{
return Content::technical_summary() + " - " + _("DCP XML subtitles");
}
diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h
index dde3139a8..5b1c8426d 100644
--- a/src/lib/dcp_subtitle_content.h
+++ b/src/lib/dcp_subtitle_content.h
@@ -24,12 +24,12 @@
class DCPSubtitleContent : public DCPSubtitle, public Content
{
public:
- DCPSubtitleContent (boost::filesystem::path);
- DCPSubtitleContent (cxml::ConstNodePtr, boost::optional<boost::filesystem::path> film_directory, int);
+ DCPSubtitleContent(boost::filesystem::path);
+ DCPSubtitleContent(cxml::ConstNodePtr, boost::optional<boost::filesystem::path> film_directory, int);
- void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override;
- std::string summary () const override;
- std::string technical_summary () const override;
+ void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override;
+ std::string summary() const override;
+ std::string technical_summary() const override;
void as_xml(
xmlpp::Element* element,
@@ -38,8 +38,8 @@ public:
boost::optional<boost::filesystem::path> film_directory
) const override;
- dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override;
- dcpomatic::DCPTime approximate_length () const override;
+ dcpomatic::DCPTime full_length(std::shared_ptr<const Film> film) const override;
+ dcpomatic::DCPTime approximate_length() const override;
private:
void add_fonts(std::shared_ptr<TextContent> content, std::shared_ptr<dcp::TextAsset> subtitle_asset);
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc
index 775298091..66f4a3c4c 100644
--- a/src/lib/dcp_video.cc
+++ b/src/lib/dcp_video.cc
@@ -135,16 +135,32 @@ DCPVideo::get_size() const
void
DCPVideo::convert_to_xyz(uint16_t* dst) const
{
- DCPOMATIC_ASSERT(_frame->colour_conversion());
+ auto conversion = [](AVPixelFormat fmt) {
+ return fmt == AV_PIX_FMT_XYZ12LE ? AV_PIX_FMT_XYZ12LE : AV_PIX_FMT_RGB48LE;
+ };
- auto image = _frame->image(force(AV_PIX_FMT_RGB48LE), VideoRange::FULL, false);
- dcp::rgb_to_xyz(
- image->data()[0],
- dst,
- image->size(),
- image->stride()[0],
- _frame->colour_conversion().get()
- );
+ auto image = _frame->image(conversion, VideoRange::FULL, false);
+
+ if (_frame->colour_conversion()) {
+ dcp::rgb_to_xyz(
+ image->data()[0],
+ dst,
+ image->size(),
+ image->stride()[0],
+ _frame->colour_conversion().get()
+ );
+ } else {
+ auto const size = image->size();
+ auto const row_bytes = static_cast<size_t>(size.width) * 3 * sizeof(uint16_t);
+ auto src = image->data()[0];
+ auto const src_stride = image->stride()[0];
+ auto out = reinterpret_cast<uint8_t*>(dst);
+ for (int y = 0; y < size.height; ++y) {
+ memcpy(out, src, row_bytes);
+ src += src_stride;
+ out += row_bytes;
+ }
+ }
}
diff --git a/src/lib/dcpomatic_socket.cc b/src/lib/dcpomatic_socket.cc
index d3bfbc309..876fa47d3 100644
--- a/src/lib/dcpomatic_socket.cc
+++ b/src/lib/dcpomatic_socket.cc
@@ -50,7 +50,11 @@ Socket::Socket (int timeout)
void
Socket::check ()
{
+#if BOOST_VERSION >= 108700
if (_deadline.expiry() <= std::chrono::system_clock::now()) {
+#else
+ if (_deadline.expires_at() <= std::chrono::system_clock::now()) {
+#endif
_socket.close();
_deadline.expires_at(std::chrono::time_point<std::chrono::system_clock>::max());
}
@@ -321,7 +325,11 @@ Socket::set_send_buffer_size (int size)
void
Socket::set_deadline_from_now(int seconds)
{
+#if BOOST_VERSION >= 108700
_deadline.expires_after(std::chrono::seconds(seconds));
+#else
+ _deadline.expires_from_now(std::chrono::seconds(seconds));
+#endif
}
void
diff --git a/src/lib/encode_server_finder.cc b/src/lib/encode_server_finder.cc
index d2ecd03b7..a873b258a 100644
--- a/src/lib/encode_server_finder.cc
+++ b/src/lib/encode_server_finder.cc
@@ -54,69 +54,69 @@ using namespace boost::placeholders;
EncodeServerFinder* EncodeServerFinder::_instance = 0;
-EncodeServerFinder::EncodeServerFinder ()
- : _stop (false)
+EncodeServerFinder::EncodeServerFinder()
+ : _stop(false)
{
- Config::instance()->Changed.connect (boost::bind (&EncodeServerFinder::config_changed, this, _1));
+ Config::instance()->Changed.connect(boost::bind(&EncodeServerFinder::config_changed, this, _1));
}
void
-EncodeServerFinder::start ()
+EncodeServerFinder::start()
{
- _search_thread = boost::thread (boost::bind(&EncodeServerFinder::search_thread, this));
- _listen_thread = boost::thread (boost::bind(&EncodeServerFinder::listen_thread, this));
+ _search_thread = boost::thread(boost::bind(&EncodeServerFinder::search_thread, this));
+ _listen_thread = boost::thread(boost::bind(&EncodeServerFinder::listen_thread, this));
#ifdef DCPOMATIC_LINUX
- pthread_setname_np (_search_thread.native_handle(), "encode-server-search");
- pthread_setname_np (_listen_thread.native_handle(), "encode-server-listen");
+ pthread_setname_np(_search_thread.native_handle(), "encode-server-search");
+ pthread_setname_np(_listen_thread.native_handle(), "encode-server-listen");
#endif
}
-EncodeServerFinder::~EncodeServerFinder ()
+EncodeServerFinder::~EncodeServerFinder()
{
- stop ();
+ stop();
}
void
-EncodeServerFinder::stop ()
+EncodeServerFinder::stop()
{
boost::this_thread::disable_interruption dis;
_stop = true;
- _search_condition.notify_all ();
+ _search_condition.notify_all();
try {
_search_thread.join();
} catch (...) {}
_listen_io_context.stop();
try {
- _listen_thread.join ();
+ _listen_thread.join();
} catch (...) {}
- boost::mutex::scoped_lock lm (_servers_mutex);
- _servers.clear ();
+ boost::mutex::scoped_lock lm(_servers_mutex);
+ _servers.clear();
}
void
-EncodeServerFinder::search_thread ()
+EncodeServerFinder::search_thread()
try
{
- start_of_thread ("EncodeServerFinder-search");
+ start_of_thread("EncodeServerFinder-search");
boost::system::error_code error;
dcpomatic::io_context io_context;
boost::asio::ip::udp::socket socket(io_context);
- socket.open (boost::asio::ip::udp::v4(), error);
+ socket.open(boost::asio::ip::udp::v4(), error);
if (error) {
- throw NetworkError ("failed to set up broadcast socket");
+ throw NetworkError("failed to set up broadcast socket");
}
- socket.set_option (boost::asio::ip::udp::socket::reuse_address(true));
- socket.set_option (boost::asio::socket_base::broadcast(true));
+ socket.set_option(boost::asio::ip::udp::socket::reuse_address(true));
+ socket.set_option(boost::asio::socket_base::broadcast(true));
string const data = DCPOMATIC_HELLO;
int const interval = 10;
@@ -125,8 +125,8 @@ try
if (Config::instance()->use_any_servers()) {
/* Broadcast to look for servers */
try {
- boost::asio::ip::udp::endpoint end_point (boost::asio::ip::address_v4::broadcast(), HELLO_PORT);
- socket.send_to (boost::asio::buffer(data.c_str(), data.size() + 1), end_point);
+ boost::asio::ip::udp::endpoint end_point(boost::asio::ip::address_v4::broadcast(), HELLO_PORT);
+ socket.send_to(boost::asio::buffer(data.c_str(), data.size() + 1), end_point);
} catch (...) {
}
@@ -152,14 +152,14 @@ try
/* Discard servers that we haven't seen for a while */
bool removed = false;
{
- boost::mutex::scoped_lock lm (_servers_mutex);
+ boost::mutex::scoped_lock lm(_servers_mutex);
auto i = _servers.begin();
while (i != _servers.end()) {
if (i->last_seen_seconds() > 2 * interval) {
auto j = i;
++j;
- _servers.erase (i);
+ _servers.erase(i);
i = j;
removed = true;
} else {
@@ -169,49 +169,49 @@ try
}
if (removed) {
- emit (boost::bind(boost::ref(ServersListChanged)));
+ emit(boost::bind(boost::ref(ServersListChanged)));
}
- boost::mutex::scoped_lock lm (_search_condition_mutex);
- _search_condition.timed_wait (lm, boost::get_system_time() + boost::posix_time::seconds(interval));
+ boost::mutex::scoped_lock lm(_search_condition_mutex);
+ _search_condition.timed_wait(lm, boost::get_system_time() + boost::posix_time::seconds(interval));
}
}
catch (...)
{
- store_current ();
+ store_current();
}
void
-EncodeServerFinder::listen_thread ()
+EncodeServerFinder::listen_thread()
try {
- start_of_thread ("EncodeServerFinder-listen");
+ start_of_thread("EncodeServerFinder-listen");
using namespace boost::asio::ip;
try {
- _listen_acceptor.reset (
+ _listen_acceptor.reset(
new tcp::acceptor(_listen_io_context, tcp::endpoint(tcp::v4(), is_batch_converter ? BATCH_SERVER_PRESENCE_PORT : MAIN_SERVER_PRESENCE_PORT))
);
} catch (...) {
boost::throw_exception(NetworkError(variant::insert_dcpomatic(_("Could not listen for remote encode servers. Perhaps another instance of {} is running."))));
}
- start_accept ();
+ start_accept();
_listen_io_context.run();
}
catch (...)
{
- store_current ();
+ store_current();
}
void
-EncodeServerFinder::start_accept ()
+EncodeServerFinder::start_accept()
{
_accept_socket = make_shared<Socket>();
- _listen_acceptor->async_accept (
+ _listen_acceptor->async_accept(
_accept_socket->socket(),
boost::bind(&EncodeServerFinder::handle_accept, this, boost::asio::placeholders::error)
);
@@ -219,10 +219,10 @@ EncodeServerFinder::start_accept ()
void
-EncodeServerFinder::handle_accept (boost::system::error_code ec)
+EncodeServerFinder::handle_accept(boost::system::error_code ec)
{
if (ec) {
- start_accept ();
+ start_accept();
return;
}
@@ -230,8 +230,8 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec)
try {
uint32_t length;
- _accept_socket->read (reinterpret_cast<uint8_t*>(&length), sizeof(uint32_t));
- length = ntohl (length);
+ _accept_socket->read(reinterpret_cast<uint8_t*>(&length), sizeof(uint32_t));
+ length = ntohl(length);
if (length > 65536) {
start_accept();
@@ -239,7 +239,7 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec)
}
scoped_array<char> buffer(new char[length]);
- _accept_socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);
+ _accept_socket->read(reinterpret_cast<uint8_t*>(buffer.get()), length);
server_available = buffer.get();
} catch (NetworkError&) {
/* Maybe the server went away; let's just try again */
@@ -253,7 +253,7 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec)
auto const ip = _accept_socket->socket().remote_endpoint().address().to_string();
bool changed = false;
{
- boost::mutex::scoped_lock lm (_servers_mutex);
+ boost::mutex::scoped_lock lm(_servers_mutex);
auto i = _servers.begin();
while (i != _servers.end() && i->host_name() != ip) {
++i;
@@ -262,26 +262,26 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec)
if (i != _servers.end()) {
i->set_seen();
} else {
- EncodeServerDescription sd (ip, xml->number_child<int>("Threads"), xml->optional_number_child<int>("Version").get_value_or(0));
- _servers.push_back (sd);
+ EncodeServerDescription sd(ip, xml->number_child<int>("Threads"), xml->optional_number_child<int>("Version").get_value_or(0));
+ _servers.push_back(sd);
changed = true;
}
}
if (changed) {
- emit (boost::bind(boost::ref (ServersListChanged)));
+ emit(boost::bind(boost::ref(ServersListChanged)));
}
- start_accept ();
+ start_accept();
}
EncodeServerFinder*
-EncodeServerFinder::instance ()
+EncodeServerFinder::instance()
{
if (!_instance) {
- _instance = new EncodeServerFinder ();
- _instance->start ();
+ _instance = new EncodeServerFinder();
+ _instance->start();
}
return _instance;
@@ -289,7 +289,7 @@ EncodeServerFinder::instance ()
void
-EncodeServerFinder::drop ()
+EncodeServerFinder::drop()
{
delete _instance;
_instance = nullptr;
@@ -297,22 +297,22 @@ EncodeServerFinder::drop ()
list<EncodeServerDescription>
-EncodeServerFinder::servers () const
+EncodeServerFinder::servers() const
{
- boost::mutex::scoped_lock lm (_servers_mutex);
+ boost::mutex::scoped_lock lm(_servers_mutex);
return _servers;
}
void
-EncodeServerFinder::config_changed (Config::Property what)
+EncodeServerFinder::config_changed(Config::Property what)
{
if (what == Config::USE_ANY_SERVERS || what == Config::SERVERS) {
{
- boost::mutex::scoped_lock lm (_servers_mutex);
- _servers.clear ();
+ boost::mutex::scoped_lock lm(_servers_mutex);
+ _servers.clear();
}
- ServersListChanged ();
- _search_condition.notify_all ();
+ ServersListChanged();
+ _search_condition.notify_all();
}
}
diff --git a/src/lib/encode_server_finder.h b/src/lib/encode_server_finder.h
index 722786b77..ae83b9609 100644
--- a/src/lib/encode_server_finder.h
+++ b/src/lib/encode_server_finder.h
@@ -47,28 +47,28 @@ class Socket;
class EncodeServerFinder : public Signaller, public ExceptionStore
{
public:
- static EncodeServerFinder* instance ();
- static void drop ();
+ static EncodeServerFinder* instance();
+ static void drop();
- std::list<EncodeServerDescription> servers () const;
+ std::list<EncodeServerDescription> servers() const;
/** Emitted whenever the list of servers changes */
boost::signals2::signal<void ()> ServersListChanged;
private:
- EncodeServerFinder ();
- ~EncodeServerFinder ();
+ EncodeServerFinder();
+ ~EncodeServerFinder();
- void start ();
- void stop ();
+ void start();
+ void stop();
- void search_thread ();
- void listen_thread ();
+ void search_thread();
+ void listen_thread();
- void start_accept ();
- void handle_accept (boost::system::error_code ec);
+ void start_accept();
+ void handle_accept(boost::system::error_code ec);
- void config_changed (Config::Property what);
+ void config_changed(Config::Property what);
/** Thread to periodically issue broadcasts and requests to find encoding servers */
boost::thread _search_thread;
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc
index d7c741d09..50e4cf41d 100644
--- a/src/lib/ffmpeg.cc
+++ b/src/lib/ffmpeg.cc
@@ -54,68 +54,68 @@ using namespace dcpomatic;
boost::mutex FFmpeg::_mutex;
-FFmpeg::FFmpeg (std::shared_ptr<const FFmpegContent> c)
- : _ffmpeg_content (c)
+FFmpeg::FFmpeg(std::shared_ptr<const FFmpegContent> c)
+ : _ffmpeg_content(c)
{
- setup_general ();
- setup_decoders ();
+ setup_general();
+ setup_decoders();
}
-FFmpeg::~FFmpeg ()
+FFmpeg::~FFmpeg()
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
for (auto& i: _codec_context) {
- avcodec_free_context (&i);
+ avcodec_free_context(&i);
}
- av_frame_free (&_video_frame);
+ av_frame_free(&_video_frame);
for (auto& audio_frame: _audio_frame) {
- av_frame_free (&audio_frame.second);
+ av_frame_free(&audio_frame.second);
}
- avformat_close_input (&_format_context);
+ avformat_close_input(&_format_context);
}
static int
-avio_read_wrapper (void* data, uint8_t* buffer, int amount)
+avio_read_wrapper(void* data, uint8_t* buffer, int amount)
{
- return reinterpret_cast<FFmpeg*>(data)->avio_read (buffer, amount);
+ return reinterpret_cast<FFmpeg*>(data)->avio_read(buffer, amount);
}
static int64_t
-avio_seek_wrapper (void* data, int64_t offset, int whence)
+avio_seek_wrapper(void* data, int64_t offset, int whence)
{
- return reinterpret_cast<FFmpeg*>(data)->avio_seek (offset, whence);
+ return reinterpret_cast<FFmpeg*>(data)->avio_seek(offset, whence);
}
void
-FFmpeg::setup_general ()
+FFmpeg::setup_general()
{
- _file_group.set_paths (_ffmpeg_content->paths ());
- _avio_buffer = static_cast<uint8_t*> (wrapped_av_malloc(_avio_buffer_size));
- _avio_context = avio_alloc_context (_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper);
+ _file_group.set_paths(_ffmpeg_content->paths());
+ _avio_buffer = static_cast<uint8_t*>(wrapped_av_malloc(_avio_buffer_size));
+ _avio_context = avio_alloc_context(_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper);
if (!_avio_context) {
- throw std::bad_alloc ();
+ throw std::bad_alloc();
}
- _format_context = avformat_alloc_context ();
+ _format_context = avformat_alloc_context();
if (!_format_context) {
- throw std::bad_alloc ();
+ throw std::bad_alloc();
}
_format_context->pb = _avio_context;
AVDictionary* options = nullptr;
- int e = avformat_open_input (&_format_context, 0, 0, &options);
+ int e = avformat_open_input(&_format_context, 0, 0, &options);
if (e < 0) {
- throw OpenFileError (_ffmpeg_content->path(0).string(), e, OpenFileError::READ);
+ throw OpenFileError(_ffmpeg_content->path(0).string(), e, OpenFileError::READ);
}
- if (avformat_find_stream_info (_format_context, 0) < 0) {
- throw DecodeError (_("could not find stream information"));
+ if (avformat_find_stream_info(_format_context, 0) < 0) {
+ throw DecodeError(_("could not find stream information"));
}
/* Find video stream */
@@ -147,15 +147,15 @@ FFmpeg::setup_general ()
_video_stream = video_stream_undefined_frame_rate.get();
}
- _video_frame = av_frame_alloc ();
+ _video_frame = av_frame_alloc();
if (_video_frame == nullptr) {
- throw std::bad_alloc ();
+ throw std::bad_alloc();
}
}
void
-FFmpeg::setup_decoders ()
+FFmpeg::setup_decoders()
{
for (uint32_t i = 0; i < _format_context->nb_streams; ++i) {
setup_decoder(i);
@@ -166,7 +166,7 @@ FFmpeg::setup_decoders ()
void
FFmpeg::setup_decoder(int stream_index)
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
if (stream_index >= static_cast<int>(_codec_context.size())) {
_codec_context.resize(stream_index + 1);
@@ -211,7 +211,7 @@ FFmpeg::setup_decoder(int stream_index)
AVCodecContext *
-FFmpeg::video_codec_context () const
+FFmpeg::video_codec_context() const
{
if (!_video_stream) {
return nullptr;
@@ -222,7 +222,7 @@ FFmpeg::video_codec_context () const
AVCodecContext *
-FFmpeg::subtitle_codec_context () const
+FFmpeg::subtitle_codec_context() const
{
auto str = _ffmpeg_content->subtitle_stream();
if (!str) {
@@ -234,7 +234,7 @@ FFmpeg::subtitle_codec_context () const
int
-FFmpeg::avio_read (uint8_t* buffer, int const amount)
+FFmpeg::avio_read(uint8_t* buffer, int const amount)
{
auto result = _file_group.read(buffer, amount);
if (result.eof && result.bytes_read == 0) {
@@ -245,20 +245,20 @@ FFmpeg::avio_read (uint8_t* buffer, int const amount)
int64_t
-FFmpeg::avio_seek (int64_t const pos, int whence)
+FFmpeg::avio_seek(int64_t const pos, int whence)
{
if (whence == AVSEEK_SIZE) {
- return _file_group.length ();
+ return _file_group.length();
}
- return _file_group.seek (pos, whence);
+ return _file_group.seek(pos, whence);
}
FFmpegSubtitlePeriod
-FFmpeg::subtitle_period (AVPacket const* packet, AVStream const* stream, AVSubtitle const & sub)
+FFmpeg::subtitle_period(AVPacket const* packet, AVStream const* stream, AVSubtitle const & sub)
{
- auto const packet_time = ContentTime::from_seconds (packet->pts * av_q2d(stream->time_base));
+ auto const packet_time = ContentTime::from_seconds(packet->pts * av_q2d(stream->time_base));
auto const start = packet_time + ContentTime::from_seconds(sub.start_display_time / 1e3);
if (sub.end_display_time == 0 || sub.end_display_time == static_cast<uint32_t>(-1)) {
@@ -270,7 +270,7 @@ FFmpeg::subtitle_period (AVPacket const* packet, AVStream const* stream, AVSubti
}
}
- return FFmpegSubtitlePeriod (start, packet_time + ContentTime::from_seconds(sub.end_display_time / 1e3));
+ return FFmpegSubtitlePeriod(start, packet_time + ContentTime::from_seconds(sub.end_display_time / 1e3));
}
@@ -280,7 +280,7 @@ FFmpeg::subtitle_period (AVPacket const* packet, AVStream const* stream, AVSubti
* in FFmpeg.
*/
ContentTime
-FFmpeg::pts_offset (vector<shared_ptr<FFmpegAudioStream>> audio_streams, optional<ContentTime> first_video, double video_frame_rate) const
+FFmpeg::pts_offset(vector<shared_ptr<FFmpegAudioStream>> audio_streams, optional<ContentTime> first_video, double video_frame_rate) const
{
/* Audio and video frame PTS values may not start with 0. We want
to fiddle them so that:
@@ -298,15 +298,15 @@ FFmpeg::pts_offset (vector<shared_ptr<FFmpegAudioStream>> audio_streams, optiona
/* First, make one of them start at 0 */
- auto po = ContentTime::min ();
+ auto po = ContentTime::min();
if (first_video) {
- po = - first_video.get ();
+ po = - first_video.get();
}
for (auto i: audio_streams) {
if (i->first_audio) {
- po = max (po, - i->first_audio.get ());
+ po = max(po, - i->first_audio.get());
}
}
@@ -316,14 +316,14 @@ FFmpeg::pts_offset (vector<shared_ptr<FFmpegAudioStream>> audio_streams, optiona
I don't think we ever want to do that, as it seems things at -ve PTS are not meant
to be seen (use for alignment bars etc.); see mantis #418.
*/
- if (po > ContentTime ()) {
- po = ContentTime ();
+ if (po > ContentTime()) {
+ po = ContentTime();
}
/* Now adjust so that the video pts starts on a frame */
if (first_video) {
auto const fvc = first_video.get() + po;
- po += fvc.ceil (video_frame_rate) - fvc;
+ po += fvc.ceil(video_frame_rate) - fvc;
}
return po;
@@ -331,14 +331,14 @@ FFmpeg::pts_offset (vector<shared_ptr<FFmpegAudioStream>> audio_streams, optiona
AVFrame *
-FFmpeg::audio_frame (shared_ptr<const FFmpegAudioStream> stream)
+FFmpeg::audio_frame(shared_ptr<const FFmpegAudioStream> stream)
{
auto iter = _audio_frame.find(stream);
if (iter != _audio_frame.end()) {
return iter->second;
}
- auto frame = av_frame_alloc ();
+ auto frame = av_frame_alloc();
if (frame == nullptr) {
throw std::bad_alloc();
}
diff --git a/src/lib/ffmpeg.h b/src/lib/ffmpeg.h
index 63446e5cd..f64f7c7bc 100644
--- a/src/lib/ffmpeg.h
+++ b/src/lib/ffmpeg.h
@@ -47,25 +47,25 @@ class Log;
class FFmpeg
{
public:
- explicit FFmpeg (std::shared_ptr<const FFmpegContent>);
- virtual ~FFmpeg ();
+ explicit FFmpeg(std::shared_ptr<const FFmpegContent>);
+ virtual ~FFmpeg();
- std::shared_ptr<const FFmpegContent> ffmpeg_content () const {
+ std::shared_ptr<const FFmpegContent> ffmpeg_content() const {
return _ffmpeg_content;
}
- int avio_read (uint8_t *, int);
- int64_t avio_seek (int64_t, int);
+ int avio_read(uint8_t *, int);
+ int64_t avio_seek(int64_t, int);
protected:
- AVCodecContext* video_codec_context () const;
- AVCodecContext* subtitle_codec_context () const;
- dcpomatic::ContentTime pts_offset (
+ AVCodecContext* video_codec_context() const;
+ AVCodecContext* subtitle_codec_context() const;
+ dcpomatic::ContentTime pts_offset(
std::vector<std::shared_ptr<FFmpegAudioStream>> audio_streams, boost::optional<dcpomatic::ContentTime> first_video, double video_frame_rate
) const;
void setup_decoder(int stream_index);
- static FFmpegSubtitlePeriod subtitle_period (AVPacket const* packet, AVStream const* stream, AVSubtitle const & sub);
+ static FFmpegSubtitlePeriod subtitle_period(AVPacket const* packet, AVStream const* stream, AVSubtitle const & sub);
std::shared_ptr<const FFmpegContent> _ffmpeg_content;
@@ -82,7 +82,7 @@ protected:
/** Index of video stream within AVFormatContext */
boost::optional<int> _video_stream;
- AVFrame* audio_frame (std::shared_ptr<const FFmpegAudioStream> stream);
+ AVFrame* audio_frame(std::shared_ptr<const FFmpegAudioStream> stream);
/* It would appear (though not completely verified) that one must have
a mutex around calls to avcodec_open* and avcodec_close... and here
@@ -91,8 +91,8 @@ protected:
static boost::mutex _mutex;
private:
- void setup_general ();
- void setup_decoders ();
+ void setup_general();
+ void setup_decoders();
/** AVFrames used for decoding audio streams; accessed with audio_frame() */
std::map<std::shared_ptr<const FFmpegAudioStream>, AVFrame*> _audio_frame;
diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc
index 8ff684ed3..44ebe5075 100644
--- a/src/lib/file_group.cc
+++ b/src/lib/file_group.cc
@@ -37,42 +37,42 @@ using std::vector;
/** Construct a FileGroup with no files */
-FileGroup::FileGroup ()
+FileGroup::FileGroup()
{
}
/** Construct a FileGroup with a single file */
-FileGroup::FileGroup (boost::filesystem::path p)
+FileGroup::FileGroup(boost::filesystem::path p)
{
- _paths.push_back (p);
- ensure_open_path (0);
- seek (0, SEEK_SET);
+ _paths.push_back(p);
+ ensure_open_path(0);
+ seek(0, SEEK_SET);
}
/** Construct a FileGroup with multiple files */
-FileGroup::FileGroup (vector<boost::filesystem::path> const & p)
- : _paths (p)
+FileGroup::FileGroup(vector<boost::filesystem::path> const & p)
+ : _paths(p)
{
- ensure_open_path (0);
- seek (0, SEEK_SET);
+ ensure_open_path(0);
+ seek(0, SEEK_SET);
}
void
-FileGroup::set_paths (vector<boost::filesystem::path> const & p)
+FileGroup::set_paths(vector<boost::filesystem::path> const & p)
{
_paths = p;
- ensure_open_path (0);
- seek (0, SEEK_SET);
+ ensure_open_path(0);
+ seek(0, SEEK_SET);
}
/** Ensure that the given path index in the content is the _current_file */
void
-FileGroup::ensure_open_path (size_t p) const
+FileGroup::ensure_open_path(size_t p) const
{
if (_current_file && _current_path == p) {
/* Already open */
@@ -95,7 +95,7 @@ FileGroup::ensure_open_path (size_t p) const
int64_t
-FileGroup::seek (int64_t pos, int whence) const
+FileGroup::seek(int64_t pos, int whence) const
{
switch (whence) {
case SEEK_SET:
@@ -122,10 +122,10 @@ FileGroup::seek (int64_t pos, int whence) const
}
if (i < _paths.size()) {
- ensure_open_path (i);
+ ensure_open_path(i);
_current_file->seek(sub_pos, SEEK_SET);
} else {
- ensure_open_path (_paths.size() - 1);
+ ensure_open_path(_paths.size() - 1);
_current_file->seek(_current_size, SEEK_SET);
}
@@ -138,9 +138,9 @@ FileGroup::seek (int64_t pos, int whence) const
* @param amount Number of bytes to read.
*/
FileGroup::Result
-FileGroup::read (uint8_t* buffer, int amount) const
+FileGroup::read(uint8_t* buffer, int amount) const
{
- DCPOMATIC_ASSERT (_current_file);
+ DCPOMATIC_ASSERT(_current_file);
int read = 0;
while (true) {
@@ -148,7 +148,7 @@ FileGroup::read (uint8_t* buffer, int amount) const
bool eof = false;
size_t to_read = amount - read;
- DCPOMATIC_ASSERT (_current_file);
+ DCPOMATIC_ASSERT(_current_file);
auto const current_position = _current_file->tell();
if (current_position == -1) {
@@ -168,7 +168,7 @@ FileGroup::read (uint8_t* buffer, int amount) const
}
if (_current_file->error()) {
- throw FileError (fmt::format("fread error {}", errno), _paths[_current_path]);
+ throw FileError(fmt::format("fread error {}", errno), _paths[_current_path]);
}
if (eof) {
@@ -176,7 +176,7 @@ FileGroup::read (uint8_t* buffer, int amount) const
if ((_current_path + 1) >= _paths.size()) {
return { read, true };
}
- ensure_open_path (_current_path + 1);
+ ensure_open_path(_current_path + 1);
}
}
@@ -186,7 +186,7 @@ FileGroup::read (uint8_t* buffer, int amount) const
/** @return Combined length of all the files */
int64_t
-FileGroup::length () const
+FileGroup::length() const
{
int64_t len = 0;
for (size_t i = 0; i < _paths.size(); ++i) {
diff --git a/src/lib/file_group.h b/src/lib/file_group.h
index aac72c228..c16b50f89 100644
--- a/src/lib/file_group.h
+++ b/src/lib/file_group.h
@@ -40,14 +40,14 @@
class FileGroup
{
public:
- FileGroup ();
- explicit FileGroup (boost::filesystem::path);
- explicit FileGroup (std::vector<boost::filesystem::path> const &);
+ FileGroup();
+ explicit FileGroup(boost::filesystem::path);
+ explicit FileGroup(std::vector<boost::filesystem::path> const &);
- FileGroup (FileGroup const&) = delete;
- FileGroup& operator= (FileGroup const&) = delete;
+ FileGroup(FileGroup const&) = delete;
+ FileGroup& operator=(FileGroup const&) = delete;
- void set_paths (std::vector<boost::filesystem::path> const &);
+ void set_paths(std::vector<boost::filesystem::path> const &);
struct Result {
Result(int bytes_read_, bool eof_)
@@ -59,12 +59,12 @@ public:
bool eof = false;
};
- int64_t seek (int64_t, int) const;
- Result read (uint8_t*, int) const;
- int64_t length () const;
+ int64_t seek(int64_t, int) const;
+ Result read(uint8_t*, int) const;
+ int64_t length() const;
private:
- void ensure_open_path (size_t) const;
+ void ensure_open_path(size_t) const;
std::vector<boost::filesystem::path> _paths;
/** Index of path that we are currently reading from */
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index 35eb640d4..90b88a6ef 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -44,16 +44,19 @@
#include <fmt/format.h>
#include <boost/algorithm/string.hpp>
#include <iostream>
+#include <numeric>
#include "i18n.h"
using std::cout;
using std::make_shared;
+using std::map;
using std::max;
using std::shared_ptr;
using std::string;
using std::weak_ptr;
+using std::vector;
using boost::optional;
using namespace dcpomatic;
#if BOOST_VERSION >= 106100
@@ -584,24 +587,42 @@ Hints::text(PlayerText text, TextType type, optional<DCPTextTrack> track, DCPTim
void
Hints::closed_caption(PlayerText text, DCPTimePeriod period)
{
- int lines = text.string.size();
- for (auto i: text.string) {
- if (utf8_strlen(i.text()) > MAX_CLOSED_CAPTION_LENGTH) {
- ++lines;
- if (!_long_ccap) {
- _long_ccap = true;
- hint(
- fmt::format(
- "At least one of your closed caption lines has more than {} characters. "
- "It is advisable to make each line {} characters at most in length.",
- MAX_CLOSED_CAPTION_LENGTH,
- MAX_CLOSED_CAPTION_LENGTH)
- );
+ map<float, vector<StringText>> lines;
+ for (auto const& line: text.string) {
+ bool added = false;
+ for (auto& existing: lines) {
+ if (std::abs(existing.first - line.v_position()) < dcp::ALIGN_EPSILON) {
+ existing.second.push_back(line);
+ added = true;
}
}
+ if (!added) {
+ lines[line.v_position()] = { line };
+ }
+ }
+
+ for (auto const& line: lines) {
+ int const length = std::accumulate(
+ line.second.begin(),
+ line.second.end(),
+ 0,
+ [](int acc, StringText const& text) {
+ return acc + dcp::utf8_strlen(text.text());
+ });
+
+ if (length > MAX_CLOSED_CAPTION_LENGTH && !_long_ccap) {
+ _long_ccap = true;
+ hint(
+ fmt::format(
+ "At least one of your closed caption lines has more than {} characters. "
+ "It is advisable to make each line {} characters at most in length.",
+ MAX_CLOSED_CAPTION_LENGTH,
+ MAX_CLOSED_CAPTION_LENGTH)
+ );
+ }
}
- if (!_too_many_ccap_lines && lines > MAX_CLOSED_CAPTION_LINES) {
+ if (!_too_many_ccap_lines && lines.size() > MAX_CLOSED_CAPTION_LINES) {
hint(fmt::format(_("Some of your closed captions span more than {} lines, so they will be truncated."), MAX_CLOSED_CAPTION_LINES));
_too_many_ccap_lines = true;
}
diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc
index 8d3092196..4e9eff237 100644
--- a/src/lib/image_content.cc
+++ b/src/lib/image_content.cc
@@ -46,33 +46,33 @@ using boost::optional;
using namespace dcpomatic;
-ImageContent::ImageContent (boost::filesystem::path p)
+ImageContent::ImageContent(boost::filesystem::path p)
{
video = make_shared<VideoContent>(this);
if (dcp::filesystem::is_regular_file(p) && valid_image_file(p)) {
- add_path (p);
+ add_path(p);
} else {
_path_to_scan = p;
}
- set_default_colour_conversion ();
+ set_default_colour_conversion();
}
ImageContent::ImageContent(cxml::ConstNodePtr node, boost::optional<boost::filesystem::path> film_directory, int version)
: Content(node, film_directory)
{
- video = VideoContent::from_xml (this, node, version, VideoRange::FULL);
+ video = VideoContent::from_xml(this, node, version, VideoRange::FULL);
}
string
-ImageContent::summary () const
+ImageContent::summary() const
{
- string s = path_summary () + " ";
+ string s = path_summary() + " ";
/* Get the string() here so that the name does not have quotes around it */
- if (still ()) {
+ if (still()) {
s += _("[still]");
} else {
s += _("[moving images]");
@@ -83,12 +83,12 @@ ImageContent::summary () const
string
-ImageContent::technical_summary () const
+ImageContent::technical_summary() const
{
string s = Content::technical_summary() + " - "
+ video->technical_summary() + " - ";
- if (still ()) {
+ if (still()) {
s += _("still");
} else {
s += _("moving");
@@ -114,92 +114,92 @@ void
ImageContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant)
{
if (_path_to_scan) {
- job->sub (_("Scanning image files"));
+ job->sub(_("Scanning image files"));
vector<boost::filesystem::path> paths;
int n = 0;
for (auto i: dcp::filesystem::directory_iterator(*_path_to_scan)) {
if (dcp::filesystem::is_regular_file(i.path()) && valid_image_file(i.path())) {
- paths.push_back (i.path());
+ paths.push_back(i.path());
}
++n;
if ((n % 1000) == 0) {
- job->set_progress_unknown ();
+ job->set_progress_unknown();
}
}
if (paths.empty()) {
- throw FileError (_("No valid image files were found in the folder."), *_path_to_scan);
+ throw FileError(_("No valid image files were found in the folder."), *_path_to_scan);
}
- sort (paths.begin(), paths.end(), ImageFilenameSorter());
- set_paths (paths);
+ sort(paths.begin(), paths.end(), ImageFilenameSorter());
+ set_paths(paths);
}
Content::examine(film, job, tolerant);
auto examiner = make_shared<ImageExaminer>(film, shared_from_this(), job);
video->take_from_examiner(film, examiner);
- set_default_colour_conversion ();
+ set_default_colour_conversion();
}
DCPTime
-ImageContent::full_length (shared_ptr<const Film> film) const
+ImageContent::full_length(shared_ptr<const Film> film) const
{
- FrameRateChange const frc (film, shared_from_this());
- return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
+ FrameRateChange const frc(film, shared_from_this());
+ return DCPTime::from_frames(llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
DCPTime
-ImageContent::approximate_length () const
+ImageContent::approximate_length() const
{
- return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+ return DCPTime::from_frames(video->length_after_3d_combine(), 24);
}
string
-ImageContent::identifier () const
+ImageContent::identifier() const
{
char buffer[256];
- snprintf (buffer, sizeof(buffer), "%s_%s_%" PRId64, Content::identifier().c_str(), video->identifier().c_str(), video->length());
+ snprintf(buffer, sizeof(buffer), "%s_%s_%" PRId64, Content::identifier().c_str(), video->identifier().c_str(), video->length());
return buffer;
}
bool
-ImageContent::still () const
+ImageContent::still() const
{
return number_of_paths() == 1;
}
void
-ImageContent::set_default_colour_conversion ()
+ImageContent::set_default_colour_conversion()
{
for (auto i: paths()) {
if (valid_j2k_file (i)) {
/* We default to no colour conversion if we have JPEG2000 files */
- video->unset_colour_conversion ();
+ video->unset_colour_conversion();
return;
}
}
- bool const s = still ();
+ bool const s = still();
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
if (s) {
- video->set_colour_conversion (PresetColourConversion::from_id ("srgb").conversion);
+ video->set_colour_conversion(PresetColourConversion::from_id("srgb").conversion);
} else {
- video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion);
+ video->set_colour_conversion(PresetColourConversion::from_id("rec709").conversion);
}
}
void
-ImageContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
+ImageContent::add_properties(shared_ptr<const Film> film, list<UserProperty>& p) const
{
- Content::add_properties (film, p);
- video->add_properties (p);
+ Content::add_properties(film, p);
+ video->add_properties(p);
}
diff --git a/src/lib/image_content.h b/src/lib/image_content.h
index 4b3b13380..04318ae0d 100644
--- a/src/lib/image_content.h
+++ b/src/lib/image_content.h
@@ -26,20 +26,20 @@
class ImageContent : public Content
{
public:
- ImageContent (boost::filesystem::path);
- ImageContent (cxml::ConstNodePtr, boost::optional<boost::filesystem::path> film_directory, int);
+ ImageContent(boost::filesystem::path);
+ ImageContent(cxml::ConstNodePtr, boost::optional<boost::filesystem::path> film_directory, int);
- std::shared_ptr<ImageContent> shared_from_this () {
- return std::dynamic_pointer_cast<ImageContent> (Content::shared_from_this ());
+ std::shared_ptr<ImageContent> shared_from_this() {
+ return std::dynamic_pointer_cast<ImageContent>(Content::shared_from_this());
};
- std::shared_ptr<const ImageContent> shared_from_this () const {
- return std::dynamic_pointer_cast<const ImageContent> (Content::shared_from_this ());
+ std::shared_ptr<const ImageContent> shared_from_this() const {
+ return std::dynamic_pointer_cast<const ImageContent>(Content::shared_from_this());
};
void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override;
- std::string summary () const override;
- std::string technical_summary () const override;
+ std::string summary() const override;
+ std::string technical_summary() const override;
void as_xml(
xmlpp::Element* element,
@@ -48,17 +48,17 @@ public:
boost::optional<boost::filesystem::path> film_directory
) const override;
- dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override;
- dcpomatic::DCPTime approximate_length () const override;
+ dcpomatic::DCPTime full_length(std::shared_ptr<const Film> film) const override;
+ dcpomatic::DCPTime approximate_length() const override;
- std::string identifier () const override;
+ std::string identifier() const override;
- void set_default_colour_conversion ();
+ void set_default_colour_conversion();
- bool still () const;
+ bool still() const;
private:
- void add_properties (std::shared_ptr<const Film> film, std::list<UserProperty>& p) const override;
+ void add_properties(std::shared_ptr<const Film> film, std::list<UserProperty>& p) const override;
boost::optional<boost::filesystem::path> _path_to_scan;
};
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc
index 527a98c7d..29e4a2f07 100644
--- a/src/lib/image_decoder.cc
+++ b/src/lib/image_decoder.cc
@@ -43,16 +43,16 @@ using dcp::Size;
using namespace dcpomatic;
-ImageDecoder::ImageDecoder (shared_ptr<const Film> film, shared_ptr<const ImageContent> c)
- : Decoder (film)
- , _image_content (c)
+ImageDecoder::ImageDecoder(shared_ptr<const Film> film, shared_ptr<const ImageContent> c)
+ : Decoder(film)
+ , _image_content(c)
{
video = make_shared<VideoDecoder>(this, c);
}
bool
-ImageDecoder::pass ()
+ImageDecoder::pass()
{
if (_frame_video_position >= _image_content->video->length()) {
return true;
@@ -60,8 +60,8 @@ ImageDecoder::pass ()
if (!_image_content->still() || !_image) {
/* Either we need an image or we are using moving images, so load one */
- auto path = _image_content->path (_image_content->still() ? 0 : _frame_video_position);
- if (valid_j2k_file (path)) {
+ auto path = _image_content->path(_image_content->still() ? 0 : _frame_video_position);
+ if (valid_j2k_file(path)) {
AVPixelFormat pf;
if (_image_content->video->colour_conversion()) {
/* We have a specified colour conversion: assume the image is RGB */
@@ -88,8 +88,8 @@ ImageDecoder::pass ()
void
-ImageDecoder::seek (ContentTime time, bool accurate)
+ImageDecoder::seek(ContentTime time, bool accurate)
{
- Decoder::seek (time, accurate);
- _frame_video_position = time.frames_round (_image_content->active_video_frame_rate(film()));
+ Decoder::seek(time, accurate);
+ _frame_video_position = time.frames_round(_image_content->active_video_frame_rate(film()));
}
diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h
index 41924735c..2b07e6b28 100644
--- a/src/lib/image_decoder.h
+++ b/src/lib/image_decoder.h
@@ -31,14 +31,14 @@ class ImageProxy;
class ImageDecoder : public Decoder
{
public:
- ImageDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const ImageContent> c);
+ ImageDecoder(std::shared_ptr<const Film> film, std::shared_ptr<const ImageContent> c);
- std::shared_ptr<const ImageContent> content () {
+ std::shared_ptr<const ImageContent> content() {
return _image_content;
}
- bool pass () override;
- void seek (dcpomatic::ContentTime, bool) override;
+ bool pass() override;
+ void seek(dcpomatic::ContentTime, bool) override;
private:
diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc
index 4a91a103f..f39500781 100644
--- a/src/lib/image_examiner.cc
+++ b/src/lib/image_examiner.cc
@@ -44,16 +44,16 @@ using std::sort;
using boost::optional;
-ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const ImageContent> content, shared_ptr<Job>)
- : _film (film)
- , _image_content (content)
+ImageExaminer::ImageExaminer(shared_ptr<const Film> film, shared_ptr<const ImageContent> content, shared_ptr<Job>)
+ : _film(film)
+ , _image_content(content)
{
auto path = content->path(0);
- if (valid_j2k_file (path)) {
+ if (valid_j2k_file(path)) {
auto size = dcp::filesystem::file_size(path);
dcp::File f(path, "rb");
if (!f) {
- throw FileError ("Could not open file for reading", path);
+ throw FileError("Could not open file for reading", path);
}
std::vector<uint8_t> buffer(size);
f.checked_read(buffer.data(), size);
@@ -70,23 +70,23 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag
_has_alpha = image.image->has_alpha();
}
- if (content->still ()) {
- _video_length = Config::instance()->default_still_length() * video_frame_rate().get_value_or (film->video_frame_rate ());
+ if (content->still()) {
+ _video_length = Config::instance()->default_still_length() * video_frame_rate().get_value_or(film->video_frame_rate());
} else {
- _video_length = _image_content->number_of_paths ();
+ _video_length = _image_content->number_of_paths();
}
}
optional<dcp::Size>
-ImageExaminer::video_size () const
+ImageExaminer::video_size() const
{
return _video_size;
}
optional<double>
-ImageExaminer::video_frame_rate () const
+ImageExaminer::video_frame_rate() const
{
if (_image_content->video_frame_rate()) {
/* The content already knows what frame rate it should be */
@@ -99,7 +99,7 @@ ImageExaminer::video_frame_rate () const
bool
-ImageExaminer::yuv () const
+ImageExaminer::yuv() const
{
/* We never convert ImageSource from YUV to RGB (though maybe sometimes we should)
so it makes sense to just say they are never YUV so the option of a conversion
diff --git a/src/lib/image_examiner.h b/src/lib/image_examiner.h
index d6cdfac53..dddb6544f 100644
--- a/src/lib/image_examiner.h
+++ b/src/lib/image_examiner.h
@@ -25,21 +25,21 @@ class ImageContent;
class ImageExaminer : public VideoExaminer
{
public:
- ImageExaminer (std::shared_ptr<const Film>, std::shared_ptr<const ImageContent>, std::shared_ptr<Job>);
+ ImageExaminer(std::shared_ptr<const Film>, std::shared_ptr<const ImageContent>, std::shared_ptr<Job>);
- bool has_video () const override {
+ bool has_video() const override {
return true;
}
- boost::optional<double> video_frame_rate () const override;
+ boost::optional<double> video_frame_rate() const override;
boost::optional<dcp::Size> video_size() const override;
- Frame video_length () const override {
+ Frame video_length() const override {
return _video_length;
}
- bool yuv () const override;
- VideoRange range () const override {
+ bool yuv() const override;
+ VideoRange range() const override {
return VideoRange::FULL;
}
- PixelQuanta pixel_quanta () const override {
+ PixelQuanta pixel_quanta() const override {
/* See ::yuv - we're assuming the image is not YUV and so not subsampled */
return {};
}
diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc
index 8fb387158..c2058794e 100644
--- a/src/lib/j2k_image_proxy.cc
+++ b/src/lib/j2k_image_proxy.cc
@@ -51,57 +51,57 @@ using dcp::ArrayData;
/** Construct a J2KImageProxy from a JPEG2000 file */
-J2KImageProxy::J2KImageProxy (boost::filesystem::path path, dcp::Size size, AVPixelFormat pixel_format)
- : _data (new dcp::ArrayData(path))
- , _size (size)
- , _pixel_format (pixel_format)
- , _error (false)
+J2KImageProxy::J2KImageProxy(boost::filesystem::path path, dcp::Size size, AVPixelFormat pixel_format)
+ : _data(new dcp::ArrayData(path))
+ , _size(size)
+ , _pixel_format(pixel_format)
+ , _error(false)
{
/* ::image assumes 16bpp */
- DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
+ DCPOMATIC_ASSERT(_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
}
-J2KImageProxy::J2KImageProxy (
+J2KImageProxy::J2KImageProxy(
shared_ptr<const dcp::MonoJ2KPictureFrame> frame,
dcp::Size size,
AVPixelFormat pixel_format,
optional<int> forced_reduction
)
- : _data (frame)
- , _size (size)
- , _pixel_format (pixel_format)
- , _forced_reduction (forced_reduction)
- , _error (false)
+ : _data(frame)
+ , _size(size)
+ , _pixel_format(pixel_format)
+ , _forced_reduction(forced_reduction)
+ , _error(false)
{
/* ::image assumes 16bpp */
- DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
+ DCPOMATIC_ASSERT(_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
}
-J2KImageProxy::J2KImageProxy (
+J2KImageProxy::J2KImageProxy(
shared_ptr<const dcp::StereoJ2KPictureFrame> frame,
dcp::Size size,
dcp::Eye eye,
AVPixelFormat pixel_format,
optional<int> forced_reduction
)
- : _data (eye == dcp::Eye::LEFT ? frame->left() : frame->right())
- , _size (size)
- , _eye (eye)
- , _pixel_format (pixel_format)
- , _forced_reduction (forced_reduction)
- , _error (false)
+ : _data(eye == dcp::Eye::LEFT ? frame->left() : frame->right())
+ , _size(size)
+ , _eye(eye)
+ , _pixel_format(pixel_format)
+ , _forced_reduction(forced_reduction)
+ , _error(false)
{
/* ::image assumes 16bpp */
- DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
+ DCPOMATIC_ASSERT(_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
}
-J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
- : _error (false)
+J2KImageProxy::J2KImageProxy(shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
+ : _error(false)
{
- _size = dcp::Size (xml->number_child<int>("Width"), xml->number_child<int>("Height"));
+ _size = dcp::Size(xml->number_child<int>("Width"), xml->number_child<int>("Height"));
if (xml->optional_number_child<int>("Eye")) {
_eye = static_cast<dcp::Eye>(xml->number_child<int>("Eye"));
}
@@ -111,18 +111,18 @@ J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
encode servers). So we can put anything in here. It's a bit of a hack.
*/
_pixel_format = AV_PIX_FMT_XYZ12LE;
- socket->read (data->data(), data->size());
+ socket->read(data->data(), data->size());
_data = data;
}
int
-J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_size) const
+J2KImageProxy::prepare(Image::Alignment alignment, optional<dcp::Size> target_size) const
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
if (_image && target_size == _target_size) {
- DCPOMATIC_ASSERT (_reduce);
+ DCPOMATIC_ASSERT(_reduce);
return *_reduce;
}
@@ -136,15 +136,15 @@ J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_s
}
--reduce;
- reduce = max (0, reduce);
+ reduce = max(0, reduce);
}
try {
/* XXX: should check that potentially trashing _data here doesn't matter */
- auto decompressed = dcp::decompress_j2k (const_cast<uint8_t*>(_data->data()), _data->size(), reduce);
+ auto decompressed = dcp::decompress_j2k(const_cast<uint8_t*>(_data->data()), _data->size(), reduce);
_image = make_shared<Image>(_pixel_format, decompressed->size(), alignment);
- int const shift = 16 - decompressed->precision (0);
+ int const shift = 16 - decompressed->precision(0);
/* Copy data in whatever format (sRGB or XYZ) into our Image; I'm assuming
the data is 12-bit either way.
@@ -153,9 +153,9 @@ J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_s
int const width = decompressed->size().width;
int p = 0;
- int* decomp_0 = decompressed->data (0);
- int* decomp_1 = decompressed->data (1);
- int* decomp_2 = decompressed->data (2);
+ int* decomp_0 = decompressed->data(0);
+ int* decomp_1 = decompressed->data(1);
+ int* decomp_2 = decompressed->data(2);
for (int y = 0; y < decompressed->size().height; ++y) {
auto q = reinterpret_cast<uint16_t *>(_image->data()[0] + y * _image->stride()[0]);
for (int x = 0; x < width; ++x) {
@@ -167,7 +167,7 @@ J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_s
}
} catch (dcp::J2KDecompressionError& e) {
_image = make_shared<Image>(_pixel_format, _size, alignment);
- _image->make_black ();
+ _image->make_black();
_error = true;
}
@@ -179,14 +179,14 @@ J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_s
ImageProxy::Result
-J2KImageProxy::image (Image::Alignment alignment, optional<dcp::Size> target_size) const
+J2KImageProxy::image(Image::Alignment alignment, optional<dcp::Size> target_size) const
{
- int const r = prepare (alignment, target_size);
+ int const r = prepare(alignment, target_size);
/* I think this is safe without a lock on mutex. _image is guaranteed to be
set up when prepare() has happened.
*/
- return Result (_image, r, _error);
+ return Result(_image, r, _error);
}
@@ -204,14 +204,14 @@ J2KImageProxy::add_metadata(xmlpp::Element* element) const
void
-J2KImageProxy::write_to_socket (shared_ptr<Socket> socket) const
+J2KImageProxy::write_to_socket(shared_ptr<Socket> socket) const
{
- socket->write (_data->data(), _data->size());
+ socket->write(_data->data(), _data->size());
}
bool
-J2KImageProxy::same (shared_ptr<const ImageProxy> other) const
+J2KImageProxy::same(shared_ptr<const ImageProxy> other) const
{
auto jp = dynamic_pointer_cast<const J2KImageProxy>(other);
if (!jp) {
@@ -222,19 +222,19 @@ J2KImageProxy::same (shared_ptr<const ImageProxy> other) const
}
-J2KImageProxy::J2KImageProxy (ArrayData data, dcp::Size size, AVPixelFormat pixel_format)
- : _data (new ArrayData(data))
- , _size (size)
- , _pixel_format (pixel_format)
- , _error (false)
+J2KImageProxy::J2KImageProxy(ArrayData data, dcp::Size size, AVPixelFormat pixel_format)
+ : _data(new ArrayData(data))
+ , _size(size)
+ , _pixel_format(pixel_format)
+ , _error(false)
{
/* ::image assumes 16bpp */
- DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
+ DCPOMATIC_ASSERT(_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
}
size_t
-J2KImageProxy::memory_used () const
+J2KImageProxy::memory_used() const
{
size_t m = _data->size();
if (_image) {
diff --git a/src/lib/j2k_image_proxy.h b/src/lib/j2k_image_proxy.h
index 1d2d5cc21..40504ddd5 100644
--- a/src/lib/j2k_image_proxy.h
+++ b/src/lib/j2k_image_proxy.h
@@ -34,16 +34,16 @@ namespace dcp {
class J2KImageProxy : public ImageProxy
{
public:
- J2KImageProxy (boost::filesystem::path path, dcp::Size, AVPixelFormat pixel_format);
+ J2KImageProxy(boost::filesystem::path path, dcp::Size, AVPixelFormat pixel_format);
- J2KImageProxy (
+ J2KImageProxy(
std::shared_ptr<const dcp::MonoJ2KPictureFrame> frame,
dcp::Size,
AVPixelFormat pixel_format,
boost::optional<int> forced_reduction
);
- J2KImageProxy (
+ J2KImageProxy(
std::shared_ptr<const dcp::StereoJ2KPictureFrame> frame,
dcp::Size,
dcp::Eye,
@@ -51,35 +51,35 @@ public:
boost::optional<int> forced_reduction
);
- J2KImageProxy (std::shared_ptr<cxml::Node> xml, std::shared_ptr<Socket> socket);
+ J2KImageProxy(std::shared_ptr<cxml::Node> xml, std::shared_ptr<Socket> socket);
/* For tests */
- J2KImageProxy (dcp::ArrayData data, dcp::Size size, AVPixelFormat pixel_format);
+ J2KImageProxy(dcp::ArrayData data, dcp::Size size, AVPixelFormat pixel_format);
- Result image (
+ Result image(
Image::Alignment alignment,
- boost::optional<dcp::Size> size = boost::optional<dcp::Size> ()
+ boost::optional<dcp::Size> size = boost::optional<dcp::Size>()
) const override;
void add_metadata(xmlpp::Element*) const override;
- void write_to_socket (std::shared_ptr<Socket> override) const override;
+ void write_to_socket(std::shared_ptr<Socket> override) const override;
/** @return true if our image is definitely the same as another, false if it is probably not */
- bool same (std::shared_ptr<const ImageProxy>) const override;
- int prepare (Image::Alignment alignment, boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const override;
+ bool same(std::shared_ptr<const ImageProxy>) const override;
+ int prepare(Image::Alignment alignment, boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const override;
- std::shared_ptr<const dcp::Data> j2k () const {
+ std::shared_ptr<const dcp::Data> j2k() const {
return _data;
}
- dcp::Size size () const {
+ dcp::Size size() const {
return _size;
}
- boost::optional<dcp::Eye> eye () const {
+ boost::optional<dcp::Eye> eye() const {
return _eye;
}
- size_t memory_used () const override;
+ size_t memory_used() const override;
private:
std::shared_ptr<const dcp::Data> _data;
diff --git a/src/lib/nanomsg.cc b/src/lib/nanomsg.cc
index fe3827247..4ec37635e 100644
--- a/src/lib/nanomsg.cc
+++ b/src/lib/nanomsg.cc
@@ -36,9 +36,9 @@ using boost::optional;
#define NANOMSG_URL "ipc:///tmp/dcpomatic.ipc"
-Nanomsg::Nanomsg (bool server)
+Nanomsg::Nanomsg(bool server)
{
- _socket = nn_socket (AF_SP, NN_PAIR);
+ _socket = nn_socket(AF_SP, NN_PAIR);
if (_socket < 0) {
throw runtime_error("Could not set up nanomsg socket");
}
@@ -54,21 +54,21 @@ Nanomsg::Nanomsg (bool server)
}
-Nanomsg::~Nanomsg ()
+Nanomsg::~Nanomsg()
{
- nn_shutdown (_socket, _endpoint);
- nn_close (_socket);
+ nn_shutdown(_socket, _endpoint);
+ nn_close(_socket);
}
bool
-Nanomsg::send (string s, int timeout)
+Nanomsg::send(string s, int timeout)
{
if (timeout != 0) {
- nn_setsockopt (_socket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, sizeof(int));
+ nn_setsockopt(_socket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, sizeof(int));
}
- int const r = nn_send (_socket, s.c_str(), s.length(), timeout ? 0 : NN_DONTWAIT);
+ int const r = nn_send(_socket, s.c_str(), s.length(), timeout ? 0 : NN_DONTWAIT);
if (r < 0) {
if (errno == ETIMEDOUT || errno == EAGAIN) {
return false;
@@ -83,7 +83,7 @@ Nanomsg::send (string s, int timeout)
optional<string>
-Nanomsg::get_from_pending ()
+Nanomsg::get_from_pending()
{
if (_pending.empty()) {
return {};
@@ -96,10 +96,10 @@ Nanomsg::get_from_pending ()
void
-Nanomsg::recv_and_parse (int flags)
+Nanomsg::recv_and_parse(int flags)
{
char* buf = 0;
- int const received = nn_recv (_socket, &buf, NN_MSG, flags);
+ int const received = nn_recv(_socket, &buf, NN_MSG, flags);
if (received < 0)
{
if (errno == ETIMEDOUT || errno == EAGAIN) {
@@ -107,36 +107,35 @@ Nanomsg::recv_and_parse (int flags)
}
LOG_DISK("nn_recv failed");
- throw CommunicationFailedError ();
+ throw CommunicationFailedError();
}
char* p = buf;
for (int i = 0; i < received; ++i) {
if (*p == '\n') {
- _pending.push_front (_current);
+ _pending.push_front(_current);
_current = "";
} else {
_current += *p;
}
++p;
}
- nn_freemsg (buf);
+ nn_freemsg(buf);
}
optional<string>
-Nanomsg::receive (int timeout)
+Nanomsg::receive(int timeout)
{
if (timeout != 0) {
- nn_setsockopt (_socket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, sizeof(int));
+ nn_setsockopt(_socket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, sizeof(int));
}
- auto l = get_from_pending ();
- if (l) {
+ if (auto l = get_from_pending()) {
return *l;
}
- recv_and_parse (timeout ? 0 : NN_DONTWAIT);
+ recv_and_parse(timeout ? 0 : NN_DONTWAIT);
- return get_from_pending ();
+ return get_from_pending();
}
diff --git a/src/lib/nanomsg.h b/src/lib/nanomsg.h
index 8d89d6d99..bd15a670f 100644
--- a/src/lib/nanomsg.h
+++ b/src/lib/nanomsg.h
@@ -27,27 +27,27 @@
class Nanomsg
{
public:
- explicit Nanomsg (bool server);
- ~Nanomsg ();
+ explicit Nanomsg(bool server);
+ ~Nanomsg();
- Nanomsg (Nanomsg const&) = delete;
- Nanomsg& operator= (Nanomsg const&) = delete;
+ Nanomsg(Nanomsg const&) = delete;
+ Nanomsg& operator=(Nanomsg const&) = delete;
/** Try to send a message, waiting for some timeout before giving up.
* @param timeout Timeout in milliseconds, or -1 for infinite timeout.
* @return true if the send happened, false if there was a timeout.
*/
- bool send (std::string s, int timeout);
+ bool send(std::string s, int timeout);
/** Try to receive a message, waiting for some timeout before giving up.
* @param timeout Timeout in milliseconds, or -1 for infinite timeout.
* @return Empty if the timeout was reached, otherwise the received string.
*/
- boost::optional<std::string> receive (int timeout);
+ boost::optional<std::string> receive(int timeout);
private:
- boost::optional<std::string> get_from_pending ();
- void recv_and_parse (int flags);
+ boost::optional<std::string> get_from_pending();
+ void recv_and_parse(int flags);
int _socket;
int _endpoint;
diff --git a/src/lib/text_ring_buffers.cc b/src/lib/text_ring_buffers.cc
index e2be7bf41..3650bf6a0 100644
--- a/src/lib/text_ring_buffers.cc
+++ b/src/lib/text_ring_buffers.cc
@@ -28,17 +28,17 @@ using namespace dcpomatic;
void
-TextRingBuffers::put (PlayerText text, DCPTextTrack track, DCPTimePeriod period)
+TextRingBuffers::put(PlayerText text, DCPTextTrack track, DCPTimePeriod period)
{
- boost::mutex::scoped_lock lm (_mutex);
- _data.push_back (Data(text, track, period));
+ boost::mutex::scoped_lock lm(_mutex);
+ _data.push_back(Data(text, track, period));
}
optional<TextRingBuffers::Data>
-TextRingBuffers::get ()
+TextRingBuffers::get()
{
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
if (_data.empty()) {
return {};
}
@@ -50,7 +50,7 @@ TextRingBuffers::get ()
void
-TextRingBuffers::clear ()
+TextRingBuffers::clear()
{
- _data.clear ();
+ _data.clear();
}
diff --git a/src/lib/text_ring_buffers.h b/src/lib/text_ring_buffers.h
index 1f366fc0b..b924a9634 100644
--- a/src/lib/text_ring_buffers.h
+++ b/src/lib/text_ring_buffers.h
@@ -33,13 +33,13 @@
class TextRingBuffers
{
public:
- void put (PlayerText text, DCPTextTrack track, dcpomatic::DCPTimePeriod period);
+ void put(PlayerText text, DCPTextTrack track, dcpomatic::DCPTimePeriod period);
struct Data {
- Data (PlayerText text_, DCPTextTrack track_, dcpomatic::DCPTimePeriod period_)
- : text (text_)
- , track (track_)
- , period (period_)
+ Data(PlayerText text_, DCPTextTrack track_, dcpomatic::DCPTimePeriod period_)
+ : text(text_)
+ , track(track_)
+ , period(period_)
{}
PlayerText text;
@@ -47,8 +47,8 @@ public:
dcpomatic::DCPTimePeriod period;
};
- boost::optional<Data> get ();
- void clear ();
+ boost::optional<Data> get();
+ void clear();
private:
boost::mutex _mutex;
diff --git a/src/lib/util.cc b/src/lib/util.cc
index adc347ab1..60b93a0c4 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -171,7 +171,7 @@ time_to_hmsf(DCPTime time, Frame rate)
m -= h * 60;
char buffer[64];
- snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d.%02d", h, m, s, static_cast<int>(f));
+ snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d:%02d", h, m, s, static_cast<int>(f));
return buffer;
}
@@ -842,26 +842,6 @@ remap(shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping ma
}
-size_t
-utf8_strlen(string s)
-{
- size_t const len = s.length();
- int N = 0;
- for (size_t i = 0; i < len; ++i) {
- unsigned char c = s[i];
- if ((c & 0xe0) == 0xc0) {
- ++i;
- } else if ((c & 0xf0) == 0xe0) {
- i += 2;
- } else if ((c & 0xf8) == 0xf0) {
- i += 3;
- }
- ++N;
- }
- return N;
-}
-
-
/** @param size Size of picture that the subtitle will be overlaid onto */
void
emit_subtitle_image(ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder)
diff --git a/src/lib/util.h b/src/lib/util.h
index aa003ff00..9863e5d94 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -84,7 +84,6 @@ extern std::string atmos_asset_filename(std::shared_ptr<dcp::AtmosAsset> asset,
extern std::string careful_string_filter(std::string s, std::wstring allowed = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.+");
extern std::pair<int, int> audio_channel_types(std::list<int> mapped, int channels);
extern std::shared_ptr<AudioBuffers> remap(std::shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map);
-extern size_t utf8_strlen(std::string s);
extern void emit_subtitle_image(dcpomatic::ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
extern void copy_in_bits(boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
extern dcp::Size scale_for_display(dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta);
diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc
index a26c54473..1accd7a5c 100644
--- a/src/lib/video_mxf_content.cc
+++ b/src/lib/video_mxf_content.cc
@@ -41,8 +41,8 @@ using boost::optional;
using namespace dcpomatic;
-VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
- : Content (path)
+VideoMXFContent::VideoMXFContent(boost::filesystem::path path)
+ : Content(path)
{
}
@@ -51,12 +51,12 @@ VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
VideoMXFContent::VideoMXFContent(cxml::ConstNodePtr node, boost::optional<boost::filesystem::path> film_directory, int version)
: Content(node, film_directory)
{
- video = VideoContent::from_xml (this, node, version, VideoRange::FULL);
+ video = VideoContent::from_xml(this, node, version, VideoRange::FULL);
}
bool
-VideoMXFContent::valid_mxf (boost::filesystem::path path)
+VideoMXFContent::valid_mxf(boost::filesystem::path path)
{
Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
@@ -71,7 +71,7 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path)
try {
Kumu::DefaultLogSink().SetFilterFlag(0);
- dcp::StereoJ2KPictureAsset sp (path);
+ dcp::StereoJ2KPictureAsset sp(path);
return true;
} catch (dcp::MXFFileError& e) {
@@ -88,33 +88,33 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path)
void
VideoMXFContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant)
{
- job->set_progress_unknown ();
+ job->set_progress_unknown();
Content::examine(film, job, tolerant);
- video.reset (new VideoContent (this));
+ video.reset(new VideoContent(this));
auto examiner = make_shared<VideoMXFExaminer>(shared_from_this());
video->take_from_examiner(film, examiner);
- video->unset_colour_conversion ();
+ video->unset_colour_conversion();
}
string
-VideoMXFContent::summary () const
+VideoMXFContent::summary() const
{
return fmt::format(_("{} [video]"), path_summary());
}
string
-VideoMXFContent::technical_summary () const
+VideoMXFContent::technical_summary() const
{
return Content::technical_summary() + " - " + video->technical_summary();
}
string
-VideoMXFContent::identifier () const
+VideoMXFContent::identifier() const
{
return Content::identifier() + "_" + video->identifier();
}
@@ -130,23 +130,23 @@ VideoMXFContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour
DCPTime
-VideoMXFContent::full_length (shared_ptr<const Film> film) const
+VideoMXFContent::full_length(shared_ptr<const Film> film) const
{
- FrameRateChange const frc (film, shared_from_this());
- return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
+ FrameRateChange const frc(film, shared_from_this());
+ return DCPTime::from_frames(llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
DCPTime
-VideoMXFContent::approximate_length () const
+VideoMXFContent::approximate_length() const
{
- return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+ return DCPTime::from_frames(video->length_after_3d_combine(), 24);
}
void
-VideoMXFContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
+VideoMXFContent::add_properties(shared_ptr<const Film> film, list<UserProperty>& p) const
{
- Content::add_properties (film, p);
- video->add_properties (p);
+ Content::add_properties(film, p);
+ video->add_properties(p);
}
diff --git a/src/lib/video_mxf_content.h b/src/lib/video_mxf_content.h
index 4c2d051b0..0383242d5 100644
--- a/src/lib/video_mxf_content.h
+++ b/src/lib/video_mxf_content.h
@@ -25,21 +25,21 @@
class VideoMXFContent : public Content
{
public:
- VideoMXFContent (boost::filesystem::path path);
- VideoMXFContent (cxml::ConstNodePtr node, boost::optional<boost::filesystem::path> film_directory, int version);
+ VideoMXFContent(boost::filesystem::path path);
+ VideoMXFContent(cxml::ConstNodePtr node, boost::optional<boost::filesystem::path> film_directory, int version);
- std::shared_ptr<VideoMXFContent> shared_from_this () {
+ std::shared_ptr<VideoMXFContent> shared_from_this() {
return std::dynamic_pointer_cast<VideoMXFContent>(Content::shared_from_this());
}
- std::shared_ptr<const VideoMXFContent> shared_from_this () const {
+ std::shared_ptr<const VideoMXFContent> shared_from_this() const {
return std::dynamic_pointer_cast<const VideoMXFContent>(Content::shared_from_this());
}
void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job> job, bool tolerant) override;
- std::string summary () const override;
- std::string technical_summary () const override;
- std::string identifier () const override;
+ std::string summary() const override;
+ std::string technical_summary() const override;
+ std::string identifier() const override;
void as_xml(
xmlpp::Element* element,
@@ -48,9 +48,9 @@ public:
boost::optional<boost::filesystem::path> film_directory
) const override;
- dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override;
- dcpomatic::DCPTime approximate_length () const override;
- void add_properties (std::shared_ptr<const Film> film, std::list<UserProperty>& p) const override;
+ dcpomatic::DCPTime full_length(std::shared_ptr<const Film> film) const override;
+ dcpomatic::DCPTime approximate_length() const override;
+ void add_properties(std::shared_ptr<const Film> film, std::list<UserProperty>& p) const override;
- static bool valid_mxf (boost::filesystem::path path);
+ static bool valid_mxf(boost::filesystem::path path);
};
diff --git a/src/tools/dcpomatic_verifier.cc b/src/tools/dcpomatic_verifier.cc
index d24100ff3..c881019d8 100644
--- a/src/tools/dcpomatic_verifier.cc
+++ b/src/tools/dcpomatic_verifier.cc
@@ -33,6 +33,7 @@
#include "wx/file_dialog.h"
#include "wx/i18n_setup.h"
#include "wx/id.h"
+#include "wx/wx_signal_manager.h"
#include "wx/verify_dcp_progress_panel.h"
#include "wx/verify_dcp_result_panel.h"
#include "wx/wx_util.h"
@@ -44,11 +45,13 @@
#include "lib/verify_dcp_job.h"
#include "lib/util.h"
#include "lib/variant.h"
+#include "lib/version.h"
#include <dcp/dcp.h>
#include <dcp/search.h>
#include <dcp/text_formatter.h>
#include <dcp/verify_report.h>
LIBDCP_DISABLE_WARNINGS
+#include <wx/cmdline.h>
#include <wx/evtloop.h>
#include <wx/progdlg.h>
#include <wx/wx.h>
@@ -123,7 +126,7 @@ private:
class DOMFrame : public wxFrame
{
public:
- explicit DOMFrame(wxString const& title)
+ explicit DOMFrame(wxString const& title, bool start, vector<boost::filesystem::path> const& dcps_to_load)
: wxFrame(nullptr, -1, title)
/* Use a panel as the only child of the Frame so that we avoid
the dark-grey background on Windows.
@@ -145,7 +148,19 @@ public:
auto dcp_sizer = new wxBoxSizer(wxHORIZONTAL);
add_label_to_sizer(dcp_sizer, _overall_panel, _("DCPs"), true, 0, wxALIGN_CENTER_VERTICAL);
- auto add = [this](wxWindow* parent) {
+ auto load_dcps = [this](vector<boost::filesystem::path> const& dcps) {
+ wxProgressDialog progress(variant::wx::dcpomatic(), _("Examining DCPs"));
+ vector<DCPPath> dcp_paths;
+ for (auto path: dcps) {
+ for (auto const& dcp: dcp::find_potential_dcps(path)) {
+ progress.Pulse();
+ dcp_paths.push_back(DCPPath(dcp, _kdms));
+ }
+ }
+ return dcp_paths;
+ };
+
+ auto add = [&load_dcps](wxWindow* parent) {
#if wxCHECK_VERSION(3, 1, 4)
DirDialog dialog(parent, _("Select DCP(s)"), wxDD_MULTIPLE, "AddVerifierInputPath");
#else
@@ -153,15 +168,7 @@ public:
#endif
if (dialog.show()) {
- wxProgressDialog progress(variant::wx::dcpomatic(), _("Examining DCPs"));
- vector<DCPPath> paths;
- for (auto path: dialog.paths()) {
- for (auto const& dcp: dcp::find_potential_dcps(path)) {
- progress.Pulse();
- paths.push_back(DCPPath(dcp, _kdms));
- }
- }
- return paths;
+ return load_dcps(dialog.paths());
} else {
return std::vector<DCPPath>{};
}
@@ -223,6 +230,12 @@ public:
} catch (...) {}
}
}
+
+ set_dcp_paths(load_dcps(dcps_to_load));
+ _dcps->refresh();
+ if (start) {
+ signal_manager->when_idle(boost::bind(&DOMFrame::verify_clicked, this));
+ }
}
private:
@@ -381,6 +394,14 @@ private:
};
+static const wxCmdLineEntryDesc command_line_description[] = {
+ { wxCMD_LINE_SWITCH, "s", "start", "start verifying specified DCP(s)", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
+ { wxCMD_LINE_SWITCH, "v", "version", "show version", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
+ { wxCMD_LINE_PARAM, 0, 0, "DCP to verify", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
+ { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
+};
+
+
/** @class App
* @brief The magic App class for wxWidgets.
*/
@@ -433,7 +454,10 @@ private:
*/
Config::drop();
- _frame = new DOMFrame(variant::wx::dcpomatic_verifier());
+ signal_manager = new wxSignalManager(this);
+ Bind(wxEVT_IDLE, boost::bind(&App::idle, this, _1));
+
+ _frame = new DOMFrame(variant::wx::dcpomatic_verifier(), _start, _dcps_to_load);
SetTopWindow(_frame);
_frame->Maximize();
_frame->Show();
@@ -497,7 +521,41 @@ private:
report_exception();
}
+ void OnInitCmdLine(wxCmdLineParser& parser) override
+ {
+ parser.SetDesc(command_line_description);
+ parser.SetSwitchChars(char_to_wx("-"));
+ }
+
+ bool OnCmdLineParsed(wxCmdLineParser& parser) override
+ {
+ if (parser.Found(char_to_wx("version"))) {
+ std::cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n";
+ exit(EXIT_SUCCESS);
+ }
+
+ _start = parser.Found(char_to_wx("start"));
+ for (auto i = 0UL; i < parser.GetParamCount(); ++i) {
+ auto const path = boost::filesystem::path(wx_to_std(parser.GetParam(0)));
+ if (path.filename_is_dot()) {
+ _dcps_to_load.push_back(path.parent_path());
+ } else {
+ _dcps_to_load.push_back(path);
+ }
+ }
+
+ return true;
+ }
+
+ void idle(wxIdleEvent& ev)
+ {
+ signal_manager->ui_idle();
+ ev.Skip();
+ }
+
DOMFrame* _frame = nullptr;
+ bool _start = false;
+ std::vector<boost::filesystem::path> _dcps_to_load;
};
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index e0fed493d..797c14356 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -59,12 +59,12 @@ using namespace boost::placeholders;
* @param content Content to analyse, or 0 to analyse all of the film's audio.
*/
AudioDialog::AudioDialog(wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content)
- : wxDialog (
+ : wxDialog(
parent,
wxID_ANY,
_("Audio"),
wxDefaultPosition,
- wxSize (640, 512),
+ wxSize(640, 512),
#ifdef DCPOMATIC_OSX
/* I can't get wxFRAME_FLOAT_ON_PARENT to work on OS X, and although wxSTAY_ON_TOP keeps
the window above all others (and not just our own) it's better than nothing for now.
@@ -74,57 +74,57 @@ AudioDialog::AudioDialog(wxWindow* parent, shared_ptr<Film> film, shared_ptr<Con
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxFRAME_FLOAT_ON_PARENT
#endif
)
- , _film (film)
- , _content (content)
- , _channels (film->audio_channels ())
- , _plot (nullptr)
+ , _film(film)
+ , _content(content)
+ , _channels(film->audio_channels())
+ , _plot(nullptr)
{
- wxFont subheading_font (*wxNORMAL_FONT);
- subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
+ wxFont subheading_font(*wxNORMAL_FONT);
+ subheading_font.SetWeight(wxFONTWEIGHT_BOLD);
- auto overall_sizer = new wxBoxSizer (wxVERTICAL);
- auto lr_sizer = new wxBoxSizer (wxHORIZONTAL);
+ auto overall_sizer = new wxBoxSizer(wxVERTICAL);
+ auto lr_sizer = new wxBoxSizer(wxHORIZONTAL);
- auto left = new wxBoxSizer (wxVERTICAL);
+ auto left = new wxBoxSizer(wxVERTICAL);
_cursor = new StaticText(this, char_to_wx("Cursor: none"));
- left->Add (_cursor, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
+ left->Add(_cursor, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
_plot = new AudioPlot(this);
- left->Add (_plot, 1, wxTOP | wxEXPAND, 12);
+ left->Add(_plot, 1, wxTOP | wxEXPAND, 12);
_sample_peak = new StaticText(this, {});
- left->Add (_sample_peak, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
+ left->Add(_sample_peak, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
_true_peak = new StaticText(this, {});
- left->Add (_true_peak, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
+ left->Add(_true_peak, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
_integrated_loudness = new StaticText(this, {});
- left->Add (_integrated_loudness, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
+ left->Add(_integrated_loudness, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
_loudness_range = new StaticText(this, {});
- left->Add (_loudness_range, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
+ left->Add(_loudness_range, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
_leqm = new StaticText(this, {});
- left->Add (_leqm, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
+ left->Add(_leqm, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
- lr_sizer->Add (left, 1, wxALL | wxEXPAND, 12);
+ lr_sizer->Add(left, 1, wxALL | wxEXPAND, 12);
- auto right = new wxBoxSizer (wxVERTICAL);
+ auto right = new wxBoxSizer(wxVERTICAL);
{
- auto m = new StaticText (this, _("Channels"));
- m->SetFont (subheading_font);
- right->Add (m, 1, wxTOP | wxBOTTOM, 16);
+ auto m = new StaticText(this, _("Channels"));
+ m->SetFont(subheading_font);
+ right->Add(m, 1, wxTOP | wxBOTTOM, 16);
}
for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
- _channel_checkbox[i] = new CheckBox (this, std_to_wx(audio_channel_name(i)));
+ _channel_checkbox[i] = new CheckBox(this, std_to_wx(audio_channel_name(i)));
_channel_checkbox[i]->SetForegroundColour(wxColour(_plot->colour(i)));
- right->Add (_channel_checkbox[i], 0, wxEXPAND | wxALL, 3);
+ right->Add(_channel_checkbox[i], 0, wxEXPAND | wxALL, 3);
_channel_checkbox[i]->bind(&AudioDialog::channel_clicked, this, _1);
}
- show_or_hide_channel_checkboxes ();
+ show_or_hide_channel_checkboxes();
{
- auto m = new StaticText (this, _("Type"));
- m->SetFont (subheading_font);
- right->Add (m, 1, wxTOP, 16);
+ auto m = new StaticText(this, _("Type"));
+ m->SetFont(subheading_font);
+ right->Add(m, 1, wxTOP, 16);
}
wxString const types[] = {
@@ -133,39 +133,39 @@ AudioDialog::AudioDialog(wxWindow* parent, shared_ptr<Film> film, shared_ptr<Con
};
for (int i = 0; i < AudioPoint::COUNT; ++i) {
- _type_checkbox[i] = new CheckBox (this, types[i]);
- right->Add (_type_checkbox[i], 0, wxEXPAND | wxALL, 3);
+ _type_checkbox[i] = new CheckBox(this, types[i]);
+ right->Add(_type_checkbox[i], 0, wxEXPAND | wxALL, 3);
_type_checkbox[i]->bind(&AudioDialog::type_clicked, this, _1);
}
{
- auto m = new StaticText (this, _("Smoothing"));
- m->SetFont (subheading_font);
- right->Add (m, 1, wxTOP, 16);
+ auto m = new StaticText(this, _("Smoothing"));
+ m->SetFont(subheading_font);
+ right->Add(m, 1, wxTOP, 16);
}
- _smoothing = new wxSlider (this, wxID_ANY, AudioPlot::max_smoothing / 2, 1, AudioPlot::max_smoothing);
- _smoothing->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind (&AudioDialog::smoothing_changed, this));
- right->Add (_smoothing, 0, wxEXPAND);
+ _smoothing = new wxSlider(this, wxID_ANY, AudioPlot::max_smoothing / 2, 1, AudioPlot::max_smoothing);
+ _smoothing->Bind(wxEVT_SCROLL_THUMBTRACK, boost::bind(&AudioDialog::smoothing_changed, this));
+ right->Add(_smoothing, 0, wxEXPAND);
- lr_sizer->Add (right, 0, wxALL, 12);
+ lr_sizer->Add(right, 0, wxALL, 12);
- overall_sizer->Add (lr_sizer, 0, wxEXPAND);
+ overall_sizer->Add(lr_sizer, 0, wxEXPAND);
#ifdef DCPOMATIC_LINUX
- auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
+ auto buttons = CreateSeparatedButtonSizer(wxCLOSE);
if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ overall_sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
}
#endif
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ SetSizer(overall_sizer);
+ overall_sizer->Layout();
+ overall_sizer->SetSizeHints(this);
_plot->Click.connect(boost::ref(Seek));
- _film_connection = film->Change.connect (boost::bind(&AudioDialog::film_change, this, _1, _2));
+ _film_connection = film->Change.connect(boost::bind(&AudioDialog::film_change, this, _1, _2));
_film_content_connection = film->ContentChange.connect(boost::bind(&AudioDialog::content_change, this, _1, _2));
if (content) {
SetTitle(wxString::Format(_("%s audio - %s"), variant::wx::dcpomatic(), std_to_wx(content->path_for_display().string())));
@@ -179,80 +179,80 @@ AudioDialog::AudioDialog(wxWindow* parent, shared_ptr<Film> film, shared_ptr<Con
_playlist = make_shared<Playlist>();
const_pointer_cast<Playlist>(_playlist)->add(film, content);
} else {
- _playlist = film->playlist ();
+ _playlist = film->playlist();
}
- _plot->Cursor.connect (bind (&AudioDialog::set_cursor, this, _1, _2));
+ _plot->Cursor.connect(bind(&AudioDialog::set_cursor, this, _1, _2));
}
void
-AudioDialog::show_or_hide_channel_checkboxes ()
+AudioDialog::show_or_hide_channel_checkboxes()
{
for (int i = 0; i < _channels; ++i) {
- _channel_checkbox[i]->Show ();
+ _channel_checkbox[i]->Show();
}
for (int i = _channels; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
- _channel_checkbox[i]->Hide ();
+ _channel_checkbox[i]->Hide();
}
}
void
-AudioDialog::try_to_load_analysis ()
+AudioDialog::try_to_load_analysis()
{
- if (!IsShown ()) {
+ if (!IsShown()) {
return;
}
- auto film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ auto film = _film.lock();
+ DCPOMATIC_ASSERT(film);
auto check = _content.lock();
- auto const path = film->audio_analysis_path (_playlist);
+ auto const path = film->audio_analysis_path(_playlist);
if (!dcp::filesystem::exists(path)) {
- _plot->set_analysis (shared_ptr<AudioAnalysis> ());
- _analysis.reset ();
+ _plot->set_analysis(shared_ptr<AudioAnalysis>());
+ _analysis.reset();
for (auto i: JobManager::instance()->get()) {
if (dynamic_pointer_cast<AnalyseAudioJob>(i)) {
- i->cancel ();
+ i->cancel();
}
}
- JobManager::instance()->analyse_audio (
- film, _playlist, !static_cast<bool>(check), _analysis_finished_connection, bind (&AudioDialog::analysis_finished, this)
+ JobManager::instance()->analyse_audio(
+ film, _playlist, !static_cast<bool>(check), _analysis_finished_connection, bind(&AudioDialog::analysis_finished, this)
);
return;
}
try {
- _analysis.reset (new AudioAnalysis (path));
+ _analysis.reset(new AudioAnalysis(path));
} catch (OldFormatError& e) {
/* An old analysis file: recreate it */
- JobManager::instance()->analyse_audio (
- film, _playlist, !static_cast<bool>(check), _analysis_finished_connection, bind (&AudioDialog::analysis_finished, this)
+ JobManager::instance()->analyse_audio(
+ film, _playlist, !static_cast<bool>(check), _analysis_finished_connection, bind(&AudioDialog::analysis_finished, this)
);
return;
} catch (xmlpp::exception& e) {
/* Probably a (very) old-style analysis file: recreate it */
- JobManager::instance()->analyse_audio (
- film, _playlist, !static_cast<bool>(check), _analysis_finished_connection, bind (&AudioDialog::analysis_finished, this)
+ JobManager::instance()->analyse_audio(
+ film, _playlist, !static_cast<bool>(check), _analysis_finished_connection, bind(&AudioDialog::analysis_finished, this)
);
return;
}
- _plot->set_analysis (_analysis);
- _plot->set_gain_correction (_analysis->gain_correction (_playlist));
- setup_statistics ();
- show_or_hide_channel_checkboxes ();
+ _plot->set_analysis(_analysis);
+ _plot->set_gain_correction(_analysis->gain_correction(_playlist));
+ setup_statistics();
+ show_or_hide_channel_checkboxes();
/* Set up some defaults if no check boxes are checked */
int i = 0;
- while (i < _channels && (!_channel_checkbox[i] || !_channel_checkbox[i]->GetValue ())) {
+ while (i < _channels && (!_channel_checkbox[i] || !_channel_checkbox[i]->GetValue())) {
++i;
}
@@ -260,41 +260,41 @@ AudioDialog::try_to_load_analysis ()
/* Nothing checked; check mapped ones */
list<int> mapped;
- auto content = _content.lock ();
+ auto content = _content.lock();
if (content) {
- mapped = content->audio->mapping().mapped_output_channels ();
+ mapped = content->audio->mapping().mapped_output_channels();
} else {
- mapped = film->mapped_audio_channels ();
+ mapped = film->mapped_audio_channels();
}
for (auto i: mapped) {
if (_channel_checkbox[i]) {
- _channel_checkbox[i]->SetValue (true);
- _plot->set_channel_visible (i, true);
+ _channel_checkbox[i]->SetValue(true);
+ _plot->set_channel_visible(i, true);
}
}
}
i = 0;
- while (i < AudioPoint::COUNT && !_type_checkbox[i]->GetValue ()) {
+ while (i < AudioPoint::COUNT && !_type_checkbox[i]->GetValue()) {
i++;
}
if (i == AudioPoint::COUNT) {
for (int i = 0; i < AudioPoint::COUNT; ++i) {
- _type_checkbox[i]->SetValue (true);
- _plot->set_type_visible (i, true);
+ _type_checkbox[i]->SetValue(true);
+ _plot->set_type_visible(i, true);
}
}
- Refresh ();
+ Refresh();
}
void
-AudioDialog::analysis_finished ()
+AudioDialog::analysis_finished()
{
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film) {
/* This should not happen, but if it does we should just give up quietly */
return;
@@ -304,24 +304,24 @@ AudioDialog::analysis_finished ()
/* We analysed and still nothing showed up, so maybe it was cancelled or it failed.
Give up.
*/
- _plot->set_message (_("Could not analyse audio."));
+ _plot->set_message(_("Could not analyse audio."));
return;
}
- try_to_load_analysis ();
+ try_to_load_analysis();
}
void
-AudioDialog::channel_clicked (wxCommandEvent& ev)
+AudioDialog::channel_clicked(wxCommandEvent& ev)
{
int c = 0;
while (c < _channels && ev.GetEventObject() != _channel_checkbox[c]) {
++c;
}
- DCPOMATIC_ASSERT (c < _channels);
+ DCPOMATIC_ASSERT(c < _channels);
- _plot->set_channel_visible (c, _channel_checkbox[c]->GetValue ());
+ _plot->set_channel_visible(c, _channel_checkbox[c]->GetValue());
}
void
@@ -332,16 +332,16 @@ AudioDialog::film_change(ChangeType type, FilmProperty p)
}
if (p == FilmProperty::AUDIO_CHANNELS) {
- auto film = _film.lock ();
+ auto film = _film.lock();
if (film) {
- _channels = film->audio_channels ();
- try_to_load_analysis ();
+ _channels = film->audio_channels();
+ try_to_load_analysis();
}
}
}
void
-AudioDialog::content_change (ChangeType type, int p)
+AudioDialog::content_change(ChangeType type, int p)
{
if (type != ChangeType::DONE) {
return;
@@ -349,61 +349,61 @@ AudioDialog::content_change (ChangeType type, int p)
switch (p) {
case AudioContentProperty::STREAMS:
- try_to_load_analysis ();
+ try_to_load_analysis();
break;
case AudioContentProperty::GAIN:
if (_playlist->content().size() == 1 && _analysis) {
/* We can use a short-cut to render the effect of this
change, rather than recalculating everything.
*/
- _plot->set_gain_correction (_analysis->gain_correction (_playlist));
- setup_statistics ();
+ _plot->set_gain_correction(_analysis->gain_correction(_playlist));
+ setup_statistics();
} else {
- try_to_load_analysis ();
+ try_to_load_analysis();
}
break;
}
}
void
-AudioDialog::type_clicked (wxCommandEvent& ev)
+AudioDialog::type_clicked(wxCommandEvent& ev)
{
int t = 0;
while (t < AudioPoint::COUNT && ev.GetEventObject() != _type_checkbox[t]) {
++t;
}
- DCPOMATIC_ASSERT (t < AudioPoint::COUNT);
+ DCPOMATIC_ASSERT(t < AudioPoint::COUNT);
- _plot->set_type_visible (t, _type_checkbox[t]->GetValue ());
+ _plot->set_type_visible(t, _type_checkbox[t]->GetValue());
}
void
-AudioDialog::smoothing_changed ()
+AudioDialog::smoothing_changed()
{
- _plot->set_smoothing (_smoothing->GetValue ());
+ _plot->set_smoothing(_smoothing->GetValue());
}
void
-AudioDialog::setup_statistics ()
+AudioDialog::setup_statistics()
{
if (!_analysis) {
return;
}
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film) {
return;
}
- auto const peak = _analysis->overall_sample_peak ();
+ auto const peak = _analysis->overall_sample_peak();
float const peak_dB = linear_to_db(peak.first.peak) + _analysis->gain_correction(_playlist);
- _sample_peak->SetLabel (
- wxString::Format (
+ _sample_peak->SetLabel(
+ wxString::Format(
_("Sample peak is %.2fdB at %s on %s"),
peak_dB,
- time_to_timecode (peak.first.time, film->video_frame_rate ()).data (),
- std_to_wx (short_audio_channel_name (peak.second)).data ()
+ time_to_timecode(peak.first.time, film->video_frame_rate()).data(),
+ std_to_wx(short_audio_channel_name(peak.second)).data()
)
);
@@ -420,7 +420,7 @@ AudioDialog::setup_statistics ()
float const peak = _analysis->overall_true_peak().get();
float const peak_dB = linear_to_db(peak) + _analysis->gain_correction(_playlist);
- _true_peak->SetLabel (wxString::Format (_("True peak is %.2fdB"), peak_dB));
+ _true_peak->SetLabel(wxString::Format(_("True peak is %.2fdB"), peak_dB));
if (peak_dB > -3) {
_true_peak->SetForegroundColour(peaking);
@@ -432,19 +432,19 @@ AudioDialog::setup_statistics ()
/* XXX: check whether it's ok to add dB gain to these quantities */
if (static_cast<bool>(_analysis->integrated_loudness())) {
- _integrated_loudness->SetLabel (
- wxString::Format (
+ _integrated_loudness->SetLabel(
+ wxString::Format(
_("Integrated loudness %.2f LUFS"),
- _analysis->integrated_loudness().get() + _analysis->gain_correction (_playlist)
+ _analysis->integrated_loudness().get() + _analysis->gain_correction(_playlist)
)
);
}
if (static_cast<bool>(_analysis->loudness_range())) {
- _loudness_range->SetLabel (
- wxString::Format (
+ _loudness_range->SetLabel(
+ wxString::Format(
_("Loudness range %.2f LU"),
- _analysis->loudness_range().get() + _analysis->gain_correction (_playlist)
+ _analysis->loudness_range().get() + _analysis->gain_correction(_playlist)
)
);
}
@@ -459,22 +459,22 @@ AudioDialog::setup_statistics ()
}
bool
-AudioDialog::Show (bool show)
+AudioDialog::Show(bool show)
{
- bool const r = wxDialog::Show (show);
- try_to_load_analysis ();
+ bool const r = wxDialog::Show(show);
+ try_to_load_analysis();
return r;
}
void
-AudioDialog::set_cursor (optional<DCPTime> time, optional<float> db)
+AudioDialog::set_cursor(optional<DCPTime> time, optional<float> db)
{
if (!time || !db) {
- _cursor->SetLabel (_("Cursor: none"));
+ _cursor->SetLabel(_("Cursor: none"));
return;
}
auto film = _film.lock();
- DCPOMATIC_ASSERT (film);
+ DCPOMATIC_ASSERT(film);
_cursor->SetLabel(wxString::Format(_("Cursor: %.1fdB at %s"), *db, std_to_wx(time->timecode(film->video_frame_rate()))));
}
diff --git a/src/wx/audio_dialog.h b/src/wx/audio_dialog.h
index 2085a7220..d4a8a9b00 100644
--- a/src/wx/audio_dialog.h
+++ b/src/wx/audio_dialog.h
@@ -49,22 +49,22 @@ class AudioDialog : public wxDialog
public:
AudioDialog(wxWindow* parent, std::shared_ptr<Film> film, std::shared_ptr<Content> content = std::shared_ptr<Content>());
- bool Show (bool show = true) override;
+ bool Show(bool show = true) override;
- void set_cursor (boost::optional<dcpomatic::DCPTime> time, boost::optional<float> db);
+ void set_cursor(boost::optional<dcpomatic::DCPTime> time, boost::optional<float> db);
boost::signals2::signal<void (dcpomatic::DCPTime)> Seek;
private:
void film_change(ChangeType, FilmProperty);
- void content_change (ChangeType, int);
- void channel_clicked (wxCommandEvent &);
- void type_clicked (wxCommandEvent &);
- void smoothing_changed ();
- void try_to_load_analysis ();
- void analysis_finished ();
- void setup_statistics ();
- void show_or_hide_channel_checkboxes ();
+ void content_change(ChangeType, int);
+ void channel_clicked(wxCommandEvent &);
+ void type_clicked(wxCommandEvent &);
+ void smoothing_changed();
+ void try_to_load_analysis();
+ void analysis_finished();
+ void setup_statistics();
+ void show_or_hide_channel_checkboxes();
std::shared_ptr<AudioAnalysis> _analysis;
std::weak_ptr<Film> _film;
diff --git a/src/wx/controls.cc b/src/wx/controls.cc
index fce3fd7eb..708cc9a5d 100644
--- a/src/wx/controls.cc
+++ b/src/wx/controls.cc
@@ -279,7 +279,7 @@ Controls::update_position_label()
{
if (!_film) {
checked_set(_frame_number, char_to_wx("0"));
- checked_set(_timecode, char_to_wx("0:0:0.0"));
+ checked_set(_timecode, char_to_wx("0:0:0:0"));
return;
}
diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h
index 4b0a48f44..ede66da1c 100644
--- a/src/wx/editable_list.h
+++ b/src/wx/editable_list.h
@@ -36,15 +36,15 @@ LIBDCP_ENABLE_WARNINGS
class EditableListColumn
{
public:
- EditableListColumn (wxString name_)
- : name (name_)
- , growable (false)
+ EditableListColumn(wxString name_)
+ : name(name_)
+ , growable(false)
{}
- EditableListColumn (wxString name_, boost::optional<int> width_, bool growable_)
- : name (name_)
- , width (width_)
- , growable (growable_)
+ EditableListColumn(wxString name_, boost::optional<int> width_, bool growable_)
+ : name(name_)
+ , width(width_)
+ , growable(growable_)
{}
wxString name;
@@ -77,7 +77,7 @@ template<class T>
class EditableList : public wxPanel
{
public:
- EditableList (
+ EditableList(
wxWindow* parent,
std::vector<EditableListColumn> columns,
std::function<std::vector<T> ()> get,
@@ -89,17 +89,17 @@ public:
int buttons,
boost::optional<wxString> custom_button = {}
)
- : wxPanel (parent)
- , _get (get)
- , _set (set)
+ : wxPanel(parent)
+ , _get(get)
+ , _set(set)
, _add(add)
, _edit(edit)
- , _columns (columns)
- , _column (column)
- , _default_width (200)
+ , _columns(columns)
+ , _column(column)
+ , _default_width(200)
{
- _sizer = new wxBoxSizer (wxHORIZONTAL);
- SetSizer (_sizer);
+ _sizer = new wxBoxSizer(wxHORIZONTAL);
+ SetSizer(_sizer);
long style = wxLC_REPORT | wxLC_SINGLE_SEL;
if (title == EditableListTitle::INVISIBLE) {
@@ -108,18 +108,18 @@ public:
int total_width = 0;
for (auto i: _columns) {
- total_width += i.width.get_value_or (_default_width);
+ total_width += i.width.get_value_or(_default_width);
}
#ifdef __WXGTK3__
/* With the GTK3 backend wxListCtrls are hard to pick out from the background of the
* window, so put a border in to help.
*/
- auto border = new wxPanel (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_THEME);
+ auto border = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_THEME);
_list = new wxListCtrl(border, wxID_ANY, wxDefaultPosition, wxSize(total_width, -1), style);
- auto border_sizer = new wxBoxSizer (wxHORIZONTAL);
- border_sizer->Add (_list, 1, wxALL | wxEXPAND, 2);
- border->SetSizer (border_sizer);
+ auto border_sizer = new wxBoxSizer(wxHORIZONTAL);
+ border_sizer->Add(_list, 1, wxALL | wxEXPAND, 2);
+ border->SetSizer(border_sizer);
#else
_list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(total_width, -1), style);
#endif
@@ -127,20 +127,20 @@ public:
int j = 0;
for (auto i: _columns) {
wxListItem ip;
- ip.SetId (j);
- ip.SetText (i.name);
- _list->InsertColumn (j, ip);
+ ip.SetId(j);
+ ip.SetText(i.name);
+ _list->InsertColumn(j, ip);
++j;
}
#ifdef __WXGTK3__
- _sizer->Add (border, 1, wxEXPAND);
+ _sizer->Add(border, 1, wxEXPAND);
#else
- _sizer->Add (_list, 1, wxEXPAND);
+ _sizer->Add(_list, 1, wxEXPAND);
#endif
{
- auto s = new wxBoxSizer (wxVERTICAL);
+ auto s = new wxBoxSizer(wxVERTICAL);
if (buttons & EditableListButton::NEW) {
_add_button = new Button(this, _("Add..."));
s->Add(_add_button, 1, wxEXPAND | wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
@@ -157,7 +157,7 @@ public:
_remove_button = new Button(this, _("Remove"));
s->Add(_remove_button, 1, wxEXPAND | wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
}
- _sizer->Add (s, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
+ _sizer->Add(s, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
}
if (_add_button) {
@@ -170,43 +170,43 @@ public:
_remove_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind(&EditableList::remove_clicked, this));
}
- _list->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&EditableList::selection_changed, this));
- _list->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&EditableList::selection_changed, this));
+ _list->Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind(&EditableList::selection_changed, this));
+ _list->Bind(wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind(&EditableList::selection_changed, this));
#if BOOST_VERSION >= 106100
- _list->Bind (wxEVT_SIZE, boost::bind (&EditableList::resized, this, boost::placeholders::_1));
+ _list->Bind(wxEVT_SIZE, boost::bind(&EditableList::resized, this, boost::placeholders::_1));
#else
- _list->Bind (wxEVT_SIZE, boost::bind (&EditableList::resized, this, _1));
+ _list->Bind(wxEVT_SIZE, boost::bind(&EditableList::resized, this, _1));
#endif
- refresh ();
- selection_changed ();
+ refresh();
+ selection_changed();
}
- void refresh ()
+ void refresh()
{
- _list->DeleteAllItems ();
+ _list->DeleteAllItems();
- auto current = _get ();
+ auto current = _get();
for (auto const& i: current) {
- add_to_control (i);
+ add_to_control(i);
}
}
- boost::optional<T> selection () const
+ boost::optional<T> selection() const
{
- int item = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ int item = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1) {
return {};
}
- auto all = _get ();
- DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ()));
+ auto all = _get();
+ DCPOMATIC_ASSERT(item >= 0 && item < int(all.size()));
return all[item];
}
- void layout ()
+ void layout()
{
- _sizer->Layout ();
+ _sizer->Layout();
}
Button* custom_button()
@@ -244,21 +244,21 @@ public:
private:
- void add_to_control (T item)
+ void add_to_control(T item)
{
wxListItem list_item;
- int const n = _list->GetItemCount ();
- list_item.SetId (n);
- _list->InsertItem (list_item);
+ int const n = _list->GetItemCount();
+ list_item.SetId(n);
+ _list->InsertItem(list_item);
for (size_t i = 0; i < _columns.size(); ++i) {
- _list->SetItem (n, i, std_to_wx (_column (item, i)));
+ _list->SetItem(n, i, std_to_wx(_column(item, i)));
}
}
- void selection_changed ()
+ void selection_changed()
{
- int const i = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ int const i = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (_edit_button) {
_edit_button->Enable(i >= 0);
}
@@ -266,10 +266,10 @@ private:
_remove_button->Enable(i >= 0);
}
- SelectionChanged ();
+ SelectionChanged();
}
- void add_clicked ()
+ void add_clicked()
{
auto all = _get();
for (auto item: _add(this)) {
@@ -279,41 +279,41 @@ private:
_set(all);
}
- void edit_clicked ()
+ void edit_clicked()
{
- int item = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ int item = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1) {
return;
}
- std::vector<T> all = _get ();
- DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ()));
+ std::vector<T> all = _get();
+ DCPOMATIC_ASSERT(item >= 0 && item < int(all.size()));
_edit(this, all[item]);
for (size_t i = 0; i < _columns.size(); ++i) {
- _list->SetItem (item, i, std_to_wx (_column (all[item], i)));
+ _list->SetItem(item, i, std_to_wx(_column(all[item], i)));
}
- _set (all);
+ _set(all);
}
- void remove_clicked ()
+ void remove_clicked()
{
- int i = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ int i = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (i == -1) {
return;
}
- _list->DeleteItem (i);
- auto all = _get ();
- all.erase (all.begin() + i);
- _set (all);
+ _list->DeleteItem(i);
+ auto all = _get();
+ all.erase(all.begin() + i);
+ _set(all);
- selection_changed ();
+ selection_changed();
}
- void resized (wxSizeEvent& ev)
+ void resized(wxSizeEvent& ev)
{
int const w = _list->GetSize().GetWidth() - 2;
@@ -321,9 +321,9 @@ private:
int growable = 0;
int j = 0;
for (auto i: _columns) {
- fixed_width += i.width.get_value_or (_default_width);
+ fixed_width += i.width.get_value_or(_default_width);
if (!i.growable) {
- _list->SetColumnWidth (j, i.width.get_value_or(_default_width));
+ _list->SetColumnWidth(j, i.width.get_value_or(_default_width));
} else {
++growable;
}
@@ -333,12 +333,12 @@ private:
j = 0;
for (auto i: _columns) {
if (i.growable) {
- _list->SetColumnWidth (j, i.width.get_value_or(_default_width) + (w - fixed_width) / growable);
+ _list->SetColumnWidth(j, i.width.get_value_or(_default_width) + (w - fixed_width) / growable);
}
++j;
}
- ev.Skip ();
+ ev.Skip();
}
std::function <std::vector<T> ()> _get;
diff --git a/src/wx/full_language_tag_dialog.cc b/src/wx/full_language_tag_dialog.cc
index 89987715a..0d0936696 100644
--- a/src/wx/full_language_tag_dialog.cc
+++ b/src/wx/full_language_tag_dialog.cc
@@ -52,76 +52,75 @@ using namespace boost::placeholders;
#endif
-FullLanguageTagDialog::FullLanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag)
- : wxDialog (parent, wxID_ANY, _("Language Tag"), wxDefaultPosition, wxSize(-1, 500))
+FullLanguageTagDialog::FullLanguageTagDialog(wxWindow* parent, dcp::LanguageTag tag)
+ : wxDialog(parent, wxID_ANY, _("Language Tag"), wxDefaultPosition, wxSize(-1, 500))
{
- _current_tag_list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER);
+ _current_tag_list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER);
_current_tag_list->AppendColumn({}, wxLIST_FORMAT_LEFT, 200);
_current_tag_list->AppendColumn({}, wxLIST_FORMAT_LEFT, 400);
- auto button_sizer = new wxBoxSizer (wxVERTICAL);
+ auto button_sizer = new wxBoxSizer(wxVERTICAL);
_add_script = new wxButton(this, wxID_ANY, _("Add script"));
- button_sizer->Add (_add_script, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
+ button_sizer->Add(_add_script, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
_add_region = new wxButton(this, wxID_ANY, _("Add region"));
- button_sizer->Add (_add_region, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
+ button_sizer->Add(_add_region, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
_add_variant = new wxButton(this, wxID_ANY, _("Add variant"));
- button_sizer->Add (_add_variant, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
+ button_sizer->Add(_add_variant, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
_add_extended = new wxButton(this, wxID_ANY, _("Add extended"));
button_sizer->Add(_add_extended, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
_remove = new wxButton(this, wxID_ANY, _("Remove"));
- button_sizer->Add (_remove, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
+ button_sizer->Add(_remove, 0, wxTOP | wxBOTTOM | wxEXPAND, 2);
- _choose_subtag_panel = new LanguageSubtagPanel (this);
- _choose_subtag_panel->set (dcp::LanguageTag::SubtagType::LANGUAGE, "");
+ _choose_subtag_panel = new LanguageSubtagPanel(this);
+ _choose_subtag_panel->set(dcp::LanguageTag::SubtagType::LANGUAGE, "");
- auto ltor_sizer = new wxBoxSizer (wxHORIZONTAL);
- ltor_sizer->Add (_current_tag_list, 1, wxALL, 8);
- ltor_sizer->Add (button_sizer, 0, wxALL, 8);
- ltor_sizer->Add (_choose_subtag_panel, 1, wxALL, 8);
+ auto ltor_sizer = new wxBoxSizer(wxHORIZONTAL);
+ ltor_sizer->Add(_current_tag_list, 1, wxALL, 8);
+ ltor_sizer->Add(button_sizer, 0, wxALL, 8);
+ ltor_sizer->Add(_choose_subtag_panel, 1, wxALL, 8);
- auto overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (ltor_sizer, 0);
+ auto overall_sizer = new wxBoxSizer(wxVERTICAL);
+ overall_sizer->Add(ltor_sizer, 0);
- auto buttons = CreateSeparatedButtonSizer (wxOK);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ if (auto buttons = CreateSeparatedButtonSizer(wxOK)) {
+ overall_sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
}
- SetSizerAndFit (overall_sizer);
+ SetSizerAndFit(overall_sizer);
- set (tag);
+ set(tag);
- _add_script->Bind (wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::SCRIPT, boost::optional<dcp::LanguageTag::SubtagData>()));
- _add_region->Bind (wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::REGION, boost::optional<dcp::LanguageTag::SubtagData>()));
- _add_variant->Bind (wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::VARIANT, boost::optional<dcp::LanguageTag::SubtagData>()));
+ _add_script->Bind(wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::SCRIPT, boost::optional<dcp::LanguageTag::SubtagData>()));
+ _add_region->Bind(wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::REGION, boost::optional<dcp::LanguageTag::SubtagData>()));
+ _add_variant->Bind(wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::VARIANT, boost::optional<dcp::LanguageTag::SubtagData>()));
_add_extended->Bind(wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::add_to_current_tag, this, dcp::LanguageTag::SubtagType::EXTLANG, boost::optional<dcp::LanguageTag::SubtagData>()));
- _remove->Bind (wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::remove_from_current_tag, this));
+ _remove->Bind(wxEVT_BUTTON, boost::bind(&FullLanguageTagDialog::remove_from_current_tag, this));
_choose_subtag_panel->SelectionChanged.connect(bind(&FullLanguageTagDialog::chosen_subtag_changed, this, _1));
_choose_subtag_panel->SearchChanged.connect(bind(&FullLanguageTagDialog::search_changed, this, _1));
- _current_tag_list->Bind (wxEVT_LIST_ITEM_SELECTED, boost::bind(&FullLanguageTagDialog::current_tag_selection_changed, this));
- _current_tag_list->Bind (wxEVT_LIST_ITEM_DESELECTED, boost::bind(&FullLanguageTagDialog::current_tag_selection_changed, this));
+ _current_tag_list->Bind(wxEVT_LIST_ITEM_SELECTED, boost::bind(&FullLanguageTagDialog::current_tag_selection_changed, this));
+ _current_tag_list->Bind(wxEVT_LIST_ITEM_DESELECTED, boost::bind(&FullLanguageTagDialog::current_tag_selection_changed, this));
}
void
-FullLanguageTagDialog::remove_from_current_tag ()
+FullLanguageTagDialog::remove_from_current_tag()
{
- auto selected = _current_tag_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ auto selected = _current_tag_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (selected <= 0) {
return;
}
- _current_tag_subtags.erase (_current_tag_subtags.begin() + selected);
- _current_tag_list->DeleteItem (selected);
+ _current_tag_subtags.erase(_current_tag_subtags.begin() + selected);
+ _current_tag_list->DeleteItem(selected);
- _current_tag_list->SetItemState (min(selected, _current_tag_list->GetItemCount() - 1L), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ _current_tag_list->SetItemState(min(selected, _current_tag_list->GetItemCount() - 1L), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- setup_sensitivity ();
- current_tag_selection_changed ();
+ setup_sensitivity();
+ current_tag_selection_changed();
}
-dcp::LanguageTag FullLanguageTagDialog::get () const
+dcp::LanguageTag FullLanguageTagDialog::get() const
{
dcp::LanguageTag tag;
@@ -134,50 +133,50 @@ dcp::LanguageTag FullLanguageTagDialog::get () const
}
switch (i.type) {
case dcp::LanguageTag::SubtagType::LANGUAGE:
- tag.set_language (i.subtag->subtag);
+ tag.set_language(i.subtag->subtag);
break;
case dcp::LanguageTag::SubtagType::SCRIPT:
- tag.set_script (i.subtag->subtag);
+ tag.set_script(i.subtag->subtag);
break;
case dcp::LanguageTag::SubtagType::REGION:
- tag.set_region (i.subtag->subtag);
+ tag.set_region(i.subtag->subtag);
break;
case dcp::LanguageTag::SubtagType::VARIANT:
- variants.push_back (i.subtag->subtag);
+ variants.push_back(i.subtag->subtag);
break;
case dcp::LanguageTag::SubtagType::EXTLANG:
- extlangs.push_back (i.subtag->subtag);
+ extlangs.push_back(i.subtag->subtag);
break;
}
}
- tag.set_variants (variants);
- tag.set_extlangs (extlangs);
+ tag.set_variants(variants);
+ tag.set_extlangs(extlangs);
return tag;
}
void
-FullLanguageTagDialog::set (dcp::LanguageTag tag)
+FullLanguageTagDialog::set(dcp::LanguageTag tag)
{
- _current_tag_subtags.clear ();
- _current_tag_list->DeleteAllItems ();
+ _current_tag_subtags.clear();
+ _current_tag_list->DeleteAllItems();
bool have_language = false;
for (auto const& i: tag.subtags()) {
- add_to_current_tag (i.first, i.second);
+ add_to_current_tag(i.first, i.second);
if (i.first == dcp::LanguageTag::SubtagType::LANGUAGE) {
have_language = true;
}
}
if (!have_language) {
- add_to_current_tag (dcp::LanguageTag::SubtagType::LANGUAGE, dcp::LanguageTag::SubtagData("en", "English"));
+ add_to_current_tag(dcp::LanguageTag::SubtagType::LANGUAGE, dcp::LanguageTag::SubtagData("en", "English"));
}
}
-string FullLanguageTagDialog::subtag_type_name (dcp::LanguageTag::SubtagType type)
+string FullLanguageTagDialog::subtag_type_name(dcp::LanguageTag::SubtagType type)
{
switch (type) {
case dcp::LanguageTag::SubtagType::LANGUAGE:
@@ -197,9 +196,9 @@ string FullLanguageTagDialog::subtag_type_name (dcp::LanguageTag::SubtagType typ
void
-FullLanguageTagDialog::search_changed (string search)
+FullLanguageTagDialog::search_changed(string search)
{
- long int selected = _current_tag_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ long int selected = _current_tag_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (selected >= 0) {
_current_tag_subtags[selected].last_search = search;
}
@@ -207,75 +206,75 @@ FullLanguageTagDialog::search_changed (string search)
void
-FullLanguageTagDialog::add_to_current_tag (dcp::LanguageTag::SubtagType type, optional<dcp::LanguageTag::SubtagData> subtag)
+FullLanguageTagDialog::add_to_current_tag(dcp::LanguageTag::SubtagType type, optional<dcp::LanguageTag::SubtagData> subtag)
{
- _current_tag_subtags.push_back (Subtag(type, subtag));
+ _current_tag_subtags.push_back(Subtag(type, subtag));
wxListItem it;
- it.SetId (_current_tag_list->GetItemCount());
- it.SetColumn (0);
+ it.SetId(_current_tag_list->GetItemCount());
+ it.SetColumn(0);
it.SetText(std_to_wx(subtag_type_name(type)));
- _current_tag_list->InsertItem (it);
- it.SetColumn (1);
+ _current_tag_list->InsertItem(it);
+ it.SetColumn(1);
if (subtag) {
it.SetText(std_to_wx(subtag->description));
} else {
it.SetText(_("Select..."));
}
- _current_tag_list->SetItem (it);
- _current_tag_list->SetItemState (_current_tag_list->GetItemCount() - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- _choose_subtag_panel->set (type, "");
- setup_sensitivity ();
- current_tag_selection_changed ();
+ _current_tag_list->SetItem(it);
+ _current_tag_list->SetItemState(_current_tag_list->GetItemCount() - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ _choose_subtag_panel->set(type, "");
+ setup_sensitivity();
+ current_tag_selection_changed();
}
void
-FullLanguageTagDialog::current_tag_selection_changed ()
+FullLanguageTagDialog::current_tag_selection_changed()
{
- auto selected = _current_tag_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ auto selected = _current_tag_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (selected >= 0) {
- _choose_subtag_panel->Enable (true);
- _choose_subtag_panel->set (_current_tag_subtags[selected].type, _current_tag_subtags[selected].last_search, _current_tag_subtags[selected].subtag);
+ _choose_subtag_panel->Enable(true);
+ _choose_subtag_panel->set(_current_tag_subtags[selected].type, _current_tag_subtags[selected].last_search, _current_tag_subtags[selected].subtag);
} else {
- _choose_subtag_panel->Enable (false);
+ _choose_subtag_panel->Enable(false);
}
}
void
-FullLanguageTagDialog::chosen_subtag_changed (optional<dcp::LanguageTag::SubtagData> selection)
+FullLanguageTagDialog::chosen_subtag_changed(optional<dcp::LanguageTag::SubtagData> selection)
{
if (!selection) {
return;
}
- auto selected = _current_tag_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ auto selected = _current_tag_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (selected >= 0) {
_current_tag_subtags[selected].subtag = *selection;
_current_tag_list->SetItem(selected, 0, std_to_wx(subtag_type_name(_current_tag_subtags[selected].type)));
_current_tag_list->SetItem(selected, 1, std_to_wx(selection->description));
}
- setup_sensitivity ();
+ setup_sensitivity();
}
void
-FullLanguageTagDialog::setup_sensitivity ()
+FullLanguageTagDialog::setup_sensitivity()
{
- _add_script->Enable ();
- _add_region->Enable ();
- _add_variant->Enable ();
+ _add_script->Enable();
+ _add_region->Enable();
+ _add_variant->Enable();
_add_extended->Enable();
for (auto const& i: _current_tag_subtags) {
switch (i.type) {
case dcp::LanguageTag::SubtagType::SCRIPT:
- _add_script->Enable (false);
+ _add_script->Enable(false);
break;
case dcp::LanguageTag::SubtagType::REGION:
- _add_region->Enable (false);
+ _add_region->Enable(false);
break;
case dcp::LanguageTag::SubtagType::VARIANT:
- _add_variant->Enable (false);
+ _add_variant->Enable(false);
break;
case dcp::LanguageTag::SubtagType::EXTLANG:
_add_extended->Enable(false);
@@ -284,7 +283,7 @@ FullLanguageTagDialog::setup_sensitivity ()
break;
}
}
- auto selected = _current_tag_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- _remove->Enable (selected > 0);
+ auto selected = _current_tag_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ _remove->Enable(selected > 0);
}
diff --git a/src/wx/full_language_tag_dialog.h b/src/wx/full_language_tag_dialog.h
index 883b50dfb..0a256f016 100644
--- a/src/wx/full_language_tag_dialog.h
+++ b/src/wx/full_language_tag_dialog.h
@@ -43,9 +43,9 @@ public:
class Subtag
{
public:
- Subtag (dcp::LanguageTag::SubtagType type_, boost::optional<dcp::LanguageTag::SubtagData> subtag_)
- : type (type_)
- , subtag (subtag_)
+ Subtag(dcp::LanguageTag::SubtagType type_, boost::optional<dcp::LanguageTag::SubtagData> subtag_)
+ : type(type_)
+ , subtag(subtag_)
{}
dcp::LanguageTag::SubtagType type;
@@ -53,20 +53,20 @@ public:
std::string last_search;
};
- FullLanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag = dcp::LanguageTag("en"));
+ FullLanguageTagDialog(wxWindow* parent, dcp::LanguageTag tag = dcp::LanguageTag("en"));
- dcp::LanguageTag get () const;
- void set (dcp::LanguageTag tag);
+ dcp::LanguageTag get() const;
+ void set(dcp::LanguageTag tag);
private:
- std::string subtag_type_name (dcp::LanguageTag::SubtagType type);
- void search_changed (std::string search);
- void add_to_current_tag (dcp::LanguageTag::SubtagType type, boost::optional<dcp::LanguageTag::SubtagData> subtag);
- void remove_from_current_tag ();
- void current_tag_selection_changed ();
- void chosen_subtag_changed (boost::optional<dcp::LanguageTag::SubtagData> selection);
- void setup_sensitivity ();
+ std::string subtag_type_name(dcp::LanguageTag::SubtagType type);
+ void search_changed(std::string search);
+ void add_to_current_tag(dcp::LanguageTag::SubtagType type, boost::optional<dcp::LanguageTag::SubtagData> subtag);
+ void remove_from_current_tag();
+ void current_tag_selection_changed();
+ void chosen_subtag_changed(boost::optional<dcp::LanguageTag::SubtagData> selection);
+ void setup_sensitivity();
std::vector<Subtag> _current_tag_subtags;
wxListCtrl* _current_tag_list;
diff --git a/src/wx/standard_controls.cc b/src/wx/standard_controls.cc
index 942c49fc4..d9b8c998b 100644
--- a/src/wx/standard_controls.cc
+++ b/src/wx/standard_controls.cc
@@ -38,6 +38,7 @@ StandardControls::StandardControls(wxWindow* parent, FilmViewer& viewer, bool ed
{
_button_sizer->Add (_play_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
_play_button->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&StandardControls::play_clicked, this));
+ setup_sensitivity();
}
diff --git a/src/wx/supporters.cc b/src/wx/supporters.cc
index 77ac85f8d..dff4f9a7c 100644
--- a/src/wx/supporters.cc
+++ b/src/wx/supporters.cc
@@ -526,6 +526,7 @@ supported_by.Add (wxT ("Reeju George"));
supported_by.Add (wxT ("Rob George"));
supported_by.Add (wxT ("Ian Gibbins"));
supported_by.Add (wxT ("John Gigrich"));
+supported_by.Add (wxT ("Weldon Gillian"));
supported_by.Add (wxT ("Barry J. Gillis"));
supported_by.Add (wxT ("Victor Gimenez"));
supported_by.Add (wxT ("Sebastian Hernandis Giner"));
@@ -1490,6 +1491,7 @@ supported_by.Add (wxT ("Tilman Vatteroth"));
supported_by.Add (wxT ("Jos Vecht"));
supported_by.Add (wxT ("Christian Vennefrohne"));
supported_by.Add (wxT ("Jaap Verseput"));
+supported_by.Add (wxT ("Dan Viafore"));
supported_by.Add (wxT ("Videoworld"));
supported_by.Add (wxT ("Robert Vidić"));
supported_by.Add (wxT ("Burg Kino Vienna"));
diff --git a/src/wx/verify_dcp_result_panel.cc b/src/wx/verify_dcp_result_panel.cc
index 425a3eb00..aa5da95c6 100644
--- a/src/wx/verify_dcp_result_panel.cc
+++ b/src/wx/verify_dcp_result_panel.cc
@@ -230,6 +230,12 @@ VerifyDCPResultPanel::add(shared_ptr<const VerifyDCPJob> job, bool many)
if (auto const error = note.error()) {
message.Replace(char_to_wx("%error"), std_to_wx(*error));
}
+ if (auto const bit_depth = note.bit_depth()) {
+ message.Replace(char_to_wx("%bit_depth"), std_to_wx(fmt::to_string(*bit_depth)));
+ }
+ if (auto const issue_date = note.issue_date()) {
+ message.Replace(char_to_wx("%issue_date"), std_to_wx(*issue_date));
+ }
if (auto const size_in_pixels = note.size_in_pixels()) {
message.Replace(char_to_wx("%size_in_pixels"), wxString::Format(char_to_wx("%dx%d"), size_in_pixels->width, size_in_pixels->height));
}
@@ -339,7 +345,7 @@ VerifyDCPResultPanel::add(shared_ptr<const VerifyDCPJob> job, bool many)
);
break;
case dcp::VerificationNote::Code::EXTERNAL_ASSET:
- add(i.second, _("This DCP refers to at the asset %asset_id in another DCP (and perhaps others), so it is a \"version file\" (VF)"));
+ add(i.second, _("This DCP refers to the asset %asset_id in another DCP (and perhaps others), so it is a \"version file\" (VF)"));
break;
case dcp::VerificationNote::Code::THREED_ASSET_MARKED_AS_TWOD:
add(i.second, _("The asset %f is 3D but its MXF is marked as 2D."));
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 8d21a3e63..8e86a5408 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -65,9 +65,9 @@ using namespace dcpomatic;
wxStaticText *
#ifdef __WXOSX__
-create_label (wxWindow* p, wxString t, bool left)
+create_label(wxWindow* p, wxString t, bool left)
#else
-create_label (wxWindow* p, wxString t, bool)
+create_label(wxWindow* p, wxString t, bool)
#endif
{
#ifdef __WXOSX__
@@ -75,14 +75,14 @@ create_label (wxWindow* p, wxString t, bool)
t += char_to_wx(":");
}
#endif
- return new StaticText (p, t);
+ return new StaticText(p, t);
}
#ifdef __WXOSX__
static
void
-setup_osx_flags (wxSizer* s, bool left, int& flags)
+setup_osx_flags(wxSizer* s, bool left, int& flags)
{
if (left) {
auto box = dynamic_cast<wxBoxSizer*>(s);
@@ -103,28 +103,28 @@ setup_osx_flags (wxSizer* s, bool left, int& flags)
* @param prop Proportion to pass when calling Add() on the wxSizer.
*/
wxStaticText *
-add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop, int flags)
+add_label_to_sizer(wxSizer* s, wxWindow* p, wxString t, bool left, int prop, int flags)
{
#ifdef __WXOSX__
- setup_osx_flags (s, left, flags);
+ setup_osx_flags(s, left, flags);
#endif
- auto m = create_label (p, t, left);
- s->Add (m, prop, flags, DCPOMATIC_SIZER_GAP);
+ auto m = create_label(p, t, left);
+ s->Add(m, prop, flags, DCPOMATIC_SIZER_GAP);
return m;
}
wxStaticText *
#ifdef __WXOSX__
-add_label_to_sizer (wxSizer* s, wxStaticText* t, bool left, int prop, int flags)
+add_label_to_sizer(wxSizer* s, wxStaticText* t, bool left, int prop, int flags)
#else
-add_label_to_sizer (wxSizer* s, wxStaticText* t, bool, int prop, int flags)
+add_label_to_sizer(wxSizer* s, wxStaticText* t, bool, int prop, int flags)
#endif
{
#ifdef __WXOSX__
- setup_osx_flags (s, left, flags);
+ setup_osx_flags(s, left, flags);
#endif
- s->Add (t, prop, flags, DCPOMATIC_SIZER_GAP);
+ s->Add(t, prop, flags, DCPOMATIC_SIZER_GAP);
return t;
}
@@ -134,9 +134,9 @@ add_label_to_sizer(wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBPo
{
int flags = wxALIGN_CENTER_VERTICAL | wxLEFT;
#ifdef __WXOSX__
- setup_osx_flags (s, left, flags);
+ setup_osx_flags(s, left, flags);
#endif
- auto m = create_label (p, t, left);
+ auto m = create_label(p, t, left);
s->Add(m, pos, span, flags, indent ? DCPOMATIC_SIZER_X_GAP : 0);
return m;
}
@@ -144,16 +144,16 @@ add_label_to_sizer(wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBPo
wxStaticText *
#ifdef __WXOSX__
-add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool left, wxGBPosition pos, wxGBSpan span)
+add_label_to_sizer(wxGridBagSizer* s, wxStaticText* t, bool left, wxGBPosition pos, wxGBSpan span)
#else
-add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool, wxGBPosition pos, wxGBSpan span)
+add_label_to_sizer(wxGridBagSizer* s, wxStaticText* t, bool, wxGBPosition pos, wxGBSpan span)
#endif
{
int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT;
#ifdef __WXOSX__
- setup_osx_flags (s, left, flags);
+ setup_osx_flags(s, left, flags);
#endif
- s->Add (t, pos, span, flags);
+ s->Add(t, pos, span, flags);
return t;
}
@@ -164,12 +164,12 @@ add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool, wxGBPosition pos,
* @param e Extended message.
*/
void
-error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
+error_dialog(wxWindow* parent, wxString m, optional<wxString> e)
{
wxMessageDialog dialog(parent, m, variant::wx::dcpomatic(), wxOK | wxICON_ERROR);
if (e) {
wxString em = *e;
- em[0] = wxToupper (em[0]);
+ em[0] = wxToupper(em[0]);
dialog.SetExtendedMessage(em);
}
dialog.ShowModal();
@@ -181,7 +181,7 @@ error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
* @param m Message.
*/
void
-message_dialog (wxWindow* parent, wxString m)
+message_dialog(wxWindow* parent, wxString m)
{
wxMessageDialog dialog(parent, m, variant::wx::dcpomatic(), wxOK | wxICON_INFORMATION);
dialog.ShowModal();
@@ -190,7 +190,7 @@ message_dialog (wxWindow* parent, wxString m)
/** @return true if the user answered "yes" */
bool
-confirm_dialog (wxWindow* parent, wxString m)
+confirm_dialog(wxWindow* parent, wxString m)
{
wxMessageDialog dialog(parent, m, variant::wx::dcpomatic(), wxYES_NO | wxICON_QUESTION);
return dialog.ShowModal() == wxID_YES;
@@ -201,9 +201,9 @@ confirm_dialog (wxWindow* parent, wxString m)
* @return Corresponding STL string.
*/
string
-wx_to_std (wxString s)
+wx_to_std(wxString s)
{
- return string (s.ToUTF8());
+ return string(s.ToUTF8());
}
@@ -211,9 +211,9 @@ wx_to_std (wxString s)
* @return Corresponding wxWidgets string.
*/
wxString
-std_to_wx (string s)
+std_to_wx(string s)
{
- return wxString (s.c_str(), wxConvUTF8);
+ return wxString(s.c_str(), wxConvUTF8);
}
@@ -225,14 +225,14 @@ char_to_wx(char const* s)
string
-string_client_data (wxClientData* o)
+string_client_data(wxClientData* o)
{
- return wx_to_std (dynamic_cast<wxStringClientData*>(o)->GetData());
+ return wx_to_std(dynamic_cast<wxStringClientData*>(o)->GetData());
}
void
-checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
+checked_set(FilePickerCtrl* widget, boost::filesystem::path value)
{
if (widget->path() != value) {
if (value.empty()) {
@@ -247,60 +247,60 @@ checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
void
-checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value)
+checked_set(wxDirPickerCtrl* widget, boost::filesystem::path value)
{
- if (widget->GetPath() != std_to_wx (value.string())) {
+ if (widget->GetPath() != std_to_wx(value.string())) {
if (value.empty()) {
/* Hack to make wxWidgets clear the control when we are passed
an empty value.
*/
value = " ";
}
- widget->SetPath (std_to_wx (value.string()));
+ widget->SetPath(std_to_wx(value.string()));
}
}
void
-checked_set (wxSpinCtrl* widget, int value)
+checked_set(wxSpinCtrl* widget, int value)
{
if (widget->GetValue() != value) {
- widget->SetValue (value);
+ widget->SetValue(value);
}
}
void
-checked_set (wxSpinCtrlDouble* widget, double value)
+checked_set(wxSpinCtrlDouble* widget, double value)
{
/* XXX: completely arbitrary epsilon */
- if (fabs (widget->GetValue() - value) > 1e-16) {
- widget->SetValue (value);
+ if (fabs(widget->GetValue() - value) > 1e-16) {
+ widget->SetValue(value);
}
}
void
-checked_set (wxChoice* widget, int value)
+checked_set(wxChoice* widget, int value)
{
if (widget->GetSelection() != value) {
- widget->SetSelection (value);
+ widget->SetSelection(value);
}
}
void
-checked_set (wxChoice* widget, string value)
+checked_set(wxChoice* widget, string value)
{
wxClientData* o = nullptr;
if (widget->GetSelection() != -1) {
- o = widget->GetClientObject (widget->GetSelection ());
+ o = widget->GetClientObject(widget->GetSelection());
}
if (!o || string_client_data(o) != value) {
for (unsigned int i = 0; i < widget->GetCount(); ++i) {
- if (string_client_data (widget->GetClientObject (i)) == value) {
- widget->SetSelection (i);
+ if (string_client_data(widget->GetClientObject(i)) == value) {
+ widget->SetSelection(i);
}
}
}
@@ -308,11 +308,11 @@ checked_set (wxChoice* widget, string value)
void
-checked_set (wxChoice* widget, vector<pair<string, string>> items)
+checked_set(wxChoice* widget, vector<pair<string, string>> items)
{
vector<pair<string, string>> current;
for (unsigned int i = 0; i < widget->GetCount(); ++i) {
- current.push_back (
+ current.push_back(
make_pair(
wx_to_std(widget->GetString(i)),
widget->GetClientData() ? string_client_data(widget->GetClientObject(i)) : ""
@@ -324,24 +324,24 @@ checked_set (wxChoice* widget, vector<pair<string, string>> items)
return;
}
- widget->Clear ();
+ widget->Clear();
for (auto i: items) {
- widget->Append (std_to_wx(i.first), new wxStringClientData(std_to_wx(i.second)));
+ widget->Append(std_to_wx(i.first), new wxStringClientData(std_to_wx(i.second)));
}
}
void
-checked_set (wxTextCtrl* widget, string value)
+checked_set(wxTextCtrl* widget, string value)
{
- if (widget->GetValue() != std_to_wx (value)) {
- widget->ChangeValue (std_to_wx (value));
+ if (widget->GetValue() != std_to_wx(value)) {
+ widget->ChangeValue(std_to_wx(value));
}
}
void
-checked_set (PasswordEntry* entry, string value)
+checked_set(PasswordEntry* entry, string value)
{
if (entry->get() != value) {
entry->set(value);
@@ -350,46 +350,46 @@ checked_set (PasswordEntry* entry, string value)
void
-checked_set (wxTextCtrl* widget, wxString value)
+checked_set(wxTextCtrl* widget, wxString value)
{
if (widget->GetValue() != value) {
- widget->ChangeValue (value);
+ widget->ChangeValue(value);
}
}
void
-checked_set (wxStaticText* widget, string value)
+checked_set(wxStaticText* widget, string value)
{
- if (widget->GetLabel() != std_to_wx (value)) {
- widget->SetLabel (std_to_wx (value));
+ if (widget->GetLabel() != std_to_wx(value)) {
+ widget->SetLabel(std_to_wx(value));
}
}
void
-checked_set (wxStaticText* widget, wxString value)
+checked_set(wxStaticText* widget, wxString value)
{
if (widget->GetLabel() != value) {
- widget->SetLabel (value);
+ widget->SetLabel(value);
}
}
void
-checked_set (wxCheckBox* widget, bool value)
+checked_set(wxCheckBox* widget, bool value)
{
if (widget->GetValue() != value) {
- widget->SetValue (value);
+ widget->SetValue(value);
}
}
void
-checked_set (wxRadioButton* widget, bool value)
+checked_set(wxRadioButton* widget, bool value)
{
if (widget->GetValue() != value) {
- widget->SetValue (value);
+ widget->SetValue(value);
}
}
@@ -422,23 +422,23 @@ checked_set(RegionSubtagWidget* widget, optional<dcp::LanguageTag::RegionSubtag>
int
-wx_get (wxSpinCtrl* w)
+wx_get(wxSpinCtrl* w)
{
- return w->GetValue ();
+ return w->GetValue();
}
int
-wx_get (wxChoice* w)
+wx_get(wxChoice* w)
{
- return w->GetSelection ();
+ return w->GetSelection();
}
double
-wx_get (wxSpinCtrlDouble* w)
+wx_get(wxSpinCtrlDouble* w)
{
- return w->GetValue ();
+ return w->GetValue();
}
@@ -454,7 +454,7 @@ context_translation(char const* s)
/* No translation; strip the context */
int c = t.Find(char_to_wx("|"));
if (c != wxNOT_FOUND) {
- t = t.Mid (c + 1);
+ t = t.Mid(c + 1);
}
}
@@ -463,46 +463,46 @@ context_translation(char const* s)
wxString
-time_to_timecode (DCPTime t, double fps)
+time_to_timecode(DCPTime t, double fps)
{
- auto w = t.seconds ();
+ auto w = t.seconds();
int const h = (w / 3600);
w -= h * 3600;
int const m = (w / 60);
w -= m * 60;
- int const s = floor (w);
+ int const s = floor(w);
w -= s;
- int const f = lrint (w * fps);
- return wxString::Format(char_to_wx("%02d:%02d:%02d.%02d"), h, m, s, f);
+ int const f = lrint(w * fps);
+ return wxString::Format(char_to_wx("%02d:%02d:%02d:%02d"), h, m, s, f);
}
void
-setup_audio_channels_choice (wxChoice* choice, int minimum)
+setup_audio_channels_choice(wxChoice* choice, int minimum)
{
vector<pair<string, string>> items;
for (int i = minimum; i <= 16; i += 2) {
if (i == 2) {
- items.push_back (make_pair(wx_to_std(_("2 - stereo")), locale_convert<string>(i)));
+ items.push_back(make_pair(wx_to_std(_("2 - stereo")), locale_convert<string>(i)));
} else if (i == 4) {
- items.push_back (make_pair(wx_to_std(_("4 - L/C/R/Lfe")), locale_convert<string>(i)));
+ items.push_back(make_pair(wx_to_std(_("4 - L/C/R/Lfe")), locale_convert<string>(i)));
} else if (i == 6) {
- items.push_back (make_pair(wx_to_std(_("6 - 5.1")), locale_convert<string>(i)));
+ items.push_back(make_pair(wx_to_std(_("6 - 5.1")), locale_convert<string>(i)));
} else if (i == 8) {
- items.push_back (make_pair(wx_to_std(_("8 - 5.1/HI/VI")), locale_convert<string>(i)));
+ items.push_back(make_pair(wx_to_std(_("8 - 5.1/HI/VI")), locale_convert<string>(i)));
} else if (i == 12) {
- items.push_back (make_pair(wx_to_std(_("12 - 7.1/HI/VI")), locale_convert<string>(i)));
+ items.push_back(make_pair(wx_to_std(_("12 - 7.1/HI/VI")), locale_convert<string>(i)));
} else {
- items.push_back (make_pair(locale_convert<string> (i), locale_convert<string>(i)));
+ items.push_back(make_pair(locale_convert<string>(i), locale_convert<string>(i)));
}
}
- checked_set (choice, items);
+ checked_set(choice, items);
}
wxSplashScreen*
-maybe_show_splash ()
+maybe_show_splash()
{
wxSplashScreen* splash = nullptr;
@@ -523,7 +523,7 @@ maybe_show_splash ()
#else
splash = new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, nullptr, -1);
#endif
- wxYield ();
+ wxYield();
}
} catch (boost::filesystem::filesystem_error& e) {
/* Maybe we couldn't find the splash image; never mind */
@@ -534,19 +534,19 @@ maybe_show_splash ()
double
-calculate_mark_interval (double mark_interval)
+calculate_mark_interval(double mark_interval)
{
if (mark_interval > 5) {
- mark_interval -= lrint (mark_interval) % 5;
+ mark_interval -= lrint(mark_interval) % 5;
}
if (mark_interval > 10) {
- mark_interval -= lrint (mark_interval) % 10;
+ mark_interval -= lrint(mark_interval) % 10;
}
if (mark_interval > 60) {
- mark_interval -= lrint (mark_interval) % 60;
+ mark_interval -= lrint(mark_interval) % 60;
}
if (mark_interval > 3600) {
- mark_interval -= lrint (mark_interval) % 3600;
+ mark_interval -= lrint(mark_interval) % 3600;
}
if (mark_interval < 1) {
@@ -559,16 +559,16 @@ calculate_mark_interval (double mark_interval)
/** @return false if the task was cancelled */
bool
-display_progress (wxString title, wxString task)
+display_progress(wxString title, wxString task)
{
- auto jm = JobManager::instance ();
+ auto jm = JobManager::instance();
- wxProgressDialog progress (title, task, 100, 0, wxPD_CAN_ABORT);
+ wxProgressDialog progress(title, task, 100, 0, wxPD_CAN_ABORT);
bool ok = true;
while (jm->work_to_do()) {
- dcpomatic_sleep_seconds (1);
+ dcpomatic_sleep_seconds(1);
if (!progress.Pulse()) {
/* user pressed cancel */
for (auto i: jm->get()) {
@@ -584,7 +584,7 @@ display_progress (wxString title, wxString task)
int
-get_offsets (vector<Offset>& offsets)
+get_offsets(vector<Offset>& offsets)
{
offsets.push_back({_("UTC-11"), dcp::UTCOffset(-11, 0)});
offsets.push_back({_("UTC-10"), dcp::UTCOffset(-10, 0)});
@@ -623,13 +623,13 @@ get_offsets (vector<Offset>& offsets)
wxString
-bitmap_path (string name)
+bitmap_path(string name)
{
boost::filesystem::path base;
#ifdef DCPOMATIC_DEBUG
/* Hack to allow Linux and OS X to find icons when running from the source tree */
- char* path = getenv ("DCPOMATIC_GRAPHICS");
+ char* path = getenv("DCPOMATIC_GRAPHICS");
if (path) {
base = path;
} else {
@@ -644,7 +644,7 @@ bitmap_path (string name)
#endif
auto p = base / name;
- return std_to_wx (p.string());
+ return std_to_wx(p.string());
}
@@ -656,18 +656,18 @@ icon_path(string name)
wxSize
-small_button_size (wxWindow* parent, wxString text)
+small_button_size(wxWindow* parent, wxString text)
{
- wxClientDC dc (parent);
- auto size = dc.GetTextExtent (text);
- size.SetHeight (-1);
- size.IncBy (32, 0);
+ wxClientDC dc(parent);
+ auto size = dc.GetTextExtent(text);
+ size.SetHeight(-1);
+ size.IncBy(32, 0);
return size;
}
bool
-gui_is_dark ()
+gui_is_dark()
{
#ifdef DCPOMATIC_WINDOWS
/* Dark mode doesn't really work at all on Windows at the moment, so just don't use it */
@@ -684,13 +684,13 @@ gui_is_dark ()
#if wxCHECK_VERSION(3,1,0)
double
-dpi_scale_factor (wxWindow* window)
+dpi_scale_factor(wxWindow* window)
{
return window->GetDPIScaleFactor();
}
#else
double
-dpi_scale_factor (wxWindow*)
+dpi_scale_factor(wxWindow*)
{
return 1;
}
@@ -699,7 +699,7 @@ dpi_scale_factor (wxWindow*)
int
-search_ctrl_height ()
+search_ctrl_height()
{
#ifdef __WXGTK3__
return 30;
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index 6f84705fb..957957589 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -94,34 +94,34 @@ class PasswordEntry;
#define S_(x) context_translation(x)
-extern void error_dialog (wxWindow *, wxString, boost::optional<wxString> e = boost::optional<wxString>());
-extern void message_dialog (wxWindow *, wxString);
-extern bool confirm_dialog (wxWindow *, wxString);
-extern wxStaticText* create_label (wxWindow* p, wxString t, bool left);
-extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, bool left, int prop = 0, int flags = wxLEFT | wxRIGHT);
-extern wxStaticText* add_label_to_sizer (wxSizer *, wxStaticText *, bool left, int prop = 0, int flags = wxLEFT | wxRIGHT);
+extern void error_dialog(wxWindow *, wxString, boost::optional<wxString> e = boost::optional<wxString>());
+extern void message_dialog(wxWindow *, wxString);
+extern bool confirm_dialog(wxWindow *, wxString);
+extern wxStaticText* create_label(wxWindow* p, wxString t, bool left);
+extern wxStaticText* add_label_to_sizer(wxSizer *, wxWindow *, wxString, bool left, int prop = 0, int flags = wxLEFT | wxRIGHT);
+extern wxStaticText* add_label_to_sizer(wxSizer *, wxStaticText *, bool left, int prop = 0, int flags = wxLEFT | wxRIGHT);
extern wxStaticText* add_label_to_sizer(wxGridBagSizer *, wxWindow *, wxString, bool, wxGBPosition, wxGBSpan span = wxDefaultSpan, bool indent = false);
-extern wxStaticText* add_label_to_sizer (wxGridBagSizer *, wxStaticText *, bool, wxGBPosition, wxGBSpan span = wxDefaultSpan);
-extern std::string wx_to_std (wxString);
-extern wxString std_to_wx (std::string);
+extern wxStaticText* add_label_to_sizer(wxGridBagSizer *, wxStaticText *, bool, wxGBPosition, wxGBSpan span = wxDefaultSpan);
+extern std::string wx_to_std(wxString);
+extern wxString std_to_wx(std::string);
/** Convert UTF8-encoded char array to wxString */
extern wxString char_to_wx(char const* s);
extern wxString context_translation(char const* s);
-extern std::string string_client_data (wxClientData* o);
-extern wxString time_to_timecode (dcpomatic::DCPTime t, double fps);
-extern void setup_audio_channels_choice (wxChoice* choice, int minimum);
+extern std::string string_client_data(wxClientData* o);
+extern wxString time_to_timecode(dcpomatic::DCPTime t, double fps);
+extern void setup_audio_channels_choice(wxChoice* choice, int minimum);
extern wxSplashScreen* maybe_show_splash();
-extern double calculate_mark_interval (double start);
-extern bool display_progress (wxString title, wxString task);
-extern bool report_errors_from_last_job (wxWindow* parent);
-extern wxString bitmap_path (std::string name);
+extern double calculate_mark_interval(double start);
+extern bool display_progress(wxString title, wxString task);
+extern bool report_errors_from_last_job(wxWindow* parent);
+extern wxString bitmap_path(std::string name);
extern wxString icon_path(std::string name);
-extern wxSize small_button_size (wxWindow* parent, wxString text);
-extern bool gui_is_dark ();
-extern double dpi_scale_factor (wxWindow* window);
-extern int search_ctrl_height ();
+extern wxSize small_button_size(wxWindow* parent, wxString text);
+extern bool gui_is_dark();
+extern double dpi_scale_factor(wxWindow* window);
+extern int search_ctrl_height();
extern void report_config_load_failure(wxWindow* parent, Config::LoadFailure what);
extern bool layout_for_short_screen(wxWindow* reference);
@@ -137,7 +137,7 @@ struct Offset
dcp::UTCOffset offset;
};
-extern int get_offsets (std::vector<Offset>& offsets);
+extern int get_offsets(std::vector<Offset>& offsets);
namespace dcpomatic {
namespace wx {
@@ -149,27 +149,27 @@ namespace wx {
}
-extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value);
-extern void checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value);
-extern void checked_set (wxSpinCtrl* widget, int value);
-extern void checked_set (wxSpinCtrlDouble* widget, double value);
-extern void checked_set (wxChoice* widget, int value);
-extern void checked_set (wxChoice* widget, std::string value);
-extern void checked_set (wxChoice* widget, std::vector<std::pair<std::string, std::string> > items);
-extern void checked_set (wxTextCtrl* widget, std::string value);
-extern void checked_set (wxTextCtrl* widget, wxString value);
-extern void checked_set (PasswordEntry* widget, std::string value);
-extern void checked_set (wxCheckBox* widget, bool value);
-extern void checked_set (wxRadioButton* widget, bool value);
-extern void checked_set (wxStaticText* widget, std::string value);
-extern void checked_set (wxStaticText* widget, wxString value);
+extern void checked_set(FilePickerCtrl* widget, boost::filesystem::path value);
+extern void checked_set(wxDirPickerCtrl* widget, boost::filesystem::path value);
+extern void checked_set(wxSpinCtrl* widget, int value);
+extern void checked_set(wxSpinCtrlDouble* widget, double value);
+extern void checked_set(wxChoice* widget, int value);
+extern void checked_set(wxChoice* widget, std::string value);
+extern void checked_set(wxChoice* widget, std::vector<std::pair<std::string, std::string> > items);
+extern void checked_set(wxTextCtrl* widget, std::string value);
+extern void checked_set(wxTextCtrl* widget, wxString value);
+extern void checked_set(PasswordEntry* widget, std::string value);
+extern void checked_set(wxCheckBox* widget, bool value);
+extern void checked_set(wxRadioButton* widget, bool value);
+extern void checked_set(wxStaticText* widget, std::string value);
+extern void checked_set(wxStaticText* widget, wxString value);
extern void checked_set(LanguageTagWidget* widget, dcp::LanguageTag value);
extern void checked_set(LanguageTagWidget* widget, boost::optional<dcp::LanguageTag> value);
extern void checked_set(RegionSubtagWidget* widget, boost::optional<dcp::LanguageTag::RegionSubtag> value);
-extern int wx_get (wxChoice* widget);
-extern int wx_get (wxSpinCtrl* widget);
-extern double wx_get (wxSpinCtrlDouble* widget);
+extern int wx_get(wxChoice* widget);
+extern int wx_get(wxSpinCtrl* widget);
+extern double wx_get(wxSpinCtrlDouble* widget);
#ifdef DCPOMATIC_WINDOWS
#define DCPOMATIC_USE_OWN_PICKER