summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/active_text.cc46
-rw-r--r--src/lib/active_text.h26
-rw-r--r--src/lib/analyse_subtitles_job.cc46
-rw-r--r--src/lib/analyse_subtitles_job.h10
-rw-r--r--src/lib/audio_content.cc8
-rw-r--r--src/lib/audio_mapping.cc84
-rw-r--r--src/lib/audio_mapping.h32
-rw-r--r--src/lib/cinema_sound_processor.cc44
-rw-r--r--src/lib/cinema_sound_processor.h20
-rw-r--r--src/lib/content.cc2
-rw-r--r--src/lib/dcp_subtitle_content.cc30
-rw-r--r--src/lib/dcp_subtitle_content.h14
-rw-r--r--src/lib/dcp_video.cc34
-rw-r--r--src/lib/dcpomatic_socket.cc8
-rw-r--r--src/lib/dcpomatic_time.cc4
-rw-r--r--src/lib/encode_server_finder.cc114
-rw-r--r--src/lib/encode_server_finder.h24
-rw-r--r--src/lib/ffmpeg.cc94
-rw-r--r--src/lib/ffmpeg.h24
-rw-r--r--src/lib/ffmpeg_content.cc2
-rw-r--r--src/lib/ffmpeg_decoder.cc2
-rw-r--r--src/lib/file_group.cc44
-rw-r--r--src/lib/file_group.h20
-rw-r--r--src/lib/frame_rate_change.cc50
-rw-r--r--src/lib/frame_rate_change.h63
-rw-r--r--src/lib/hints.cc2
-rw-r--r--src/lib/image.cc11
-rw-r--r--src/lib/image_content.cc66
-rw-r--r--src/lib/image_content.h28
-rw-r--r--src/lib/image_decoder.cc18
-rw-r--r--src/lib/image_decoder.h8
-rw-r--r--src/lib/image_examiner.cc22
-rw-r--r--src/lib/image_examiner.h14
-rw-r--r--src/lib/j2k_image_proxy.cc96
-rw-r--r--src/lib/j2k_image_proxy.h28
-rw-r--r--src/lib/log.cc26
-rw-r--r--src/lib/log.h22
-rw-r--r--src/lib/nanomsg.cc39
-rw-r--r--src/lib/nanomsg.h16
-rw-r--r--src/lib/player.cc4
-rw-r--r--src/lib/playlist.cc8
-rw-r--r--src/lib/po/ja_JP.po60
-rw-r--r--src/lib/text_ring_buffers.cc14
-rw-r--r--src/lib/text_ring_buffers.h14
-rw-r--r--src/lib/video_content.cc4
-rw-r--r--src/lib/video_mxf_content.cc38
-rw-r--r--src/lib/video_mxf_content.h22
47 files changed, 730 insertions, 675 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/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index 21159fcac..b285a78fe 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -42,18 +42,18 @@ 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.push_back(make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE));
}
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
@@ -69,10 +69,10 @@ DCPSubtitleContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bo
set_video_frame_rate(film, smpte->edit_rate().numerator);
}
- boost::mutex::scoped_lock lm (_mutex);
+ boost::mutex::scoped_lock lm(_mutex);
/* Default to turning these subtitles on */
- only_text()->set_use (true);
+ only_text()->set_use(true);
_length = ContentTime::from_seconds(subtitle_asset->latest_text_out().as_seconds());
@@ -115,26 +115,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..35eb640d4 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -227,7 +227,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;
}
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/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);
};