/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "analytics.h"
-#include "exceptions.h"
#include "compose.hpp"
+#include "exceptions.h"
#include "warnings.h"
#include <dcp/raw_convert.h>
#include <libcxml/cxml.h>
DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
DCPOMATIC_ENABLE_WARNINGS
-#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
+#include <boost/filesystem.hpp>
#include "i18n.h"
+
using std::string;
using dcp::raw_convert;
using boost::algorithm::trim;
+
Analytics* Analytics::_instance;
int const Analytics::_current_version = 1;
+
Analytics::Analytics ()
- : _successful_dcp_encodes (0)
{
}
+
void
Analytics::successful_dcp_encode ()
{
}
}
+
void
Analytics::write () const
{
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("Analytics");
+ auto root = doc.create_root_node ("Analytics");
root->add_child("Version")->add_child_text(raw_convert<string>(_current_version));
root->add_child("SuccessfulDCPEncodes")->add_child_text(raw_convert<string>(_successful_dcp_encodes));
}
}
+
void
Analytics::read ()
try
/* Never mind */
}
+
Analytics*
Analytics::instance ()
{
/*
- Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
-#include "state.h"
+
#include "signaller.h"
+#include "state.h"
#include <boost/signals2.hpp>
+
class Analytics : public State, public Signaller
{
public:
static Analytics* instance ();
private:
- int _successful_dcp_encodes;
+ int _successful_dcp_encodes = 0;
static Analytics* _instance;
static int const _current_version;
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "audio_delay.h"
#include "audio_buffers.h"
#include "dcpomatic_assert.h"
#include <iostream>
+
using std::cout;
+using std::make_shared;
using std::shared_ptr;
+
AudioDelay::AudioDelay (int samples)
: _samples (samples)
{
}
+
shared_ptr<AudioBuffers>
AudioDelay::run (shared_ptr<const AudioBuffers> in)
{
/* Keep tail */
if (!_tail) {
- _tail.reset (new AudioBuffers (in->channels(), _samples));
+ _tail = make_shared<AudioBuffers>(in->channels(), _samples);
}
_tail->copy_from (in.get(), _samples, in->frames() - _samples, 0);
out->copy_from (_tail.get(), out->frames(), 0, 0);
} else {
out->make_silent ();
- _tail.reset (new AudioBuffers (out->channels(), _samples));
+ _tail = make_shared<AudioBuffers>(out->channels(), _samples);
_tail->make_silent ();
}
return out;
}
+
void
AudioDelay::flush ()
{
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
class AudioBuffers;
+
/** @class AudioDelay
- * @brief An audio delay line.
+ * @brief An audio delay line
*/
class AudioDelay
{
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "audio_point.h"
#include "warnings.h"
#include <dcp/raw_convert.h>
#include <libxml++/libxml++.h>
DCPOMATIC_ENABLE_WARNINGS
+
using std::string;
using dcp::raw_convert;
+
AudioPoint::AudioPoint ()
{
for (int i = 0; i < COUNT; ++i) {
}
}
+
AudioPoint::AudioPoint (cxml::ConstNodePtr node)
{
- _data[PEAK] = node->number_child<float> ("Peak");
- _data[RMS] = node->number_child<float> ("RMS");
+ _data[PEAK] = node->number_child<float>("Peak");
+ _data[RMS] = node->number_child<float>("RMS");
}
+
AudioPoint::AudioPoint (AudioPoint const & other)
{
for (int i = 0; i < COUNT; ++i) {
}
}
+
AudioPoint &
AudioPoint::operator= (AudioPoint const & other)
{
return *this;
}
+
void
AudioPoint::as_xml (xmlpp::Element* parent) const
{
- parent->add_child ("Peak")->add_child_text (raw_convert<string> (_data[PEAK]));
- parent->add_child ("RMS")->add_child_text (raw_convert<string> (_data[RMS]));
+ parent->add_child("Peak")->add_child_text(raw_convert<string>(_data[PEAK]));
+ parent->add_child("RMS")->add_child_text(raw_convert<string>(_data[RMS]));
}
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_AUDIO_POINT_H
#define DCPOMATIC_AUDIO_POINT_H
+
#include <libcxml/cxml.h>
+
namespace xmlpp {
class Element;
}
+
class AudioPoint
{
public:
float _data[COUNT];
};
+
#endif
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "audio_processor.h"
+#include "config.h"
#include "mid_side_decoder.h"
#include "upmixer_a.h"
#include "upmixer_b.h"
-#include "config.h"
+
using std::string;
using std::list;
+
list<AudioProcessor const *> AudioProcessor::_all;
list<AudioProcessor const *> AudioProcessor::_non_experimental;
+
void
AudioProcessor::setup_audio_processors ()
{
- AudioProcessor* mid_side = new MidSideDecoder ();
+ auto mid_side = new MidSideDecoder ();
_all.push_back (mid_side);
_non_experimental.push_back (mid_side);
- _all.push_back (new UpmixerA (48000));
- _all.push_back (new UpmixerB (48000));
+ _all.push_back (new UpmixerA(48000));
+ _all.push_back (new UpmixerB(48000));
}
+
AudioProcessor const *
AudioProcessor::from_id (string id)
{
- for (list<AudioProcessor const *>::const_iterator i = _all.begin(); i != _all.end(); ++i) {
- if ((*i)->id() == id) {
- return *i;
+ for (auto i: _all) {
+ if (i->id() == id) {
+ return i;
}
}
- return 0;
+ return nullptr;
}
+
list<AudioProcessor const *>
AudioProcessor::visible ()
{
return _non_experimental;
}
+
list<AudioProcessor const *>
AudioProcessor::all ()
{
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/lib/audio_processor.h
* @brief AudioProcessor class.
*/
+
#ifndef DCPOMATIC_AUDIO_PROCESSOR_H
#define DCPOMATIC_AUDIO_PROCESSOR_H
+
#include "types.h"
#include <list>
#include <string>
#include <vector>
+
class AudioBuffers;
class AudioMapping;
+
/** @class AudioProcessor
* @brief A parent class for processors of audio data.
*
static std::list<AudioProcessor const *> _non_experimental;
};
+
#endif
using std::shared_ptr;
using boost::bind;
using boost::optional;
-using boost::function;
+using std::function;
using namespace dcpomatic;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
std::shared_ptr<Player> player,
AudioMapping map,
int audio_channels,
- boost::function<AVPixelFormat (AVPixelFormat)> pixel_format,
+ std::function<AVPixelFormat (AVPixelFormat)> pixel_format,
VideoRange video_range,
bool aligned,
bool fast
bool _disable_audio;
- boost::function<AVPixelFormat (AVPixelFormat)> _pixel_format;
+ std::function<AVPixelFormat (AVPixelFormat)> _pixel_format;
VideoRange _video_range;
bool _aligned;
bool _fast;
#include <boost/filesystem.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/optional.hpp>
-#include <boost/function.hpp>
#ifdef DCPOMATIC_WINDOWS
#define WEXITSTATUS(w) (w)
/*
- 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.
*/
-#include "cross.h"
+
#include "compose.hpp"
-#include "log.h"
-#include "dcpomatic_log.h"
#include "config.h"
-#include "exceptions.h"
+#include "cross.h"
+#include "dcpomatic_log.h"
#include "dcpomatic_log.h"
+#include "exceptions.h"
+#include "log.h"
#include <dcp/raw_convert.h>
#include <glib.h>
extern "C" {
#include <libavformat/avio.h>
}
#include <boost/algorithm/string.hpp>
-#include <boost/function.hpp>
#if BOOST_VERSION >= 106100
#include <boost/dll/runtime_symbol_info.hpp>
#endif
#include "i18n.h"
-using std::pair;
-using std::list;
-using std::ifstream;
-using std::string;
-using std::wstring;
-using std::make_pair;
-using std::vector;
+
using std::cerr;
using std::cout;
+using std::function;
+using std::ifstream;
+using std::list;
+using std::make_pair;
+using std::pair;
using std::runtime_error;
using std::shared_ptr;
+using std::string;
+using std::vector;
+using std::wstring;
using boost::optional;
-using boost::function;
+
/** @param s Number of seconds to sleep for */
void
sleep (s);
}
+
void
dcpomatic_sleep_milliseconds (int ms)
{
usleep (ms * 1000);
}
+
/** @return A string of CPU information (model name etc.) */
string
cpu_info ()
return info;
}
+
boost::filesystem::path
resources_path ()
{
}
}
-list<pair<string, string> >
+
+list<pair<string, string>>
mount_info ()
{
- list<pair<string, string> > m;
+ list<pair<string, string>> m;
- FILE* f = setmntent ("/etc/mtab", "r");
+ auto f = setmntent ("/etc/mtab", "r");
if (!f) {
return m;
}
boost::filesystem::path
openssl_path ()
{
- boost::filesystem::path p = directory_containing_executable() / "dcpomatic2_openssl";
+ auto p = directory_containing_executable() / "dcpomatic2_openssl";
if (boost::filesystem::is_regular_file(p)) {
return p;
}
FILE *
fopen_boost (boost::filesystem::path p, string t)
{
- return fopen (p.c_str(), t.c_str ());
+ return fopen(p.c_str(), t.c_str());
}
+
int
dcpomatic_fseek (FILE* stream, int64_t offset, int whence)
{
return fseek (stream, offset, whence);
}
+
void
Waker::nudge ()
{
}
+
Waker::Waker ()
{
}
+
Waker::~Waker ()
{
void
start_tool (string executable)
{
- boost::filesystem::path batch = directory_containing_executable() / executable;
+ auto batch = directory_containing_executable() / executable;
pid_t pid = fork ();
if (pid == 0) {
return (uint64_t) pthread_self ();
}
+
int
avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags)
{
return getenv("HOME");
}
+
/** @return true if this process is a 32-bit one running on a 64-bit-capable OS */
bool
running_32_on_64 ()
static
-vector<pair<string, string> >
+vector<pair<string, string>>
get_mounts (string prefix)
{
- vector<pair<string, string> > mounts;
+ vector<pair<string, string>> mounts;
std::ifstream f("/proc/mounts");
string line;
bool PrivilegeEscalator::test = false;
+
PrivilegeEscalator::~PrivilegeEscalator ()
{
if (!test) {
}
}
+
PrivilegeEscalator::PrivilegeEscalator ()
{
if (!test) {
}
}
+
boost::filesystem::path
config_path ()
{
}
+
string
dcpomatic::get_process_id ()
{
using std::map;
using std::shared_ptr;
using boost::optional;
-using boost::function;
+using std::function;
/** @param s Number of seconds to sleep for */
void
using std::string;
using std::cout;
-using boost::function;
+using std::function;
static size_t
read_callback (void* ptr, size_t size, size_t nmemb, void* object)
class CurlUploader : public Uploader
{
public:
- CurlUploader (boost::function<void (std::string)> set_status, boost::function<void (float)> set_progress);
+ CurlUploader (std::function<void (std::string)> set_status, std::function<void (float)> set_progress);
~CurlUploader ();
size_t read_callback (void* ptr, size_t size, size_t nmemb);
using std::vector;
using boost::scoped_ptr;
using boost::optional;
-using boost::function;
+using std::function;
using std::dynamic_pointer_cast;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
std::list<dcpomatic::DCPTimePeriod> reels (std::shared_ptr<const Film> film) const;
bool can_reference (
std::shared_ptr<const Film> film,
- boost::function <bool (std::shared_ptr<const Content>)>,
+ std::function <bool (std::shared_ptr<const Content>)>,
std::string overlapping,
std::string& why_not
) const;
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "dcp_subtitle.h"
#include "exceptions.h"
#include "compose.hpp"
#include "i18n.h"
-using std::string;
+
using std::exception;
using std::shared_ptr;
+using std::string;
+using std::make_shared;
+
shared_ptr<dcp::SubtitleAsset>
DCPSubtitle::load (boost::filesystem::path file) const
string smpte_error;
try {
- sc.reset (new dcp::InteropSubtitleAsset (file));
+ sc = make_shared<dcp::InteropSubtitleAsset>(file);
} catch (exception& e) {
interop_error = e.what ();
}
if (!sc) {
try {
- sc.reset (new dcp::SMPTESubtitleAsset (file));
+ sc = make_shared<dcp::SMPTESubtitleAsset>(file);
} catch (exception& e) {
smpte_error = e.what();
}
}
if (!sc) {
- throw FileError (String::compose (_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file);
+ throw FileError(String::compose(_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file);
}
return sc;
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_DCP_SUBTITLE_H
#define DCPOMATIC_DCP_SUBTITLE_H
+
#include <boost/filesystem.hpp>
+
namespace dcp {
class SubtitleAsset;
}
+
class DCPSubtitle
{
protected:
std::shared_ptr<dcp::SubtitleAsset> load (boost::filesystem::path) const;
};
+
#endif
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "dcpomatic_log.h"
#include "null_log.h"
+
/** The current log; set up by the front-ends when they have a Film to log into */
std::shared_ptr<Log> dcpomatic_log (new NullLog());
/*
- Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "log.h"
#include "compose.hpp"
+
/** The current log; set up by the front-ends when they have a Film to log into */
extern std::shared_ptr<Log> dcpomatic_log;
+
#define LOG_GENERAL(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
#define LOG_GENERAL_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_GENERAL);
#define LOG_ERROR(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_ERROR);
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "decoder_part.h"
#include "decoder.h"
-using std::shared_ptr;
DecoderPart::DecoderPart (Decoder* parent)
: _parent (parent)
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_DECODER_PART_H
#define DCPOMATIC_DECODER_PART_H
+
#include "dcpomatic_time.h"
#include <boost/optional.hpp>
+
class Decoder;
class Log;
class Film;
+
class DecoderPart
{
public:
bool _ignore;
};
+
#endif
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "ffmpeg_audio_stream.h"
#include <dcp/raw_convert.h>
#include "warnings.h"
DCPOMATIC_ENABLE_WARNINGS
#include <libcxml/cxml.h>
+
using std::string;
using boost::optional;
using dcp::raw_convert;
using namespace dcpomatic;
+
FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
: FFmpegStream (node)
, AudioStream (
- node->number_child<int> ("FrameRate"),
- node->optional_number_child<Frame>("Length").get_value_or (0),
- AudioMapping (node->node_child ("Mapping"), version)
+ node->number_child<int>("FrameRate"),
+ node->optional_number_child<Frame>("Length").get_value_or(0),
+ AudioMapping (node->node_child("Mapping"), version)
)
{
- optional<ContentTime::Type> const f = node->optional_number_child<ContentTime::Type> ("FirstAudio");
+ optional<ContentTime::Type> const f = node->optional_number_child<ContentTime::Type>("FirstAudio");
if (f) {
- first_audio = ContentTime (f.get ());
+ first_audio = ContentTime(f.get());
}
codec_name = node->optional_string_child("CodecName");
}
+
void
FFmpegAudioStream::as_xml (xmlpp::Node* root) const
{
FFmpegStream::as_xml (root);
- root->add_child("FrameRate")->add_child_text (raw_convert<string> (frame_rate ()));
- root->add_child("Length")->add_child_text (raw_convert<string> (length ()));
+ root->add_child("FrameRate")->add_child_text(raw_convert<string>(frame_rate()));
+ root->add_child("Length")->add_child_text(raw_convert<string>(length()));
mapping().as_xml (root->add_child("Mapping"));
if (first_audio) {
- root->add_child("FirstAudio")->add_child_text (raw_convert<string> (first_audio.get().get ()));
+ root->add_child("FirstAudio")->add_child_text(raw_convert<string>(first_audio.get().get()));
}
if (codec_name) {
- root->add_child("CodecName")->add_child_text (codec_name.get());
+ root->add_child("CodecName")->add_child_text(codec_name.get());
}
}
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
-#include "ffmpeg_stream.h"
+
#include "audio_stream.h"
#include "dcpomatic_time.h"
+#include "ffmpeg_stream.h"
+
struct ffmpeg_pts_offset_test;
+
class FFmpegAudioStream : public FFmpegStream, public AudioStream
{
public:
, AudioStream (0, 0, 0)
{}
};
+
/*
- 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.
*/
+
/** @file src/lib/file_group.cc
* @brief FileGroup class.
*/
-#include "file_group.h"
-#include "exceptions.h"
-#include "cross.h"
+
#include "compose.hpp"
+#include "cross.h"
#include "dcpomatic_assert.h"
+#include "exceptions.h"
+#include "file_group.h"
#include <sndfile.h>
#include <cstdio>
+
using std::vector;
+
/** Construct a FileGroup with no files */
FileGroup::FileGroup ()
- : _current_path (0)
- , _current_file (0)
- , _current_size (0)
- , _position (0)
{
}
+
/** Construct a FileGroup with a single file */
FileGroup::FileGroup (boost::filesystem::path p)
- : _current_path (0)
- , _current_file (0)
- , _current_size (0)
{
_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)
- , _current_path (0)
- , _current_file (0)
{
ensure_open_path (0);
seek (0, SEEK_SET);
}
+
/** Destroy a FileGroup, closing any open file */
FileGroup::~FileGroup ()
{
}
}
+
void
FileGroup::set_paths (vector<boost::filesystem::path> const & p)
{
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
_current_path = p;
_current_file = fopen_boost (_paths[_current_path], "rb");
- if (_current_file == 0) {
+ if (!_current_file) {
throw OpenFileError (_paths[_current_path], errno, OpenFileError::READ);
}
_current_size = boost::filesystem::file_size (_paths[_current_path]);
}
+
int64_t
FileGroup::seek (int64_t pos, int whence) const
{
return _position;
}
+
/** Try to read some data from the current position into a buffer.
* @param buffer Buffer to write data into.
* @param amount Number of bytes to read.
return read;
}
+
/** @return Combined length of all the files */
int64_t
FileGroup::length () const
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/lib/file_group.h
* @brief FileGroup class.
*/
+
#ifndef DCPOMATIC_FILE_GROUP_H
#define DCPOMATIC_FILE_GROUP_H
+
#include <boost/filesystem.hpp>
#include <vector>
+
/** @class FileGroup
* @brief A class to make a list of files behave like they were concatenated.
*/
std::vector<boost::filesystem::path> _paths;
/** Index of path that we are currently reading from */
- mutable size_t _current_path;
- mutable FILE* _current_file;
- mutable size_t _current_size;
- mutable int64_t _position;
+ mutable size_t _current_path = 0;
+ mutable FILE* _current_file = nullptr;
+ mutable size_t _current_size = 0;
+ mutable int64_t _position = 0;
};
+
#endif
/*
- 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 "frame_interval_checker.h"
+
using namespace dcpomatic;
+
int const FrameIntervalChecker::_frames = 16;
+
void
FrameIntervalChecker::feed (ContentTime time, double frame_rate)
{
_last = time;
}
+
FrameIntervalChecker::Guess
FrameIntervalChecker::guess () const
{
/* How soon can you land?
* I can't tell.
* You can tell me, I'm a doctor.
- * Nom I mean I'm just not sure.
+ * No I mean I'm just not sure.
* Can't you take a guess?
* Well, not for another two hours.
* You can't take a guess for another two hours?
/*
- Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "scoped_temporary.h"
#include "compose.hpp"
#include "exceptions.h"
#include "util.h"
#include <curl/curl.h>
#include <zip.h>
-#include <boost/function.hpp>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "i18n.h"
-using std::string;
+
+using std::function;
using std::list;
+using std::string;
using boost::optional;
-using boost::function;
using boost::algorithm::trim;
+
static size_t
ls_url_data (void* buffer, size_t size, size_t nmemb, void* output)
{
return nmemb;
}
+
list<string>
ls_url (string url)
{
- CURL* curl = curl_easy_init ();
+ auto curl = curl_easy_init ();
curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
curl_easy_setopt (curl, CURLOPT_DIRLISTONLY, 1);
string ls;
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ls_url_data);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, &ls);
- CURLcode const cr = curl_easy_perform (curl);
+ auto const cr = curl_easy_perform (curl);
if (cr != CURLE_OK) {
return list<string>();
return result;
}
+
static size_t
get_from_url_data (void* buffer, size_t size, size_t nmemb, void* stream)
{
- FILE* f = reinterpret_cast<FILE*> (stream);
+ auto f = reinterpret_cast<FILE*> (stream);
return fwrite (buffer, size, nmemb, f);
}
+
optional<string>
get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
{
- CURL* curl = curl_easy_init ();
+ auto curl = curl_easy_init ();
curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
- FILE* f = temp.open ("wb");
+ auto f = temp.open ("wb");
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, get_from_url_data);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
get_from_url (string url, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path)> load)
{
ScopedTemporary temp;
- optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp);
+ auto e = get_from_url (url, pasv, skip_pasv_ip, temp);
if (e) {
return e;
}
{
/* Download the ZIP file to temp_zip */
ScopedTemporary temp_zip;
- optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
+ auto e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
if (e) {
return e;
}
Centos 6, Centos 7, Debian 7 and Debian 8.
*/
- FILE* zip_file = fopen_boost (temp_zip.file (), "rb");
+ auto zip_file = fopen_boost (temp_zip.file (), "rb");
if (!zip_file) {
return optional<string> (_("Could not open downloaded ZIP file"));
}
- zip_source_t* zip_source = zip_source_filep_create (zip_file, 0, -1, 0);
+ auto zip_source = zip_source_filep_create (zip_file, 0, -1, 0);
if (!zip_source) {
return optional<string> (_("Could not open downloaded ZIP file"));
}
zip_error_t error;
zip_error_init (&error);
- zip_t* zip = zip_open_from_source (zip_source, ZIP_RDONLY, &error);
+ auto zip = zip_open_from_source (zip_source, ZIP_RDONLY, &error);
if (!zip) {
return String::compose (_("Could not open downloaded ZIP file (%1:%2: %3)"), error.zip_err, error.sys_err, error.str ? error.str : "");
}
}
ScopedTemporary temp_cert;
- FILE* f = temp_cert.open ("wb");
+ auto f = temp_cert.open ("wb");
char buffer[4096];
while (true) {
int const N = zip_fread (file_in_zip, buffer, sizeof (buffer));
/*
- Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
#include <boost/optional.hpp>
-#include <boost/function.hpp>
#include <boost/filesystem.hpp>
+
class ScopedTemporary;
+
boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp);
-boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, boost::function<boost::optional<std::string> (boost::filesystem::path)> load);
-boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, boost::function<boost::optional<std::string> (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, std::function<boost::optional<std::string> (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, std::function<boost::optional<std::string> (boost::filesystem::path)> load);
std::list<std::string> ls_url (std::string url);
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "j2k_image_proxy.h"
#include "dcpomatic_socket.h"
#include "image.h"
#include "i18n.h"
-using std::string;
+
using std::cout;
+using std::dynamic_pointer_cast;
+using std::make_pair;
+using std::make_shared;
using std::max;
using std::pair;
-using std::make_pair;
using std::shared_ptr;
+using std::string;
using boost::optional;
-using std::dynamic_pointer_cast;
using dcp::ArrayData;
using dcp::raw_convert;
+
/** Construct a J2KImageProxy from a JPEG2000 file */
J2KImageProxy::J2KImageProxy (boost::filesystem::path path, dcp::Size size, AVPixelFormat pixel_format)
: _data (new dcp::ArrayData(path))
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"));
- if (xml->optional_number_child<int> ("Eye")) {
- _eye = static_cast<dcp::Eye> (xml->number_child<int> ("Eye"));
+ _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"));
}
shared_ptr<ArrayData> data(new ArrayData(xml->number_child<int>("Size")));
/* This only matters when we are using J2KImageProxy for the preview, which
_data = data;
}
+
int
J2KImageProxy::prepare (optional<dcp::Size> target_size) const
{
try {
/* XXX: should check that potentially trashing _data here doesn't matter */
- shared_ptr<dcp::OpenJPEGImage> 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.reset (new Image (_pixel_format, decompressed->size(), true));
int const shift = 16 - decompressed->precision (0);
int* decomp_1 = decompressed->data (1);
int* decomp_2 = decompressed->data (2);
for (int y = 0; y < decompressed->size().height; ++y) {
- uint16_t* q = (uint16_t *) (_image->data()[0] + y * _image->stride()[0]);
+ auto q = reinterpret_cast<uint16_t *>(_image->data()[0] + y * _image->stride()[0]);
for (int x = 0; x < width; ++x) {
*q++ = decomp_0[p] << shift;
*q++ = decomp_1[p] << shift;
}
}
} catch (dcp::J2KDecompressionError& e) {
- _image.reset (new Image (_pixel_format, _size, true));
+ _image = make_shared<Image>(_pixel_format, _size, true);
_image->make_black ();
_error = true;
}
void
J2KImageProxy::add_metadata (xmlpp::Node* node) const
{
- node->add_child("Type")->add_child_text (N_("J2K"));
- node->add_child("Width")->add_child_text (raw_convert<string> (_size.width));
- node->add_child("Height")->add_child_text (raw_convert<string> (_size.height));
+ node->add_child("Type")->add_child_text(N_("J2K"));
+ node->add_child("Width")->add_child_text(raw_convert<string>(_size.width));
+ node->add_child("Height")->add_child_text(raw_convert<string>(_size.height));
if (_eye) {
- node->add_child("Eye")->add_child_text (raw_convert<string> (static_cast<int> (_eye.get ())));
+ node->add_child("Eye")->add_child_text(raw_convert<string>(static_cast<int>(_eye.get())));
}
- node->add_child("Size")->add_child_text (raw_convert<string>(_data->size()));
+ node->add_child("Size")->add_child_text(raw_convert<string>(_data->size()));
}
+
void
J2KImageProxy::write_to_socket (shared_ptr<Socket> socket) const
{
socket->write (_data->data(), _data->size());
}
+
bool
J2KImageProxy::same (shared_ptr<const ImageProxy> other) const
{
- shared_ptr<const J2KImageProxy> jp = dynamic_pointer_cast<const J2KImageProxy> (other);
+ auto jp = dynamic_pointer_cast<const J2KImageProxy>(other);
if (!jp) {
return false;
}
return *_data == *jp->_data;
}
+
J2KImageProxy::J2KImageProxy (ArrayData data, dcp::Size size, AVPixelFormat pixel_format)
: _data (new ArrayData(data))
, _size (size)
DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
}
+
size_t
J2KImageProxy::memory_used () const
{
/*
- Copyright (C) 2015-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "image_proxy.h"
#include <dcp/array_data.h>
#include <dcp/util.h>
#include <boost/thread/mutex.hpp>
+
namespace dcp {
class MonoPictureFrame;
class StereoPictureFrame;
}
+
class J2KImageProxy : public ImageProxy
{
public:
using std::cout;
using std::shared_ptr;
using boost::optional;
-using boost::function;
+using std::function;
using namespace dcpomatic;
/** @param film Associated film, or 0 */
return _film;
}
- void when_finished (boost::signals2::connection& connection, boost::function<void()> finished);
+ void when_finished (boost::signals2::connection& connection, std::function<void()> finished);
boost::signals2::signal<void()> Progress;
/** Emitted from the UI thread when the job is finished */
using std::dynamic_pointer_cast;
+using std::function;
using std::list;
using std::make_shared;
using std::shared_ptr;
using std::string;
using std::weak_ptr;
using boost::bind;
-using boost::function;
using boost::optional;
std::shared_ptr<const Playlist> playlist,
bool from_zero,
boost::signals2::connection& connection,
- boost::function<void()> ready
+ std::function<void()> ready
);
void analyse_subtitles (
std::shared_ptr<const Film> film,
std::shared_ptr<Content> content,
boost::signals2::connection& connection,
- boost::function<void()> ready
+ std::function<void()> ready
);
boost::signals2::signal<void (std::weak_ptr<Job>)> JobAdded;
#include "config.h"
#include "dcpomatic_log.h"
#include "emailer.h"
-#include <boost/function.hpp>
-#include <boost/function.hpp>
#include "i18n.h"
using std::list;
using std::shared_ptr;
using boost::optional;
-using boost::function;
+using std::function;
int
list<KDMWithMetadataPtr> kdms,
boost::filesystem::path directory,
dcp::NameFormat name_format,
- boost::function<bool (boost::filesystem::path)> confirm_overwrite
+ std::function<bool (boost::filesystem::path)> confirm_overwrite
)
{
int written = 0;
int write_files (
std::list<KDMWithMetadataPtr> screen_kdms, boost::filesystem::path directory,
- dcp::NameFormat name_format, boost::function<bool (boost::filesystem::path)> confirm_overwrite
+ dcp::NameFormat name_format, std::function<bool (boost::filesystem::path)> confirm_overwrite
);
boost::filesystem::path directory,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
- boost::function<bool (boost::filesystem::path)> confirm_overwrite
+ std::function<bool (boost::filesystem::path)> confirm_overwrite
);
boost::filesystem::path directory,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
- boost::function<bool (boost::filesystem::path)> confirm_overwrite
+ std::function<bool (boost::filesystem::path)> confirm_overwrite
);
#include "content.h"
using std::shared_ptr;
-using boost::function;
+using std::function;
using namespace dcpomatic;
ContentList overlaps (shared_ptr<const Film> film, ContentList cl, function<bool (shared_ptr<const Content>)> part, DCPTime from, DCPTime to)
* ContentList
*/
ContentList overlaps (
- std::shared_ptr<const Film> film, ContentList cl, boost::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime from, dcpomatic::DCPTime to
+ std::shared_ptr<const Film> film, ContentList cl, std::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime from, dcpomatic::DCPTime to
);
using std::string;
using std::weak_ptr;
using boost::optional;
-using boost::function;
+using std::function;
using dcp::Data;
using dcp::raw_convert;
void set_text (PositionImage);
- void prepare (boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast);
- std::shared_ptr<Image> image (boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
+ void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast);
+ std::shared_ptr<Image> image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
static AVPixelFormat force (AVPixelFormat, AVPixelFormat);
static AVPixelFormat keep_xyz_or_rgb (AVPixelFormat);
}
private:
- void make_image (boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
+ void make_image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
std::shared_ptr<const ImageProxy> _in;
Crop _crop;
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "position_image.h"
#include "image.h"
-#include <iostream>
-using std::cout;
bool
PositionImage::same (PositionImage const & other) const
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_POSITION_IMAGE_H
#define DCPOMATIC_POSITION_IMAGE_H
class Image;
+
class PositionImage
{
public:
bool same (PositionImage const & other) const;
};
+
#endif
}
void
-ReelWriter::calculate_digests (boost::function<void (float)> set_progress)
+ReelWriter::calculate_digests (std::function<void (float)> set_progress)
try
{
if (_picture_asset) {
bool ensure_subtitles,
std::set<DCPTextTrack> ensure_closed_captions
);
- void calculate_digests (boost::function<void (float)> set_progress);
+ void calculate_digests (std::function<void (float)> set_progress);
Frame start () const;
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "rgba.h"
#include "warnings.h"
DCPOMATIC_DISABLE_WARNINGS
DCPOMATIC_ENABLE_WARNINGS
#include <boost/lexical_cast.hpp>
+
using std::string;
using boost::lexical_cast;
+
RGBA::RGBA (cxml::ConstNodePtr node)
{
- r = node->number_child<int> ("R");
- g = node->number_child<int> ("G");
- b = node->number_child<int> ("B");
- a = node->number_child<int> ("A");
+ r = node->number_child<int>("R");
+ g = node->number_child<int>("G");
+ b = node->number_child<int>("B");
+ a = node->number_child<int>("A");
}
+
void
RGBA::as_xml (xmlpp::Node* parent) const
{
- parent->add_child("R")->add_child_text (lexical_cast<string> (int (r)));
- parent->add_child("G")->add_child_text (lexical_cast<string> (int (g)));
- parent->add_child("B")->add_child_text (lexical_cast<string> (int (b)));
- parent->add_child("A")->add_child_text (lexical_cast<string> (int (a)));
+ parent->add_child("R")->add_child_text(lexical_cast<string>(int(r)));
+ parent->add_child("G")->add_child_text(lexical_cast<string>(int(g)));
+ parent->add_child("B")->add_child_text(lexical_cast<string>(int(b)));
+ parent->add_child("A")->add_child_text(lexical_cast<string>(int(a)));
}
+
bool
RGBA::operator< (RGBA const & other) const
{
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_RGBA_H
#define DCPOMATIC_RGBA_H
+
#include <libcxml/cxml.h>
#include <stdint.h>
+
/** @class RGBA
* @brief A 32-bit RGBA colour.
*/
-
class RGBA
{
public:
- RGBA ()
- : r (0)
- , g (0)
- , b (0)
- , a (0)
- {}
+ RGBA () {}
RGBA (uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_)
: r (r_)
void as_xml (xmlpp::Node* parent) const;
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t a;
+ uint8_t r = 0;
+ uint8_t g = 0;
+ uint8_t b = 0;
+ uint8_t a = 0;
bool operator< (RGBA const & other) const;
};
+
#endif
/*
- Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "shuffler.h"
#include "content_video.h"
#include "dcpomatic_assert.h"
#include <string>
#include <iostream>
+
using std::make_pair;
+using std::shared_ptr;
using std::string;
using std::weak_ptr;
-using std::shared_ptr;
using boost::optional;
+
int const Shuffler::_max_size = 64;
+
struct Comparator
{
bool operator()(Shuffler::Store const & a, Shuffler::Store const & b) {
}
};
+
void
Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
{
return;
}
- shared_ptr<Piece> piece = weak_piece.lock ();
+ auto piece = weak_piece.lock ();
DCPOMATIC_ASSERT (piece);
if (!_last && video.eyes == Eyes::LEFT) {
}
}
+
void
Shuffler::clear ()
{
_last = optional<ContentVideo>();
}
+
void
Shuffler::flush ()
{
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "types.h"
#include "content_video.h"
#include <boost/signals2.hpp>
+
struct shuffler_test5;
+
class Piece;
+
class Shuffler
{
public:
/*
- Copyright (C) 2013-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "text_decoder.h"
#include "text_content.h"
#include "util.h"
#include <boost/algorithm/string.hpp>
#include <iostream>
+
using std::list;
using std::cout;
using std::string;
using std::max;
using std::shared_ptr;
using boost::optional;
-using boost::function;
+using std::function;
using namespace dcpomatic;
+
TextDecoder::TextDecoder (
Decoder* parent,
shared_ptr<const TextContent> c,
}
+
/** Called by subclasses when an image subtitle is starting.
* @param from From time of the subtitle.
* @param image Subtitle image.
_position = from;
}
+
void
TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
{
_position = from;
}
+
void
TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
{
emit_plain_start (from, out);
}
+
void
TextDecoder::emit_stop (ContentTime to)
{
Stop (to);
}
+
void
TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s)
{
emit_stop (period.to);
}
+
void
TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
{
emit_stop (period.to);
}
+
/* @param rect Area expressed as a fraction of the video frame that this subtitle
* is for (e.g. a width of 0.5 means the width of the subtitle is half the width
* of the video frame)
emit_stop (period.to);
}
+
void
TextDecoder::seek ()
{
/*
- 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_CAPTION_DECODER_H
#define DCPOMATIC_CAPTION_DECODER_H
+
#include "decoder.h"
#include "rect.h"
#include "types.h"
#include <dcp/subtitle_string.h>
#include <boost/signals2.hpp>
+
namespace sub {
class Subtitle;
}
class Image;
+
class TextDecoder : public DecoderPart
{
public:
boost::optional<dcpomatic::ContentTime> _position;
};
+
#endif
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "text_ring_buffers.h"
+
using std::pair;
using boost::optional;
using namespace dcpomatic;
+
void
TextRingBuffers::put (PlayerText text, DCPTextTrack track, DCPTimePeriod period)
{
_data.push_back (Data(text, track, period));
}
+
optional<TextRingBuffers::Data>
TextRingBuffers::get ()
{
boost::mutex::scoped_lock lm (_mutex);
- if (_data.empty ()) {
- return optional<Data>();
+ if (_data.empty()) {
+ return {};
}
- Data r = _data.front ();
- _data.pop_front ();
+ auto r = _data.front();
+ _data.pop_front();
return r;
}
+
void
TextRingBuffers::clear ()
{
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_TEXT_RING_BUFFERS_H
#define DCPOMATIC_TEXT_RING_BUFFERS_H
-#include "player_text.h"
+
#include "dcp_text_track.h"
+#include "player_text.h"
#include <boost/thread.hpp>
#include <utility>
+
class TextRingBuffers
{
public:
std::list<Data> _data;
};
+
#endif
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "uploader.h"
#include "dcpomatic_assert.h"
#include "compose.hpp"
#include "i18n.h"
+
using std::string;
using std::shared_ptr;
-using boost::function;
+using std::function;
+
Uploader::Uploader (function<void (string)> set_status, function<void (float)> set_progress)
: _set_progress (set_progress)
_set_status (_("connecting"));
}
+
boost::uintmax_t
Uploader::count_file_sizes (boost::filesystem::path directory) const
{
boost::uintmax_t size = 0;
- for (directory_iterator i = directory_iterator (directory); i != directory_iterator (); ++i) {
- if (is_directory (i->path ())) {
- size += count_file_sizes (i->path ());
+ for (auto i: directory_iterator(directory)) {
+ if (is_directory (i.path())) {
+ size += count_file_sizes (i.path());
} else {
- size += file_size (*i);
+ size += file_size (i);
}
}
return size;
}
+
void
Uploader::upload (boost::filesystem::path directory)
{
boost::uintmax_t transferred = 0;
- upload_directory (directory.parent_path (), directory, transferred, count_file_sizes (directory));
+ upload_directory (directory.parent_path(), directory, transferred, count_file_sizes(directory));
}
+
void
Uploader::upload_directory (boost::filesystem::path base, boost::filesystem::path directory, boost::uintmax_t& transferred, boost::uintmax_t total_size)
{
using namespace boost::filesystem;
- create_directory (remove_prefix (base, directory));
- for (directory_iterator i = directory_iterator (directory); i != directory_iterator (); ++i) {
- if (is_directory (i->path ())) {
- upload_directory (base, i->path (), transferred, total_size);
+ create_directory (remove_prefix(base, directory));
+ for (auto i: directory_iterator(directory)) {
+ if (is_directory(i.path())) {
+ upload_directory (base, i.path(), transferred, total_size);
} else {
- _set_status (String::compose (_("copying %1"), i->path().leaf ()));
- upload_file (i->path (), remove_prefix (base, i->path ()), transferred, total_size);
+ _set_status (String::compose(_("copying %1"), i.path().leaf()));
+ upload_file (i.path(), remove_prefix (base, i.path()), transferred, total_size);
}
}
}
+
boost::filesystem::path
Uploader::remove_prefix (boost::filesystem::path prefix, boost::filesystem::path target) const
{
path result;
- path::iterator i = target.begin ();
- for (path::iterator j = prefix.begin (); j != prefix.end(); ++j) {
+ auto i = target.begin ();
+ for (auto j = prefix.begin (); j != prefix.end(); ++j) {
DCPOMATIC_ASSERT (*i == *j);
++i;
}
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#ifndef DCPOMATIC_UPLOADER_H
#define DCPOMATIC_UPLOADER_H
+
#include <boost/filesystem.hpp>
-#include <boost/function.hpp>
+
class Job;
+
class Uploader
{
public:
- Uploader (boost::function<void (std::string)> set_status, boost::function<void (float)> set_progress);
+ Uploader (std::function<void (std::string)> set_status, std::function<void (float)> set_progress);
virtual ~Uploader () {}
void upload (boost::filesystem::path directory);
virtual void create_directory (boost::filesystem::path directory) = 0;
virtual void upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size) = 0;
- boost::function<void (float)> _set_progress;
+ std::function<void (float)> _set_progress;
private:
void upload_directory (boost::filesystem::path base, boost::filesystem::path directory, boost::uintmax_t& transferred, boost::uintmax_t total_size);
boost::uintmax_t count_file_sizes (boost::filesystem::path) const;
boost::filesystem::path remove_prefix (boost::filesystem::path prefix, boost::filesystem::path target) const;
- boost::function<void (std::string)> _set_status;
+ std::function<void (std::string)> _set_status;
};
#endif
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "upmixer_b.h"
#include "audio_buffers.h"
#include "audio_mapping.h"
#include "i18n.h"
+
using std::string;
+using std::make_shared;
using std::min;
using std::vector;
using std::shared_ptr;
+
UpmixerB::UpmixerB (int sampling_rate)
: _lfe (0.01, 150.0 / sampling_rate)
, _delay (0.02 * sampling_rate)
}
+
string
UpmixerB::name () const
{
return N_("stereo-5.1-upmix-b");
}
+
int
UpmixerB::out_channels () const
{
return 6;
}
+
shared_ptr<AudioProcessor>
UpmixerB::clone (int sampling_rate) const
{
- return shared_ptr<AudioProcessor> (new UpmixerB (sampling_rate));
+ return make_shared<UpmixerB>(sampling_rate);
}
+
shared_ptr<AudioBuffers>
UpmixerB::run (shared_ptr<const AudioBuffers> in, int channels)
{
- shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames()));
+ auto out = make_shared<AudioBuffers>(channels, in->frames());
/* L + R minus 6dB (in terms of amplitude) */
- shared_ptr<AudioBuffers> in_LR = in->channel(0);
+ auto in_LR = in->channel(0);
in_LR->accumulate_frames (in->channel(1).get(), in->frames(), 0, 0);
in_LR->apply_gain (-6);
shared_ptr<AudioBuffers> S;
if (channels > 4) {
/* Ls is L - R with some delay */
- shared_ptr<AudioBuffers> sub (new AudioBuffers (1, in->frames()));
+ auto sub = make_shared<AudioBuffers>(1, in->frames());
sub->copy_channel_from (in.get(), 0, 0);
float* p = sub->data (0);
float const * q = in->data (1);
return out;
}
+
void
UpmixerB::flush ()
{
_delay.flush ();
}
+
void
UpmixerB::make_audio_mapping_default (AudioMapping& mapping) const
{
}
}
+
vector<NamedChannel>
UpmixerB::input_names () const
{
- vector<NamedChannel> n;
- n.push_back (NamedChannel(_("Upmix L"), 0));
- n.push_back (NamedChannel(_("Upmix R"), 1));
- return n;
+ return {
+ NamedChannel(_("Upmix L"), 0),
+ NamedChannel(_("Upmix R"), 1)
+ };
}
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/lib/upmixer_b.h
* @brief UpmixerB class.
*/
+
#include "audio_processor.h"
#include "audio_filter.h"
#include "audio_delay.h"
+
class UpmixerB : public AudioProcessor
{
public:
LowPassAudioFilter _lfe;
AudioDelay _delay;
};
+
/** XXX: could use mmap? */
void
-copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)> progress)
+copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)> progress)
{
auto f = fopen_boost (from, "rb");
if (!f) {
extern std::string day_of_week_to_string (boost::gregorian::greg_weekday d);
extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
extern bool show_jobs_on_console (bool progress);
-extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)>);
+extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container);
extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
extern boost::filesystem::path default_font_file ();
pool.create_thread (boost::bind (&boost::asio::io_service::run, &service));
}
- boost::function<void (float)> set_progress;
+ std::function<void (float)> set_progress;
if (job) {
set_progress = boost::bind (&Writer::set_digest_progress, this, job.get(), _1);
} else {
/** Calculate hashes for any referenced MXF assets which do not already have one */
void
-Writer::calculate_referenced_digests (boost::function<void (float)> set_progress)
+Writer::calculate_referenced_digests (std::function<void (float)> set_progress)
try
{
for (auto const& i: _reel_assets) {
size_t video_reel (int frame) const;
void set_digest_progress (Job* job, float progress);
void write_cover_sheet (boost::filesystem::path output_dcp);
- void calculate_referenced_digests (boost::function<void (float)> set_progress);
+ void calculate_referenced_digests (std::function<void (float)> set_progress);
void write_hanging_text (ReelWriter& reel);
void calculate_digests ();
*/
+
/** @file src/tools/dcpomatic.cc
* @brief The main DCP-o-matic GUI.
*/
+
#include "wx/standard_controls.h"
#include "wx/film_viewer.h"
#include "wx/film_editor.h"
#undef check
#endif
+
using std::cout;
-using std::wcout;
+using std::dynamic_pointer_cast;
+using std::exception;
+using std::function;
+using std::list;
+using std::make_pair;
+using std::make_shared;
+using std::map;
+using std::shared_ptr;
using std::string;
using std::vector;
+using std::wcout;
using std::wstring;
using std::wstringstream;
-using std::map;
-using std::make_pair;
-using std::list;
-using std::exception;
-using std::make_shared;
-using std::shared_ptr;
-using std::dynamic_pointer_cast;
using boost::optional;
-using boost::function;
using boost::is_any_of;
using boost::algorithm::find;
#if BOOST_VERSION >= 106100
#endif
using dcp::raw_convert;
+
class FilmChangedClosingDialog
{
public:
explicit FilmChangedClosingDialog (string name)
{
_dialog = new wxMessageDialog (
- 0,
- wxString::Format (_("Save changes to film \"%s\" before closing?"), std_to_wx (name).data()),
+ nullptr,
+ wxString::Format(_("Save changes to film \"%s\" before closing?"), std_to_wx (name).data()),
/// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
/// project (Film) has been changed since it was last saved.
_("Film changed"),
explicit FilmChangedDuplicatingDialog (string name)
{
_dialog = new wxMessageDialog (
- 0,
- wxString::Format (_("Save changes to film \"%s\" before duplicating?"), std_to_wx (name).data()),
+ nullptr,
+ wxString::Format(_("Save changes to film \"%s\" before duplicating?"), std_to_wx (name).data()),
/// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
/// project (Film) has been changed since it was last saved.
_("Film changed"),
wxMessageDialog* _dialog;
};
+
#define ALWAYS 0x0
#define NEEDS_FILM 0x1
#define NOT_DURING_DCP_CREATION 0x2
#define NEEDS_CLIPBOARD 0x40
#define NEEDS_ENCRYPTION 0x80
+
map<wxMenuItem*, int> menu_items;
enum {
ID_forward_frame
};
+
class DOMFrame : public wxFrame
{
public:
- explicit DOMFrame (wxString const & title)
- : wxFrame (NULL, -1, title)
- , _video_waveform_dialog (0)
- , _system_information_dialog (0)
- , _hints_dialog (0)
- , _servers_list_dialog (0)
- , _config_dialog (0)
- , _kdm_dialog (0)
- , _dkdm_dialog (0)
- , _templates_dialog (0)
- , _file_menu (0)
- , _history_items (0)
- , _history_position (0)
- , _history_separator (0)
- , _update_news_requested (false)
- , _first_shown_called (false)
+ explicit DOMFrame (wxString const& title)
+ : wxFrame (nullptr, -1, title)
{
#if defined(DCPOMATIC_WINDOWS)
- if (Config::instance()->win32_console ()) {
+ if (Config::instance()->win32_console()) {
AllocConsole();
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
SetIcon (wxIcon (std_to_wx ("id")));
#endif
- _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this, _1));
+ _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this, _1));
config_changed (Config::OTHER);
_analytics_message_connection = Analytics::instance()->Message.connect(boost::bind(&DOMFrame::analytics_message, this, _1, _2));
/* Use a panel as the only child of the Frame so that we avoid
the dark-grey background on Windows.
*/
- wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
+ auto overall_panel = new wxPanel (this, wxID_ANY);
_film_viewer.reset (new FilmViewer (overall_panel));
_controls = new StandardControls (overall_panel, _film_viewer, true);
_controls->set_film (_film);
if (_video_waveform_dialog) {
_video_waveform_dialog->Destroy ();
- _video_waveform_dialog = 0;
+ _video_waveform_dialog = nullptr;
}
set_menu_sensitivity ();
if (_film && _film->directory()) {
}
/* Remove any existing DCP if the user agrees */
- boost::filesystem::path const dcp_dir = _film->dir (_film->dcp_name(), false);
- if (boost::filesystem::exists (dcp_dir)) {
+ auto const dcp_dir = _film->dir (_film->dcp_name(), false);
+ if (boost::filesystem::exists(dcp_dir)) {
if (!confirm_dialog (this, wxString::Format (_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) {
return;
}
if (_dkdm_dialog) {
_dkdm_dialog->Destroy ();
- _dkdm_dialog = 0;
+ _dkdm_dialog = nullptr;
}
_dkdm_dialog = new DKDMDialog (this, _film);
if (kdm) {
if (d->internal ()) {
auto dkdms = Config::instance()->dkdms();
- dkdms->add (shared_ptr<DKDM> (new DKDM (kdm.get())));
+ dkdms->add (make_shared<DKDM>(kdm.get()));
Config::instance()->changed ();
} else {
auto path = d->directory() / (_film->dcp_name(false) + "_DKDM.xml");
FilmEditor* _film_editor;
std::shared_ptr<FilmViewer> _film_viewer;
StandardControls* _controls;
- VideoWaveformDialog* _video_waveform_dialog;
- SystemInformationDialog* _system_information_dialog;
- HintsDialog* _hints_dialog;
- ServersListDialog* _servers_list_dialog;
- wxPreferencesEditor* _config_dialog;
- KDMDialog* _kdm_dialog;
- DKDMDialog* _dkdm_dialog;
- TemplatesDialog* _templates_dialog;
- wxMenu* _file_menu;
+ VideoWaveformDialog* _video_waveform_dialog = nullptr;
+ SystemInformationDialog* _system_information_dialog = nullptr;
+ HintsDialog* _hints_dialog = nullptr;
+ ServersListDialog* _servers_list_dialog = nullptr;
+ wxPreferencesEditor* _config_dialog = nullptr;
+ KDMDialog* _kdm_dialog = nullptr;
+ DKDMDialog* _dkdm_dialog = nullptr;
+ TemplatesDialog* _templates_dialog = nullptr;
+ wxMenu* _file_menu = nullptr;
shared_ptr<Film> _film;
- int _history_items;
- int _history_position;
- wxMenuItem* _history_separator;
+ int _history_items = 0;
+ int _history_position = 0;
+ wxMenuItem* _history_separator = nullptr;
boost::signals2::scoped_connection _config_changed_connection;
boost::signals2::scoped_connection _analytics_message_connection;
- bool _update_news_requested;
+ bool _update_news_requested = false;
shared_ptr<Content> _clipboard;
- bool _first_shown_called;
+ bool _first_shown_called = false;
};
+
static const wxCmdLineEntryDesc command_line_description[] = {
{ wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_OPTION, "c", "content", "add content file / directory", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
};
+
/** @class App
* @brief The magic App class for wxWidgets.
*/
public:
App ()
: wxApp ()
- , _frame (0)
- , _splash (0)
{
#ifdef DCPOMATIC_LINUX
XInitThreads ();
signal_manager = new wxSignalManager (this);
Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
- if (!_film_to_load.empty() && boost::filesystem::is_directory (_film_to_load)) {
+ if (!_film_to_load.empty() && boost::filesystem::is_directory(_film_to_load)) {
try {
_frame->load_film (_film_to_load);
} catch (exception& e) {
- error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what()));
+ error_dialog (nullptr, std_to_wx(String::compose(wx_to_std(_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what()));
}
}
if (!_film_to_create.empty ()) {
- _frame->new_film (_film_to_create, optional<string> ());
- if (!_content_to_add.empty ()) {
+ _frame->new_film (_film_to_create, optional<string>());
+ if (!_content_to_add.empty()) {
for (auto i: content_factory(_content_to_add)) {
- _frame->film()->examine_and_add_content (i);
+ _frame->film()->examine_and_add_content(i);
}
}
if (!_dcp_to_add.empty ()) {
- _frame->film()->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent(_dcp_to_add)));
+ _frame->film()->examine_and_add_content(make_shared<DCPContent>(_dcp_to_add));
}
}
}
}
- DOMFrame* _frame;
- wxSplashScreen* _splash;
+ DOMFrame* _frame = nullptr;
+ wxSplashScreen* _splash = nullptr;
shared_ptr<wxTimer> _timer;
string _film_to_load;
string _film_to_create;
string _dcp_to_add;
};
+
IMPLEMENT_APP (App)
using boost::bind;
using boost::optional;
using std::shared_ptr;
-using boost::function;
+using std::function;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
wxWindow* parent,
wxString title,
int border,
- boost::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
- boost::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
- boost::function<bool (void)> nag_alter
+ std::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
+ std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
+ std::function<bool (void)> nag_alter
);
void add_button (wxWindow* button);
wxStaticText* _private_key_bad;
wxSizer* _sizer;
wxBoxSizer* _button_sizer;
- boost::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
- boost::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
- boost::function<bool (void)> _nag_alter;
+ std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
+ std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
+ std::function<bool (void)> _nag_alter;
};
class KeysPage : public Page
#include <wx/wx.h>
#include <wx/gbsizer.h>
#include <wx/spinctrl.h>
-#include <boost/function.hpp>
#include <vector>
/** @class ContentWidget
wxWindow* parent,
T* wrapped,
int property,
- boost::function<std::shared_ptr<S> (Content*)> part,
- boost::function<U (S*)> model_getter,
- boost::function<void (S*, U)> model_setter,
- boost::function<void ()> view_changed,
- boost::function<U (V)> view_to_model,
- boost::function<V (U)> model_to_view
+ std::function<std::shared_ptr<S> (Content*)> part,
+ std::function<U (S*)> model_getter,
+ std::function<void (S*, U)> model_setter,
+ std::function<void ()> view_changed,
+ std::function<U (V)> view_to_model,
+ std::function<V (U)> model_to_view
)
: _wrapped (wrapped)
, _sizer (0)
wxButton* _button;
List _content;
int _property;
- boost::function<std::shared_ptr<S> (Content *)> _part;
- boost::function<U (S*)> _model_getter;
- boost::function<void (S*, U)> _model_setter;
- boost::function<void ()> _view_changed;
- boost::function<U (V)> _view_to_model;
- boost::function<V (U)> _model_to_view;
+ std::function<std::shared_ptr<S> (Content *)> _part;
+ std::function<U (S*)> _model_getter;
+ std::function<void (S*, U)> _model_setter;
+ std::function<void ()> _view_changed;
+ std::function<U (V)> _view_to_model;
+ std::function<V (U)> _model_to_view;
std::list<boost::signals2::connection> _connections;
bool _ignore_model_changes;
};
wxWindow* parent,
wxSpinCtrl* wrapped,
int property,
- boost::function<std::shared_ptr<S> (Content *)> part,
- boost::function<int (S*)> getter,
- boost::function<void (S*, int)> setter,
- boost::function<void ()> view_changed = boost::function<void ()>()
+ std::function<std::shared_ptr<S> (Content *)> part,
+ std::function<int (S*)> getter,
+ std::function<void (S*, int)> setter,
+ std::function<void ()> view_changed = std::function<void ()>()
)
: ContentWidget<S, wxSpinCtrl, int, int> (
parent,
wxWindow* parent,
wxSpinCtrlDouble* wrapped,
int property,
- boost::function<std::shared_ptr<S> (Content *)> part,
- boost::function<double (S*)> getter,
- boost::function<void (S*, double)> setter,
- boost::function<void ()> view_changed = boost::function<void ()>()
+ std::function<std::shared_ptr<S> (Content *)> part,
+ std::function<double (S*)> getter,
+ std::function<void (S*, double)> setter,
+ std::function<void ()> view_changed = std::function<void ()>()
)
: ContentWidget<S, wxSpinCtrlDouble, double, double> (
parent,
wxWindow* parent,
wxChoice* wrapped,
int property,
- boost::function<std::shared_ptr<S> (Content *)> part,
- boost::function<U (S*)> getter,
- boost::function<void (S*, U)> setter,
- boost::function<U (int)> view_to_model,
- boost::function<int (U)> model_to_view,
- boost::function<void ()> view_changed = boost::function<void()>()
+ std::function<std::shared_ptr<S> (Content *)> part,
+ std::function<U (S*)> getter,
+ std::function<void (S*, U)> setter,
+ std::function<U (int)> view_to_model,
+ std::function<int (U)> model_to_view,
+ std::function<void ()> view_changed = std::function<void()>()
)
: ContentWidget<S, wxChoice, U, int> (
parent,
#include "wx_util.h"
using std::string;
-using boost::function;
+using std::function;
using boost::optional;
CredentialsDownloadCertificatePanel::CredentialsDownloadCertificatePanel (
#define CREDENTIALS_DOWNLOAD_CERTIFICATE_PANEL_H
#include "download_certificate_panel.h"
-#include <boost/function.hpp>
class PasswordEntry;
public:
CredentialsDownloadCertificatePanel (
DownloadCertificateDialog* dialog,
- boost::function<boost::optional<std::string> ()> get_username,
- boost::function<void (std::string)> set_username,
- boost::function<void ()> unset_username,
- boost::function<boost::optional<std::string> ()> get_password,
- boost::function<void (std::string)> set_password,
- boost::function<void ()> unset_password
+ std::function<boost::optional<std::string> ()> get_username,
+ std::function<void (std::string)> set_username,
+ std::function<void ()> unset_username,
+ std::function<boost::optional<std::string> ()> get_password,
+ std::function<void (std::string)> set_password,
+ std::function<void ()> unset_password
);
virtual bool ready_to_download () const;
void username_changed ();
void password_changed ();
- boost::function<boost::optional<std::string> (void)> _get_username;
- boost::function<void (std::string)> _set_username;
- boost::function<void ()> _unset_username;
- boost::function<boost::optional<std::string> (void)> _get_password;
- boost::function<void (std::string)> _set_password;
- boost::function<void ()> _unset_password;
+ std::function<boost::optional<std::string> (void)> _get_username;
+ std::function<void (std::string)> _set_username;
+ std::function<void ()> _unset_username;
+ std::function<boost::optional<std::string> (void)> _get_password;
+ std::function<void (std::string)> _set_password;
+ std::function<void ()> _unset_password;
wxTextCtrl* _username;
PasswordEntry* _password;
using std::exception;
using std::make_pair;
using std::shared_ptr;
-using boost::function;
+using std::function;
DKDMOutputPanel::DKDMOutputPanel (wxWindow* parent)
std::pair<std::shared_ptr<Job>, int> make (
std::list<KDMWithMetadataPtr > kdms,
std::string name,
- boost::function<bool (boost::filesystem::path)> confirm_overwrite
+ std::function<bool (boost::filesystem::path)> confirm_overwrite
);
private:
#include "download_certificate_dialog.h"
#include "wx_util.h"
#include "lib/compose.hpp"
-#include "lib/util.h"
-#include "lib/signal_manager.h"
#include "lib/internet.h"
+#include "lib/signal_manager.h"
+#include "lib/util.h"
#include <dcp/raw_convert.h>
#include <curl/curl.h>
#include <zip.h>
#include <iostream>
-using std::string;
using std::cout;
+using std::function;
using std::list;
-using boost::function;
+using std::string;
using boost::optional;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
*/
-#include "wx_util.h"
-#include "download_certificate_panel.h"
#include "download_certificate_dialog.h"
-#include "lib/signal_manager.h"
+#include "download_certificate_panel.h"
+#include "wx_util.h"
#include "lib/compose.hpp"
-#include <dcp/util.h>
+#include "lib/signal_manager.h"
#include <dcp/certificate_chain.h>
#include <dcp/exceptions.h>
+#include <dcp/util.h>
#include <boost/bind/bind.hpp>
using std::string;
-using boost::function;
using boost::optional;
#include "dcpomatic_button.h"
#include <wx/wx.h>
#include <wx/listctrl.h>
-#include <boost/function.hpp>
#include <vector>
class EditableListColumn
EditableList (
wxWindow* parent,
std::vector<EditableListColumn> columns,
- boost::function<std::vector<T> ()> get,
- boost::function<void (std::vector<T>)> set,
- boost::function<std::string (T, int)> column,
+ std::function<std::vector<T> ()> get,
+ std::function<void (std::vector<T>)> set,
+ std::function<std::string (T, int)> column,
bool can_edit = true,
bool title = true
)
ev.Skip ();
}
- boost::function <std::vector<T> ()> _get;
- boost::function <void (std::vector<T>)> _set;
+ std::function <std::vector<T> ()> _get;
+ std::function <void (std::vector<T>)> _set;
std::vector<EditableListColumn> _columns;
- boost::function<std::string (T, int)> _column;
+ std::function<std::string (T, int)> _column;
wxButton* _add;
wxButton* _edit;
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/wx/film_editor.cc
* @brief FilmEditor class.
*/
+
#include "wx_util.h"
#include "film_editor.h"
#include "dcp_panel.h"
#include <wx/notebook.h>
#include <iostream>
+
using std::cout;
using std::string;
using std::list;
using namespace boost::placeholders;
#endif
+
FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer)
: wxPanel (parent)
{
- wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+ auto s = new wxBoxSizer (wxVERTICAL);
_main_notebook = new wxNotebook (this, wxID_ANY);
s->Add (_main_notebook, 1);
_main_notebook->AddPage (_dcp_panel->panel (), _("DCP"), false);
JobManager::instance()->ActiveJobsChanged.connect (
- bind (&FilmEditor::active_jobs_changed, this, _2)
+ bind(&FilmEditor::active_jobs_changed, this, _2)
);
set_film (shared_ptr<Film> ());
}
}
+
void
FilmEditor::film_content_change (ChangeType type, int property)
{
_dcp_panel->film_content_changed (property);
}
+
/** Sets the Film that we are editing */
void
FilmEditor::set_film (shared_ptr<Film> film)
{
- set_general_sensitivity (film != 0);
+ set_general_sensitivity (film != nullptr);
if (_film == film) {
return;
return;
}
- _film->Change.connect (bind (&FilmEditor::film_change, this, _1, _2));
- _film->ContentChange.connect (bind (&FilmEditor::film_content_change, this, _1, _3));
+ _film->Change.connect (bind(&FilmEditor::film_change, this, _1, _2));
+ _film->ContentChange.connect (bind(&FilmEditor::film_content_change, this, _1, _3));
if (_film->directory()) {
FileChanged (_film->directory().get());
}
if (!_film->content().empty()) {
- _content_panel->set_selection (_film->content().front ());
+ _content_panel->set_selection (_film->content().front());
}
}
+
void
FilmEditor::set_general_sensitivity (bool s)
{
_dcp_panel->set_general_sensitivity (s);
}
+
void
FilmEditor::active_jobs_changed (optional<string> j)
{
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/wx/film_editor.h
* @brief FilmEditor class.
*/
+
#include "lib/film.h"
#include "lib/warnings.h"
DCPOMATIC_DISABLE_WARNINGS
DCPOMATIC_ENABLE_WARNINGS
#include <boost/signals2.hpp>
+
class wxNotebook;
class Film;
class ContentPanel;
class DCPPanel;
class FilmViewer;
+
/** @class FilmEditor
* @brief A wx widget to edit a film's metadata, and perform various functions.
*/
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/full_config_dialog.cc
* @brief A dialogue to edit all DCP-o-matic configuration.
*/
-#include "full_config_dialog.h"
-#include "wx_util.h"
-#include "editable_list.h"
-#include "filter_dialog.h"
+
+#include "check_box.h"
+#include "config_dialog.h"
+#include "config_move_dialog.h"
+#include "dcpomatic_button.h"
#include "dir_picker_ctrl.h"
+#include "editable_list.h"
+#include "email_dialog.h"
#include "file_picker_ctrl.h"
-#include "server_dialog.h"
+#include "filter_dialog.h"
+#include "full_config_dialog.h"
#include "make_chain_dialog.h"
-#include "email_dialog.h"
-#include "name_format_editor.h"
#include "nag_dialog.h"
-#include "config_move_dialog.h"
-#include "config_dialog.h"
-#include "static_text.h"
-#include "check_box.h"
-#include "dcpomatic_button.h"
+#include "name_format_editor.h"
#include "password_entry.h"
+#include "server_dialog.h"
+#include "static_text.h"
+#include "wx_util.h"
#include "lib/config.h"
-#include "lib/ratio.h"
-#include "lib/filter.h"
+#include "lib/cross.h"
#include "lib/dcp_content_type.h"
+#include "lib/exceptions.h"
+#include "lib/filter.h"
#include "lib/log.h"
+#include "lib/ratio.h"
#include "lib/util.h"
-#include "lib/cross.h"
-#include "lib/exceptions.h"
-#include <dcp/locale_convert.h>
-#include <dcp/exceptions.h>
#include <dcp/certificate_chain.h>
-#include <wx/stdpaths.h>
+#include <dcp/exceptions.h>
+#include <dcp/locale_convert.h>
+#include <wx/filepicker.h>
#include <wx/preferences.h>
#include <wx/spinctrl.h>
-#include <wx/filepicker.h>
+#include <wx/stdpaths.h>
#include <RtAudio.h>
#include <boost/filesystem.hpp>
#include <iostream>
-using std::vector;
-using std::string;
-using std::list;
+
using std::cout;
-using std::pair;
+using std::function;
+using std::list;
using std::make_pair;
using std::map;
-using boost::bind;
+using std::pair;
using std::shared_ptr;
-using boost::function;
+using std::string;
+using std::vector;
+using boost::bind;
using boost::optional;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
using dcp::locale_convert;
+
class FullGeneralPage : public GeneralPage
{
public:
private:
void setup ()
{
- wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
_panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
int r = 0;
add_update_controls (table, r);
- _config_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind (&FullGeneralPage::config_file_changed, this));
- _cinemas_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind (&FullGeneralPage::cinemas_file_changed, this));
+ _config_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind(&FullGeneralPage::config_file_changed, this));
+ _cinemas_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind(&FullGeneralPage::cinemas_file_changed, this));
_master_encoding_threads->SetRange (1, 128);
_master_encoding_threads->Bind (wxEVT_SPINCTRL, boost::bind (&FullGeneralPage::master_encoding_threads_changed, this));
void config_changed ()
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
checked_set (_master_encoding_threads, config->master_encoding_threads ());
checked_set (_server_encoding_threads, config->server_encoding_threads ());
void export_cinemas_file ()
{
- wxFileDialog* d = new wxFileDialog (
- _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT ("XML files (*.xml)|*.xml"),
+ auto d = new wxFileDialog (
+ _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);
#ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
void analyse_ebur128_changed ()
{
- Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue ());
+ Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue());
}
#endif
void automatic_audio_analysis_changed ()
{
- Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue ());
+ Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue());
}
void master_encoding_threads_changed ()
{
- Config::instance()->set_master_encoding_threads (_master_encoding_threads->GetValue ());
+ Config::instance()->set_master_encoding_threads (_master_encoding_threads->GetValue());
}
void server_encoding_threads_changed ()
{
- Config::instance()->set_server_encoding_threads (_server_encoding_threads->GetValue ());
+ Config::instance()->set_server_encoding_threads (_server_encoding_threads->GetValue());
}
void config_file_changed ()
{
- Config* config = Config::instance();
+ auto config = Config::instance();
boost::filesystem::path new_file = wx_to_std(_config_file->GetPath());
if (new_file == config->config_file()) {
return;
}
bool copy_and_link = true;
if (boost::filesystem::exists(new_file)) {
- ConfigMoveDialog* d = new ConfigMoveDialog (_panel, new_file);
+ auto d = new ConfigMoveDialog (_panel, new_file);
if (d->ShowModal() == wxID_OK) {
copy_and_link = false;
}
wxCheckBox* _automatic_audio_analysis;
};
+
class DefaultsPage : public Page
{
public:
private:
void setup ()
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
{
add_label_to_sizer (table, _panel, _("Default duration of still images"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_still_length = new wxSpinCtrl (_panel);
s->Add (_still_length);
add_label_to_sizer (s, _panel, _("s"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
{
add_label_to_sizer (table, _panel, _("Default JPEG2000 bandwidth"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_j2k_bandwidth = new wxSpinCtrl (_panel);
s->Add (_j2k_bandwidth);
add_label_to_sizer (s, _panel, _("Mbit/s"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
{
add_label_to_sizer (table, _panel, _("Default audio delay"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_audio_delay = new wxSpinCtrl (_panel);
s->Add (_audio_delay);
add_label_to_sizer (s, _panel, _("ms"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
void config_changed ()
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
- vector<Ratio const *> containers = Ratio::containers ();
+ auto containers = Ratio::containers ();
for (size_t i = 0; i < containers.size(); ++i) {
- if (containers[i] == config->default_container ()) {
+ if (containers[i] == config->default_container()) {
_container->SetSelection (i);
}
}
- vector<DCPContentType const *> const ct = DCPContentType::all ();
+ auto const ct = DCPContentType::all ();
for (size_t i = 0; i < ct.size(); ++i) {
- if (ct[i] == config->default_dcp_content_type ()) {
+ if (ct[i] == config->default_dcp_content_type()) {
_dcp_content_type->SetSelection (i);
}
}
int const s = _dcp_audio_channels->GetSelection ();
if (s != wxNOT_FOUND) {
Config::instance()->set_default_dcp_audio_channels (
- locale_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s)))
+ locale_convert<int>(string_client_data(_dcp_audio_channels->GetClientObject(s)))
);
}
}
void container_changed ()
{
- vector<Ratio const *> ratio = Ratio::containers ();
+ auto ratio = Ratio::containers ();
Config::instance()->set_default_container (ratio[_container->GetSelection()]);
}
void dcp_content_type_changed ()
{
- vector<DCPContentType const *> ct = DCPContentType::all ();
+ auto ct = DCPContentType::all ();
Config::instance()->set_default_dcp_content_type (ct[_dcp_content_type->GetSelection()]);
}
wxChoice* _standard;
};
+
class EncodingServersPage : public Page
{
public:
_panel->GetSizer()->Add (_servers_list, 1, wxEXPAND | wxALL, _border);
- _use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind (&EncodingServersPage::use_any_servers_changed, this));
+ _use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind(&EncodingServersPage::use_any_servers_changed, this));
}
void config_changed ()
EditableList<string, ServerDialog>* _servers_list;
};
+
class TMSPage : public Page
{
public:
void config_changed ()
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
checked_set (_upload, config->upload_after_make_dcp());
checked_set (_tms_protocol, static_cast<int>(config->tms_protocol()));
PasswordEntry* _tms_password;
};
-static string
-column (string s)
-{
- return s;
-}
class EmailPage : public Page
{
private:
void setup ()
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border);
_password = new PasswordEntry (_panel);
table->Add (_password->get_panel(), 1, wxEXPAND | wxALL);
- _server->Bind (wxEVT_TEXT, boost::bind (&EmailPage::server_changed, this));
- _port->Bind (wxEVT_SPINCTRL, boost::bind (&EmailPage::port_changed, this));
- _protocol->Bind (wxEVT_CHOICE, boost::bind (&EmailPage::protocol_changed, this));
- _user->Bind (wxEVT_TEXT, boost::bind (&EmailPage::user_changed, this));
- _password->Changed.connect (boost::bind (&EmailPage::password_changed, this));
+ _server->Bind (wxEVT_TEXT, boost::bind(&EmailPage::server_changed, this));
+ _port->Bind (wxEVT_SPINCTRL, boost::bind(&EmailPage::port_changed, this));
+ _protocol->Bind (wxEVT_CHOICE, boost::bind(&EmailPage::protocol_changed, this));
+ _user->Bind (wxEVT_TEXT, boost::bind(&EmailPage::user_changed, this));
+ _password->Changed.connect (boost::bind(&EmailPage::password_changed, this));
}
void config_changed ()
{
auto config = Config::instance ();
- checked_set (_server, config->mail_server ());
- checked_set (_port, config->mail_port ());
+ checked_set (_server, config->mail_server());
+ checked_set (_port, config->mail_port());
switch (config->mail_protocol()) {
case EmailProtocol::AUTO:
checked_set (_protocol, 0);
checked_set (_protocol, 3);
break;
}
- checked_set (_user, config->mail_user ());
+ checked_set (_user, config->mail_user());
checked_set (_password, config->mail_password());
}
void server_changed ()
{
- Config::instance()->set_mail_server (wx_to_std (_server->GetValue ()));
+ Config::instance()->set_mail_server(wx_to_std(_server->GetValue()));
}
void port_changed ()
{
- Config::instance()->set_mail_port (_port->GetValue ());
+ Config::instance()->set_mail_port(_port->GetValue());
}
void protocol_changed ()
PasswordEntry* _password;
};
+
class KDMEmailPage : public Page
{
public:
columns,
bind (&Config::kdm_cc, Config::instance()),
bind (&Config::set_kdm_cc, Config::instance(), _1),
- bind (&column, _1)
- );
+ [] (string s, int) {
+ return s;
+ });
table->Add (_cc, 1, wxEXPAND | wxALL);
add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
wxButton* _reset_email;
};
+
class NotificationsPage : public Page
{
public:
private:
void setup ()
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border);
columns,
bind (&Config::notification_cc, Config::instance()),
bind (&Config::set_notification_cc, Config::instance(), _1),
- bind (&column, _1)
- );
+ [] (string s, int) {
+ return s;
+ });
table->Add (_cc, 1, wxEXPAND | wxALL);
add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
void config_changed ()
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
checked_set (_enable_message_box, config->notification(Config::MESSAGE_BOX));
checked_set (_enable_email, config->notification(Config::EMAIL));
void notification_subject_changed ()
{
- Config::instance()->set_notification_subject (wx_to_std (_subject->GetValue ()));
+ Config::instance()->set_notification_subject(wx_to_std(_subject->GetValue()));
}
void notification_from_changed ()
{
- Config::instance()->set_notification_from (wx_to_std (_from->GetValue ()));
+ Config::instance()->set_notification_from(wx_to_std(_from->GetValue()));
}
void notification_to_changed ()
{
- Config::instance()->set_notification_to (wx_to_std (_to->GetValue ()));
+ Config::instance()->set_notification_to(wx_to_std(_to->GetValue()));
}
void notification_bcc_changed ()
{
- Config::instance()->set_notification_bcc (wx_to_std (_bcc->GetValue ()));
+ Config::instance()->set_notification_bcc(wx_to_std(_bcc->GetValue()));
}
void notification_email_changed ()
{
- if (_email->GetValue().IsEmpty ()) {
+ if (_email->GetValue().IsEmpty()) {
/* Sometimes we get sent an erroneous notification that the email
is empty; I don't know why.
*/
return;
}
- Config::instance()->set_notification_email (wx_to_std (_email->GetValue ()));
+ Config::instance()->set_notification_email(wx_to_std(_email->GetValue()));
}
void reset_email ()
{
- Config::instance()->reset_notification_email ();
- checked_set (_email, Config::instance()->notification_email ());
+ Config::instance()->reset_notification_email();
+ checked_set (_email, Config::instance()->notification_email());
}
void type_changed (wxCheckBox* b, Config::Notification n)
wxButton* _reset_email;
};
+
class CoverSheetPage : public Page
{
public:
void config_changed ()
{
- checked_set (_cover_sheet, Config::instance()->cover_sheet ());
+ checked_set (_cover_sheet, Config::instance()->cover_sheet());
}
void cover_sheet_changed ()
*/
return;
}
- Config::instance()->set_cover_sheet (wx_to_std (_cover_sheet->GetValue ()));
+ Config::instance()->set_cover_sheet(wx_to_std(_cover_sheet->GetValue()));
}
void reset_cover_sheet ()
{
- Config::instance()->reset_cover_sheet ();
- checked_set (_cover_sheet, Config::instance()->cover_sheet ());
+ Config::instance()->reset_cover_sheet();
+ checked_set (_cover_sheet, Config::instance()->cover_sheet());
}
wxTextCtrl* _cover_sheet;
private:
void setup ()
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
add_label_to_sizer (table, _panel, _("Issuer"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
void config_changed ()
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
checked_set (_issuer, config->dcp_issuer ());
checked_set (_creator, config->dcp_creator ());
checked_set (_company_name, config->dcp_company_name ());
void issuer_changed ()
{
- Config::instance()->set_dcp_issuer (wx_to_std (_issuer->GetValue ()));
+ Config::instance()->set_dcp_issuer(wx_to_std(_issuer->GetValue()));
}
void creator_changed ()
{
- Config::instance()->set_dcp_creator (wx_to_std (_creator->GetValue ()));
+ Config::instance()->set_dcp_creator(wx_to_std(_creator->GetValue()));
}
void company_name_changed ()
{
- Config::instance()->set_dcp_company_name (wx_to_std(_company_name->GetValue()));
+ Config::instance()->set_dcp_company_name(wx_to_std(_company_name->GetValue()));
}
void product_name_changed ()
{
- Config::instance()->set_dcp_product_name (wx_to_std(_product_name->GetValue()));
+ Config::instance()->set_dcp_product_name(wx_to_std(_product_name->GetValue()));
}
void product_version_changed ()
{
- Config::instance()->set_dcp_product_version (wx_to_std(_product_version->GetValue()));
+ Config::instance()->set_dcp_product_version(wx_to_std(_product_version->GetValue()));
}
void j2k_comment_changed ()
public:
AdvancedPage (wxSize panel_size, int border)
: Page (panel_size, border)
- , _maximum_j2k_bandwidth (0)
- , _allow_any_dcp_frame_rate (0)
- , _allow_any_container (0)
- , _show_experimental_audio_processors (0)
- , _only_servers_encode (0)
- , _log_general (0)
- , _log_warning (0)
- , _log_error (0)
- , _log_timing (0)
- , _log_debug_threed (0)
- , _log_debug_encode (0)
- , _log_debug_email (0)
- , _log_debug_video_view (0)
- , _log_debug_player (0)
- , _log_debug_audio_analysis (0)
{}
wxString GetName () const
void setup ()
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
_video_display_mode = new wxChoice (_panel, wxID_ANY);
table->Add (_video_display_mode);
- wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to change display mode)"), false);
- wxFont font = restart->GetFont();
+ auto restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to change display mode)"), false);
+ auto font = restart->GetFont();
font.SetStyle (wxFONTSTYLE_ITALIC);
font.SetPointSize (font.GetPointSize() - 1);
restart->SetFont (font);
{
add_label_to_sizer (table, _panel, _("Maximum number of frames to store per thread"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_frames_in_memory_multiplier = new wxSpinCtrl (_panel);
s->Add (_frames_in_memory_multiplier, 1);
table->Add (s, 1);
{
add_top_aligned_label_to_sizer (table, _panel, _("Log"));
- wxBoxSizer* t = new wxBoxSizer (wxVERTICAL);
+ auto t = new wxBoxSizer (wxVERTICAL);
_log_general = new CheckBox (_panel, _("General"));
t->Add (_log_general, 1, wxEXPAND | wxALL);
_log_warning = new CheckBox (_panel, _("Warnings"));
void config_changed ()
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
checked_set (_maximum_j2k_bandwidth, config->maximum_j2k_bandwidth() / 1000000);
switch (config->video_view_type()) {
void maximum_j2k_bandwidth_changed ()
{
- Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000);
+ Config::instance()->set_maximum_j2k_bandwidth(_maximum_j2k_bandwidth->GetValue() * 1000000);
}
void video_display_mode_changed ()
{
if (_video_display_mode->GetSelection() == 0) {
- Config::instance()->set_video_view_type (Config::VIDEO_VIEW_SIMPLE);
+ Config::instance()->set_video_view_type(Config::VIDEO_VIEW_SIMPLE);
} else {
- Config::instance()->set_video_view_type (Config::VIDEO_VIEW_OPENGL);
+ Config::instance()->set_video_view_type(Config::VIDEO_VIEW_OPENGL);
}
}
void frames_in_memory_multiplier_changed ()
{
- Config::instance()->set_frames_in_memory_multiplier (_frames_in_memory_multiplier->GetValue());
+ Config::instance()->set_frames_in_memory_multiplier(_frames_in_memory_multiplier->GetValue());
}
void allow_any_dcp_frame_rate_changed ()
{
- Config::instance()->set_allow_any_dcp_frame_rate (_allow_any_dcp_frame_rate->GetValue ());
+ Config::instance()->set_allow_any_dcp_frame_rate(_allow_any_dcp_frame_rate->GetValue());
}
void allow_any_container_changed ()
{
- Config::instance()->set_allow_any_container (_allow_any_container->GetValue ());
+ Config::instance()->set_allow_any_container(_allow_any_container->GetValue());
}
void show_experimental_audio_processors_changed ()
{
- Config::instance()->set_show_experimental_audio_processors (_show_experimental_audio_processors->GetValue ());
+ Config::instance()->set_show_experimental_audio_processors(_show_experimental_audio_processors->GetValue());
}
void only_servers_encode_changed ()
{
- Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue ());
+ Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue());
}
void dcp_metadata_filename_format_changed ()
{
- Config::instance()->set_dcp_metadata_filename_format (_dcp_metadata_filename_format->get ());
+ Config::instance()->set_dcp_metadata_filename_format(_dcp_metadata_filename_format->get());
}
void dcp_asset_filename_format_changed ()
{
- Config::instance()->set_dcp_asset_filename_format (_dcp_asset_filename_format->get ());
+ Config::instance()->set_dcp_asset_filename_format(_dcp_asset_filename_format->get());
}
void log_changed ()
#ifdef DCPOMATIC_WINDOWS
void win32_console_changed ()
{
- Config::instance()->set_win32_console (_win32_console->GetValue ());
+ Config::instance()->set_win32_console(_win32_console->GetValue());
}
#endif
- wxSpinCtrl* _maximum_j2k_bandwidth;
- wxChoice* _video_display_mode;
- wxSpinCtrl* _frames_in_memory_multiplier;
- wxCheckBox* _allow_any_dcp_frame_rate;
- wxCheckBox* _allow_any_container;
- wxCheckBox* _show_experimental_audio_processors;
- wxCheckBox* _only_servers_encode;
- NameFormatEditor* _dcp_metadata_filename_format;
- NameFormatEditor* _dcp_asset_filename_format;
- wxCheckBox* _log_general;
- wxCheckBox* _log_warning;
- wxCheckBox* _log_error;
- wxCheckBox* _log_timing;
- wxCheckBox* _log_debug_threed;
- wxCheckBox* _log_debug_encode;
- wxCheckBox* _log_debug_email;
- wxCheckBox* _log_debug_video_view;
- wxCheckBox* _log_debug_player;
- wxCheckBox* _log_debug_audio_analysis;
+ wxSpinCtrl* _maximum_j2k_bandwidth = nullptr;
+ wxChoice* _video_display_mode = nullptr;
+ wxSpinCtrl* _frames_in_memory_multiplier = nullptr;
+ wxCheckBox* _allow_any_dcp_frame_rate = nullptr;
+ wxCheckBox* _allow_any_container = nullptr;
+ wxCheckBox* _show_experimental_audio_processors = nullptr;
+ wxCheckBox* _only_servers_encode = nullptr;
+ NameFormatEditor* _dcp_metadata_filename_format = nullptr;
+ NameFormatEditor* _dcp_asset_filename_format = nullptr;
+ wxCheckBox* _log_general = nullptr;
+ wxCheckBox* _log_warning = nullptr;
+ wxCheckBox* _log_error = nullptr;
+ wxCheckBox* _log_timing = nullptr;
+ wxCheckBox* _log_debug_threed = nullptr;
+ wxCheckBox* _log_debug_encode = nullptr;
+ wxCheckBox* _log_debug_email = nullptr;
+ wxCheckBox* _log_debug_video_view = nullptr;
+ wxCheckBox* _log_debug_player = nullptr;
+ wxCheckBox* _log_debug_audio_analysis = nullptr;
#ifdef DCPOMATIC_WINDOWS
- wxCheckBox* _win32_console;
+ wxCheckBox* _win32_console = nullptr;
#endif
};
+
wxPreferencesEditor*
create_full_config_dialog ()
{
- wxPreferencesEditor* e = new wxPreferencesEditor ();
+ auto e = new wxPreferencesEditor ();
#ifdef DCPOMATIC_OSX
/* Width that we force some of the config panels to be on OSX so that
int const border = 8;
#endif
- e->AddPage (new FullGeneralPage (ps, border));
- e->AddPage (new SoundPage (ps, border));
- e->AddPage (new DefaultsPage (ps, border));
- e->AddPage (new EncodingServersPage (ps, border));
- e->AddPage (new KeysPage (ps, border));
- e->AddPage (new TMSPage (ps, border));
- e->AddPage (new EmailPage (ps, border));
- e->AddPage (new KDMEmailPage (ps, border));
- e->AddPage (new NotificationsPage (ps, border));
- e->AddPage (new CoverSheetPage (ps, border));
- e->AddPage (new IdentifiersPage (ps, border));
- e->AddPage (new AdvancedPage (ps, border));
+ e->AddPage (new FullGeneralPage (ps, border));
+ e->AddPage (new SoundPage (ps, border));
+ e->AddPage (new DefaultsPage (ps, border));
+ e->AddPage (new EncodingServersPage(ps, border));
+ e->AddPage (new KeysPage (ps, border));
+ e->AddPage (new TMSPage (ps, border));
+ e->AddPage (new EmailPage (ps, border));
+ e->AddPage (new KDMEmailPage (ps, border));
+ e->AddPage (new NotificationsPage (ps, border));
+ e->AddPage (new CoverSheetPage (ps, border));
+ e->AddPage (new IdentifiersPage (ps, border));
+ e->AddPage (new AdvancedPage (ps, border));
return e;
}
/*
- Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/full_config_dialog.h
* @brief A dialogue to edit all DCP-o-matic configuration.
*/
+
class wxPreferencesEditor;
+
wxPreferencesEditor* create_full_config_dialog ();
+
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "job_view_dialog.h"
#include "normal_job_view.h"
#include "lib/job.h"
+
using std::shared_ptr;
+
JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job> job)
: TableDialog (parent, title, 4, 0, false)
, _job (job)
layout ();
SetMinSize (wxSize (960, -1));
- Bind (wxEVT_TIMER, boost::bind (&JobViewDialog::periodic, this));
- _timer.reset (new wxTimer (this));
+ Bind (wxEVT_TIMER, boost::bind(&JobViewDialog::periodic, this));
+ _timer.reset (new wxTimer(this));
_timer->Start (1000);
/* Start off with OK disabled and it will be enabled when the job is finished */
- wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+ auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
if (ok) {
ok->Enable (false);
}
}
+
JobViewDialog::~JobViewDialog ()
{
delete _view;
}
+
void
JobViewDialog::periodic ()
{
_view->maybe_pulse ();
- shared_ptr<Job> job = _job.lock ();
- wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+ auto job = _job.lock ();
+ auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
if (job && ok) {
ok->Enable (job->finished ());
}
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
class JobView;
class Job;
+
class JobViewDialog : public TableDialog
{
public:
private:
void periodic ();
- JobView* _view;
+ JobView* _view = nullptr;
std::weak_ptr<Job> _job;
std::shared_ptr<wxTimer> _timer;
};
using std::exception;
using std::make_pair;
using std::shared_ptr;
-using boost::function;
+using std::function;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
std::pair<std::shared_ptr<Job>, int> make (
std::list<KDMWithMetadataPtr > screen_kdms,
std::string name,
- boost::function<bool (boost::filesystem::path)> confirm_overwrite
+ std::function<bool (boost::filesystem::path)> confirm_overwrite
);
private:
/*
- Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "nag_dialog.h"
#include "wx_util.h"
#include "static_text.h"
#include "check_box.h"
+
using std::shared_ptr;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
if (can_cancel) {
flags |= wxCANCEL;
}
- wxSizer* buttons = CreateSeparatedButtonSizer (flags);
+ auto buttons = CreateSeparatedButtonSizer (flags);
if (buttons) {
sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
}
sizer->SetSizeHints (this);
}
+
void
NagDialog::shut_up (wxCommandEvent& ev)
{
Config::instance()->set_nagged (_nag, ev.IsChecked());
}
+
/** @return true if the user clicked Cancel */
bool
NagDialog::maybe_nag (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel)
/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/config.h"
#include "lib/warnings.h"
DCPOMATIC_DISABLE_WARNINGS
#include <wx/wx.h>
DCPOMATIC_ENABLE_WARNINGS
+
class NagDialog : public wxDialog
{
public:
using std::map;
using boost::bind;
using std::shared_ptr;
-using boost::function;
+using std::function;
using boost::optional;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#include "suspender.h"
-Suspender::Suspender(boost::function<void (int)> handler)
+Suspender::Suspender(std::function<void (int)> handler)
: _handler (handler)
- , _count (0)
{
}
*/
-#include <boost/function.hpp>
+#include <functional>
#include <set>
class Suspender
{
public:
- Suspender (boost::function<void (int)> handler);
+ Suspender (std::function<void (int)> handler);
bool check (int property);
void increment ();
void decrement ();
- boost::function<void (int)> _handler;
- int _count;
+ std::function<void (int)> _handler;
+ int _count = 0;
std::set<int> _pending;
};
#include <wx/wx.h>
DCPOMATIC_ENABLE_WARNINGS
#include <wx/gbsizer.h>
-#include <boost/function.hpp>
#include <boost/thread.hpp>
#include <boost/signals2.hpp>
#include <dcp/raw_convert.h>
#include <boost/test/unit_test.hpp>
#include <boost/bind/bind.hpp>
-#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include <iostream>
-Subproject commit 3596fb230c71b820ee5ced44d08d76a4ca3821d1
+Subproject commit 1ba6c3a1d4b3b507ef868aaacf9fa0383a7f22a9
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/ffmpeg_examiner_test.cc
* @brief FFmpegExaminer tests
* @ingroup selfcontained
*/
+
#include <boost/test/unit_test.hpp>
#include "lib/ffmpeg_examiner.h"
#include "lib/ffmpeg_content.h"
#include "lib/ffmpeg_audio_stream.h"
#include "test.h"
+
+using std::make_shared;
using std::shared_ptr;
using namespace dcpomatic;
+
/** Check that the FFmpegExaminer can extract the first video and audio time
* correctly from data/count300bd24.m2ts.
*/
BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_examiner_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/count300bd24.m2ts"));
- shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (content));
+ auto film = new_test_film ("ffmpeg_examiner_test");
+ auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts");
+ auto examiner = make_shared<FFmpegExaminer>(content);
BOOST_CHECK_EQUAL (examiner->first_video().get().get(), ContentTime::from_seconds(600).get());
BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 1U);
BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->first_audio.get().get(), ContentTime::from_seconds(600).get());
}
+
/** Check that audio sampling rate and channel counts are correctly picked up from
* a problematic file. When we used to specify analyzeduration and probesize
* this file's details were picked up incorrectly.
*/
BOOST_AUTO_TEST_CASE (ffmpeg_examiner_probesize_test)
{
- shared_ptr<FFmpegContent> content (new FFmpegContent(TestPaths::private_data() / "RockyTop10 Playlist Flat.m4v"));
- shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer(content));
+ auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "RockyTop10 Playlist Flat.m4v");
+ auto examiner = make_shared<FFmpegExaminer>(content);
BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 2U);
BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->frame_rate(), 48000);
using std::string;
using std::shared_ptr;
using std::make_shared;
-using boost::function;
+using std::function;
using namespace dcpomatic;
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/required_disk_space_test.cc
* @brief Check Film::required_disk_space
* @ingroup selfcontained
*/
+
#include "lib/content_factory.h"
#include "lib/dcp_content.h"
#include "lib/film.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
+using std::dynamic_pointer_cast;
using std::make_shared;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+
void check_within_n (int64_t a, int64_t b, int64_t n)
{
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/util_test.cc
* @brief Test various utility methods.
* @ingroup selfcontained
*/
+
#include "lib/util.h"
#include "lib/cross.h"
#include "lib/exceptions.h"
#include <boost/test/unit_test.hpp>
#include <boost/bind/bind.hpp>
-using std::string;
-using std::vector;
+
using std::list;
using std::shared_ptr;
+using std::string;
+using std::vector;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
using namespace dcpomatic;
+
BOOST_AUTO_TEST_CASE (digest_head_tail_test)
{
vector<boost::filesystem::path> p;
BOOST_CHECK_THROW (digest_head_tail (p, 1024), OpenFileError);
}
+
BOOST_AUTO_TEST_CASE (timecode_test)
{
- DCPTime t = DCPTime::from_seconds (2 * 60 * 60 + 4 * 60 + 31) + DCPTime::from_frames (19, 24);
+ auto t = DCPTime::from_seconds (2 * 60 * 60 + 4 * 60 + 31) + DCPTime::from_frames (19, 24);
BOOST_CHECK_EQUAL (t.timecode (24), "02:04:31:19");
}
+
BOOST_AUTO_TEST_CASE (seconds_to_approximate_hms_test)
{
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1), "1s");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2), "2s");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (60), "1m");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1.5 * 60), "1m 30s");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 60), "2m");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (17 * 60 + 20), "17m");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1 * 3600), "1h");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (3600 + 40 * 60), "1h 40m");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 3600), "2h");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 3600 - 1), "2h");
- BOOST_CHECK_EQUAL (seconds_to_approximate_hms (13 * 3600 + 40 * 60), "14h");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(1), "1s");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2), "2s");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(60), "1m");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(1.5 * 60), "1m 30s");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2 * 60), "2m");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(17 * 60 + 20), "17m");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(1 * 3600), "1h");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(3600 + 40 * 60), "1h 40m");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2 * 3600), "2h");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2 * 3600 - 1), "2h");
+ BOOST_CHECK_EQUAL (seconds_to_approximate_hms(13 * 3600 + 40 * 60), "14h");
}
+
BOOST_AUTO_TEST_CASE (time_to_hmsf_test)
{
BOOST_CHECK_EQUAL (time_to_hmsf(DCPTime::from_frames(12, 24), 24), "0:00:00.12");
BOOST_CHECK_EQUAL (time_to_hmsf(DCPTime::from_seconds(2 * 60 * 60 + 92), 24), "2:01:32.0");
}
+
BOOST_AUTO_TEST_CASE (tidy_for_filename_test)
{
BOOST_CHECK_EQUAL (tidy_for_filename ("fish\\chips"), "fish_chips");
BOOST_CHECK_EQUAL (tidy_for_filename ("abcdefghï"), "abcdefghï");
}
+
BOOST_AUTO_TEST_CASE (utf8_strlen_test)
{
BOOST_CHECK_EQUAL (utf8_strlen("hello world"), 11U);
BOOST_CHECK_EQUAL (utf8_strlen("hëłlo wørld"), 11U);
}
+
BOOST_AUTO_TEST_CASE (careful_string_filter_test)
{
BOOST_CHECK_EQUAL ("hello_world", careful_string_filter("hello_world"));
BOOST_CHECK_EQUAL ("hello_world_CcGgIOoSsUu", careful_string_filter("hello_world_ÇçĞğİÖöŞşÜü"));
}
+
static list<float> progress_values;
static void
progress_values.push_back (p);
}
+
BOOST_AUTO_TEST_CASE (copy_in_bits_test)
{
for (int i = 0; i < 32; ++i) {