summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-29 09:14:20 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-29 20:53:49 +0200
commit39fb8198febde1937019db1c300ec363aab5aa56 (patch)
tree52bc32134e8ae2b5587b3a62130baa9acf815b60 /src/lib
parentb249700e1da7dd6631a8b4440587f4093a2bdef1 (diff)
C++11 tidying.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cross_common.cc8
-rw-r--r--src/lib/dcp_decoder.cc2
-rw-r--r--src/lib/dcp_decoder.h18
-rw-r--r--src/lib/dcp_subtitle_decoder.cc21
-rw-r--r--src/lib/dcp_subtitle_decoder.h5
-rw-r--r--src/lib/dcpomatic_time.cc17
-rw-r--r--src/lib/dolby_cp750.cc5
-rw-r--r--src/lib/dolby_cp750.h5
-rw-r--r--src/lib/empty.cc14
-rw-r--r--src/lib/empty.h9
-rw-r--r--src/lib/ffmpeg_decoder.cc1
-rw-r--r--src/lib/ffmpeg_decoder.h6
-rw-r--r--src/lib/font.cc15
-rw-r--r--src/lib/font.h8
-rw-r--r--src/lib/hints.cc15
-rw-r--r--src/lib/hints.h3
-rw-r--r--src/lib/image_decoder.cc6
-rw-r--r--src/lib/image_decoder.h11
-rw-r--r--src/lib/kdm_recipient.cc6
-rw-r--r--src/lib/kdm_recipient.h6
-rw-r--r--src/lib/scp_uploader.cc42
-rw-r--r--src/lib/scp_uploader.h10
-rw-r--r--src/lib/spl.cc10
-rw-r--r--src/lib/usl.cc4
-rw-r--r--src/lib/usl.h5
-rw-r--r--src/lib/video_mxf_decoder.cc28
-rw-r--r--src/lib/video_mxf_decoder.h9
27 files changed, 191 insertions, 98 deletions
diff --git a/src/lib/cross_common.cc b/src/lib/cross_common.cc
index f8556b1fd..2e48bf3e0 100644
--- a/src/lib/cross_common.cc
+++ b/src/lib/cross_common.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,6 +18,7 @@
*/
+
#include "cross.h"
#include "compose.hpp"
#include "dcpomatic_log.h"
@@ -30,8 +31,10 @@ DCPOMATIC_ENABLE_WARNINGS
#include "i18n.h"
+
using std::string;
+
Drive::Drive (string xml)
{
cxml::Document doc;
@@ -50,7 +53,7 @@ string
Drive::as_xml () const
{
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("Drive");
+ auto root = doc.create_root_node ("Drive");
root->add_child("Device")->add_child_text(_device);
for (auto i: _mount_points) {
root->add_child("MountPoint")->add_child_text(i.string());
@@ -91,6 +94,7 @@ Drive::description () const
return String::compose(_("%1 (%2 GB) [%3]"), name, gb, _device);
}
+
string
Drive::log_summary () const
{
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index 566ed2935..f9b0d9a57 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -67,7 +67,6 @@ using namespace dcpomatic;
DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> c, bool fast, bool tolerant, shared_ptr<DCPDecoder> old)
: DCP (c, tolerant)
, Decoder (film)
- , _decode_referenced (false)
{
if (c->can_be_played()) {
if (c->video) {
@@ -125,7 +124,6 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
set_decode_referenced (false);
_reel = _reels.begin ();
- _offset = 0;
get_readers ();
}
diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h
index 887f8ad5c..a4dfbad4e 100644
--- a/src/lib/dcp_decoder.h
+++ b/src/lib/dcp_decoder.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,10 +18,12 @@
*/
+
/** @file src/dcp_decoder.h
* @brief A decoder of existing DCPs.
*/
+
#include "atmos_metadata.h"
#include "decoder.h"
#include "dcp.h"
@@ -30,6 +32,7 @@
#include <dcp/sound_asset_reader.h>
#include <dcp/subtitle_asset.h>
+
namespace dcp {
class Reel;
}
@@ -38,6 +41,7 @@ class DCPContent;
class Log;
struct dcp_subtitle_within_dcp_test;
+
class DCPDecoder : public DCP, public Decoder
{
public:
@@ -56,16 +60,16 @@ public:
void set_decode_referenced (bool r);
void set_forced_reduction (boost::optional<int> reduction);
- bool pass ();
- void seek (dcpomatic::ContentTime t, bool accurate);
+ bool pass () override;
+ void seek (dcpomatic::ContentTime t, bool accurate) override;
- std::vector<dcpomatic::FontData> fonts () const;
+ std::vector<dcpomatic::FontData> fonts () const override;
std::string lazy_digest () const {
return _lazy_digest;
}
- dcpomatic::ContentTime position () const;
+ dcpomatic::ContentTime position () const override;
private:
friend struct dcp_subtitle_within_dcp_test;
@@ -89,7 +93,7 @@ private:
std::vector<std::shared_ptr<dcp::Reel>>::iterator _reel;
/** Offset of _reel from the start of the content in frames */
- int64_t _offset;
+ int64_t _offset = 0;
/** Reader for current mono picture asset, if applicable */
std::shared_ptr<dcp::MonoPictureAssetReader> _mono_reader;
/** Reader for current stereo picture asset, if applicable */
@@ -99,7 +103,7 @@ private:
std::shared_ptr<dcp::AtmosAssetReader> _atmos_reader;
boost::optional<AtmosMetadata> _atmos_metadata;
- bool _decode_referenced;
+ bool _decode_referenced = false;
boost::optional<int> _forced_reduction;
std::string _lazy_digest;
diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc
index 1b144f204..024d62f34 100644
--- a/src/lib/dcp_subtitle_decoder.cc
+++ b/src/lib/dcp_subtitle_decoder.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,12 +18,14 @@
*/
+
#include "dcp_subtitle_decoder.h"
#include "dcp_subtitle_content.h"
#include <dcp/interop_subtitle_asset.h>
#include <dcp/load_font_node.h>
#include <iostream>
+
using std::cout;
using std::list;
using std::map;
@@ -31,13 +33,15 @@ using std::string;
using std::vector;
using std::shared_ptr;
using std::dynamic_pointer_cast;
+using std::make_shared;
using boost::bind;
using namespace dcpomatic;
+
DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const Film> film, shared_ptr<const DCPSubtitleContent> content)
: Decoder (film)
{
- shared_ptr<dcp::SubtitleAsset> c (load (content->path (0)));
+ auto c = load (content->path(0));
c->fix_empty_font_ids ();
_subtitles = c->subtitles ();
_next = _subtitles.begin ();
@@ -46,11 +50,11 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const Film> film, shared_ptr<
if (_next != _subtitles.end()) {
first = content_time_period(*_next).from;
}
- text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_text(), first)));
+ text.push_back (make_shared<TextDecoder>(this, content->only_text(), first));
- map<string, dcp::ArrayData> fm = c->font_data();
- for (map<string, dcp::ArrayData>::const_iterator j = fm.begin(); j != fm.end(); ++j) {
- _fonts.push_back (FontData(j->first, j->second));
+ auto fm = c->font_data();
+ for (auto const& i: fm) {
+ _fonts.push_back (FontData(i.first, i.second));
}
/* Add a default font for any LoadFont nodes in our file which we haven't yet found fonts for */
@@ -61,6 +65,7 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const Film> film, shared_ptr<
}
}
+
void
DCPSubtitleDecoder::seek (ContentTime time, bool accurate)
{
@@ -73,6 +78,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate)
}
}
+
bool
DCPSubtitleDecoder::pass ()
{
@@ -89,7 +95,7 @@ DCPSubtitleDecoder::pass ()
list<dcp::SubtitleString> s;
list<dcp::SubtitleImage> i;
- ContentTimePeriod const p = content_time_period (*_next);
+ auto const p = content_time_period (*_next);
while (_next != _subtitles.end () && content_time_period (*_next) == p) {
auto ns = dynamic_pointer_cast<const dcp::SubtitleString>(*_next);
@@ -113,6 +119,7 @@ DCPSubtitleDecoder::pass ()
return false;
}
+
ContentTimePeriod
DCPSubtitleDecoder::content_time_period (shared_ptr<const dcp::Subtitle> s) const
{
diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h
index a9540c3cf..95e783d06 100644
--- a/src/lib/dcp_subtitle_decoder.h
+++ b/src/lib/dcp_subtitle_decoder.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,12 +18,15 @@
*/
+
#include "text_decoder.h"
#include "dcp_subtitle.h"
#include "font_data.h"
+
class DCPSubtitleContent;
+
class DCPSubtitleDecoder : public DCPSubtitle, public Decoder
{
public:
diff --git a/src/lib/dcpomatic_time.cc b/src/lib/dcpomatic_time.cc
index 8abd77555..ac797f8f4 100644
--- a/src/lib/dcpomatic_time.cc
+++ b/src/lib/dcpomatic_time.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,26 +18,31 @@
*/
+
#include "dcpomatic_time.h"
#include <inttypes.h>
+
using std::string;
using namespace dcpomatic;
+
template <>
Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRateChange f)
- : _t (llrint (d.get() * f.speed_up))
+ : _t (llrint(d.get() * f.speed_up))
{
}
+
template <>
Time<DCPTimeDifferentiator, ContentTimeDifferentiator>::Time (ContentTime d, FrameRateChange f)
- : _t (llrint (d.get() / f.speed_up))
+ : _t (llrint(d.get() / f.speed_up))
{
}
+
DCPTime
dcpomatic::min (DCPTime a, DCPTime b)
{
@@ -48,6 +53,7 @@ dcpomatic::min (DCPTime a, DCPTime b)
return b;
}
+
DCPTime
dcpomatic::max (DCPTime a, DCPTime b)
{
@@ -58,6 +64,7 @@ dcpomatic::max (DCPTime a, DCPTime b)
return b;
}
+
ContentTime
dcpomatic::min (ContentTime a, ContentTime b)
{
@@ -68,6 +75,7 @@ dcpomatic::min (ContentTime a, ContentTime b)
return b;
}
+
ContentTime
dcpomatic::max (ContentTime a, ContentTime b)
{
@@ -78,6 +86,7 @@ dcpomatic::max (ContentTime a, ContentTime b)
return b;
}
+
string
dcpomatic::to_string (ContentTime t)
{
@@ -90,6 +99,7 @@ dcpomatic::to_string (ContentTime t)
return buffer;
}
+
string
dcpomatic::to_string (DCPTime t)
{
@@ -102,6 +112,7 @@ dcpomatic::to_string (DCPTime t)
return buffer;
}
+
string
dcpomatic::to_string (DCPTimePeriod p)
{
diff --git a/src/lib/dolby_cp750.cc b/src/lib/dolby_cp750.cc
index 380ab0564..667168722 100644
--- a/src/lib/dolby_cp750.cc
+++ b/src/lib/dolby_cp750.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,12 +18,15 @@
*/
+
#include "dolby_cp750.h"
#include "i18n.h"
+
using namespace std;
+
DolbyCP750::DolbyCP750 ()
: CinemaSoundProcessor ("dolby_cp750", _("Dolby CP650 or CP750"), 4.0f, 20, 3.33333333333333333)
{
diff --git a/src/lib/dolby_cp750.h b/src/lib/dolby_cp750.h
index 3162a962d..92f8ec446 100644
--- a/src/lib/dolby_cp750.h
+++ b/src/lib/dolby_cp750.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,12 +18,15 @@
*/
+
/** @file src/lib/dolby_cp750.h
* @brief DolbyCP750 class.
*/
+
#include "cinema_sound_processor.h"
+
class DolbyCP750 : public CinemaSoundProcessor
{
public:
diff --git a/src/lib/empty.cc b/src/lib/empty.cc
index 0cf2b85dc..f6dcad96f 100644
--- a/src/lib/empty.cc
+++ b/src/lib/empty.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,6 +18,7 @@
*/
+
#include "empty.h"
#include "film.h"
#include "playlist.h"
@@ -28,29 +29,32 @@
#include "piece.h"
#include <iostream>
+
using std::cout;
using std::list;
using std::shared_ptr;
using std::dynamic_pointer_cast;
-using boost::function;
+using std::function;
using namespace dcpomatic;
+
Empty::Empty (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist, function<bool (shared_ptr<const Content>)> part, DCPTime length)
{
list<DCPTimePeriod> full;
for (auto i: playlist->content()) {
if (part(i)) {
- full.push_back (DCPTimePeriod (i->position(), i->end(film)));
+ full.push_back (DCPTimePeriod(i->position(), i->end(film)));
}
}
_periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
- if (!_periods.empty ()) {
+ if (!_periods.empty()) {
_position = _periods.front().from;
}
}
+
void
Empty::set_position (DCPTime position)
{
@@ -70,6 +74,7 @@ Empty::set_position (DCPTime position)
}
}
+
DCPTimePeriod
Empty::period_at_position () const
{
@@ -82,6 +87,7 @@ Empty::period_at_position () const
DCPOMATIC_ASSERT (false);
}
+
bool
Empty::done () const
{
diff --git a/src/lib/empty.h b/src/lib/empty.h
index 443d3322b..145b84091 100644
--- a/src/lib/empty.h
+++ b/src/lib/empty.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,25 +18,29 @@
*/
+
#ifndef DCPOMATIC_EMPTY_H
#define DCPOMATIC_EMPTY_H
+
#include "playlist.h"
#include "dcpomatic_time.h"
#include "content_part.h"
#include <list>
+
struct empty_test1;
struct empty_test2;
struct empty_test3;
struct empty_test_with_overlapping_content;
struct player_subframe_test;
+
class Empty
{
public:
Empty () {}
- Empty (std::shared_ptr<const Film> film, std::shared_ptr<const Playlist> playlist, boost::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime length);
+ Empty (std::shared_ptr<const Film> film, std::shared_ptr<const Playlist> playlist, std::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime length);
dcpomatic::DCPTime position () const {
return _position;
@@ -59,4 +63,5 @@ private:
dcpomatic::DCPTime _position;
};
+
#endif
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 147bb384f..9d7e15557 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -81,7 +81,6 @@ using namespace dcpomatic;
FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmpegContent> c, bool fast)
: FFmpeg (c)
, Decoder (film)
- , _have_current_subtitle (false)
{
if (c->video && c->video->use()) {
video = make_shared<VideoDecoder>(this, c);
diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h
index e18d5e8eb..d19a9f703 100644
--- a/src/lib/ffmpeg_decoder.h
+++ b/src/lib/ffmpeg_decoder.h
@@ -46,8 +46,8 @@ class FFmpegDecoder : public FFmpeg, public Decoder
public:
FFmpegDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const FFmpegContent>, bool fast);
- bool pass ();
- void seek (dcpomatic::ContentTime time, bool);
+ bool pass () override;
+ void seek (dcpomatic::ContentTime time, bool) override;
private:
friend struct ::ffmpeg_pts_offset_test;
@@ -77,7 +77,7 @@ private:
dcpomatic::ContentTime _pts_offset;
boost::optional<dcpomatic::ContentTime> _current_subtitle_to;
/** true if we have a subtitle which has not had emit_stop called for it yet */
- bool _have_current_subtitle;
+ bool _have_current_subtitle = false;
std::shared_ptr<Image> _black_image;
diff --git a/src/lib/font.cc b/src/lib/font.cc
index aa9a8aaef..a2dc1945f 100644
--- a/src/lib/font.cc
+++ b/src/lib/font.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,31 +18,35 @@
*/
-#include "font.h"
+
#include "dcpomatic_assert.h"
+#include "font.h"
#include "warnings.h"
DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
DCPOMATIC_ENABLE_WARNINGS
+
using std::string;
using namespace dcpomatic;
+
Font::Font (cxml::NodePtr node)
- : _id (node->string_child ("Id"))
+ : _id (node->string_child("Id"))
{
for (auto i: node->node_children("File")) {
- string variant = i->optional_string_attribute("Variant").get_value_or ("Normal");
+ string variant = i->optional_string_attribute("Variant").get_value_or("Normal");
if (variant == "Normal") {
_file = i->content();
}
}
}
+
void
Font::as_xml (xmlpp::Node* node)
{
- node->add_child("Id")->add_child_text (_id);
+ node->add_child("Id")->add_child_text(_id);
if (_file) {
node->add_child("File")->add_child_text(_file->string());
}
@@ -59,6 +63,7 @@ dcpomatic::operator== (Font const & a, Font const & b)
return a.file() == b.file();
}
+
bool
dcpomatic::operator!= (Font const & a, Font const & b)
{
diff --git a/src/lib/font.h b/src/lib/font.h
index 5876bf8a4..ed3ecc38f 100644
--- a/src/lib/font.h
+++ b/src/lib/font.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,17 +18,21 @@
*/
+
#ifndef DCPOMATIC_FONT_H
#define DCPOMATIC_FONT_H
+
#include <libcxml/cxml.h>
#include <boost/optional.hpp>
#include <boost/signals2.hpp>
#include <boost/filesystem.hpp>
#include <string>
+
namespace dcpomatic {
+
class Font
{
public:
@@ -60,9 +64,11 @@ private:
boost::optional<boost::filesystem::path> _file;
};
+
bool operator!= (Font const & a, Font const & b);
bool operator== (Font const & a, Font const & b);
+
}
#endif
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index 52debf3ef..4d3b2d95e 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -18,6 +18,7 @@
*/
+
#include "dcp_content_type.h"
#include "hints.h"
#include "types.h"
@@ -45,6 +46,7 @@
#include "i18n.h"
+
using std::cout;
using std::make_shared;
using std::max;
@@ -82,12 +84,14 @@ Hints::Hints (weak_ptr<const Film> weak_film)
}
+
void
Hints::start ()
{
_thread = boost::thread (bind(&Hints::thread, this));
}
+
Hints::~Hints ()
{
boost::this_thread::disable_interruption dis;
@@ -256,7 +260,7 @@ Hints::check_big_font_files ()
for (auto i: film()->content()) {
for (auto j: i->text) {
for (auto k: j->fonts()) {
- optional<boost::filesystem::path> const p = k->file ();
+ auto const p = k->file ();
if (p && boost::filesystem::file_size(p.get()) >= (MAX_FONT_FILE_SIZE - SIZE_SLACK)) {
big_font_files = true;
}
@@ -276,7 +280,7 @@ Hints::check_vob ()
{
int vob = 0;
for (auto i: film()->content()) {
- if (boost::algorithm::starts_with (i->path(0).filename().string(), "VTS_")) {
+ if (boost::algorithm::starts_with(i->path(0).filename().string(), "VTS_")) {
++vob;
}
}
@@ -330,8 +334,8 @@ Hints::check_loudness ()
ch = ch.substr (0, ch.length() - 2);
- if (!ch.empty ()) {
- hint (String::compose (
+ if (!ch.empty()) {
+ hint(String::compose(
_("Your audio level is very high (on %1). You should reduce the gain of your audio content."),
ch
)
@@ -445,7 +449,7 @@ try
bool ccap_mxf_too_big = false;
bool subs_mxf_too_big = false;
- boost::filesystem::path dcp_dir = film->dir("hints") / dcpomatic::get_process_id();
+ auto dcp_dir = film->dir("hints") / dcpomatic::get_process_id();
boost::filesystem::remove_all (dcp_dir);
_writer->finish (film->dir("hints") / dcpomatic::get_process_id());
@@ -491,6 +495,7 @@ catch (...)
store_current ();
}
+
void
Hints::hint (string h)
{
diff --git a/src/lib/hints.h b/src/lib/hints.h
index 06155f434..81a37a3c4 100644
--- a/src/lib/hints.h
+++ b/src/lib/hints.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,6 +18,7 @@
*/
+
#include "audio_analyser.h"
#include "signaller.h"
#include "player_text.h"
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc
index 2f7416c62..2e0a98092 100644
--- a/src/lib/image_decoder.cc
+++ b/src/lib/image_decoder.cc
@@ -18,6 +18,7 @@
*/
+
#include "image_content.h"
#include "image_decoder.h"
#include "video_decoder.h"
@@ -33,20 +34,22 @@
#include "i18n.h"
+
using std::cout;
using std::make_shared;
using std::shared_ptr;
using dcp::Size;
using namespace dcpomatic;
+
ImageDecoder::ImageDecoder (shared_ptr<const Film> film, shared_ptr<const ImageContent> c)
: Decoder (film)
, _image_content (c)
- , _frame_video_position (0)
{
video = make_shared<VideoDecoder>(this, c);
}
+
bool
ImageDecoder::pass ()
{
@@ -80,6 +83,7 @@ ImageDecoder::pass ()
return false;
}
+
void
ImageDecoder::seek (ContentTime time, bool accurate)
{
diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h
index d575f9021..067a24720 100644
--- a/src/lib/image_decoder.h
+++ b/src/lib/image_decoder.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,12 +18,15 @@
*/
+
#include "decoder.h"
+
class ImageContent;
class Log;
class ImageProxy;
+
class ImageDecoder : public Decoder
{
public:
@@ -33,12 +36,12 @@ public:
return _image_content;
}
- bool pass ();
- void seek (dcpomatic::ContentTime, bool);
+ bool pass () override;
+ void seek (dcpomatic::ContentTime, bool) override;
private:
std::shared_ptr<const ImageContent> _image_content;
std::shared_ptr<ImageProxy> _image;
- Frame _frame_video_position;
+ Frame _frame_video_position = 0;
};
diff --git a/src/lib/kdm_recipient.cc b/src/lib/kdm_recipient.cc
index d05192ac6..cde41e22d 100644
--- a/src/lib/kdm_recipient.cc
+++ b/src/lib/kdm_recipient.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,11 +18,13 @@
*/
+
#include "kdm_recipient.h"
+
KDMRecipient::KDMRecipient (cxml::ConstNodePtr node)
: name (node->string_child("Name"))
- , notes (node->optional_string_child("Notes").get_value_or (""))
+ , notes (node->optional_string_child("Notes").get_value_or(""))
{
if (node->optional_string_child("Certificate")) {
recipient = dcp::Certificate (node->string_child("Certificate"));
diff --git a/src/lib/kdm_recipient.h b/src/lib/kdm_recipient.h
index e92fc3c48..85352f0ee 100644
--- a/src/lib/kdm_recipient.h
+++ b/src/lib/kdm_recipient.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,9 +18,11 @@
*/
+
#ifndef DCPOMATIC_KDM_RECIPIENT_H
#define DCPOMATIC_KDM_RECIPIENT_H
+
#include "warnings.h"
#include <dcp/certificate.h>
#include <libcxml/cxml.h>
@@ -30,6 +32,7 @@ DCPOMATIC_ENABLE_WARNINGS
#include <boost/optional.hpp>
#include <string>
+
class KDMRecipient
{
public:
@@ -50,4 +53,5 @@ public:
boost::optional<dcp::Certificate> recipient;
};
+
#endif
diff --git a/src/lib/scp_uploader.cc b/src/lib/scp_uploader.cc
index 0926ffa9f..9c349f233 100644
--- a/src/lib/scp_uploader.cc
+++ b/src/lib/scp_uploader.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,6 +18,7 @@
*/
+
#include "scp_uploader.h"
#include "exceptions.h"
#include "job.h"
@@ -29,52 +30,55 @@
#include "i18n.h"
-using std::string;
+
+using std::function;
using std::min;
using std::shared_ptr;
-using boost::function;
+using std::string;
+
SCPUploader::SCPUploader (function<void (string)> set_status, function<void (float)> set_progress)
: Uploader (set_status, set_progress)
{
_session = ssh_new ();
if (!_session) {
- throw NetworkError (_("could not start SSH session"));
+ throw NetworkError (String::compose(_("SSH error [%1]"), "ssh_new"));
}
- ssh_options_set (_session, SSH_OPTIONS_HOST, Config::instance()->tms_ip().c_str ());
- ssh_options_set (_session, SSH_OPTIONS_USER, Config::instance()->tms_user().c_str ());
+ ssh_options_set (_session, SSH_OPTIONS_HOST, Config::instance()->tms_ip().c_str());
+ ssh_options_set (_session, SSH_OPTIONS_USER, Config::instance()->tms_user().c_str());
int const port = 22;
ssh_options_set (_session, SSH_OPTIONS_PORT, &port);
int r = ssh_connect (_session);
if (r != SSH_OK) {
- throw NetworkError (String::compose (_("Could not connect to server %1 (%2)"), Config::instance()->tms_ip(), ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("Could not connect to server %1 (%2)"), Config::instance()->tms_ip(), ssh_get_error(_session)));
}
DCPOMATIC_DISABLE_WARNINGS
r = ssh_is_server_known (_session);
if (r == SSH_SERVER_ERROR) {
- throw NetworkError (String::compose (_("SSH error (%1)"), ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("SSH error [%1] (%2)"), "ssh_is_server_known", ssh_get_error(_session)));
}
DCPOMATIC_ENABLE_WARNINGS
r = ssh_userauth_password (_session, 0, Config::instance()->tms_password().c_str ());
if (r != SSH_AUTH_SUCCESS) {
- throw NetworkError (String::compose (_("Failed to authenticate with server (%1)"), ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("Failed to authenticate with server (%1)"), ssh_get_error(_session)));
}
- _scp = ssh_scp_new (_session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, Config::instance()->tms_path().c_str ());
+ _scp = ssh_scp_new (_session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, Config::instance()->tms_path().c_str());
if (!_scp) {
- throw NetworkError (String::compose (_("could not start SCP session (%1)"), ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("SSH error [%1] (%2)"), "ssh_scp_new", ssh_get_error(_session)));
}
r = ssh_scp_init (_scp);
if (r != SSH_OK) {
- throw NetworkError (String::compose (_("Could not start SCP session (%1)"), ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("SSH error [%1] (%2)"), "ssh_scp_init", ssh_get_error(_session)));
}
}
+
SCPUploader::~SCPUploader ()
{
ssh_scp_free (_scp);
@@ -82,26 +86,28 @@ SCPUploader::~SCPUploader ()
ssh_free (_session);
}
+
void
SCPUploader::create_directory (boost::filesystem::path directory)
{
/* Use generic_string so that we get forward-slashes in the path, even on Windows */
int const r = ssh_scp_push_directory (_scp, directory.generic_string().c_str(), S_IRWXU);
if (r != SSH_OK) {
- throw NetworkError (String::compose (_("Could not create remote directory %1 (%2)"), directory, ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("Could not create remote directory %1 (%2)"), directory, ssh_get_error(_session)));
}
}
+
void
SCPUploader::upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size)
{
- boost::uintmax_t to_do = boost::filesystem::file_size (from);
+ auto to_do = boost::filesystem::file_size (from);
/* Use generic_string so that we get forward-slashes in the path, even on Windows */
ssh_scp_push_file (_scp, to.generic_string().c_str(), to_do, S_IRUSR | S_IWUSR);
- FILE* f = fopen_boost (from, "rb");
- if (f == 0) {
- throw NetworkError (String::compose (_("Could not open %1 to send"), from));
+ auto f = fopen_boost (from, "rb");
+ if (f == nullptr) {
+ throw NetworkError (String::compose(_("Could not open %1 to send"), from));
}
boost::uintmax_t buffer_size = 64 * 1024;
@@ -118,7 +124,7 @@ SCPUploader::upload_file (boost::filesystem::path from, boost::filesystem::path
int const r = ssh_scp_write (_scp, buffer, t);
if (r != SSH_OK) {
fclose (f);
- throw NetworkError (String::compose (_("Could not write to remote file (%1)"), ssh_get_error (_session)));
+ throw NetworkError (String::compose(_("Could not write to remote file (%1)"), ssh_get_error(_session)));
}
to_do -= t;
transferred += t;
diff --git a/src/lib/scp_uploader.h b/src/lib/scp_uploader.h
index 5c90db927..e6bf7da2b 100644
--- a/src/lib/scp_uploader.h
+++ b/src/lib/scp_uploader.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,18 +18,20 @@
*/
+
#include "uploader.h"
#include <libssh/libssh.h>
+
class SCPUploader : public Uploader
{
public:
- SCPUploader (boost::function<void (std::string)> set_status, boost::function<void (float)> set_progress);
+ SCPUploader (std::function<void (std::string)> set_status, std::function<void (float)> set_progress);
~SCPUploader ();
protected:
- virtual void create_directory (boost::filesystem::path directory);
- virtual void upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size);
+ virtual void create_directory (boost::filesystem::path directory) override;
+ virtual void upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size) override;
private:
ssh_session _session;
diff --git a/src/lib/spl.cc b/src/lib/spl.cc
index 1677e626f..8d0dcc6fc 100644
--- a/src/lib/spl.cc
+++ b/src/lib/spl.cc
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,6 +18,7 @@
*/
+
#include "content_store.h"
#include "spl.h"
#include "warnings.h"
@@ -28,11 +29,13 @@ DCPOMATIC_DISABLE_WARNINGS
DCPOMATIC_ENABLE_WARNINGS
#include <iostream>
+
using std::cout;
using std::string;
using std::shared_ptr;
using dcp::raw_convert;
+
void
SPL::read (boost::filesystem::path path, ContentStore* store)
{
@@ -43,7 +46,7 @@ SPL::read (boost::filesystem::path path, ContentStore* store)
_id = doc.string_child("Id");
_name = doc.string_child("Name");
for (auto i: doc.node_children("Entry")) {
- shared_ptr<Content> c = store->get(i->string_child("Digest"));
+ auto c = store->get(i->string_child("Digest"));
if (c) {
add (SPLEntry(c));
} else {
@@ -52,11 +55,12 @@ SPL::read (boost::filesystem::path path, ContentStore* store)
}
}
+
void
SPL::write (boost::filesystem::path path) const
{
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("SPL");
+ auto root = doc.create_root_node ("SPL");
root->add_child("Id")->add_child_text (_id);
root->add_child("Name")->add_child_text (_name);
for (auto i: _spl) {
diff --git a/src/lib/usl.cc b/src/lib/usl.cc
index b8a9a71f0..063cc8d61 100644
--- a/src/lib/usl.cc
+++ b/src/lib/usl.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,10 +18,12 @@
*/
+
#include "usl.h"
#include "i18n.h"
+
USL::USL ()
: CinemaSoundProcessor ("usl", _("USL"), 5.5f, 10, 3.33333333333333333)
{
diff --git a/src/lib/usl.h b/src/lib/usl.h
index 260eb3c80..896fcf971 100644
--- a/src/lib/usl.h
+++ b/src/lib/usl.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,12 +18,15 @@
*/
+
/** @file src/lib/usl.h
* @brief USL class.
*/
+
#include "cinema_sound_processor.h"
+
class USL : public CinemaSoundProcessor
{
public:
diff --git a/src/lib/video_mxf_decoder.cc b/src/lib/video_mxf_decoder.cc
index 6e194a6df..d3fe2b897 100644
--- a/src/lib/video_mxf_decoder.cc
+++ b/src/lib/video_mxf_decoder.cc
@@ -18,6 +18,7 @@
*/
+
#include "video_mxf_decoder.h"
#include "video_decoder.h"
#include "video_mxf_content.h"
@@ -29,19 +30,22 @@
#include <dcp/stereo_picture_asset_reader.h>
#include <dcp/exceptions.h>
+
+using std::make_shared;
using std::shared_ptr;
using boost::optional;
using namespace dcpomatic;
+
VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const Film> film, shared_ptr<const VideoMXFContent> content)
: Decoder (film)
, _content (content)
{
- video.reset (new VideoDecoder (this, content));
+ video = make_shared<VideoDecoder>(this, content);
shared_ptr<dcp::MonoPictureAsset> mono;
try {
- mono.reset (new dcp::MonoPictureAsset (_content->path(0)));
+ mono = make_shared<dcp::MonoPictureAsset>(_content->path(0));
} catch (dcp::MXFFileError& e) {
/* maybe it's stereo */
} catch (dcp::ReadError& e) {
@@ -50,7 +54,7 @@ VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const Film> film, shared_ptr<const
shared_ptr<dcp::StereoPictureAsset> stereo;
try {
- stereo.reset (new dcp::StereoPictureAsset (_content->path(0)));
+ stereo = make_shared<dcp::StereoPictureAsset>(_content->path(0));
} catch (dcp::MXFFileError& e) {
if (!mono) {
throw;
@@ -70,11 +74,12 @@ VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const Film> film, shared_ptr<const
}
}
+
bool
VideoMXFDecoder::pass ()
{
- double const vfr = _content->active_video_frame_rate (film());
- int64_t const frame = _next.frames_round (vfr);
+ auto const vfr = _content->active_video_frame_rate (film());
+ auto const frame = _next.frames_round (vfr);
if (frame >= _content->video->length()) {
return true;
@@ -83,24 +88,18 @@ VideoMXFDecoder::pass ()
if (_mono_reader) {
video->emit (
film(),
- shared_ptr<ImageProxy> (
- new J2KImageProxy (_mono_reader->get_frame(frame), _size, AV_PIX_FMT_XYZ12LE, optional<int>())
- ),
+ std::make_shared<J2KImageProxy>(_mono_reader->get_frame(frame), _size, AV_PIX_FMT_XYZ12LE, optional<int>()),
frame
);
} else {
video->emit (
film(),
- shared_ptr<ImageProxy> (
- new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::Eye::LEFT, AV_PIX_FMT_XYZ12LE, optional<int>())
- ),
+ std::make_shared<J2KImageProxy>(_stereo_reader->get_frame(frame), _size, dcp::Eye::LEFT, AV_PIX_FMT_XYZ12LE, optional<int>()),
frame
);
video->emit (
film(),
- shared_ptr<ImageProxy> (
- new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::Eye::RIGHT, AV_PIX_FMT_XYZ12LE, optional<int>())
- ),
+ std::make_shared<J2KImageProxy>(_stereo_reader->get_frame(frame), _size, dcp::Eye::RIGHT, AV_PIX_FMT_XYZ12LE, optional<int>()),
frame
);
}
@@ -109,6 +108,7 @@ VideoMXFDecoder::pass ()
return false;
}
+
void
VideoMXFDecoder::seek (ContentTime t, bool accurate)
{
diff --git a/src/lib/video_mxf_decoder.h b/src/lib/video_mxf_decoder.h
index ae5d2fb78..774e269c6 100644
--- a/src/lib/video_mxf_decoder.h
+++ b/src/lib/video_mxf_decoder.h
@@ -1,5 +1,5 @@
/*
- 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.
@@ -18,20 +18,23 @@
*/
+
#include "decoder.h"
#include <dcp/mono_picture_asset_reader.h>
#include <dcp/stereo_picture_asset_reader.h>
+
class VideoMXFContent;
class Log;
+
class VideoMXFDecoder : public Decoder
{
public:
VideoMXFDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const VideoMXFContent>);
- bool pass ();
- void seek (dcpomatic::ContentTime t, bool accurate);
+ bool pass () override;
+ void seek (dcpomatic::ContentTime t, bool accurate) override;
private: