/*
- Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "audio_ring_buffers.h"
#include "dcpomatic_assert.h"
#include "exceptions.h"
#include <iostream>
+
using std::min;
using std::cout;
using std::make_pair;
using boost::optional;
using namespace dcpomatic;
+
AudioRingBuffers::AudioRingBuffers ()
- : _used_in_head (0)
{
}
+
/** @param frame_rate Frame rate in use; this is only used to check timing consistency of the incoming data */
void
AudioRingBuffers::put (shared_ptr<const AudioBuffers> data, DCPTime time, int frame_rate)
_buffers.push_back(make_pair(data, time));
}
+
/** @return time of the returned data; if it's not set this indicates an underrun */
optional<DCPTime>
AudioRingBuffers::get (float* out, int channels, int frames)
return time;
}
- pair<shared_ptr<const AudioBuffers>, DCPTime> front = _buffers.front ();
+ auto front = _buffers.front ();
if (!time) {
time = front.second + DCPTime::from_frames(_used_in_head, 48000);
}
return time;
}
+
optional<DCPTime>
AudioRingBuffers::peek () const
{
boost::mutex::scoped_lock lm (_mutex);
if (_buffers.empty()) {
- return optional<DCPTime>();
+ return {};
}
return _buffers.front().second;
}
+
void
AudioRingBuffers::clear ()
{
_used_in_head = 0;
}
+
Frame
AudioRingBuffers::size () const
{
boost::mutex::scoped_lock lm (_mutex);
Frame s = 0;
- for (list<pair<shared_ptr<const AudioBuffers>, DCPTime> >::const_iterator i = _buffers.begin(); i != _buffers.end(); ++i) {
- s += i->first->frames();
+ for (auto const& i: _buffers) {
+ s += i.first->frames();
}
return s - _used_in_head;
}
/*
- Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_AUDIO_RING_BUFFERS_H
#define DCPOMATIC_AUDIO_RING_BUFFERS_H
+
#include "audio_buffers.h"
#include "types.h"
#include "dcpomatic_time.h"
#include <boost/thread.hpp>
#include <list>
-class AudioRingBuffers : public boost::noncopyable
+
+class AudioRingBuffers
{
public:
AudioRingBuffers ();
+ AudioRingBuffers (AudioBuffers const&) = delete;
+ AudioRingBuffers& operator= (AudioBuffers const&) = delete;
+
void put (std::shared_ptr<const AudioBuffers> data, dcpomatic::DCPTime time, int frame_rate);
boost::optional<dcpomatic::DCPTime> get (float* out, int channels, int frames);
boost::optional<dcpomatic::DCPTime> peek () const;
private:
mutable boost::mutex _mutex;
std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime> > _buffers;
- int _used_in_head;
+ int _used_in_head = 0;
};
+
#endif
/*
- Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "decoder.h"
#include "video_decoder.h"
#include "audio_decoder.h"
#include <boost/optional.hpp>
#include <iostream>
+
using std::cout;
using boost::optional;
using std::shared_ptr;
using std::weak_ptr;
using namespace dcpomatic;
+
Decoder::Decoder (weak_ptr<const Film> film)
: WeakConstFilm (film)
{
}
+
/** @return Earliest time of content that the next pass() will emit */
ContentTime
Decoder::position () const
{
optional<ContentTime> pos;
- shared_ptr<const Film> f = film();
+ auto f = film();
if (video && !video->ignore() && (!pos || video->position(f).get_value_or(ContentTime()) < *pos)) {
pos = video->position(f);
return pos.get_value_or(ContentTime());
}
+
void
Decoder::seek (ContentTime, bool)
{
}
}
+
shared_ptr<TextDecoder>
Decoder::only_text () const
{
DCPOMATIC_ASSERT (text.size() < 2);
- if (text.empty ()) {
- return shared_ptr<TextDecoder> ();
+ if (text.empty()) {
+ return {};
}
- return text.front ();
+ return text.front();
}
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/decoder.h
* @brief Decoder class.
*/
+
#ifndef DCPOMATIC_DECODER_H
#define DCPOMATIC_DECODER_H
-#include "types.h"
+
+#include "dcpomatic_time.h"
#include "film.h"
#include "font_data.h"
-#include "dcpomatic_time.h"
+#include "types.h"
#include "weak_film.h"
#include <boost/utility.hpp>
-class Decoded;
-class VideoDecoder;
-class AudioDecoder;
-class TextDecoder;
+
class AtmosDecoder;
+class AudioDecoder;
+class Decoded;
class DecoderPart;
+class TextDecoder;
+class VideoDecoder;
+
/** @class Decoder.
* @brief Parent class for decoders of content.
*/
-class Decoder : public boost::noncopyable, public WeakConstFilm
+class Decoder : public WeakConstFilm
{
public:
Decoder (std::weak_ptr<const Film> film);
virtual ~Decoder () {}
+ Decoder (Decoder const&) = delete;
+ Decoder& operator= (Decoder const&) = delete;
+
std::shared_ptr<VideoDecoder> video;
std::shared_ptr<AudioDecoder> audio;
- std::list<std::shared_ptr<TextDecoder> > text;
+ std::list<std::shared_ptr<TextDecoder>> text;
std::shared_ptr<AtmosDecoder> atmos;
std::shared_ptr<TextDecoder> only_text () const;
virtual dcpomatic::ContentTime position () const;
virtual std::vector<dcpomatic::FontData> fonts () const {
- return std::vector<dcpomatic::FontData>();
+ return {};
}
};
+
#endif
/*
- Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "digester.h"
#include "dcpomatic_assert.h"
#include <nettle/md5.h>
#include <iomanip>
#include <cstdio>
+
using std::string;
using std::hex;
using std::setfill;
using std::setw;
+
Digester::Digester ()
{
md5_init (&_context);
}
+
Digester::~Digester ()
{
get ();
}
+
void
Digester::add (void const * data, size_t size)
{
- md5_update (&_context, size, reinterpret_cast<uint8_t const *> (data));
+ md5_update (&_context, size, reinterpret_cast<uint8_t const *>(data));
}
+
void
Digester::add (string const & s)
{
add (s.c_str(), s.length());
}
+
string
Digester::get () const
{
return _digest.get ();
}
+
void
Digester::get (uint8_t* buffer) const
{
/*
- Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include <nettle/md5.h>
-#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <string>
-class Digester : public boost::noncopyable
+
+class Digester
{
public:
Digester ();
~Digester ();
+ Digester (Digester const&) = delete;
+ Digester& operator= (Digester const&) = delete;
+
void add (void const * data, size_t size);
template <class T>
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "dcpomatic_time.h"
#include <boost/optional.hpp>
-#include <boost/noncopyable.hpp>
#include <vector>
-class FrameIntervalChecker : public boost::noncopyable
+
+class FrameIntervalChecker
{
public:
+ FrameIntervalChecker () {}
+ FrameIntervalChecker (FrameIntervalChecker const &) = delete;
+ FrameIntervalChecker& operator= (FrameIntervalChecker const &) = delete;
+
void feed (dcpomatic::ContentTime time, double frame_rate);
enum Guess
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/job_manager.cc
* @brief A simple scheduler for jobs.
*/
-#include "job_manager.h"
-#include "job.h"
-#include "cross.h"
+
#include "analyse_audio_job.h"
#include "analyse_subtitles_job.h"
+#include "cross.h"
#include "film.h"
+#include "job.h"
+#include "job_manager.h"
#include <boost/thread.hpp>
-#include <iostream>
-using std::string;
+
+using std::dynamic_pointer_cast;
using std::list;
-using std::cout;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
using std::weak_ptr;
+using boost::bind;
using boost::function;
-using std::dynamic_pointer_cast;
using boost::optional;
-using boost::bind;
-JobManager* JobManager::_instance = 0;
+
+JobManager* JobManager::_instance = nullptr;
+
JobManager::JobManager ()
- : _terminate (false)
- , _paused (false)
{
}
+
void
JobManager::start ()
{
#endif
}
+
JobManager::~JobManager ()
{
boost::this_thread::disable_interruption dis;
} catch (...) {}
}
+
shared_ptr<Job>
JobManager::add (shared_ptr<Job> j)
{
_empty_condition.notify_all ();
}
- emit (boost::bind (boost::ref (JobAdded), weak_ptr<Job> (j)));
+ emit (boost::bind(boost::ref(JobAdded), weak_ptr<Job>(j)));
return j;
}
+
shared_ptr<Job>
JobManager::add_after (shared_ptr<Job> after, shared_ptr<Job> j)
{
{
boost::mutex::scoped_lock lm (_mutex);
- list<shared_ptr<Job> >::iterator i = find (_jobs.begin(), _jobs.end(), after);
+ auto i = find (_jobs.begin(), _jobs.end(), after);
DCPOMATIC_ASSERT (i != _jobs.end());
_jobs.insert (i, j);
_empty_condition.notify_all ();
}
- emit (boost::bind (boost::ref (JobAdded), weak_ptr<Job> (j)));
+ emit (boost::bind(boost::ref(JobAdded), weak_ptr<Job>(j)));
return j;
}
-list<shared_ptr<Job> >
+
+list<shared_ptr<Job>>
JobManager::get () const
{
boost::mutex::scoped_lock lm (_mutex);
return _jobs;
}
+
bool
JobManager::work_to_do () const
{
boost::mutex::scoped_lock lm (_mutex);
- list<shared_ptr<Job> >::const_iterator i = _jobs.begin();
+ auto i = _jobs.begin();
while (i != _jobs.end() && (*i)->finished()) {
++i;
}
return i != _jobs.end ();
}
+
bool
JobManager::errors () const
{
boost::mutex::scoped_lock lm (_mutex);
for (auto i: _jobs) {
- if (i->finished_in_error ()) {
+ if (i->finished_in_error()) {
return true;
}
}
return false;
}
+
void
JobManager::scheduler ()
{
}
}
+
void
JobManager::job_finished ()
{
{
boost::mutex::scoped_lock lm (_mutex);
- emit (boost::bind (boost::ref (ActiveJobsChanged), _last_active_job, optional<string>()));
+ emit (boost::bind(boost::ref (ActiveJobsChanged), _last_active_job, optional<string>()));
_last_active_job = optional<string>();
}
_empty_condition.notify_all ();
}
+
JobManager *
JobManager::instance ()
{
- if (_instance == 0) {
+ if (!_instance) {
_instance = new JobManager ();
_instance->start ();
}
return _instance;
}
+
void
JobManager::drop ()
{
delete _instance;
- _instance = 0;
+ _instance = nullptr;
}
+
void
JobManager::analyse_audio (
shared_ptr<const Film> film,
boost::mutex::scoped_lock lm (_mutex);
for (auto i: _jobs) {
- shared_ptr<AnalyseAudioJob> a = dynamic_pointer_cast<AnalyseAudioJob> (i);
+ auto a = dynamic_pointer_cast<AnalyseAudioJob> (i);
if (a && a->path() == film->audio_analysis_path(playlist) && !i->finished_cancelled()) {
i->when_finished (connection, ready);
return;
{
boost::mutex::scoped_lock lm (_mutex);
- job.reset (new AnalyseAudioJob (film, playlist, from_zero));
+ job = make_shared<AnalyseAudioJob> (film, playlist, from_zero);
connection = job->Finished.connect (ready);
_jobs.push_back (job);
_empty_condition.notify_all ();
boost::mutex::scoped_lock lm (_mutex);
for (auto i: _jobs) {
- shared_ptr<AnalyseSubtitlesJob> a = dynamic_pointer_cast<AnalyseSubtitlesJob> (i);
+ auto a = dynamic_pointer_cast<AnalyseSubtitlesJob> (i);
if (a && a->path() == film->subtitle_analysis_path(content)) {
i->when_finished (connection, ready);
return;
{
boost::mutex::scoped_lock lm (_mutex);
- job.reset (new AnalyseSubtitlesJob(film, content));
+ job = make_shared<AnalyseSubtitlesJob>(film, content);
connection = job->Finished.connect (ready);
_jobs.push_back (job);
_empty_condition.notify_all ();
}
- emit (boost::bind (boost::ref (JobAdded), weak_ptr<Job> (job)));
+ emit (boost::bind(boost::ref(JobAdded), weak_ptr<Job>(job)));
}
{
boost::mutex::scoped_lock lm (_mutex);
- list<shared_ptr<Job> >::iterator last = _jobs.end ();
- for (list<shared_ptr<Job> >::iterator i = _jobs.begin(); i != _jobs.end(); ++i) {
+ auto last = _jobs.end ();
+ for (auto i = _jobs.begin(); i != _jobs.end(); ++i) {
if (*i == job && last != _jobs.end()) {
swap (*i, *last);
changed = true;
}
}
+
void
JobManager::priority_changed ()
{
}
}
- emit (boost::bind (boost::ref (JobsReordered)));
+ emit (boost::bind(boost::ref(JobsReordered)));
}
+
void
JobManager::decrease_priority (shared_ptr<Job> job)
{
{
boost::mutex::scoped_lock lm (_mutex);
- for (list<shared_ptr<Job> >::iterator i = _jobs.begin(); i != _jobs.end(); ++i) {
- list<shared_ptr<Job> >::iterator next = i;
+ for (auto i = _jobs.begin(); i != _jobs.end(); ++i) {
+ auto next = i;
++next;
if (*i == job && next != _jobs.end()) {
swap (*i, *next);
}
}
+
void
JobManager::pause ()
{
_paused = true;
}
+
void
JobManager::resume ()
{
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/job_manager.h
* @brief A simple scheduler for jobs.
*/
+
#include "signaller.h"
#include <boost/thread/mutex.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <list>
+
class Job;
class Film;
class Playlist;
class Content;
struct threed_test7;
+
extern bool wait_for_jobs ();
+
/** @class JobManager
* @brief A simple scheduler for jobs.
*/
-class JobManager : public Signaller, public boost::noncopyable
+class JobManager : public Signaller
{
public:
+ JobManager (JobManager const&) = delete;
+ JobManager& operator= (JobManager const&) = delete;
+
std::shared_ptr<Job> add (std::shared_ptr<Job>);
std::shared_ptr<Job> add_after (std::shared_ptr<Job> after, std::shared_ptr<Job> j);
- std::list<std::shared_ptr<Job> > get () const;
+ std::list<std::shared_ptr<Job>> get () const;
bool work_to_do () const;
bool errors () const;
void increase_priority (std::shared_ptr<Job>);
mutable boost::mutex _mutex;
boost::condition _empty_condition;
/** List of jobs in the order that they will be executed */
- std::list<std::shared_ptr<Job> > _jobs;
+ std::list<std::shared_ptr<Job>> _jobs;
std::list<boost::signals2::connection> _connections;
- bool _terminate;
- bool _paused;
+ bool _terminate = false;
+ bool _paused = false;
std::shared_ptr<Job> _paused_job;
boost::optional<std::string> _last_active_job;
/*
- Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "playlist.h"
#include "video_content.h"
#include "text_content.h"
#include "i18n.h"
+
using std::list;
using std::cout;
using std::vector;
using namespace boost::placeholders;
#endif
+
Playlist::Playlist ()
- : _sequence (true)
- , _sequencing (false)
{
}
+
Playlist::~Playlist ()
{
boost::mutex::scoped_lock lm (_mutex);
disconnect ();
}
+
void
Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ptr<Content> content, int property, bool frequent)
{
ContentChange (type, content, property, frequent);
}
+
void
Playlist::maybe_sequence (shared_ptr<const Film> film)
{
_sequencing = true;
- ContentList cont = content ();
+ auto cont = content ();
/* Keep track of the content that we've set the position of so that we don't
do it twice.
_sequencing = false;
}
+
string
Playlist::video_identifier () const
{
return digester.get ();
}
+
/** @param film Film that this Playlist is for.
* @param node <Playlist> node.
* @param version Metadata version number.
}
/* ...or have a start trim which is an integer number of frames */
- ContentTime const old_trim = content->trim_start();
+ auto const old_trim = content->trim_start();
content->set_trim_start(old_trim);
if (old_trim != content->trim_start()) {
string note = _("Your project contains video content whose trim was not aligned to a frame boundary.");
reconnect (film);
}
+
/** @param node <Playlist> node.
* @param with_content_paths true to include <Path> nodes in <Content> nodes, false to omit them.
*/
}
}
+
void
Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c)
{
LengthChange ();
}
+
void
Playlist::remove (shared_ptr<Content> c)
{
LengthChange ();
}
+
void
Playlist::remove (ContentList c)
{
boost::mutex::scoped_lock lm (_mutex);
for (auto i: c) {
- ContentList::iterator j = _content.begin ();
+ auto j = _content.begin ();
while (j != _content.end() && *j != i) {
++j;
}
LengthChange ();
}
+
class FrameRateCandidate
{
public:
int dcp;
};
+
/** @return the best frame rate from Config::_allowed_dcp_frame_rates for the content in this list */
int
Playlist::best_video_frame_rate () const
return best->dcp;
}
+
/** @return length of the playlist from time 0 to the last thing on the playlist */
DCPTime
Playlist::length (shared_ptr<const Film> film) const
return len;
}
+
/** @return position of the first thing on the playlist, if it's not empty */
optional<DCPTime>
Playlist::start () const
return start;
}
+
/** Must be called with a lock held on _mutex */
void
Playlist::disconnect ()
_content_connections.clear ();
}
+
/** Must be called with a lock held on _mutex */
void
Playlist::reconnect (shared_ptr<const Film> film)
}
}
+
DCPTime
Playlist::video_end (shared_ptr<const Film> film) const
{
return end;
}
+
DCPTime
Playlist::text_end (shared_ptr<const Film> film) const
{
return end;
}
+
FrameRateChange
Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const
{
- ContentList cont = content ();
+ auto cont = content ();
for (ContentList::const_reverse_iterator i = cont.rbegin(); i != cont.rend(); ++i) {
if (!(*i)->video) {
continue;
return FrameRateChange (dcp_video_frame_rate, dcp_video_frame_rate);
}
+
void
Playlist::set_sequence (bool s)
{
_sequence = s;
}
+
bool
ContentSorter::operator() (shared_ptr<Content> a, shared_ptr<Content> b)
{
return a->digest() < b->digest();
}
+
/** @return content in ascending order of position */
ContentList
Playlist::content () const
return _content;
}
+
void
Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n)
{
- pair<DCPTime, DCPTime> range (DCPTime::max (), DCPTime ());
+ pair<DCPTime, DCPTime> range (DCPTime::max(), DCPTime());
for (auto i: c) {
range.first = min (range.first, i->position ());
range.second = max (range.second, i->position ());
Change (ChangeType::DONE);
}
+
void
Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c)
{
c->set_position (film, p);
}
+
void
Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c)
{
c->set_position (film, c->position() + next_c->length_after_trim(film));
}
+
int64_t
Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const
{
return video + audio + 65536;
}
+
string
Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) const
{
return best_summary;
}
+
pair<double, double>
Playlist::speed_up_range (int dcp_video_frame_rate) const
{
/*
- Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_PLAYLIST_H
#define DCPOMATIC_PLAYLIST_H
+
#include "change_signaller.h"
#include "frame_rate_change.h"
#include "util.h"
#include <boost/thread.hpp>
#include <list>
+
class Film;
+
struct ContentSorter
{
bool operator() (std::shared_ptr<Content> a, std::shared_ptr<Content> b);
};
+
/** @class Playlist
* @brief A set of Content objects with knowledge of how they should be arranged into
* a DCP.
*/
-class Playlist : public boost::noncopyable
+class Playlist
{
public:
Playlist ();
~Playlist ();
+ Playlist (Playlist const&) = delete;
+ Playlist& operator= (Playlist const&) = delete;
+
void as_xml (xmlpp::Node *, bool with_content_paths);
void set_from_xml (std::shared_ptr<const Film> film, cxml::ConstNodePtr node, int version, std::list<std::string>& notes);
mutable boost::mutex _mutex;
/** List of content. Kept sorted in position order. */
ContentList _content;
- bool _sequence;
- bool _sequencing;
+ bool _sequence = true;
+ bool _sequencing = false;
std::list<boost::signals2::connection> _content_connections;
};
+
#endif
/*
- Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "ratio.h"
#include "util.h"
#include "config.h"
#include "i18n.h"
+
using std::string;
using std::vector;
using boost::optional;
+
vector<Ratio const *> Ratio::_ratios;
+
void
Ratio::setup_ratios ()
{
- _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), optional<string>(), "119"));
- _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("1.33 (4:3)"), optional<string>(), "133"));
- _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.38 (Academy)"), optional<string>(), "137"));
- _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("1.43 (IMAX)"), optional<string>(), "143"));
- _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), optional<string>(), "166"));
- _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("1.78 (16:9 or HD)"), optional<string>(), "178"));
- _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("1.85 (Flat)"), string(_("DCI Flat")), "F"));
- _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35 (35mm Scope)"), optional<string>(), "S"));
- _ratios.push_back (new Ratio (float(2048) / 858, "239", _("2.39 (Scope)"), string(_("DCI Scope")), "S"));
- _ratios.push_back (new Ratio (float(2048) / 1080, "190", _("1.90 (Full frame)"), string(_("Full frame")), "C"));
+ _ratios.push_back (new Ratio(float(1290) / 1080, "119", _("1.19"), optional<string>(), "119"));
+ _ratios.push_back (new Ratio(float(1440) / 1080, "133", _("1.33 (4:3)"), optional<string>(), "133"));
+ _ratios.push_back (new Ratio(float(1485) / 1080, "138", _("1.38 (Academy)"), optional<string>(), "137"));
+ _ratios.push_back (new Ratio(float(1544) / 1080, "143", _("1.43 (IMAX)"), optional<string>(), "143"));
+ _ratios.push_back (new Ratio(float(1800) / 1080, "166", _("1.66"), optional<string>(), "166"));
+ _ratios.push_back (new Ratio(float(1920) / 1080, "178", _("1.78 (16:9 or HD)"), optional<string>(), "178"));
+ _ratios.push_back (new Ratio(float(1998) / 1080, "185", _("1.85 (Flat)"), string(_("DCI Flat")), "F"));
+ _ratios.push_back (new Ratio(float(2048) / 872, "235", _("2.35 (35mm Scope)"), optional<string>(), "S"));
+ _ratios.push_back (new Ratio(float(2048) / 858, "239", _("2.39 (Scope)"), string(_("DCI Scope")), "S"));
+ _ratios.push_back (new Ratio(float(2048) / 1080, "190", _("1.90 (Full frame)"), string(_("Full frame")), "C"));
}
+
Ratio const *
Ratio::from_id (string i)
{
i = "138";
}
- vector<Ratio const *>::iterator j = _ratios.begin ();
+ auto j = _ratios.begin ();
while (j != _ratios.end() && (*j)->id() != i) {
++j;
}
return *j;
}
+
/** @return Ratio corresponding to a given fractional ratio (+/- 0.01), or 0 */
Ratio const *
Ratio::from_ratio (float r)
{
- vector<Ratio const *>::iterator j = _ratios.begin ();
- while (j != _ratios.end() && fabs ((*j)->ratio() - r) > 0.01) {
+ auto j = _ratios.begin ();
+ while (j != _ratios.end() && fabs((*j)->ratio() - r) > 0.01) {
++j;
}
if (j == _ratios.end ()) {
- return 0;
+ return nullptr;
}
return *j;
}
+
Ratio const *
Ratio::nearest_from_ratio (float r)
{
- Ratio const * nearest = 0;
+ Ratio const * nearest = nullptr;
float distance = FLT_MAX;
- for (vector<Ratio const *>::iterator i = _ratios.begin (); i != _ratios.end(); ++i) {
- float const d = fabs ((*i)->ratio() - r);
+ for (auto i = _ratios.begin(); i != _ratios.end(); ++i) {
+ float const d = fabs((*i)->ratio() - r);
if (d < distance) {
distance = d;
nearest = *i;
return r;
}
+
string
Ratio::container_nickname () const
{
/*
- Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_RATIO_H
#define DCPOMATIC_RATIO_H
+
#include <dcp/util.h>
#include <boost/utility.hpp>
#include <vector>
+
/** @class Ratio
* @brief Description of an image ratio.
*/
-class Ratio : public boost::noncopyable
+class Ratio
{
public:
Ratio (float ratio, std::string id, std::string in, boost::optional<std::string> cn, std::string d)
, _isdcf_name (d)
{}
+ Ratio (Ratio const&) = delete;
+ Ratio& operator= (Ratio const&) = delete;
+
std::string id () const {
return _id;
}
std::string container_nickname () const;
bool used_for_container () const {
- return static_cast<bool> (_container_nickname);
+ return static_cast<bool>(_container_nickname);
}
std::string isdcf_name () const {
static std::vector<Ratio const *> _ratios;
};
+
#endif
#include <shellapi.h>
#endif
#include <boost/filesystem.hpp>
-#include <boost/noncopyable.hpp>
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <fstream>
#endif
using dcp::raw_convert;
-class FilmChangedClosingDialog : public boost::noncopyable
+class FilmChangedClosingDialog
{
public:
explicit FilmChangedClosingDialog (string name)
_dialog->Destroy ();
}
+ FilmChangedClosingDialog (FilmChangedClosingDialog const&) = delete;
+ FilmChangedClosingDialog& operator= (FilmChangedClosingDialog const&) = delete;
+
int run ()
{
return _dialog->ShowModal ();
wxMessageDialog* _dialog;
};
-class FilmChangedDuplicatingDialog : public boost::noncopyable
+
+class FilmChangedDuplicatingDialog
{
public:
explicit FilmChangedDuplicatingDialog (string name)
_dialog->Destroy ();
}
+ FilmChangedDuplicatingDialog (FilmChangedDuplicatingDialog const&) = delete;
+ FilmChangedDuplicatingDialog& operator= (FilmChangedDuplicatingDialog const&) = delete;
+
int run ()
{
return _dialog->ShowModal ();
* @param V Data type of state as used by the view.
*/
template <class S, class T, typename U, typename V>
-class ContentWidget : public boost::noncopyable
+class ContentWidget
{
public:
/** @param parent Parent window.
_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentWidget::button_clicked, this));
}
+ ContentWidget (ContentWidget const&) = delete;
+ ContentWidget& operator= (ContentWidget const&) = delete;
+
/** @return the widget that we are wrapping */
T* wrapped () const
{
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "timeline_view.h"
#include "timeline.h"
+
using std::list;
using namespace dcpomatic;
+
/** @class TimelineView
* @brief Parent class for components of the timeline (e.g. a piece of content or an axis).
*/
}
+
void
-TimelineView::paint (wxGraphicsContext* g, list<dcpomatic::Rect<int> > overlaps)
+TimelineView::paint (wxGraphicsContext* g, list<dcpomatic::Rect<int>> overlaps)
{
_last_paint_bbox = bbox ();
do_paint (g, overlaps);
}
+
void
TimelineView::force_redraw ()
{
- _timeline.force_redraw (_last_paint_bbox.extended (4));
- _timeline.force_redraw (bbox().extended (4));
+ _timeline.force_redraw (_last_paint_bbox.extended(4));
+ _timeline.force_redraw (bbox().extended(4));
}
+
int
TimelineView::time_x (DCPTime t) const
{
- return t.seconds() * _timeline.pixels_per_second().get_value_or (0);
+ return t.seconds() * _timeline.pixels_per_second().get_value_or(0);
}
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_TIMELINE_VIEW_H
#define DCPOMATIC_TIMELINE_VIEW_H
+
#include "lib/rect.h"
#include "lib/dcpomatic_time.h"
-#include <boost/noncopyable.hpp>
+
class wxGraphicsContext;
class Timeline;
+
/** @class TimelineView
* @brief Parent class for components of the timeline (e.g. a piece of content or an axis).
*/
-class TimelineView : public boost::noncopyable
+class TimelineView
{
public:
explicit TimelineView (Timeline& t);
virtual ~TimelineView () {}
+ TimelineView (TimelineView const&) = delete;
+ TimelineView& operator= (TimelineView const&) = delete;
+
void paint (wxGraphicsContext* g, std::list<dcpomatic::Rect<int> > overlaps);
void force_redraw ();
dcpomatic::Rect<int> _last_paint_bbox;
};
-typedef std::vector<std::shared_ptr<TimelineView> > TimelineViewList;
+
+typedef std::vector<std::shared_ptr<TimelineView>> TimelineViewList;
+
#endif
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "video_view.h"
#include "wx_util.h"
#include "film_viewer.h"
using std::shared_ptr;
using boost::optional;
+
VideoView::VideoView (FilmViewer* viewer)
: _viewer (viewer)
, _state_timer ("viewer")
- , _video_frame_rate (0)
- , _eyes (Eyes::LEFT)
- , _three_d (false)
- , _dropped (0)
- , _errored (0)
- , _gets (0)
{
}
+
void
VideoView::clear ()
{
_player_video.second = dcpomatic::DCPTime ();
}
+
/** Could be called from any thread.
* @param non_blocking true to return false quickly if no video is available quickly.
* @return FAIL if there's no frame, AGAIN if the method should be called again, or SUCCESS
return SUCCESS;
}
+
dcpomatic::DCPTime
VideoView::one_video_frame () const
{
return dcpomatic::DCPTime::from_frames (1, video_frame_rate());
}
+
/** @return Time in ms until the next frame is due, or empty if nothing is due */
optional<int>
VideoView::time_until_next_frame () const
return (next.seconds() - time.seconds()) * 1000;
}
+
void
VideoView::start ()
{
_errored = 0;
}
+
bool
VideoView::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
{
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_VIDEO_VIEW_H
#define DCPOMATIC_VIDEO_VIEW_H
+
#include "lib/dcpomatic_time.h"
#include "lib/timer.h"
#include "lib/types.h"
#include "lib/exception_store.h"
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
-#include <boost/noncopyable.hpp>
+
class Image;
class wxWindow;
class Player;
class PlayerVideo;
-class VideoView : public ExceptionStore, public boost::noncopyable
+
+class VideoView : public ExceptionStore
{
public:
VideoView (FilmViewer* viewer);
virtual ~VideoView () {}
+ VideoView (VideoView const&) = delete;
+ VideoView& operator= (VideoView const&) = delete;
+
/** @return the thing displaying the image */
virtual wxWindow* get () const = 0;
/** Re-make and display the image from the current _player_video */
mutable boost::mutex _mutex;
std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> _player_video;
- int _video_frame_rate;
+ int _video_frame_rate = 0;
/** length of the film we are playing, or 0 if there is none */
dcpomatic::DCPTime _length;
- Eyes _eyes;
- bool _three_d;
+ Eyes _eyes = Eyes::LEFT;
+ bool _three_d = false;
- int _dropped;
- int _errored;
- int _gets;
+ int _dropped = 0;
+ int _errored = 0;
+ int _gets = 0;
};
+
#endif