diff options
Diffstat (limited to 'src')
68 files changed, 1498 insertions, 1335 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_content.cc b/src/lib/audio_content.cc index 50601fc58..bd25593d0 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -212,8 +212,8 @@ AudioContent::resampled_frame_rate(shared_ptr<const Film> film) const look different in the DCP compared to the source (slower or faster). */ - if (frc.change_speed) { - t /= frc.speed_up; + if (frc.change_speed()) { + t /= frc.speed_up(); } return lrint(t); @@ -330,11 +330,11 @@ AudioContent::add_properties(shared_ptr<const Film> film, list<UserProperty>& p) } p.push_back( - UserProperty(UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source)) + UserProperty(UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source())) ); p.push_back(UserProperty(UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate(film), _("Hz"))); - p.push_back(UserProperty(UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round(frc.dcp))); + p.push_back(UserProperty(UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round(frc.dcp()))); } 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/content.cc b/src/lib/content.cc index 8f486380a..067086509 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -431,7 +431,7 @@ Content::active_video_frame_rate(shared_ptr<const Film> film) const prepared for any concurrent video content or perhaps just the DCP rate. */ - return film->active_frame_rate_change(position()).source; + return film->active_frame_rate_change(position()).source(); } 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/dcpomatic_time.cc b/src/lib/dcpomatic_time.cc index 60fc5342a..2b1400ccf 100644 --- a/src/lib/dcpomatic_time.cc +++ b/src/lib/dcpomatic_time.cc @@ -48,7 +48,7 @@ dcpomatic::operator<=(HMSF const& a, HMSF const& b) template <> Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRateChange f) - : _t (llrint(d.get() * f.speed_up)) + : _t (llrint(d.get() * f.speed_up())) { } @@ -56,7 +56,7 @@ Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRa template <> Time<DCPTimeDifferentiator, ContentTimeDifferentiator>::Time (ContentTime d, FrameRateChange f) - : _t (llrint(d.get() / f.speed_up)) + : _t (llrint(d.get() / f.speed_up())) { } 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/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 322553586..3ab9bfb0c 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -421,7 +421,7 @@ FFmpegContent::full_length(shared_ptr<const Film> film) const if (audio) { DCPTime longest; for (auto i: audio->streams()) { - longest = max(longest, DCPTime::from_frames(llrint(i->length() / frc.speed_up), i->frame_rate())); + longest = max(longest, DCPTime::from_frames(llrint(i->length() / frc.speed_up()), i->frame_rate())); } return longest; } diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 0f38b3247..719406259 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -176,7 +176,7 @@ FFmpegDecoder::flush_fill() auto const frc = film()->active_frame_rate_change(_ffmpeg_content->position()); ContentTime full_length (_ffmpeg_content->full_length(film()), frc); - full_length = full_length.ceil (frc.source); + full_length = full_length.ceil (frc.source()); if (video && !video->ignore()) { double const vfr = _ffmpeg_content->video_frame_rate().get(); auto const v = video->position(film()).get_value_or(ContentTime()) + ContentTime::from_frames(1, vfr); 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/frame_rate_change.cc b/src/lib/frame_rate_change.cc index 69296c970..6057f9ca3 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -31,74 +31,76 @@ using std::shared_ptr; using std::string; -FrameRateChange::FrameRateChange () +FrameRateChange::FrameRateChange() { } -FrameRateChange::FrameRateChange (double source_, int dcp_) +FrameRateChange::FrameRateChange(double source, int dcp) { - source = source_; - dcp = dcp_; + _source = source; + _dcp = dcp; - if (fabs(source / 2.0 - dcp) < fabs(source - dcp)) { + if (fabs(_source / 2.0 - _dcp) < fabs(_source - _dcp)) { /* The difference between source and DCP frame rate will be lower (i.e. better) if we skip. */ - skip = true; - } else if (fabs(source * 2 - dcp) < fabs(source - dcp)) { + _skip = round(source / dcp) - 1; + } else if (fabs(_source * 2 - _dcp) < fabs(_source - _dcp)) { /* The difference between source and DCP frame rate would be better if we repeated each frame once; it may be better still if we repeated more than once. Work out the required repeat. */ - repeat = round (dcp / source); + _repeat = round(_dcp / _source); } - speed_up = dcp / (source * factor()); + _speed_up = _dcp / (_source * factor()); auto about_equal = [](double a, double b) { - return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON); + return fabs(a - b) < VIDEO_FRAME_RATE_EPSILON; }; - change_speed = !about_equal (speed_up, 1.0); + _change_speed = !about_equal(_speed_up, 1.0); } -FrameRateChange::FrameRateChange (shared_ptr<const Film> film, shared_ptr<const Content> content) - : FrameRateChange (content->active_video_frame_rate(film), film->video_frame_rate()) +FrameRateChange::FrameRateChange(shared_ptr<const Film> film, shared_ptr<const Content> content) + : FrameRateChange(content->active_video_frame_rate(film), film->video_frame_rate()) { } -FrameRateChange::FrameRateChange (shared_ptr<const Film> film, Content const * content) - : FrameRateChange (content->active_video_frame_rate(film), film->video_frame_rate()) +FrameRateChange::FrameRateChange(shared_ptr<const Film> film, Content const * content) + : FrameRateChange(content->active_video_frame_rate(film), film->video_frame_rate()) { } string -FrameRateChange::description () const +FrameRateChange::description() const { string description; - if (!skip && repeat == 1 && !change_speed) { + if (_skip == 0 && _repeat == 1 && !_change_speed) { description = _("Content and DCP have the same rate.\n"); } else { - if (skip) { + if (_skip == 1) { description = _("DCP will use every other frame of the content.\n"); - } else if (repeat == 2) { + } else if (_skip >= 2) { + description = fmt::format(_("DCP will contain 1 out of every {} frames of the content.\n"), _skip + 1); + } else if (_repeat == 2) { description = _("Each content frame will be doubled in the DCP.\n"); - } else if (repeat > 2) { - description = fmt::format(_("Each content frame will be repeated {} more times in the DCP.\n"), repeat - 1); + } else if (_repeat > 2) { + description = fmt::format(_("Each content frame will be repeated {} more times in the DCP.\n"), _repeat - 1); } - if (change_speed) { - double const pc = dcp * 100 / (source * factor()); + if (_change_speed) { + double const pc = _dcp * 100 / (_source * factor()); char buffer[256]; - snprintf (buffer, sizeof(buffer), _("DCP will run at %.1f%% of the content speed.\n"), pc); + snprintf(buffer, sizeof(buffer), _("DCP will run at %.1f%% of the content speed.\n"), pc); description += buffer; } } diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h index c28342e92..b58e499d8 100644 --- a/src/lib/frame_rate_change.h +++ b/src/lib/frame_rate_change.h @@ -27,36 +27,65 @@ #include <string> -class Film; class Content; +class Film; class FrameRateChange { public: - FrameRateChange (); - FrameRateChange (double, int); - FrameRateChange (std::shared_ptr<const Film> film, std::shared_ptr<const Content> content); - FrameRateChange (std::shared_ptr<const Film> film, Content const * content); + FrameRateChange(); + FrameRateChange(double, int); + FrameRateChange(std::shared_ptr<const Film> film, std::shared_ptr<const Content> content); + FrameRateChange(std::shared_ptr<const Film> film, Content const * content); /** @return factor by which to multiply a source frame rate to get the effective rate after any skip or repeat has happened. */ - double factor () const { - if (skip) { - return 0.5; + double factor() const { + if (_skip > 0) { + return 1.0 / (_skip + 1); } - return repeat; + return _repeat; } - double source = 24; - int dcp = 24; + std::string description() const; - /** true to skip every other frame */ - bool skip = false; + int skip() const { + return _skip; + } + + int repeat() const { + return _repeat; + } + + double speed_up() const { + return _speed_up; + } + + bool change_speed() const { + return _change_speed; + } + + double source() const { + return _source; + } + + int dcp() const { + return _dcp; + } + +private: + double _source = 24; + int _dcp = 24; + + /** Frames to skip between each one to use, e.g. + * 0 to skip no frames, 1 to skip every other one, 2 to skip 2 out of 3, etc. + */ + int _skip = 0; /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */ - int repeat = 1; + int _repeat = 1; /** true if this DCP will run its video faster or slower than the source * without taking into account `repeat' nor `skip'. * (e.g. change_speed will be true if @@ -66,14 +95,12 @@ public: * source is 15.00fps, DCP is 30fps * source is 12.50fps, DCP is 25fps) */ - bool change_speed = false; + bool _change_speed = false; /** Amount by which the video is being sped-up in the DCP; e.g. for a * 24fps source in a 25fps DCP this would be 25/24. */ - double speed_up = 1.0; - - std::string description () const; + double _speed_up = 1.0; }; diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 99882ec0e..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 @@ -227,7 +230,7 @@ Hints::check_speed_up() optional<double> lowest_speed_up; optional<double> highest_speed_up; for (auto i: film()->content()) { - double spu = film()->active_frame_rate_change(i->position()).speed_up; + double spu = film()->active_frame_rate_change(i->position()).speed_up(); if (!lowest_speed_up || spu < *lowest_speed_up) { lowest_speed_up = spu; } @@ -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.cc b/src/lib/image.cc index 51e894900..95de4bc03 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -1573,17 +1573,18 @@ Image::fade(float f) case AV_PIX_FMT_RGB48LE: /* 16-bit little-endian */ for (int c = 0; c < 3; ++c) { - int const stride_pixels = stride()[c] / 2; - int const line_size_pixels = line_size()[c] / 2; + /* Number of R, G, B values */ + int const stride_values = stride()[c] / 2; + int const line_size_values = line_size()[c] / 2; uint16_t* p = reinterpret_cast<uint16_t*>(data()[c]); int const lines = sample_size(c).height; for (int y = 0; y < lines; ++y) { uint16_t* q = p; - for (int x = 0; x < line_size_pixels; ++x) { - *q = int(float(*q) * f); + for (int x = 0; x < line_size_values; ++x) { + *q = int(*q * f); ++q; } - p += stride_pixels; + p += stride_values; } } break; 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/log.cc b/src/lib/log.cc index aae492faf..e5d1a8206 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -40,30 +40,30 @@ using std::shared_ptr; using std::string; -Log::Log () +Log::Log() { } void -Log::log (shared_ptr<const LogEntry> e) +Log::log(shared_ptr<const LogEntry> e) { - boost::mutex::scoped_lock lm (_mutex); + boost::mutex::scoped_lock lm(_mutex); if ((_types & e->type()) == 0) { return; } - do_log (e); + do_log(e); } /** @param n String to log */ void -Log::log (string message, int type) +Log::log(string message, int type) { - boost::mutex::scoped_lock lm (_mutex); + boost::mutex::scoped_lock lm(_mutex); if ((_types & type) == 0) { return; @@ -71,30 +71,30 @@ Log::log (string message, int type) auto e = make_shared<StringLogEntry>(type, message); - do_log (e); + do_log(e); } void -Log::dcp_log (dcp::NoteType type, string m) +Log::dcp_log(dcp::NoteType type, string m) { switch (type) { case dcp::NoteType::PROGRESS: - do_log (make_shared<StringLogEntry>(LogEntry::TYPE_GENERAL, m)); + do_log(make_shared<StringLogEntry>(LogEntry::TYPE_GENERAL, m)); break; case dcp::NoteType::ERROR: - do_log (make_shared<StringLogEntry>(LogEntry::TYPE_ERROR, m)); + do_log(make_shared<StringLogEntry>(LogEntry::TYPE_ERROR, m)); break; case dcp::NoteType::NOTE: - do_log (make_shared<StringLogEntry>(LogEntry::TYPE_WARNING, m)); + do_log(make_shared<StringLogEntry>(LogEntry::TYPE_WARNING, m)); break; } } void -Log::set_types (int t) +Log::set_types(int t) { - boost::mutex::scoped_lock lm (_mutex); + boost::mutex::scoped_lock lm(_mutex); _types = t; } diff --git a/src/lib/log.h b/src/lib/log.h index c6685bda1..e372e618f 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -45,25 +45,25 @@ LIBDCP_ENABLE_WARNINGS class Log { public: - Log (); - virtual ~Log () {} + Log(); + virtual ~Log() {} - Log (Log const&) = delete; - Log& operator= (Log const&) = delete; + Log(Log const&) = delete; + Log& operator=(Log const&) = delete; - void log (std::shared_ptr<const LogEntry> entry); - void log (std::string message, int type); - void dcp_log (dcp::NoteType type, std::string message); + void log(std::shared_ptr<const LogEntry> entry); + void log(std::string message, int type); + void dcp_log(dcp::NoteType type, std::string message); - void set_types (int types); - int types () const { + void set_types(int types); + int types() const { return _types; } /** @param amount Approximate number of bytes to return; the returned value * may be shorter or longer than this. */ - virtual std::string head_and_tail (int amount = 1024) const { + virtual std::string head_and_tail(int amount = 1024) const { (void) amount; return ""; } @@ -74,7 +74,7 @@ protected: mutable boost::mutex _mutex; private: - virtual void do_log (std::shared_ptr<const LogEntry> entry) = 0; + virtual void do_log(std::shared_ptr<const LogEntry> entry) = 0; /** bit-field of log types which should be put into the log (others are ignored) */ int _types = 0; 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/player.cc b/src/lib/player.cc index 7498ca4e7..f93327495 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -542,7 +542,7 @@ Player::dcp_to_content_video(shared_ptr<const Piece> piece, DCPTime t) const Instead we convert the DCPTime using the DCP video rate then account for any skip/repeat. */ - return s.frames_floor(piece->frc.dcp) / piece->frc.factor(); + return s.frames_floor(piece->frc.dcp()) / piece->frc.factor(); } @@ -550,7 +550,7 @@ DCPTime Player::content_video_to_dcp(shared_ptr<const Piece> piece, Frame f) const { /* See comment in dcp_to_content_video */ - auto const d = DCPTime::from_frames(f * piece->frc.factor(), piece->frc.dcp) - DCPTime(piece->content->trim_start(), piece->frc); + auto const d = DCPTime::from_frames(f * piece->frc.factor(), piece->frc.dcp()) - DCPTime(piece->content->trim_start(), piece->frc); return d + piece->content->position(); } diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index d3315a722..05c2a7e9e 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -730,12 +730,12 @@ Playlist::speed_up_range(int dcp_video_frame_rate) const } if (i->video_frame_rate()) { FrameRateChange const frc(i->video_frame_rate().get(), dcp_video_frame_rate); - range.first = min(range.first, frc.speed_up); - range.second = max(range.second, frc.speed_up); + range.first = min(range.first, frc.speed_up()); + range.second = max(range.second, frc.speed_up()); } else { FrameRateChange const frc(dcp_video_frame_rate, dcp_video_frame_rate); - range.first = min(range.first, frc.speed_up); - range.second = max(range.second, frc.speed_up); + range.first = min(range.first, frc.speed_up()); + range.second = max(range.second, frc.speed_up()); } } diff --git a/src/lib/po/ja_JP.po b/src/lib/po/ja_JP.po index d8d43a137..b6c29136a 100644 --- a/src/lib/po/ja_JP.po +++ b/src/lib/po/ja_JP.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-02-15 21:03+0100\n" -"PO-Revision-Date: 2026-03-23 22:33+0900\n" +"PO-Revision-Date: 2026-04-07 19:21+0900\n" "Last-Translator: \n" "Language-Team: \n" "Language: ja_JP\n" @@ -33,7 +33,7 @@ msgid "" "Cropped to {}x{}" msgstr "" "\n" -"トリミング: {}x{}" +"切り抜きサイズ: {}x{}" #: src/lib/video_content.cc:467 #, c-format @@ -193,7 +193,7 @@ msgstr "; {} fps" #: src/lib/job.cc:633 msgid "; {} remaining; finishing at {}{}" -msgstr "" +msgstr "; 残り時間 {} ; 終了予定 {}{}" #: src/lib/analytics.cc:58 #, c-format @@ -210,17 +210,17 @@ msgid "" "href=\"https://dcpomatic.com/donate_amount?amount=10\">Go to Paypal to " "donate €10</a></ul><p>Thank you!</font>" msgstr "" -"<h2>{} を使用して {} 個の DCP を作成しました!</h2><img width=\"20%%\" " -"src=\"memory:me.jpg\" align=\"center\"><font size=\"+1\"><p>こんにちは。私は " -"Carl、{} の開発者です。私は空き時間に(テスターと翻訳者のボランティア チーム" -"の協力を得て){} の開発に取り組んでおり、フリー ソフトウェアとしてリリースし" -"ています。<p>{} が役に立つと思われる場合は、プロジェクトへの寄付をご検討くだ" -"さい。資金援助をしていただけると、{} の開発と改善にさらに時間を費やすことがで" -"きます。<p><ul><li><a href=\"https://dcpomatic.com/donate_amount?" -"amount=40\">Paypal で €40 を寄付</a><li><a href=\"https://dcpomatic.com/" -"donate_amount?amount=20\">Paypal で €20 を寄付</a><li><a href=\"https://" -"dcpomatic.com/donate_amount?amount=10\">Paypal で €10 を寄付</a></ul><p>あり" -"がとうございます。</font>" +"<h2>{}を使用して{}個のDCPを作成しました!</h2><img width=\"20%%\" " +"src=\"memory:me.jpg\" align=\"center\"><font size=\"+1\"><p>こんにちは。私は" +"Carl、{}の開発者です。私は空き時間に(テスターと翻訳者のボランティア チームの" +"協力を得て){}の開発に取り組んでおり、フリー ソフトウェアとしてリリースしてい" +"ます。<p>{}が役に立つと思われる場合はプロジェクトへの寄付をご検討ください。資" +"金援助をしていただけると、{}の開発と改善にさらに時間を費やすことができます。" +"<p><ul><li><a href=\"https://dcpomatic.com/donate_amount?amount=40\">Paypalで" +"€40 を寄付</a><li><a href=\"https://dcpomatic.com/donate_amount?" +"amount=20\">Paypal で €20 を寄付</a><li><a href=\"https://dcpomatic.com/" +"donate_amount?amount=10\">Paypal で €10 を寄付</a></ul><p>ありがとうございま" +"す。</font>" #: src/lib/hints.cc:176 msgid "" @@ -530,9 +530,8 @@ msgid "Colourspace" msgstr "カラースペース" #: src/lib/combine_dcp_job.cc:48 -#, fuzzy msgid "Combine DCPs" -msgstr "DCPを結合" +msgstr "複数のDCPを結合" #: src/lib/writer.cc:522 #, fuzzy @@ -563,12 +562,16 @@ msgid "Content to be joined must all have or not have audio" msgstr "結合するコンテンツはすべて音声付きまたは音声なしである必要があります" #: src/lib/ffmpeg_content.cc:152 +#, fuzzy msgid "Content to be joined must all have or not have subtitles or captions" msgstr "" +"参加するコンテンツは字幕またはキャプションがすべて付いているか、付いていない" +"かのいずれかである必要があります。" #: src/lib/ffmpeg_content.cc:146 +#, fuzzy msgid "Content to be joined must all have or not have video" -msgstr "" +msgstr "参加するコンテンツはすべて動画を含むか含まないかのいずれかである。" #: src/lib/text_content.cc:302 msgid "" @@ -610,7 +613,8 @@ msgstr "結合するコンテンツは同じ色変換になっている必要が #: src/lib/video_content.cc:215 msgid "Content to be joined must have the same crop." -msgstr "結合するコンテンツは同じトリミングである必要があります。" +msgstr "" +"結合するコンテンツは同じ切り抜き(クロップ)サイズである必要があります。" #: src/lib/video_content.cc:219 msgid "Content to be joined must have the same custom ratio setting." @@ -943,9 +947,8 @@ msgid "Email problem report for {}" msgstr "{} の問題レポートをメールで送信" #: src/lib/dcp_film_encoder.cc:120 src/lib/ffmpeg_film_encoder.cc:134 -#, fuzzy msgid "Encoding" -msgstr "エンコード済" +msgstr "エンコード進捗" #: src/lib/dcp_content_type.cc:67 msgid "Episode" @@ -1779,15 +1782,14 @@ msgid "The file {} has been trimmed by {} milliseconds more." msgstr "{}はさらにに{}ms短縮されました。" #: src/lib/hints.cc:267 -#, fuzzy msgid "" "The vast majority of cinemas in Europe, Australasia and North America expect " "DCPs encoded with JPEG2000 rather than MPEG2. Make sure that your cinema " "really wants an old-style MPEG2 DCP." msgstr "" -"ヨーロッパ、オーストララシア、北米の映画館の大多数は、MPEG2ではなくJPEG2000で" -"エンコードされたDCPを想定しています。ご利用予定の映画館が本当に旧式のMPEG2 " -"DCPを必要としているかどうかを必ずご確認ください。" +"ヨーロッパ・オーストララシア・北米の映画館の大多数はMPEG2ではなくJPEG2000でエ" +"ンコードされたDCPを想定しています。ご利用予定の映画館が本当に旧式のMPEG2 DCP" +"を必要としているかどうかを必ずご確認ください。" #: src/lib/release_notes.cc:87 #, fuzzy @@ -2074,13 +2076,12 @@ msgstr "" "ンテンツの一部を削除する必要があります。" #: src/lib/hints.cc:612 -#, fuzzy msgid "" "You have overlapping closed captions, which are not allowed in Interop " "DCPs. Change your DCP standard to SMPTE." msgstr "" -"字幕が重複していますが、これは相互運用可能なDCPでは許可されていません。DCP規" -"格をSMPTEに変更してください。" +"字幕が重複していますが、これはInterop DCPでは許可されていません。DCP規格を" +"SMPTEに変更してください。" #: src/lib/hints.cc:290 msgid "" @@ -2417,13 +2418,12 @@ msgstr "" "形式の可能性があります。" #: src/lib/film.cc:1829 -#, fuzzy msgid "" "{} had to change your settings for referring to DCPs as OV. Please review " "those settings to make sure they are what you want." msgstr "" -"{} は DCP を OV として参照するために設定を変更する必要がありました。設定を確" -"認し、正しいことを確認してください。" +"{}はDCPをOVとして参照するために設定を変更する必要がありました。設定を確認し、" +"正しいことを確認してください。" #: src/lib/film.cc:1795 #, fuzzy 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_content.cc b/src/lib/video_content.cc index b6e350d34..25c0fac62 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -435,8 +435,10 @@ VideoContent::fade(shared_ptr<const Film> film, ContentTime time) const auto const fade_out_time = ContentTime::from_frames(fade_out(), vfr); auto const end = ContentTime::from_frames(length(), vfr) - _parent->trim_end(); auto const time_after_end_fade_start = time - (end - fade_out_time); + /* The first frame of the fade (at time 0) must have some fade */ + auto const fade_amount = time_after_end_fade_start + ContentTime::from_frames(1, vfr); if (time_after_end_fade_start > ContentTime()) { - return std::max(0.0, 1 - static_cast<double>(time_after_end_fade_start.get()) / fade_out_time.get()); + return std::max(0.0, 1 - static_cast<double>(fade_amount.get()) / fade_out_time.get()); } return {}; 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/tools/po/ja_JP.po b/src/tools/po/ja_JP.po index 2eba0daa6..1b4607b7a 100644 --- a/src/tools/po/ja_JP.po +++ b/src/tools/po/ja_JP.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-02-15 21:03+0100\n" -"PO-Revision-Date: 2026-03-23 22:51+0900\n" +"PO-Revision-Date: 2026-04-07 19:25+0900\n" "Last-Translator: \n" "Language-Team: \n" "Language: ja_JP\n" @@ -534,9 +534,8 @@ msgid "Creator" msgstr "作成者" #: src/tools/dcpomatic_playlist.cc:342 -#, fuzzy msgid "Crop" -msgstr "作物" +msgstr "切り抜き" #: src/tools/dcpomatic_disk.cc:139 src/tools/dcpomatic_verifier.cc:172 msgid "DCP" @@ -547,7 +546,6 @@ msgid "DCP-o-matic Encode Server" msgstr "DCP-o-matic Encode Server" #: src/tools/dcpomatic_disk.cc:135 src/tools/dcpomatic_verifier.cc:146 -#, fuzzy msgid "DCPs" msgstr "DCP一覧" @@ -610,9 +608,9 @@ msgstr "" "示されましたか? その場合は「はい」をクリックしてもう一度お試しください。" #: src/tools/dcpomatic.cc:863 -#, fuzzy, c-format +#, c-format msgid "Do you want to overwrite the existing DCP %s?" -msgstr "既存の DCP %s を上書きしますか?" +msgstr "既存のDCPを上書きしますか? %s" #: src/tools/dcpomatic.cc:167 msgid "Don't close" @@ -816,14 +814,13 @@ msgstr "プロジェクトを新規作成" #: src/tools/dcpomatic_playlist.cc:257 msgid "New Playlist" -msgstr "プレイリストを新規作成" +msgstr "新しいプレイリスト" #: src/tools/dcpomatic.cc:1360 msgid "New...\tCtrl-N" msgstr "新規作成\tCtrl-N" #: src/tools/dcpomatic_disk.cc:93 -#, fuzzy msgid "" "No ASSETMAP or ASSETMAP.xml found in this folder. Please choose a DCP " "folder." @@ -1234,8 +1231,8 @@ msgid "" "Tick to check details of the picture asset, such as frame sizes and JPEG2000 " "bitstream validity. These checks are quite time-consuming." msgstr "" -"フレームサイズやJPEG2000ビットストリームの有効性など、画像アセットの詳細を確" -"認するにはチェックを入れてください。これらのチェックにはかなり時間がかかりま" +"フレームサイズやJPEG2000ビットストリームの有効性など、画像データの詳細を確認" +"するにはチェックを入れてください。これらのチェックにはかなり時間がかかりま" "す。" #: src/tools/dcpomatic_player.cc:712 @@ -1291,9 +1288,8 @@ msgid "Verify DCP..." msgstr "DCPを検証" #: src/tools/dcpomatic_verifier.cc:187 -#, fuzzy msgid "Verify picture asset details" -msgstr "画像アセットの詳細を確認する" +msgstr "画像データの詳細を確認する" #: src/tools/dcpomatic.cc:1437 msgid "Version File (VF)..." 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/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 97aa835c6..11b2901b9 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -63,80 +63,80 @@ using namespace boost::placeholders; #endif -KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film) - : wxDialog (parent, wxID_ANY, _("Make KDMs")) - , _film (film) +KDMDialog::KDMDialog(wxWindow* parent, shared_ptr<const Film> film) + : wxDialog(parent, wxID_ANY, _("Make KDMs")) + , _film(film) { /* Main sizers */ - auto horizontal = new wxBoxSizer (wxHORIZONTAL); - auto left = new wxBoxSizer (wxVERTICAL); - auto right = new wxBoxSizer (wxVERTICAL); + auto horizontal = new wxBoxSizer(wxHORIZONTAL); + auto left = new wxBoxSizer(wxVERTICAL); + auto right = new wxBoxSizer(wxVERTICAL); - horizontal->Add (left, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP * 4); - horizontal->Add (right, 1, wxEXPAND); + horizontal->Add(left, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP * 4); + horizontal->Add(right, 1, wxEXPAND); /* Font for sub-headings */ - wxFont subheading_font (*wxNORMAL_FONT); - subheading_font.SetWeight (wxFONTWEIGHT_BOLD); + wxFont subheading_font(*wxNORMAL_FONT); + subheading_font.SetWeight(wxFONTWEIGHT_BOLD); /* Sub-heading: Screens */ - auto h = new StaticText (this, _("Screens")); - h->SetFont (subheading_font); - left->Add (h, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); - _screens = new ScreensPanel (this); - left->Add (_screens, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); + auto h = new StaticText(this, _("Screens")); + h->SetFont(subheading_font); + left->Add(h, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); + _screens = new ScreensPanel(this); + left->Add(_screens, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); /* Sub-heading: Timing */ /// TRANSLATORS: translate the word "Timing" here; do not include the "KDM|" prefix - h = new StaticText (this, S_("KDM|Timing")); - h->SetFont (subheading_font); - right->Add (h); - _timing = new KDMTimingPanel (this); - right->Add (_timing); + h = new StaticText(this, S_("KDM|Timing")); + h->SetFont(subheading_font); + right->Add(h); + _timing = new KDMTimingPanel(this); + right->Add(_timing); /* Sub-heading: CPL */ - h = new StaticText (this, _("CPL")); - h->SetFont (subheading_font); - right->Add (h); + h = new StaticText(this, _("CPL")); + h->SetFont(subheading_font); + right->Add(h); vector<dcp::CPLSummary> cpls; for (auto const& i: film->cpls()) { if (i.encrypted) { - cpls.push_back (i); + cpls.push_back(i); } } - _cpl = new KDMCPLPanel (this, cpls); - right->Add (_cpl, 0, wxEXPAND); + _cpl = new KDMCPLPanel(this, cpls); + right->Add(_cpl, 0, wxEXPAND); /* Sub-heading: Output */ - h = new StaticText (this, _("Output")); - h->SetFont (subheading_font); + h = new StaticText(this, _("Output")); + h->SetFont(subheading_font); right->Add(h, 0, wxTOP, DCPOMATIC_SUBHEADING_TOP_PAD); _output = new TallKDMOutputPanel(this); - right->Add (_output, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP); + right->Add(_output, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP); - _make = new Button (this, _("Make KDMs")); - right->Add (_make, 0, wxTOP | wxBOTTOM, DCPOMATIC_SIZER_GAP); + _make = new Button(this, _("Make KDMs")); + right->Add(_make, 0, wxTOP | wxBOTTOM, DCPOMATIC_SIZER_GAP); /* Make an overall sizer to get a nice border */ - auto overall_sizer = new wxBoxSizer (wxVERTICAL); - overall_sizer->Add (horizontal, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER); + auto overall_sizer = new wxBoxSizer(wxVERTICAL); + overall_sizer->Add(horizontal, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER); /* Bind */ _screens->ScreensChanged.connect(boost::bind(&KDMDialog::screens_changed, this)); - _timing->TimingChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this)); - _make->Bind (wxEVT_BUTTON, boost::bind (&KDMDialog::make_clicked, this)); + _timing->TimingChanged.connect(boost::bind(&KDMDialog::setup_sensitivity, this)); + _make->Bind(wxEVT_BUTTON, boost::bind(&KDMDialog::make_clicked, this)); _cpl->Changed.connect(boost::bind(&KDMDialog::cpl_changed, this)); cpl_changed(); - setup_sensitivity (); + setup_sensitivity(); - SetSizer (overall_sizer); - overall_sizer->Layout (); - overall_sizer->SetSizeHints (this); + SetSizer(overall_sizer); + overall_sizer->Layout(); + overall_sizer->SetSizeHints(this); } @@ -162,29 +162,29 @@ KDMDialog::cpl_changed() void -KDMDialog::setup_sensitivity () +KDMDialog::setup_sensitivity() { - _screens->setup_sensitivity (); - _output->setup_sensitivity (); - _make->Enable (!_screens->screens().empty() && _timing->valid() && _cpl->has_selected()); + _screens->setup_sensitivity(); + _output->setup_sensitivity(); + _make->Enable(!_screens->screens().empty() && _timing->valid() && _cpl->has_selected()); } bool -KDMDialog::confirm_overwrite (boost::filesystem::path path) +KDMDialog::confirm_overwrite(boost::filesystem::path path) { - return confirm_dialog ( + return confirm_dialog( this, - wxString::Format (_("File %s already exists. Do you want to overwrite it?"), std_to_wx(path.string()).data()) + wxString::Format(_("File %s already exists. Do you want to overwrite it?"), std_to_wx(path.string()).data()) ); } void -KDMDialog::make_clicked () +KDMDialog::make_clicked() { - auto film = _film.lock (); - DCPOMATIC_ASSERT (film); + auto film = _film.lock(); + DCPOMATIC_ASSERT(film); list<KDMWithMetadataPtr> kdms; try { @@ -200,7 +200,7 @@ KDMDialog::make_clicked () vector<KDMCertificatePeriod> period_checks; - std::function<dcp::DecryptedKDM (dcp::LocalTime, dcp::LocalTime)> make_kdm = [film, this](dcp::LocalTime begin, dcp::LocalTime end) { + std::function<dcp::DecryptedKDM(dcp::LocalTime, dcp::LocalTime)> make_kdm = [film, this](dcp::LocalTime begin, dcp::LocalTime end) { return film->make_kdm(_cpl->cpl(), begin, end); }; @@ -220,7 +220,7 @@ KDMDialog::make_clicked () period_checks ); if (p) { - kdms.push_back (p); + kdms.push_back(p); } } @@ -238,7 +238,7 @@ KDMDialog::make_clicked () } catch (dcp::BadKDMDateError& e) { if (e.starts_too_early()) { - error_dialog (this, _("The KDM start period is before (or close to) the start of the signing certificate's validity period. Use a later start time for this KDM.")); + error_dialog(this, _("The KDM start period is before (or close to) the start of the signing certificate's validity period. Use a later start time for this KDM.")); } else { error_dialog( this, @@ -250,21 +250,21 @@ KDMDialog::make_clicked () } return; } catch (runtime_error& e) { - error_dialog (this, std_to_wx(e.what())); + error_dialog(this, std_to_wx(e.what())); return; } - auto result = _output->make(kdms, film->dcp_name(), bind (&KDMDialog::confirm_overwrite, this, _1)); + auto result = _output->make(kdms, film->dcp_name(), bind(&KDMDialog::confirm_overwrite, this, _1)); if (result.first) { - JobManager::instance()->add (result.first); + JobManager::instance()->add(result.first); } if (result.second > 0) { /* XXX: proper plural form support in wxWidgets? */ wxString s = result.second == 1 ? _("%d KDM written to %s") : _("%d KDMs written to %s"); - message_dialog ( + message_dialog( this, - wxString::Format (s, result.second, std_to_wx(_output->directory().string()).data()) + wxString::Format(s, result.second, std_to_wx(_output->directory().string()).data()) ); } } diff --git a/src/wx/kdm_dialog.h b/src/wx/kdm_dialog.h index b6e4b7604..168fb2544 100644 --- a/src/wx/kdm_dialog.h +++ b/src/wx/kdm_dialog.h @@ -44,12 +44,12 @@ class ScreensPanel; class KDMDialog : public wxDialog { public: - KDMDialog (wxWindow *, std::shared_ptr<const Film> film); + KDMDialog(wxWindow *, std::shared_ptr<const Film> film); private: - void setup_sensitivity (); - void make_clicked (); - bool confirm_overwrite (boost::filesystem::path path); + void setup_sensitivity(); + void make_clicked(); + bool confirm_overwrite(boost::filesystem::path path); void cpl_changed(); void screens_changed(); diff --git a/src/wx/po/ja_JP.po b/src/wx/po/ja_JP.po index 7f84e8142..d734ef575 100644 --- a/src/wx/po/ja_JP.po +++ b/src/wx/po/ja_JP.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-02-15 21:03+0100\n" -"PO-Revision-Date: 2026-03-23 23:11+0900\n" +"PO-Revision-Date: 2026-04-01 21:46+0900\n" "Last-Translator: \n" "Language-Team: \n" "Language: ja_JP\n" @@ -241,13 +241,13 @@ msgstr ":1" #: src/wx/verify_dcp_result_panel.cc:637 #, fuzzy, c-format -msgid "<IssueDate> has an invalid value %issue_date" -msgstr "<IssueDate> 無効な値があります %issue_date" +msgid "<IssueDate> has an invalid value %n" +msgstr "<IssueDate> 無効な値があります %n" #: src/wx/verify_dcp_result_panel.cc:643 #, fuzzy, c-format -msgid "<MainSoundConfiguration> is invalid (%error)" -msgstr "<MainSoundConfiguration> 無効です (%error)" +msgid "<MainSoundConfiguration> is invalid (%n)" +msgstr "<MainSoundConfiguration> 無効です (%n)" #: src/wx/subtitle_appearance_dialog.cc:118 #, fuzzy @@ -272,44 +272,44 @@ msgstr "A" #: src/wx/verify_dcp_result_panel.cc:546 #, fuzzy, c-format -msgid "A 2K JPEG2000 frame contains %tile_parts tile parts instead of 3." -msgstr "2K JPEG2000 フレームには、3 個ではなく %tile_parts 個のタイル部分が含まれます。" +msgid "A 2K JPEG2000 frame contains %n tile parts instead of 3." +msgstr "2K JPEG2000 フレームには、3 個ではなく %n 個のタイル部分が含まれます。" #: src/wx/verify_dcp_result_panel.cc:560 #, fuzzy, c-format -msgid "A 2K JPEG2000 frame contains an invalid Rsiz (capabilities) value of %capabilities" -msgstr "2K JPEG2000フレームに無効なRsiz(機能)値%capabilitiesが含まれています" +msgid "A 2K JPEG2000 frame contains an invalid Rsiz (capabilities) value of %n" +msgstr "2K JPEG2000フレームに無効なRsiz(機能)値%nが含まれています" #: src/wx/verify_dcp_result_panel.cc:518 #, fuzzy, c-format -msgid "A 2K JPEG2000 frame has %poc_markers POC marker(s) instead of 0." -msgstr "2K JPEG2000 フレームには、0 ではなく %poc_markers 個の POC マーカーがあります。" +msgid "A 2K JPEG2000 frame has %n POC marker(s) instead of 0." +msgstr "2K JPEG2000 フレームには、0 ではなく %n 個の POC マーカーがあります。" #: src/wx/verify_dcp_result_panel.cc:483 #, fuzzy, c-format -msgid "A 2K JPEG2000 frame has %guard_bits guard bits instead of 1." -msgstr "2K JPEG2000 フレームには、1 ではなく %guard_bits のガード ビットがあります。" +msgid "A 2K JPEG2000 frame has %n guard bits instead of 1." +msgstr "2K JPEG2000 フレームには、1 ではなく %n のガード ビットがあります。" #: src/wx/verify_dcp_result_panel.cc:553 #, fuzzy, c-format -msgid "A 4K JPEG2000 frame contains %tile_parts tile parts instead of 6." -msgstr "4K JPEG2000 フレームには、6 個ではなく %tile_parts 個のタイル部分が含まれます。" +msgid "A 4K JPEG2000 frame contains %n tile parts instead of 6." +msgstr "4K JPEG2000 フレームには、6 個ではなく %n 個のタイル部分が含まれます。" #: src/wx/verify_dcp_result_panel.cc:567 #, fuzzy, c-format -msgid "A 4K JPEG2000 frame contains an invalid Rsiz (capabilities) value of %capabilities" -msgstr "4K JPEG2000フレームに無効なRsiz(機能)値%capabilitiesが含まれています" +msgid "A 4K JPEG2000 frame contains an invalid Rsiz (capabilities) value of %n" +msgstr "4K JPEG2000フレームに無効なRsiz(機能)値%nが含まれています" #: src/wx/verify_dcp_result_panel.cc:525 #, fuzzy, c-format -msgid "A 4K JPEG2000 frame has %poc_markers POC marker(s) instead of 1." +msgid "A 4K JPEG2000 frame has %n POC marker(s) instead of 1." msgstr "" -"4K JPEG2000 フレームには、1 個ではなく %poc_markers 個の POC マーカーがあります。" +"4K JPEG2000 フレームには、1 個ではなく %n 個の POC マーカーがあります。" #: src/wx/verify_dcp_result_panel.cc:490 #, fuzzy, c-format -msgid "A 4K JPEG2000 frame has %guard_bits guard bits instead of 2." -msgstr "4K JPEG2000 フレームには 2 ではなく %guard_bits のガード ビットがあります。" +msgid "A 4K JPEG2000 frame has %n guard bits instead of 2." +msgstr "4K JPEG2000 フレームには 2 ではなく %n のガード ビットがあります。" #: src/wx/verify_dcp_result_panel.cc:539 #, fuzzy @@ -323,13 +323,13 @@ msgstr "JPEG2000 フレームに無効な POC マーカー (%n) が含まれて #: src/wx/verify_dcp_result_panel.cc:511 #, fuzzy, c-format -msgid "A JPEG2000 frame has a code-block height of %code_block_height instead of 32." -msgstr "JPEG2000フレームのコードブロックの高さが32ではなく%code_block_heightです。" +msgid "A JPEG2000 frame has a code-block height of %n instead of 32." +msgstr "JPEG2000フレームのコードブロックの高さが32ではなく%nです。" #: src/wx/verify_dcp_result_panel.cc:504 #, fuzzy, c-format -msgid "A JPEG2000 frame has a code-block width of %code_block_width instead of 32." -msgstr "JPEG2000 フレームのコード ブロック幅は 32 ではなく %code_block_width です。" +msgid "A JPEG2000 frame has a code-block width of %n instead of 32." +msgstr "JPEG2000 フレームのコード ブロック幅は 32 ではなく %n です。" #: src/wx/verify_dcp_result_panel.cc:574 msgid "A JPEG2000 frame has no TLM marker." @@ -347,8 +347,8 @@ msgstr "%s の新しいバージョンが利用可能です。" #: src/wx/verify_dcp_result_panel.cc:476 #, fuzzy, c-format -msgid "A picture frame has an invalid JPEG2000 codestream (%error)." -msgstr "画像フレームに無効な JPEG2000 コードストリーム (%error) があります。" +msgid "A picture frame has an invalid JPEG2000 codestream (%n)." +msgstr "画像フレームに無効な JPEG2000 コードストリーム (%n) があります。" #: src/wx/hints_dialog.cc:183 #, fuzzy, c-format @@ -419,10 +419,13 @@ msgid "Add a DCP." msgstr "DCPを追加" #: src/wx/content_panel.cc:277 +#, fuzzy msgid "" "Add a folder of image files (which will be used as a moving image sequence) " "or a folder of sound files." msgstr "" +"画像ファイルまたは音声ファイルを含むフォルダを追加してください。(画像ファイ" +"ルは動画シーケンスとして使用されます)" #: src/wx/full_language_tag_dialog.cc:69 #, fuzzy @@ -579,8 +582,8 @@ msgstr "ASSETMAP内のデータのパスが空です。" #: src/wx/verify_dcp_result_panel.cc:622 #, fuzzy, c-format -msgid "An invalid <ContentKind> %content_kind has been used." -msgstr "無効な <ContentKind> %content_kind が使用されました。" +msgid "An invalid <ContentKind> %n has been used." +msgstr "無効な <ContentKind> %n が使用されました。" #: src/wx/dkdm_output_panel.cc:204 src/wx/kdm_output_panel.cc:321 #, fuzzy @@ -882,9 +885,9 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:426 #, c-format -msgid "Closed caption asset %asset_id has a non-zero <EntryPoint>." +msgid "Closed caption asset %n has a non-zero <EntryPoint>." msgstr "" -"クローズド キャプション データ %asset_id には、ゼロ以外の <EntryPoint> があります。." +"クローズド キャプション データ %n には、ゼロ以外の <EntryPoint> があります。." #: src/wx/closed_captions_dialog.cc:49 src/wx/dcp_referencing_dialog.cc:115 msgid "Closed captions" @@ -1028,8 +1031,8 @@ msgstr "コンテンツを再生できませんでした" #: src/wx/verify_dcp_result_panel.cc:262 #, c-format -msgid "Could not read DCP (%error)" -msgstr "DCPファイルを読み取れませんでした(%error)" +msgid "Could not read DCP (%n)" +msgstr "DCPファイルを読み取れませんでした(%n)" #: src/wx/gl_video_view.cc:131 #, c-format @@ -1083,13 +1086,12 @@ msgid "Creator" msgstr "作成者" #: src/wx/video_panel.cc:91 -#, fuzzy msgid "Crop" msgstr "切り抜き" #: src/wx/ratio_picker.cc:37 msgid "Crop output to" -msgstr "出力画面アスペクト比" +msgstr "切り抜き出力" #: src/wx/update_dialog.cc:68 msgid "Current version" @@ -1588,7 +1590,7 @@ msgstr "" #, c-format msgid "" "Frame %frame has an image component that is too large (component %component " -"is %size_in_bytes bytes in size)." +"is %size bytes in size)." msgstr "" #: src/wx/dcp_panel.cc:863 @@ -3328,7 +3330,7 @@ msgstr "字幕外観" #: src/wx/verify_dcp_result_panel.cc:420 #, c-format -msgid "Subtitle asset %asset_id has a non-zero <EntryPoint>." +msgid "Subtitle asset %n has a non-zero <EntryPoint>." msgstr "" #: src/wx/export_subtitles_dialog.cc:105 @@ -3427,8 +3429,8 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:631 #, c-format -msgid "The ASSETMAP %asset_map_id has more than one asset with the same ID." -msgstr "ASSETMAP %asset_map_id には、同じ ID を持つデータが複数存在します。" +msgid "The ASSETMAP %n has more than one asset with the same ID." +msgstr "ASSETMAP %n には、同じ ID を持つデータが複数存在します。" #: src/wx/verify_dcp_result_panel.cc:585 #, fuzzy @@ -3449,8 +3451,8 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:671 #, c-format -msgid "The CPL %cpl has an invalid namespace %xml_namespace" -msgstr "" +msgid "The CPL %cpl has an invalid namespace %n" +msgstr "CPL%cplには無効な名前空間%nが含まれています" #: src/wx/verify_dcp_result_panel.cc:462 #, c-format @@ -3485,18 +3487,18 @@ msgstr "CPL %cpl には CPL付帯情報バージョン番号タグがありま #: src/wx/verify_dcp_result_panel.cc:459 #, c-format -msgid "The CPL %f has an invalid CPL extension metadata tag (%error)" -msgstr "CPL %f には無効な CPL 拡張メタデータ タグ (%error) が含まれています" +msgid "The CPL %f has an invalid CPL extension metadata tag (%n)" +msgstr "CPL %f には無効な CPL 拡張メタデータ タグ (%n) が含まれています" #: src/wx/verify_dcp_result_panel.cc:444 #, c-format -msgid "The DCP has a FFOC of %time instead of 1." -msgstr "DCPのFFOCは1ではなく%timeです。" +msgid "The DCP has a FFOC of %n instead of 1." +msgstr "DCPのFFOCは1ではなく%nです。" #: src/wx/verify_dcp_result_panel.cc:447 #, c-format -msgid "The DCP has a LFOC of %time instead of the reel duration minus one." -msgstr "DCPのLFOCは、リールの長さから1を引いた値ではなく%timeとなっています。" +msgid "The DCP has a LFOC of %n instead of the reel duration minus one." +msgstr "DCPのLFOCは、リールの長さから1を引いた値ではなく%nとなっています。" #: src/wx/verify_dcp_result_panel.cc:414 msgid "" @@ -3560,27 +3562,27 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:690 #, c-format -msgid "The PKL %f has an invalid namespace %xml_namespace" -msgstr "" +msgid "The PKL %f has an invalid namespace %n" +msgstr "PKL%fには無効な名前空間%nが含まれています" #: src/wx/verify_dcp_result_panel.cc:468 #, c-format msgid "" -"The PKL %pkl has an <AnnotationText> which does not match its CPL's " +"The PKL %n has an <AnnotationText> which does not match its CPL's " "<ContentTitleText>." msgstr "" -"PKL %pkl には、CPL の <ContentTitleText> と一致しない <AnnotationText> がありま" +"PKL %n には、CPL の <ContentTitleText> と一致しない <AnnotationText> がありま" "す。" #: src/wx/verify_dcp_result_panel.cc:465 #, c-format -msgid "The PKL %pkl has encrypted content but is not signed." -msgstr "PKL %pkl は暗号化されたコンテンツを含みますが署名がされていません。" +msgid "The PKL %n has encrypted content but is not signed." +msgstr "PKL %n は暗号化されたコンテンツを含みますが署名がされていません。" #: src/wx/verify_dcp_result_panel.cc:628 #, c-format -msgid "The PKL %pkl_id has more than one asset with the same ID." -msgstr "PKL %pkl_id には、同じ ID を持つデータが複数存在します。" +msgid "The PKL %n has more than one asset with the same ID." +msgstr "PKL %n には、同じ ID を持つデータが複数存在します。" #: src/wx/verify_dcp_result_panel.cc:274 #, c-format @@ -3608,27 +3610,27 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:296 #, c-format -msgid "The XML in %f is malformed (%error)." -msgstr "%f の XML は不正な形式です (%error)。" +msgid "The XML in %f is malformed (%n)." +msgstr "%f の XML は不正な形式です (%n)。" #: src/wx/verify_dcp_result_panel.cc:294 -msgid "The XML in %f is malformed on line %l (%error)." -msgstr "XML %f の %l 行目は不正な形式です(%error)。" +msgid "The XML in %f is malformed on line %l (%n)." +msgstr "XML %f の %l 行目は不正な形式です(%n)。" #: src/wx/verify_dcp_result_panel.cc:348 #, c-format msgid "" -"The XML in the closed caption asset %f takes up %size_in_bytes bytes which is over the " +"The XML in the closed caption asset %f takes up %n bytes which is over the " "256KB limit." msgstr "" -"クローズド キャプション アセット %f 内の XML は %size_in_bytes バイトを占めており、256 " +"クローズド キャプション アセット %f 内の XML は %n バイトを占めており、256 " "KB の制限を超えています。" #: src/wx/verify_dcp_result_panel.cc:656 #, c-format msgid "" -"The XML in the subtitle asset %asset_id has more than one namespace declaration." -msgstr "" +"The XML in the subtitle asset %n has more than one namespace declaration." +msgstr "字幕データ%n内のXMLには複数の名前空間宣言が含まれています。" #: src/wx/verify_dcp_result_panel.cc:327 #, c-format @@ -3642,20 +3644,20 @@ msgstr "データ%fが見つかりません。" #: src/wx/verify_dcp_result_panel.cc:307 #, c-format -msgid "The asset %asset_id has a duration of less than 1 second, which is invalid." -msgstr "データ%asset_idの有効期間が1秒未満であるため、無効です。" +msgid "The asset %n has a duration of less than 1 second, which is invalid." +msgstr "データ%nの有効期間が1秒未満であるため、無効です。" #: src/wx/verify_dcp_result_panel.cc:304 #, c-format msgid "" -"The asset %asset_id has an intrinsic duration of less than 1 second, which is " +"The asset %n has an intrinsic duration of less than 1 second, which is " "invalid." -msgstr "データ%asset_idの固有持続時間は1秒未満であり、これは無効です。" +msgstr "データ%nの固有持続時間は1秒未満であり、これは無効です。" #: src/wx/verify_dcp_result_panel.cc:429 #, c-format -msgid "The asset %asset_id has no <Hash> in the CPL." -msgstr "データ%asset_idのCPLには<Hash>は含まれません。" +msgid "The asset %n has no <Hash> in the CPL." +msgstr "データ%nのCPLには<Hash>は含まれません。" #: src/wx/verify_dcp_result_panel.cc:665 #, c-format @@ -3665,8 +3667,8 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:423 #, c-format -msgid "The closed caption asset %asset_id has no <EntryPoint> tag." -msgstr "クローズドキャプションアセット %asset_id には <EntryPoint> タグがありません。" +msgid "The closed caption asset %n has no <EntryPoint> tag." +msgstr "クローズドキャプションアセット %n には <EntryPoint> タグがありません。" #: src/wx/film_name_location_dialog.cc:146 #, c-format @@ -3717,19 +3719,19 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:646 #, c-format msgid "" -"The font file for font ID \"%load_font_id\" was not found, or was not referred to in " +"The font file for font ID \"%n\" was not found, or was not referred to in " "the ASSETMAP." msgstr "" -"フォント ID \"%load_font_id\" のフォント ファイルが見つからないか、ASSETMAP で参照されて" +"フォント ID \"%n\" のフォント ファイルが見つからないか、ASSETMAP で参照されて" "いません。" #: src/wx/verify_dcp_result_panel.cc:354 #, c-format msgid "" -"The fonts in the timed text asset %f take up %size_in_bytes bytes which is over the 10MB " +"The fonts in the timed text asset %f take up %n bytes which is over the 10MB " "limit." msgstr "" -"タイムドテキストデータ%fに含まれるフォントは%size_in_bytesバイトを消費しており、10MBの制" +"タイムドテキストデータ%fに含まれるフォントは%nバイトを消費しており、10MBの制" "限を超えています。" #: src/wx/verify_dcp_result_panel.cc:271 @@ -3762,8 +3764,8 @@ msgstr "" #: src/wx/verify_dcp_result_panel.cc:333 #, c-format -msgid "The invalid language tag %language is used." -msgstr "無効な言語タグ %language が使用されています。" +msgid "The invalid language tag %n is used." +msgstr "無効な言語タグ %n が使用されています。" #: src/wx/smpte_metadata_dialog.cc:63 #, c-format @@ -3778,16 +3780,16 @@ msgstr "リール内の画像フレームレートは%nですが無効です。" #: src/wx/verify_dcp_result_panel.cc:595 #, c-format msgid "" -"The reel duration (%other_duration) of some timed text is not the same as the " -"ContainerDuration (%duration) of its MXF." +"The reel duration (%s) of some timed text is not the same as the " +"ContainerDuration (%s) of its MXF." msgstr "" -"一部のタイムドテキストのリール再生時間(%other_duration)は、そのMXFファイルのコンテナ再生" -"時間(%duration)とは異なります。" +"一部のタイムドテキストのリール再生時間(%s)は、そのMXFファイルのコンテナ再生" +"時間(%s)とは異なります。" #: src/wx/verify_dcp_result_panel.cc:399 #, c-format -msgid "The sound asset %f has an invalid bit depth of %bit_depth." -msgstr "音声データ%fのビット深度%bit_depthは無効です。" +msgid "The sound asset %f has an invalid bit depth of %n." +msgstr "音声データ%fのビット深度%nは無効です。" #: src/wx/verify_dcp_result_panel.cc:396 #, c-format @@ -3819,20 +3821,20 @@ msgstr "字幕データ%fの<StartTime>はゼロではありません。" #: src/wx/verify_dcp_result_panel.cc:634 #, c-format -msgid "The subtitle asset %asset_id contains no subtitles." -msgstr "字幕データ%asset_idには字幕が含まれていません。" +msgid "The subtitle asset %n contains no subtitles." +msgstr "字幕データ%nには字幕が含まれていません。" #: src/wx/verify_dcp_result_panel.cc:417 #, c-format -msgid "The subtitle asset %asset_id has no <EntryPoint> tag." -msgstr "字幕データ%asset_idには<EntryPoint>タグがありません。" +msgid "The subtitle asset %n has no <EntryPoint> tag." +msgstr "字幕データ%nには<EntryPoint>タグがありません。" #: src/wx/verify_dcp_result_panel.cc:351 #, c-format msgid "" -"The timed text asset %f takes up %size_in_bytes bytes which is over the 115MB limit." +"The timed text asset %f takes up %n bytes which is over the 115MB limit." msgstr "" -"タイムドテキストデータ%fは%size_in_bytesバイトを消費しており、115MBの制限を超えています。" +"タイムドテキストデータ%fは%nバイトを消費しており、115MBの制限を超えています。" #: src/wx/verify_dcp_result_panel.cc:345 #, c-format @@ -3853,8 +3855,8 @@ msgstr "動画データ%fには無効なフレームレート%nを使用して #: src/wx/verify_dcp_result_panel.cc:336 #, c-format -msgid "The video asset %f uses the invalid image size %size_in_pixels." -msgstr "動画データ%fには無効な画像サイズ%size_in_pixelsを使用しています。" +msgid "The video asset %f uses the invalid image size %n." +msgstr "動画データ%fには無効な画像サイズ%nを使用しています。" #: src/wx/verify_dcp_result_panel.cc:390 msgid "There are more than 3 closed caption lines in at least one place." @@ -3917,10 +3919,10 @@ msgstr "このCPLには暗号化されたデータが含まれていません。 #: src/wx/verify_dcp_result_panel.cc:324 #, c-format msgid "" -"This DCP refers to at the asset %asset_id in another DCP (and perhaps others), so " +"This DCP refers to at the asset %n in another DCP (and perhaps others), so " "it is a \"version file\" (VF)" msgstr "" -"これはバージョンファイル(VF)です。別のDCP(またはその他)のデータ%asset_idを参照し" +"これはバージョンファイル(VF)です。別のDCP(またはその他)のデータ%nを参照し" "ます。" #: src/wx/verify_dcp_result_panel.cc:330 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 ba9f4119a..dff4f9a7c 100644 --- a/src/wx/supporters.cc +++ b/src/wx/supporters.cc @@ -137,6 +137,7 @@ supported_by.Add (wxT ("Jason Boulware")); supported_by.Add (wxT ("Yves Bourget")); supported_by.Add (wxT ("Cédric Bourquard")); supported_by.Add (wxT ("Erik Bowen")); +supported_by.Add (wxT ("Parker Bowling")); supported_by.Add (wxT ("Derek Boyes")); supported_by.Add (wxT ("Fabio Bozzoli")); supported_by.Add (wxT ("Jean-Pierre Brachet")); @@ -435,6 +436,7 @@ supported_by.Add (wxT ("“How to Successfully Fail in Hollywood” Film")); supported_by.Add (wxT ("Hamann Film")); supported_by.Add (wxT ("Traverse City Film Festival")); supported_by.Add (wxT ("Z-fest Film Project")); +supported_by.Add (wxT ("New Vizion Film/Media")); supported_by.Add (wxT ("DIAMETRALE Filmfestival")); supported_by.Add (wxT ("Lichtwerk && Kamera Filmkunst")); supported_by.Add (wxT ("Casablanca Filmkunsttheater")); @@ -471,6 +473,7 @@ supported_by.Add (wxT ("Labyrinth Films")); supported_by.Add (wxT ("Tiempos Dificiles Films")); supported_by.Add (wxT ("Artio Films")); supported_by.Add (wxT ("Jason Gray (Loaded Films)")); +supported_by.Add (wxT ("Solothurner Filmtage")); supported_by.Add (wxT ("Broadway Filmtheater")); supported_by.Add (wxT ("Diego Fincatto")); supported_by.Add (wxT ("Andres Fink")); @@ -523,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")); @@ -582,6 +586,7 @@ supported_by.Add (wxT ("Filmcrew Hamburg")); supported_by.Add (wxT ("Frédéric Hamelin")); supported_by.Add (wxT ("Howard Hamilton")); supported_by.Add (wxT ("Florian Hammann")); +supported_by.Add (wxT ("Dominic Büttner Hammerfilm")); supported_by.Add (wxT ("Hassan Hamza")); supported_by.Add (wxT ("Jessica Han")); supported_by.Add (wxT ("Mark Hanrahan")); @@ -612,6 +617,7 @@ supported_by.Add (wxT ("Mark Hensley")); supported_by.Add (wxT ("Ronny Hermansen")); supported_by.Add (wxT ("Antonio Ruiz Hernandez")); supported_by.Add (wxT ("Javier Hernandez")); +supported_by.Add (wxT ("Francisco Javier Espinal Hernández")); supported_by.Add (wxT ("Mark Van Heusden")); supported_by.Add (wxT ("Michael Higgins")); supported_by.Add (wxT ("Erin Hill")); @@ -776,7 +782,7 @@ supported_by.Add (wxT ("Christian Kreil")); supported_by.Add (wxT ("Sebastian Kreis")); supported_by.Add (wxT ("Tobias Kremer")); supported_by.Add (wxT ("Indu Krishnan")); -supported_by.Add (wxT ("Cabine Filmtheater Kriterion")); +supported_by.Add (wxT ("Filmtheater Kriterion")); supported_by.Add (wxT ("Kino Krokodil")); supported_by.Add (wxT ("Jakub Królikowski")); supported_by.Add (wxT ("Peter Kuehnis-Dietz")); @@ -862,6 +868,7 @@ supported_by.Add (wxT ("Divine Sign Productions LLC")); supported_by.Add (wxT ("8 Picture House LLC")); supported_by.Add (wxT ("Hummingbear && Company LLC")); supported_by.Add (wxT ("DAA Montenegro LLC")); +supported_by.Add (wxT ("Ghost Ship LLC")); supported_by.Add (wxT ("Mainstreem LLC")); supported_by.Add (wxT ("Mesh Multimedia LLC")); supported_by.Add (wxT ("Deep Structure Productions LLC")); @@ -878,6 +885,7 @@ supported_by.Add (wxT ("ColabDM Productions LLP")); supported_by.Add (wxT ("Marco Löber")); supported_by.Add (wxT ("Sergio Lobo-Navia")); supported_by.Add (wxT ("Locarco")); +supported_by.Add (wxT ("Colin Locascio")); supported_by.Add (wxT ("Joshua Logan")); supported_by.Add (wxT ("LoïcK!")); supported_by.Add (wxT ("Kwen In London")); @@ -1089,6 +1097,7 @@ supported_by.Add (wxT ("Antons Video Productions P/L")); supported_by.Add (wxT ("k pakiz")); supported_by.Add (wxT ("Nina Paley")); supported_by.Add (wxT ("Sigurður Sverrir Pálsson")); +supported_by.Add (wxT ("Ambuj Pandey")); supported_by.Add (wxT ("Pedro Pão")); supported_by.Add (wxT ("Harald Pape")); supported_by.Add (wxT ("Stanley Papulkas")); @@ -1173,6 +1182,7 @@ supported_by.Add (wxT ("Hitman Productions")); supported_by.Add (wxT ("WLFK Productions")); supported_by.Add (wxT ("Ceridwen Productions")); supported_by.Add (wxT ("ZooTime Productions")); +supported_by.Add (wxT ("Boom Video Productions")); supported_by.Add (wxT ("SmallStage Productions")); supported_by.Add (wxT ("A Tractor Productions")); supported_by.Add (wxT ("Second Wind Productions")); @@ -1248,6 +1258,7 @@ supported_by.Add (wxT ("Leigh Rosin")); supported_by.Add (wxT ("Jean-Maurice Rossel")); supported_by.Add (wxT ("Antonio Rotunno")); supported_by.Add (wxT ("Georges Rousseau")); +supported_by.Add (wxT ("Shelagh Rowan-Legg")); supported_by.Add (wxT ("David Rozenthal")); supported_by.Add (wxT ("Damon Rubio")); supported_by.Add (wxT ("Jean-Marc Rueff")); @@ -1371,6 +1382,7 @@ supported_by.Add (wxT ("Chris Stevens")); supported_by.Add (wxT ("Mike Stiebing")); supported_by.Add (wxT ("Tomislav Stojanović")); supported_by.Add (wxT ("The Icelandic Academy of Storytelling")); +supported_by.Add (wxT ("Jon Stout")); supported_by.Add (wxT ("Robert Stracke")); supported_by.Add (wxT ("Patrik Strömdahl")); supported_by.Add (wxT ("Francois Stuck")); @@ -1479,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")); @@ -1565,6 +1578,7 @@ supported_by.Add (wxT ("Daniel Židek")); supported_by.Add (wxT ("Hens Zimmerman")); supported_by.Add (wxT ("Ernst Zimmerman")); supported_by.Add (wxT ("Roberto Zin")); +supported_by.Add (wxT ("Grygorii Zinchenko")); supported_by.Add (wxT ("Matthieu Zingle")); supported_by.Add (wxT ("Allard Zoetman")); supported_by.Add (wxT ("zondergeluid")); diff --git a/src/wx/text_view.cc b/src/wx/text_view.cc index bde7b09e9..999fe94ab 100644 --- a/src/wx/text_view.cc +++ b/src/wx/text_view.cc @@ -142,7 +142,7 @@ TextView::data_start (ContentStringText cts) wxListItem list_item; list_item.SetId (_subs); _list->InsertItem (list_item); - _list->SetItem (_subs, 0, std_to_wx (cts.from().timecode (_frc->source))); + _list->SetItem (_subs, 0, std_to_wx (cts.from().timecode (_frc->source()))); _list->SetItem (_subs, 2, std_to_wx (i.text ())); _start_times.push_back (cts.from ()); ++_subs; @@ -160,7 +160,7 @@ TextView::data_stop (ContentTime time) } for (int i = _subs - *_last_count; i < _subs; ++i) { - _list->SetItem (i, 1, std_to_wx (time.timecode (_frc->source))); + _list->SetItem (i, 1, std_to_wx (time.timecode (_frc->source()))); } } @@ -176,5 +176,5 @@ TextView::subtitle_selected (wxListEvent& ev) auto lc = _content.lock (); DCPOMATIC_ASSERT (lc); /* Add on a frame here to work around any rounding errors and make sure we land in the subtitle */ - _film_viewer.seek(lc, _start_times[ev.GetIndex()] + ContentTime::from_frames(1, _frc->source), true); + _film_viewer.seek(lc, _start_times[ev.GetIndex()] + ContentTime::from_frames(1, _frc->source()), true); } 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 |
