C++11 tidying.
authorCarl Hetherington <cth@carlh.net>
Mon, 3 May 2021 09:17:34 +0000 (11:17 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 3 May 2021 18:18:04 +0000 (20:18 +0200)
120 files changed:
src/lib/analyse_subtitles_job.cc
src/lib/analyse_subtitles_job.h
src/lib/atmos_content.cc
src/lib/atmos_content.h
src/lib/atmos_decoder.cc
src/lib/atmos_decoder.h
src/lib/atmos_mxf_content.cc
src/lib/atmos_mxf_content.h
src/lib/atmos_mxf_decoder.cc
src/lib/atmos_mxf_decoder.h
src/lib/audio_buffers.cc
src/lib/audio_buffers.h
src/lib/butler.cc
src/lib/butler.h
src/lib/case_insensitive_sorter.cc
src/lib/case_insensitive_sorter.h
src/lib/content_part.h
src/lib/copy_dcp_details_to_film.cc
src/lib/copy_dcp_details_to_film.h
src/lib/create_cli.cc
src/lib/create_cli.h
src/lib/cross_osx.cc
src/lib/crypto.cc
src/lib/crypto.h
src/lib/curl_uploader.cc
src/lib/curl_uploader.h
src/lib/datasat_ap2x.cc
src/lib/datasat_ap2x.h
src/lib/dcp_content_type.cc
src/lib/dcp_content_type.h
src/lib/dkdm_recipient.cc
src/lib/dkdm_recipient.h
src/lib/emailer.cc
src/lib/emailer.h
src/lib/encode_server_finder.cc
src/lib/encode_server_finder.h
src/lib/encoded_log_entry.cc
src/lib/encoded_log_entry.h
src/lib/event_history.cc
src/lib/event_history.h
src/lib/exceptions.cc
src/lib/exceptions.h
src/lib/file_log.cc
src/lib/file_log.h
src/lib/filter.cc
src/lib/filter.h
src/lib/font_data.cc
src/lib/font_data.h
src/lib/frame_rate_change.cc
src/lib/frame_rate_change.h
src/lib/log_entry.cc
src/lib/log_entry.h
src/lib/mid_side_decoder.cc
src/lib/mid_side_decoder.h
src/lib/overlaps.cc
src/lib/overlaps.h
src/lib/raw_image_proxy.cc
src/lib/raw_image_proxy.h
src/lib/rng.cc
src/lib/rng.h
src/lib/scoped_temporary.cc
src/lib/scoped_temporary.h
src/lib/screen.cc
src/lib/screen.h
src/lib/send_notification_email_job.cc
src/lib/send_notification_email_job.h
src/lib/send_problem_report_job.cc
src/lib/send_problem_report_job.h
src/lib/spl_entry.cc
src/lib/spl_entry.h
src/lib/stdout_log.cc
src/lib/stdout_log.h
src/lib/string_log_entry.cc
src/lib/string_log_entry.h
src/lib/subtitle_encoder.cc
src/lib/subtitle_encoder.h
src/lib/transcode_job.cc
src/lib/transcode_job.h
src/lib/trusted_device.cc
src/lib/trusted_device.h
src/lib/verify_dcp_job.cc
src/lib/verify_dcp_job.h
src/lib/video_mxf_content.cc
src/lib/video_mxf_content.h
src/lib/video_mxf_decoder.cc
src/tools/dcpomatic_batch.cc
src/tools/dcpomatic_combiner.cc
src/tools/server_test.cc
src/wx/cinema_dialog.cc
src/wx/cinema_dialog.h
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/file_dialog_wrapper.h
src/wx/filter_dialog.cc
src/wx/filter_dialog.h
src/wx/fonts_dialog.cc
src/wx/fonts_dialog.h
src/wx/i18n_hook.cc
src/wx/i18n_hook.h
src/wx/screen_dialog.cc
src/wx/screen_dialog.h
src/wx/system_font_dialog.cc
src/wx/system_font_dialog.h
test/audio_mapping_test.cc
test/cinema_sound_processor_test.cc
test/colour_conversion_test.cc
test/dcp_playback_test.cc
test/file_group_test.cc
test/file_log_test.cc
test/image_filename_sorter_test.cc
test/image_proxy_test.cc
test/interrupt_encoder_test.cc
test/kdm_naming_test.cc
test/no_use_video_test.cc
test/reel_writer_test.cc
test/resampler_test.cc
test/socket_test.cc
test/subtitle_charset_test.cc
test/subtitle_language_test.cc
test/upmixer_a_test.cc

index d95e859db8b44aedebb8de4668e1d9eb1c8c6361..0b003427c54115af0b6771017c410af5b12d52d4 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "analyse_subtitles_job.h"
 #include "analyse_subtitles_job.h"
-#include "playlist.h"
-#include "player.h"
-#include "subtitle_analysis.h"
 #include "bitmap_text.h"
 #include "bitmap_text.h"
+#include "image.h"
+#include "player.h"
+#include "playlist.h"
 #include "render_text.h"
 #include "render_text.h"
+#include "subtitle_analysis.h"
 #include "text_content.h"
 #include "text_content.h"
-#include "image.h"
 #include <iostream>
 
 #include "i18n.h"
 
 #include <iostream>
 
 #include "i18n.h"
 
+
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
@@ -38,6 +40,7 @@ using std::weak_ptr;
 using namespace boost::placeholders;
 #endif
 
 using namespace boost::placeholders;
 #endif
 
+
 AnalyseSubtitlesJob::AnalyseSubtitlesJob (shared_ptr<const Film> film, shared_ptr<Content> content)
        : Job (film)
        , _content (content)
 AnalyseSubtitlesJob::AnalyseSubtitlesJob (shared_ptr<const Film> film, shared_ptr<Content> content)
        : Job (film)
        , _content (content)
index 5ad9dd4a4dae2e8f57198ee88d7f5efaf2ef75cc..daaaf267a6b9a346fe0b04a2d16e27120eac667d 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "job.h"
 #include "types.h"
 #include "player_text.h"
 
 #include "job.h"
 #include "types.h"
 #include "player_text.h"
 
+
 class Film;
 class Content;
 
 class Film;
 class Content;
 
+
 class AnalyseSubtitlesJob : public Job
 {
 public:
        AnalyseSubtitlesJob (std::shared_ptr<const Film> film, std::shared_ptr<Content> content);
 
 class AnalyseSubtitlesJob : public Job
 {
 public:
        AnalyseSubtitlesJob (std::shared_ptr<const Film> film, std::shared_ptr<Content> content);
 
-       std::string name () const;
-       std::string json_name () const;
-       void run ();
+       std::string name () const override;
+       std::string json_name () const override;
+       void run () override;
 
        boost::filesystem::path path () const {
                return _path;
 
        boost::filesystem::path path () const {
                return _path;
@@ -43,6 +46,6 @@ private:
 
        std::weak_ptr<Content> _content;
        boost::filesystem::path _path;
 
        std::weak_ptr<Content> _content;
        boost::filesystem::path _path;
-       boost::optional<dcpomatic::Rect<double> > _bounding_box;
+       boost::optional<dcpomatic::Rect<double>> _bounding_box;
 };
 
 };
 
index e69474e01807756763c7f24fa4890a7a97358e56..cc74209e0ee8abc4f2a51fd30afca91cda0b2313 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -27,6 +27,7 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 
 
 DCPOMATIC_ENABLE_WARNINGS
 
 
+using std::make_shared;
 using std::string;
 using std::shared_ptr;
 
 using std::string;
 using std::shared_ptr;
 
@@ -54,10 +55,10 @@ shared_ptr<AtmosContent>
 AtmosContent::from_xml (Content* parent, cxml::ConstNodePtr node)
 {
        if (!node->optional_node_child("AtmosLength")) {
 AtmosContent::from_xml (Content* parent, cxml::ConstNodePtr node)
 {
        if (!node->optional_node_child("AtmosLength")) {
-               return shared_ptr<AtmosContent>();
+               return {};
        }
 
        }
 
-       return shared_ptr<AtmosContent> (new AtmosContent(parent, node));
+       return make_shared<AtmosContent>(parent, node);
 }
 
 
 }
 
 
index 948c3d3c0638bc216dd071544873fe4b7df22eff..8edab8c3168937057d4a9085250a829d4a3e51f3 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -35,7 +35,8 @@ public:
 class AtmosContent : public ContentPart
 {
 public:
 class AtmosContent : public ContentPart
 {
 public:
-       AtmosContent (Content* parent);
+       explicit AtmosContent (Content* parent);
+       AtmosContent (Content* parent, cxml::ConstNodePtr node);
 
        static std::shared_ptr<AtmosContent> from_xml (Content* parent, cxml::ConstNodePtr node);
 
 
        static std::shared_ptr<AtmosContent> from_xml (Content* parent, cxml::ConstNodePtr node);
 
@@ -54,8 +55,6 @@ public:
        }
 
 private:
        }
 
 private:
-       AtmosContent (Content* parent, cxml::ConstNodePtr node);
-
        Frame _length;
        dcp::Fraction _edit_rate;
 };
        Frame _length;
        dcp::Fraction _edit_rate;
 };
index 51ee7f0a48e010460befdfae8b3234f5167fa22b..478c4580977cd8e2ad8bcc33fb5904976d0a4ade 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index 935fd9925d8b2c1db7c7716aa4cd929494f70beb..1ec1b8a6cff380e3dfb11444a4d75432e33a2613 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -30,11 +30,11 @@ class AtmosDecoder : public DecoderPart
 public:
        AtmosDecoder (Decoder* parent, std::shared_ptr<const Content> content);
 
 public:
        AtmosDecoder (Decoder* parent, std::shared_ptr<const Content> content);
 
-       boost::optional<dcpomatic::ContentTime> position (std::shared_ptr<const Film>) const {
+       boost::optional<dcpomatic::ContentTime> position (std::shared_ptr<const Film>) const override {
                return _position;
        }
 
                return _position;
        }
 
-       void seek ();
+       void seek () override;
 
        void emit (std::shared_ptr<const Film> film, std::shared_ptr<const dcp::AtmosFrame> data, Frame frame, AtmosMetadata metadata);
 
 
        void emit (std::shared_ptr<const Film> film, std::shared_ptr<const dcp::AtmosFrame> data, Frame frame, AtmosMetadata metadata);
 
index 3f41a52a09e165856a43fa50e87b38b70a8620cf..82c20e88f7bd8e7c723e49216b1d4aeeabe3bc4d 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "atmos_content.h"
 #include "atmos_mxf_content.h"
 #include "atmos_content.h"
 #include "atmos_mxf_content.h"
-#include "job.h"
-#include "film.h"
 #include "compose.hpp"
 #include "compose.hpp"
+#include "film.h"
+#include "job.h"
 #include <asdcp/KM_log.h>
 #include <dcp/atmos_asset.h>
 #include <dcp/exceptions.h>
 #include <asdcp/KM_log.h>
 #include <dcp/atmos_asset.h>
 #include <dcp/exceptions.h>
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::list;
 using std::list;
+using std::make_shared;
 using std::string;
 using std::shared_ptr;
 using namespace dcpomatic;
 
 using std::string;
 using std::shared_ptr;
 using namespace dcpomatic;
 
+
 AtmosMXFContent::AtmosMXFContent (boost::filesystem::path path)
        : Content (path)
 {
 
 }
 
 AtmosMXFContent::AtmosMXFContent (boost::filesystem::path path)
        : Content (path)
 {
 
 }
 
+
 AtmosMXFContent::AtmosMXFContent (cxml::ConstNodePtr node, int)
        : Content (node)
 {
        atmos = AtmosContent::from_xml (this, node);
 }
 
 AtmosMXFContent::AtmosMXFContent (cxml::ConstNodePtr node, int)
        : Content (node)
 {
        atmos = AtmosContent::from_xml (this, node);
 }
 
+
 bool
 AtmosMXFContent::valid_mxf (boost::filesystem::path path)
 {
        Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
 
        try {
 bool
 AtmosMXFContent::valid_mxf (boost::filesystem::path path)
 {
        Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
 
        try {
-               shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path));
+               dcp::AtmosAsset a (path);
                return true;
        } catch (dcp::MXFFileError& e) {
 
                return true;
        } catch (dcp::MXFFileError& e) {
 
@@ -67,42 +73,47 @@ AtmosMXFContent::valid_mxf (boost::filesystem::path path)
        return false;
 }
 
        return false;
 }
 
+
 void
 AtmosMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
        job->set_progress_unknown ();
        Content::examine (film, job);
 void
 AtmosMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
        job->set_progress_unknown ();
        Content::examine (film, job);
-       shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path(0)));
+       auto a = make_shared<dcp::AtmosAsset>(path(0));
 
        {
                boost::mutex::scoped_lock lm (_mutex);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
-               atmos.reset (new AtmosContent(this));
+               atmos = make_shared<AtmosContent>(this);
                atmos->set_length (a->intrinsic_duration());
                atmos->set_edit_rate (a->edit_rate());
        }
 }
 
                atmos->set_length (a->intrinsic_duration());
                atmos->set_edit_rate (a->edit_rate());
        }
 }
 
+
 string
 AtmosMXFContent::summary () const
 {
        return String::compose (_("%1 [Atmos]"), path_summary());
 }
 
 string
 AtmosMXFContent::summary () const
 {
        return String::compose (_("%1 [Atmos]"), path_summary());
 }
 
+
 void
 AtmosMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
 void
 AtmosMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
-       node->add_child("Type")->add_child_text ("AtmosMXF");
+       node->add_child("Type")->add_child_text("AtmosMXF");
        Content::as_xml (node, with_paths);
        atmos->as_xml (node);
 }
 
        Content::as_xml (node, with_paths);
        atmos->as_xml (node);
 }
 
+
 DCPTime
 AtmosMXFContent::full_length (shared_ptr<const Film> film) const
 {
        FrameRateChange const frc (film, shared_from_this());
 DCPTime
 AtmosMXFContent::full_length (shared_ptr<const Film> film) const
 {
        FrameRateChange const frc (film, shared_from_this());
-       return DCPTime::from_frames (llrint (atmos->length() * frc.factor()), film->video_frame_rate());
+       return DCPTime::from_frames (llrint(atmos->length() * frc.factor()), film->video_frame_rate());
 }
 
 }
 
+
 DCPTime
 AtmosMXFContent::approximate_length () const
 {
 DCPTime
 AtmosMXFContent::approximate_length () const
 {
index b485167c553a820df7c87c8218ba22e6e9c5ccab..57f041774c1b3776926545b7b77c025c2c872c33 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -37,11 +37,11 @@ public:
                return std::dynamic_pointer_cast<const AtmosMXFContent> (Content::shared_from_this());
        }
 
                return std::dynamic_pointer_cast<const AtmosMXFContent> (Content::shared_from_this());
        }
 
-       void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job);
-       std::string summary () const;
-       void as_xml (xmlpp::Node* node, bool with_path) const;
-       dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const;
-       dcpomatic::DCPTime approximate_length () const;
+       void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job) override;
+       std::string summary () const override;
+       void as_xml (xmlpp::Node* node, bool with_path) const override;
+       dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override;
+       dcpomatic::DCPTime approximate_length () const override;
 
        static bool valid_mxf (boost::filesystem::path path);
 };
 
        static bool valid_mxf (boost::filesystem::path path);
 };
index 6c7cda61a632e248d71470ff941db3f8b786b5da..9fcd9d2a6db6f06a4f6b50f1f13e6e7890e89b9e 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "atmos_content.h"
 #include "atmos_decoder.h"
 #include "atmos_mxf_content.h"
 #include "atmos_content.h"
 #include "atmos_decoder.h"
 #include "atmos_mxf_content.h"
 #include <dcp/atmos_asset.h>
 #include <dcp/atmos_asset_reader.h>
 
 #include <dcp/atmos_asset.h>
 #include <dcp/atmos_asset_reader.h>
 
+
+using std::make_shared;
 using std::shared_ptr;
 
 using std::shared_ptr;
 
+
 AtmosMXFDecoder::AtmosMXFDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const AtmosMXFContent> content)
        : Decoder (film)
        , _content (content)
 {
 AtmosMXFDecoder::AtmosMXFDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const AtmosMXFContent> content)
        : Decoder (film)
        , _content (content)
 {
-       atmos.reset (new AtmosDecoder(this, content));
+       atmos = make_shared<AtmosDecoder>(this, content);
 
 
-       shared_ptr<dcp::AtmosAsset> asset (new dcp::AtmosAsset(_content->path(0)));
+       auto asset = make_shared<dcp::AtmosAsset>(_content->path(0));
        _reader = asset->start_read ();
        _metadata = AtmosMetadata (asset);
 }
        _reader = asset->start_read ();
        _metadata = AtmosMetadata (asset);
 }
@@ -43,8 +47,8 @@ AtmosMXFDecoder::AtmosMXFDecoder (std::shared_ptr<const Film> film, std::shared_
 bool
 AtmosMXFDecoder::pass ()
 {
 bool
 AtmosMXFDecoder::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->atmos->length()) {
                return true;
 
        if (frame >= _content->atmos->length()) {
                return true;
index 4e7ce5c6f34cbd71f879799075363bd912b158b5..b8e7fc53d81b19a08a2a6c80f5e67f97f4fe10ff 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "atmos_metadata.h"
 #include "dcpomatic_time.h"
 #include "decoder.h"
 #include <dcp/atmos_asset_reader.h>
 
 #include "atmos_metadata.h"
 #include "dcpomatic_time.h"
 #include "decoder.h"
 #include <dcp/atmos_asset_reader.h>
 
+
 class AtmosMXFContent;
 
 class AtmosMXFContent;
 
+
 class AtmosMXFDecoder : public Decoder
 {
 public:
        AtmosMXFDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const AtmosMXFContent>);
 
 class AtmosMXFDecoder : public Decoder
 {
 public:
        AtmosMXFDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const AtmosMXFContent>);
 
-       bool pass ();
-       void seek (dcpomatic::ContentTime t, bool accurate);
+       bool pass () override;
+       void seek (dcpomatic::ContentTime t, bool accurate) override;
 
 private:
        std::shared_ptr<const AtmosMXFContent> _content;
 
 private:
        std::shared_ptr<const AtmosMXFContent> _content;
index 5f2d5539d0293706634f43c7320b9c7dceb2a6a6..9f91810e0c4ab14387b55eef574a1362bf1c6fdf 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "util.h"
 #include "audio_buffers.h"
 #include "dcpomatic_assert.h"
 #include "util.h"
 #include "audio_buffers.h"
 #include "dcpomatic_assert.h"
 #include <cmath>
 #include <stdexcept>
 
 #include <cmath>
 #include <stdexcept>
 
+
 using std::bad_alloc;
 using std::shared_ptr;
 using std::bad_alloc;
 using std::shared_ptr;
+using std::make_shared;
+
 
 /** Construct an AudioBuffers.  Audio data is undefined after this constructor.
  *  @param channels Number of channels.
 
 /** Construct an AudioBuffers.  Audio data is undefined after this constructor.
  *  @param channels Number of channels.
@@ -38,6 +42,7 @@ AudioBuffers::AudioBuffers (int channels, int32_t frames)
        allocate (channels, frames);
 }
 
        allocate (channels, frames);
 }
 
+
 /** Copy constructor.
  *  @param other Other AudioBuffers; data is copied.
  */
 /** Copy constructor.
  *  @param other Other AudioBuffers; data is copied.
  */
@@ -47,18 +52,21 @@ AudioBuffers::AudioBuffers (AudioBuffers const & other)
        copy_from (&other, other._frames, 0, 0);
 }
 
        copy_from (&other, other._frames, 0, 0);
 }
 
+
 AudioBuffers::AudioBuffers (std::shared_ptr<const AudioBuffers> other)
 {
        allocate (other->_channels, other->_frames);
        copy_from (other.get(), other->_frames, 0, 0);
 }
 
 AudioBuffers::AudioBuffers (std::shared_ptr<const AudioBuffers> other)
 {
        allocate (other->_channels, other->_frames);
        copy_from (other.get(), other->_frames, 0, 0);
 }
 
+
 AudioBuffers::AudioBuffers (std::shared_ptr<const AudioBuffers> other, int32_t frames_to_copy, int32_t read_offset)
 {
        allocate (other->_channels, frames_to_copy);
        copy_from (other.get(), frames_to_copy, read_offset, 0);
 }
 
 AudioBuffers::AudioBuffers (std::shared_ptr<const AudioBuffers> other, int32_t frames_to_copy, int32_t read_offset)
 {
        allocate (other->_channels, frames_to_copy);
        copy_from (other.get(), frames_to_copy, read_offset, 0);
 }
 
+
 AudioBuffers &
 AudioBuffers::operator= (AudioBuffers const & other)
 {
 AudioBuffers &
 AudioBuffers::operator= (AudioBuffers const & other)
 {
@@ -73,12 +81,14 @@ AudioBuffers::operator= (AudioBuffers const & other)
        return *this;
 }
 
        return *this;
 }
 
+
 /** AudioBuffers destructor */
 AudioBuffers::~AudioBuffers ()
 {
        deallocate ();
 }
 
 /** AudioBuffers destructor */
 AudioBuffers::~AudioBuffers ()
 {
        deallocate ();
 }
 
+
 void
 AudioBuffers::allocate (int channels, int32_t frames)
 {
 void
 AudioBuffers::allocate (int channels, int32_t frames)
 {
@@ -89,19 +99,20 @@ AudioBuffers::allocate (int channels, int32_t frames)
        _frames = frames;
        _allocated_frames = frames;
 
        _frames = frames;
        _allocated_frames = frames;
 
-       _data = static_cast<float**> (malloc (_channels * sizeof (float *)));
+       _data = static_cast<float**> (malloc(_channels * sizeof(float *)));
        if (!_data) {
                throw bad_alloc ();
        }
 
        for (int i = 0; i < _channels; ++i) {
        if (!_data) {
                throw bad_alloc ();
        }
 
        for (int i = 0; i < _channels; ++i) {
-               _data[i] = static_cast<float*> (malloc (frames * sizeof (float)));
+               _data[i] = static_cast<float*> (malloc(frames * sizeof(float)));
                if (!_data[i]) {
                        throw bad_alloc ();
                }
        }
 }
 
                if (!_data[i]) {
                        throw bad_alloc ();
                }
        }
 }
 
+
 void
 AudioBuffers::deallocate ()
 {
 void
 AudioBuffers::deallocate ()
 {
@@ -112,6 +123,7 @@ AudioBuffers::deallocate ()
        free (_data);
 }
 
        free (_data);
 }
 
+
 /** @param c Channel index.
  *  @return Buffer for this channel.
  */
 /** @param c Channel index.
  *  @return Buffer for this channel.
  */
@@ -122,6 +134,7 @@ AudioBuffers::data (int c) const
        return _data[c];
 }
 
        return _data[c];
 }
 
+
 /** Set the number of frames that these AudioBuffers will report themselves
  *  as having.  If we reduce the number of frames, the `lost' frames will
  *  be silenced.
 /** Set the number of frames that these AudioBuffers will report themselves
  *  as having.  If we reduce the number of frames, the `lost' frames will
  *  be silenced.
@@ -138,6 +151,7 @@ AudioBuffers::set_frames (int32_t f)
        _frames = f;
 }
 
        _frames = f;
 }
 
+
 /** Make all frames silent */
 void
 AudioBuffers::make_silent ()
 /** Make all frames silent */
 void
 AudioBuffers::make_silent ()
@@ -147,6 +161,7 @@ AudioBuffers::make_silent ()
        }
 }
 
        }
 }
 
+
 /** Make all samples on a given channel silent.
  *  @param c Channel.
  */
 /** Make all samples on a given channel silent.
  *  @param c Channel.
  */
@@ -161,6 +176,7 @@ AudioBuffers::make_silent (int c)
        memset (_data[c], 0, _frames * sizeof(float));
 }
 
        memset (_data[c], 0, _frames * sizeof(float));
 }
 
+
 /** Make some frames.
  *  @param from Start frame.
  *  @param frames Number of frames to silence.
 /** Make some frames.
  *  @param from Start frame.
  *  @param frames Number of frames to silence.
@@ -178,6 +194,7 @@ AudioBuffers::make_silent (int32_t from, int32_t frames)
        }
 }
 
        }
 }
 
+
 /** Copy data from another AudioBuffers to this one.  All channels are copied.
  *  @param from AudioBuffers to copy from; must have the same number of channels as this.
  *  @param frames_to_copy Number of frames to copy.
 /** Copy data from another AudioBuffers to this one.  All channels are copied.
  *  @param from AudioBuffers to copy from; must have the same number of channels as this.
  *  @param frames_to_copy Number of frames to copy.
@@ -202,6 +219,7 @@ AudioBuffers::copy_from (AudioBuffers const * from, int32_t frames_to_copy, int3
        }
 }
 
        }
 }
 
+
 /** Move audio data around.
  *  @param from Offset to move from.
  *  @param to Offset to move to.
 /** Move audio data around.
  *  @param from Offset to move from.
  *  @param to Offset to move to.
@@ -228,6 +246,7 @@ AudioBuffers::move (int32_t frames, int32_t from, int32_t to)
        }
 }
 
        }
 }
 
+
 /** Add data from from `from', `from_channel' to our channel `to_channel'.
  *  @param from Buffers to copy data from.
  *  @param from_channel Channel index to read in \p from.
 /** Add data from from `from', `from_channel' to our channel `to_channel'.
  *  @param from Buffers to copy data from.
  *  @param from_channel Channel index to read in \p from.
@@ -241,14 +260,15 @@ AudioBuffers::accumulate_channel (AudioBuffers const * from, int from_channel, i
        DCPOMATIC_ASSERT (from->frames() == N);
        DCPOMATIC_ASSERT (to_channel <= _channels);
 
        DCPOMATIC_ASSERT (from->frames() == N);
        DCPOMATIC_ASSERT (to_channel <= _channels);
 
-       float* s = from->data (from_channel);
-       float* d = _data[to_channel];
+       auto s = from->data (from_channel);
+       auto d = _data[to_channel];
 
        for (int i = 0; i < N; ++i) {
                *d++ += (*s++) * gain;
        }
 }
 
 
        for (int i = 0; i < N; ++i) {
                *d++ += (*s++) * gain;
        }
 }
 
+
 /** Ensure we have space for at least a certain number of frames.  If we extend
  *  the buffers, fill the new space with silence.
  */
 /** Ensure we have space for at least a certain number of frames.  If we extend
  *  the buffers, fill the new space with silence.
  */
@@ -271,19 +291,20 @@ AudioBuffers::ensure_size (int32_t frames)
        frames++;
 
        for (int i = 0; i < _channels; ++i) {
        frames++;
 
        for (int i = 0; i < _channels; ++i) {
-               _data[i] = static_cast<float*> (realloc (_data[i], frames * sizeof (float)));
+               _data[i] = static_cast<float*> (realloc(_data[i], frames * sizeof(float)));
                if (!_data[i]) {
                        throw bad_alloc ();
                }
        }
 
                if (!_data[i]) {
                        throw bad_alloc ();
                }
        }
 
-       int32_t const old_allocated = _allocated_frames;
+       auto const old_allocated = _allocated_frames;
        _allocated_frames = frames;
        if (old_allocated < _allocated_frames) {
                make_silent (old_allocated, _allocated_frames - old_allocated);
        }
 }
 
        _allocated_frames = frames;
        if (old_allocated < _allocated_frames) {
                make_silent (old_allocated, _allocated_frames - old_allocated);
        }
 }
 
+
 /** Mix some other buffers with these ones.  The AudioBuffers must have the same number of channels.
  *  @param from Audio buffers to get data from.
  *  @param frames Number of frames to mix.
 /** Mix some other buffers with these ones.  The AudioBuffers must have the same number of channels.
  *  @param from Audio buffers to get data from.
  *  @param frames Number of frames to mix.
@@ -297,7 +318,7 @@ AudioBuffers::accumulate_frames (AudioBuffers const * from, int32_t frames, int3
        DCPOMATIC_ASSERT (read_offset >= 0);
        DCPOMATIC_ASSERT (write_offset >= 0);
 
        DCPOMATIC_ASSERT (read_offset >= 0);
        DCPOMATIC_ASSERT (write_offset >= 0);
 
-       float** from_data = from->data ();
+       auto from_data = from->data ();
        for (int i = 0; i < _channels; ++i) {
                for (int j = 0; j < frames; ++j) {
                        _data[i][j + write_offset] += from_data[i][j + read_offset];
        for (int i = 0; i < _channels; ++i) {
                for (int j = 0; j < frames; ++j) {
                        _data[i][j + write_offset] += from_data[i][j + read_offset];
@@ -305,11 +326,12 @@ AudioBuffers::accumulate_frames (AudioBuffers const * from, int32_t frames, int3
        }
 }
 
        }
 }
 
+
 /** @param dB gain in dB */
 void
 AudioBuffers::apply_gain (float dB)
 {
 /** @param dB gain in dB */
 void
 AudioBuffers::apply_gain (float dB)
 {
-       float const linear = db_to_linear (dB);
+       auto const linear = db_to_linear (dB);
 
        for (int i = 0; i < _channels; ++i) {
                for (int j = 0; j < _frames; ++j) {
 
        for (int i = 0; i < _channels; ++i) {
                for (int j = 0; j < _frames; ++j) {
@@ -318,17 +340,19 @@ AudioBuffers::apply_gain (float dB)
        }
 }
 
        }
 }
 
+
 /** @param c Channel index.
  *  @return AudioBuffers object containing only channel `c' from this AudioBuffers.
  */
 shared_ptr<AudioBuffers>
 AudioBuffers::channel (int c) const
 {
 /** @param c Channel index.
  *  @return AudioBuffers object containing only channel `c' from this AudioBuffers.
  */
 shared_ptr<AudioBuffers>
 AudioBuffers::channel (int c) const
 {
-       shared_ptr<AudioBuffers> o (new AudioBuffers (1, frames ()));
+       auto o = make_shared<AudioBuffers>(1, frames());
        o->copy_channel_from (this, c, 0);
        return o;
 }
 
        o->copy_channel_from (this, c, 0);
        return o;
 }
 
+
 /** Copy all the samples from a channel on another AudioBuffers to a channel on this one.
  *  @param from AudioBuffers to copy from.
  *  @param from_channel Channel index in `from' to copy from.
 /** Copy all the samples from a channel on another AudioBuffers to a channel on this one.
  *  @param from AudioBuffers to copy from.
  *  @param from_channel Channel index in `from' to copy from.
@@ -341,15 +365,17 @@ AudioBuffers::copy_channel_from (AudioBuffers const * from, int from_channel, in
        memcpy (data(to_channel), from->data(from_channel), frames() * sizeof (float));
 }
 
        memcpy (data(to_channel), from->data(from_channel), frames() * sizeof (float));
 }
 
+
 /** Make a copy of these AudioBuffers */
 shared_ptr<AudioBuffers>
 AudioBuffers::clone () const
 {
 /** Make a copy of these AudioBuffers */
 shared_ptr<AudioBuffers>
 AudioBuffers::clone () const
 {
-       shared_ptr<AudioBuffers> b (new AudioBuffers (channels (), frames ()));
-       b->copy_from (this, frames (), 0, 0);
+       auto b = make_shared<AudioBuffers>(channels(), frames());
+       b->copy_from (this, frames(), 0, 0);
        return b;
 }
 
        return b;
 }
 
+
 /** Extend these buffers with the data from another.  The AudioBuffers must have the same number of channels. */
 void
 AudioBuffers::append (shared_ptr<const AudioBuffers> other)
 /** Extend these buffers with the data from another.  The AudioBuffers must have the same number of channels. */
 void
 AudioBuffers::append (shared_ptr<const AudioBuffers> other)
@@ -360,6 +386,7 @@ AudioBuffers::append (shared_ptr<const AudioBuffers> other)
        _frames += other->frames();
 }
 
        _frames += other->frames();
 }
 
+
 /** Remove some frames from the start of these AudioBuffers */
 void
 AudioBuffers::trim_start (int32_t frames)
 /** Remove some frames from the start of these AudioBuffers */
 void
 AudioBuffers::trim_start (int32_t frames)
index 7a02b2b0a458c7f51a75bd62cced144b905d4685..146d5bd3e2d8f88c260b3f7776d0104cd66d8c0b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 /** @file  src/lib/audio_buffers.h
  *  @brief AudioBuffers class.
  */
 /** @file  src/lib/audio_buffers.h
  *  @brief AudioBuffers class.
  */
@@ -98,4 +99,5 @@ private:
        float** _data;
 };
 
        float** _data;
 };
 
+
 #endif
 #endif
index b2128efdb28f0b9cb7660d7ff42d94c94c6648ee..5a8e646aa4635556fca90f8791f23e46b6468a9e 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "butler.h"
 #include "player.h"
 #include "util.h"
 #include "butler.h"
 #include "player.h"
 #include "util.h"
@@ -43,6 +44,7 @@ using namespace dcpomatic;
 using namespace boost::placeholders;
 #endif
 
 using namespace boost::placeholders;
 #endif
 
+
 /** Minimum video readahead in frames */
 #define MINIMUM_VIDEO_READAHEAD 10
 /** Maximum video readahead in frames; should never be exceeded (by much) unless there are bugs in Player */
 /** Minimum video readahead in frames */
 #define MINIMUM_VIDEO_READAHEAD 10
 /** Maximum video readahead in frames; should never be exceeded (by much) unless there are bugs in Player */
@@ -52,6 +54,7 @@ using namespace boost::placeholders;
 /** Maximum audio readahead in frames; should never be exceeded (by much) unless there are bugs in Player */
 #define MAXIMUM_AUDIO_READAHEAD (48000 * MAXIMUM_VIDEO_READAHEAD / 24)
 
 /** Maximum audio readahead in frames; should never be exceeded (by much) unless there are bugs in Player */
 #define MAXIMUM_AUDIO_READAHEAD (48000 * MAXIMUM_VIDEO_READAHEAD / 24)
 
+
 /** @param pixel_format Pixel format functor that will be used when calling ::image on PlayerVideos coming out of this
  *  butler.  This will be used (where possible) to prepare the PlayerVideos so that calling image() on them is quick.
  *  @param aligned Same as above for the `aligned' flag.
 /** @param pixel_format Pixel format functor that will be used when calling ::image on PlayerVideos coming out of this
  *  butler.  This will be used (where possible) to prepare the PlayerVideos so that calling image() on them is quick.
  *  @param aligned Same as above for the `aligned' flag.
@@ -69,7 +72,7 @@ Butler::Butler (
        )
        : _film (film)
        , _player (player)
        )
        : _film (film)
        , _player (player)
-       , _prepare_work (new boost::asio::io_service::work (_prepare_service))
+       , _prepare_work (new boost::asio::io_service::work(_prepare_service))
        , _pending_seek_accurate (false)
        , _suspended (0)
        , _finished (false)
        , _pending_seek_accurate (false)
        , _suspended (0)
        , _finished (false)
@@ -106,6 +109,7 @@ Butler::Butler (
        }
 }
 
        }
 }
 
+
 Butler::~Butler ()
 {
        boost::this_thread::disable_interruption dis;
 Butler::~Butler ()
 {
        boost::this_thread::disable_interruption dis;
@@ -175,6 +179,7 @@ Butler::should_run () const
        return (_video.size() < MAXIMUM_VIDEO_READAHEAD) && (_audio.size() < MAXIMUM_AUDIO_READAHEAD);
 }
 
        return (_video.size() < MAXIMUM_VIDEO_READAHEAD) && (_audio.size() < MAXIMUM_AUDIO_READAHEAD);
 }
 
+
 void
 Butler::thread ()
 try
 void
 Butler::thread ()
 try
@@ -230,6 +235,7 @@ try
        _arrived.notify_all ();
 }
 
        _arrived.notify_all ();
 }
 
+
 /** @param blocking true if we should block until video is available.  If blocking is false
  *  and no video is immediately available the method will return a 0 PlayerVideo and the error AGAIN.
  *  @param e if non-0 this is filled with an error code (if an error occurs) or is untouched if no error occurs.
 /** @param blocking true if we should block until video is available.  If blocking is false
  *  and no video is immediately available the method will return a 0 PlayerVideo and the error AGAIN.
  *  @param e if non-0 this is filled with an error code (if an error occurs) or is untouched if no error occurs.
@@ -272,6 +278,7 @@ Butler::get_video (bool blocking, Error* e)
        return r;
 }
 
        return r;
 }
 
+
 optional<TextRingBuffers::Data>
 Butler::get_closed_caption ()
 {
 optional<TextRingBuffers::Data>
 Butler::get_closed_caption ()
 {
@@ -279,6 +286,7 @@ Butler::get_closed_caption ()
        return _closed_caption.get ();
 }
 
        return _closed_caption.get ();
 }
 
+
 void
 Butler::seek (DCPTime position, bool accurate)
 {
 void
 Butler::seek (DCPTime position, bool accurate)
 {
@@ -287,6 +295,7 @@ Butler::seek (DCPTime position, bool accurate)
        seek_unlocked (position, accurate);
 }
 
        seek_unlocked (position, accurate);
 }
 
+
 void
 Butler::seek_unlocked (DCPTime position, bool accurate)
 {
 void
 Butler::seek_unlocked (DCPTime position, bool accurate)
 {
@@ -305,6 +314,7 @@ Butler::seek_unlocked (DCPTime position, bool accurate)
        _summon.notify_all ();
 }
 
        _summon.notify_all ();
 }
 
+
 void
 Butler::prepare (weak_ptr<PlayerVideo> weak_video)
 try
 void
 Butler::prepare (weak_ptr<PlayerVideo> weak_video)
 try
@@ -331,6 +341,7 @@ catch (...)
        _died = true;
 }
 
        _died = true;
 }
 
+
 void
 Butler::video (shared_ptr<PlayerVideo> video, DCPTime time)
 {
 void
 Butler::video (shared_ptr<PlayerVideo> video, DCPTime time)
 {
@@ -341,11 +352,12 @@ Butler::video (shared_ptr<PlayerVideo> video, DCPTime time)
                return;
        }
 
                return;
        }
 
-       _prepare_service.post (bind (&Butler::prepare, this, weak_ptr<PlayerVideo>(video)));
+       _prepare_service.post (bind(&Butler::prepare, this, weak_ptr<PlayerVideo>(video)));
 
        _video.put (video, time);
 }
 
 
        _video.put (video, time);
 }
 
+
 void
 Butler::audio (shared_ptr<AudioBuffers> audio, DCPTime time, int frame_rate)
 {
 void
 Butler::audio (shared_ptr<AudioBuffers> audio, DCPTime time, int frame_rate)
 {
@@ -355,9 +367,10 @@ Butler::audio (shared_ptr<AudioBuffers> audio, DCPTime time, int frame_rate)
                return;
        }
 
                return;
        }
 
-       _audio.put (remap (audio, _audio_channels, _audio_mapping), time, frame_rate);
+       _audio.put (remap(audio, _audio_channels, _audio_mapping), time, frame_rate);
 }
 
 }
 
+
 /** Try to get `frames' frames of audio and copy it into `out'.  Silence
  *  will be filled if no audio is available.
  *  @return time of this audio, or unset if there was a buffer underrun.
 /** Try to get `frames' frames of audio and copy it into `out'.  Silence
  *  will be filled if no audio is available.
  *  @return time of this audio, or unset if there was a buffer underrun.
@@ -370,6 +383,7 @@ Butler::get_audio (float* out, Frame frames)
        return t;
 }
 
        return t;
 }
 
+
 void
 Butler::disable_audio ()
 {
 void
 Butler::disable_audio ()
 {
@@ -377,6 +391,7 @@ Butler::disable_audio ()
        _disable_audio = true;
 }
 
        _disable_audio = true;
 }
 
+
 pair<size_t, string>
 Butler::memory_used () const
 {
 pair<size_t, string>
 Butler::memory_used () const
 {
@@ -384,6 +399,7 @@ Butler::memory_used () const
        return _video.memory_used();
 }
 
        return _video.memory_used();
 }
 
+
 void
 Butler::player_change (ChangeType type, int property)
 {
 void
 Butler::player_change (ChangeType type, int property)
 {
@@ -430,6 +446,7 @@ Butler::player_change (ChangeType type, int property)
        _summon.notify_all ();
 }
 
        _summon.notify_all ();
 }
 
+
 void
 Butler::text (PlayerText pt, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
 {
 void
 Butler::text (PlayerText pt, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
 {
@@ -442,6 +459,7 @@ Butler::text (PlayerText pt, TextType type, optional<DCPTextTrack> track, DCPTim
        _closed_caption.put (pt, *track, period);
 }
 
        _closed_caption.put (pt, *track, period);
 }
 
+
 string
 Butler::Error::summary () const
 {
 string
 Butler::Error::summary () const
 {
index 29966b956b2b491d7c7d82c85f2adc5128842927..a231fd0990bf75f8f4e0f8f5bfe4eab50f9bff26 100644 (file)
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "audio_mapping.h"
 #include "audio_ring_buffers.h"
 #include "change_signaller.h"
 #include "audio_mapping.h"
 #include "audio_ring_buffers.h"
 #include "change_signaller.h"
 #include <boost/thread.hpp>
 #include <boost/thread/condition.hpp>
 
 #include <boost/thread.hpp>
 #include <boost/thread/condition.hpp>
 
+
 class Player;
 class PlayerVideo;
 
 class Player;
 class PlayerVideo;
 
+
 class Butler : public ExceptionStore
 {
 public:
 class Butler : public ExceptionStore
 {
 public:
index c26f1e64263a606a456426ca5b33ae218c8e9c2e..4bf3c2d18217fd21ea9b1608874b27d3d8b1284c 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "case_insensitive_sorter.h"
 #include <boost/filesystem.hpp>
 #include "case_insensitive_sorter.h"
 #include <boost/filesystem.hpp>
-#include <iostream>
+
 
 using std::string;
 
 
 using std::string;
 
+
 bool
 CaseInsensitiveSorter::operator() (boost::filesystem::path a, boost::filesystem::path b)
 {
 bool
 CaseInsensitiveSorter::operator() (boost::filesystem::path a, boost::filesystem::path b)
 {
-       string x = a.string ();
-       string y = b.string ();
+       auto x = a.string();
+       auto y = b.string();
        transform (x.begin(), x.end(), x.begin(), ::tolower);
        transform (y.begin(), y.end(), y.begin(), ::tolower);
        return x < y;
        transform (x.begin(), x.end(), x.begin(), ::tolower);
        transform (y.begin(), y.end(), y.begin(), ::tolower);
        return x < y;
index 28bd28ee8438515bde2630359849c9936e61d304..7f8186072ce8bb03c327ce0834c933267f81a202 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include <boost/filesystem.hpp>
 
 #include <boost/filesystem.hpp>
 
+
 class CaseInsensitiveSorter
 {
 public:
 class CaseInsensitiveSorter
 {
 public:
index 443c356b19ab45c883adc8d01e16417cd84fc72e..590be311289406c738b153423d5a6ab206a8d9e2 100644 (file)
@@ -1,6 +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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_CONTENT_PART_H
 #define DCPOMATIC_CONTENT_PART_H
 
 #ifndef DCPOMATIC_CONTENT_PART_H
 #define DCPOMATIC_CONTENT_PART_H
 
-#include "content.h"
+
 #include "change_signaller.h"
 #include "change_signaller.h"
+#include "content.h"
 #include <boost/thread/mutex.hpp>
 
 #include <boost/thread/mutex.hpp>
 
+
 class Content;
 class Film;
 
 class Content;
 class Film;
 
+
 class ContentPart
 {
 public:
 class ContentPart
 {
 public:
@@ -71,4 +74,5 @@ protected:
        mutable boost::mutex _mutex;
 };
 
        mutable boost::mutex _mutex;
 };
 
+
 #endif
 #endif
index 3e62c96a3b9ac4750d34c26600819bc7c050d125..5c3c79638b877ef00d6f358fa7c5115a6a8a5167 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index 1b5c058116ffa6bbe7d22fab32ed1530bb2ca7e8..37507b8da14a9a8a2f2da1bf6988e3a24ea2e94c 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -25,4 +25,5 @@
 class DCPContent;
 class Film;
 
 class DCPContent;
 class Film;
 
+
 extern void copy_dcp_details_to_film (std::shared_ptr<const DCPContent> dcp, std::shared_ptr<Film> film);
 extern void copy_dcp_details_to_film (std::shared_ptr<const DCPContent> dcp, std::shared_ptr<Film> film);
index 819f17f6ea87b43966be130c851388e71354e350..2258f8a2ea0ab6c439214309813c8a2a33ca5218 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
+#include "compose.hpp"
+#include "config.h"
 #include "create_cli.h"
 #include "dcp_content_type.h"
 #include "ratio.h"
 #include "create_cli.h"
 #include "dcp_content_type.h"
 #include "ratio.h"
-#include "config.h"
-#include "compose.hpp"
 #include <dcp/raw_convert.h>
 #include <dcp/raw_convert.h>
+#include <iostream>
 #include <string>
 
 #include <string>
 
-#include <iostream>
 
 using std::string;
 using std::cout;
 using boost::optional;
 
 
 using std::string;
 using std::cout;
 using boost::optional;
 
+
 string CreateCLI::_help =
        "\nSyntax: %1 [OPTION] <CONTENT> [OPTION] [<CONTENT> ...]\n"
        "  -v, --version                 show DCP-o-matic version\n"
 string CreateCLI::_help =
        "\nSyntax: %1 [OPTION] <CONTENT> [OPTION] [<CONTENT> ...]\n"
        "  -v, --version                 show DCP-o-matic version\n"
@@ -54,6 +56,7 @@ string CreateCLI::_help =
        "      --left-eye                next piece of content is for the left eye\n"
        "      --right-eye               next piece of content is for the right eye\n";
 
        "      --left-eye                next piece of content is for the left eye\n"
        "      --right-eye               next piece of content is for the right eye\n";
 
+
 template <class T>
 void
 argument_option (int& n, int argc, char* argv[], string short_name, string long_name, bool* claimed, optional<string>* error, T* out)
 template <class T>
 void
 argument_option (int& n, int argc, char* argv[], string short_name, string long_name, bool* claimed, optional<string>* error, T* out)
@@ -72,6 +75,7 @@ argument_option (int& n, int argc, char* argv[], string short_name, string long_
        *claimed = true;
 }
 
        *claimed = true;
 }
 
+
 CreateCLI::CreateCLI (int argc, char* argv[])
        : version (false)
        , encrypt (false)
 CreateCLI::CreateCLI (int argc, char* argv[])
        : version (false)
        , encrypt (false)
index 97e0910567686bb8251d6abcb30f3442f18d2bb1..3a06c64f8e98ea39e6b16d9cbab5abc6ae248636 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "types.h"
 #include <dcp/types.h>
 #include <boost/optional.hpp>
 #include <boost/filesystem.hpp>
 #include <vector>
 
 #include "types.h"
 #include <dcp/types.h>
 #include <boost/optional.hpp>
 #include <boost/filesystem.hpp>
 #include <vector>
 
+
 class DCPContentType;
 class Ratio;
 
 class DCPContentType;
 class Ratio;
 
+
 class CreateCLI
 {
 public:
 class CreateCLI
 {
 public:
index 58ec8e3c46cd6cb6d4b2a228de5086eab0469b2c..b9b7796a21a73c71e2fb59ac972134fd4ed3439f 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "cross.h"
 #include "compose.hpp"
 #include "log.h"
 #include "cross.h"
 #include "compose.hpp"
 #include "log.h"
@@ -52,6 +53,7 @@ extern "C" {
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::pair;
 using std::list;
 using std::ifstream;
 using std::pair;
 using std::list;
 using std::ifstream;
@@ -67,6 +69,7 @@ using std::shared_ptr;
 using boost::optional;
 using std::function;
 
 using boost::optional;
 using std::function;
 
+
 /** @param s Number of seconds to sleep for */
 void
 dcpomatic_sleep_seconds (int s)
 /** @param s Number of seconds to sleep for */
 void
 dcpomatic_sleep_seconds (int s)
@@ -74,12 +77,14 @@ dcpomatic_sleep_seconds (int s)
        sleep (s);
 }
 
        sleep (s);
 }
 
+
 void
 dcpomatic_sleep_milliseconds (int ms)
 {
        usleep (ms * 1000);
 }
 
 void
 dcpomatic_sleep_milliseconds (int ms)
 {
        usleep (ms * 1000);
 }
 
+
 /** @return A string of CPU information (model name etc.) */
 string
 cpu_info ()
 /** @return A string of CPU information (model name etc.) */
 string
 cpu_info ()
@@ -88,7 +93,7 @@ cpu_info ()
 
        char buffer[64];
        size_t N = sizeof (buffer);
 
        char buffer[64];
        size_t N = sizeof (buffer);
-       if (sysctlbyname ("machdep.cpu.brand_string", buffer, &N, 0, 0) == 0) {
+       if (sysctlbyname("machdep.cpu.brand_string", buffer, &N, 0, 0) == 0) {
                info = buffer;
        }
 
                info = buffer;
        }
 
@@ -127,7 +132,7 @@ tags_path ()
 void
 run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
 {
 void
 run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
 {
-       boost::filesystem::path path = directory_containing_executable () / "ffprobe";
+       auto path = directory_containing_executable () / "ffprobe";
 
        string ffprobe = "\"" + path.string() + "\" \"" + content.string() + "\" 2> \"" + out.string() + "\"";
        LOG_GENERAL (N_("Probing with %1"), ffprobe);
 
        string ffprobe = "\"" + path.string() + "\" \"" + content.string() + "\" 2> \"" + out.string() + "\"";
        LOG_GENERAL (N_("Probing with %1"), ffprobe);
@@ -135,13 +140,14 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
 }
 
 
 }
 
 
-list<pair<string, string> >
+
+list<pair<string, string>>
 mount_info ()
 {
 mount_info ()
 {
-       list<pair<string, string> > m;
-       return m;
+       return {};
 }
 
 }
 
+
 boost::filesystem::path
 openssl_path ()
 {
 boost::filesystem::path
 openssl_path ()
 {
@@ -158,6 +164,7 @@ disk_writer_path ()
 }
 #endif
 
 }
 #endif
 
+
 /* Apparently there is no way to create an ofstream using a UTF-8
    filename under Windows.  We are hence reduced to using fopen
    with this wrapper.
 /* Apparently there is no way to create an ofstream using a UTF-8
    filename under Windows.  We are hence reduced to using fopen
    with this wrapper.
@@ -165,40 +172,45 @@ disk_writer_path ()
 FILE *
 fopen_boost (boost::filesystem::path p, string t)
 {
 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);
 }
 
 int
 dcpomatic_fseek (FILE* stream, int64_t offset, int whence)
 {
        return fseek (stream, offset, whence);
 }
 
+
 void
 Waker::nudge ()
 {
 
 }
 
 void
 Waker::nudge ()
 {
 
 }
 
+
 Waker::Waker ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
 }
 
 Waker::Waker ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
 }
 
+
 Waker::~Waker ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        IOPMAssertionRelease (_assertion_id);
 }
 
 Waker::~Waker ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        IOPMAssertionRelease (_assertion_id);
 }
 
+
 void
 start_tool (string executable, string app)
 {
 void
 start_tool (string executable, string app)
 {
-       boost::filesystem::path exe_path = directory_containing_executable();
-       exe_path = exe_path.parent_path (); // Contents
-       exe_path = exe_path.parent_path (); // DCP-o-matic 2.app
-       exe_path = exe_path.parent_path (); // Applications
+       auto exe_path = directory_containing_executable();
+       exe_path = exe_path.parent_path(); // Contents
+       exe_path = exe_path.parent_path(); // DCP-o-matic 2.app
+       exe_path = exe_path.parent_path(); // Applications
        exe_path /= app;
        exe_path /= "Contents";
        exe_path /= "MacOS";
        exe_path /= app;
        exe_path /= "Contents";
        exe_path /= "MacOS";
@@ -235,18 +247,21 @@ thread_id ()
        return (uint64_t) pthread_self ();
 }
 
        return (uint64_t) pthread_self ();
 }
 
+
 int
 avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags)
 {
        return avio_open (s, file.c_str(), flags);
 }
 
 int
 avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags)
 {
        return avio_open (s, file.c_str(), flags);
 }
 
+
 boost::filesystem::path
 home_directory ()
 {
 boost::filesystem::path
 home_directory ()
 {
-               return getenv("HOME");
+       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 ()
 /** @return true if this process is a 32-bit one running on a 64-bit-capable OS */
 bool
 running_32_on_64 ()
@@ -255,6 +270,7 @@ running_32_on_64 ()
        return false;
 }
 
        return false;
 }
 
+
 static optional<string>
 get_vendor (CFDictionaryRef& description)
 {
 static optional<string>
 get_vendor (CFDictionaryRef& description)
 {
@@ -273,6 +289,7 @@ get_vendor (CFDictionaryRef& description)
        return s;
 }
 
        return s;
 }
 
+
 static optional<string>
 get_model (CFDictionaryRef& description)
 {
 static optional<string>
 get_model (CFDictionaryRef& description)
 {
@@ -291,12 +308,14 @@ get_model (CFDictionaryRef& description)
        return s;
 }
 
        return s;
 }
 
+
 struct MediaPath
 {
        bool real;       ///< true for a "real" disk, false for a synthesized APFS one
        std::string prt; ///< "PRT" entry from the media path
 };
 
 struct MediaPath
 {
        bool real;       ///< true for a "real" disk, false for a synthesized APFS one
        std::string prt; ///< "PRT" entry from the media path
 };
 
+
 static optional<MediaPath>
 analyse_media_path (CFDictionaryRef& description)
 {
 static optional<MediaPath>
 analyse_media_path (CFDictionaryRef& description)
 {
@@ -343,6 +362,7 @@ analyse_media_path (CFDictionaryRef& description)
        return mp;
 }
 
        return mp;
 }
 
+
 static bool
 is_whole_drive (DADiskRef& disk)
 {
 static bool
 is_whole_drive (DADiskRef& disk)
 {
@@ -357,6 +377,7 @@ is_whole_drive (DADiskRef& disk)
        return whole_media;
 }
 
        return whole_media;
 }
 
+
 static optional<boost::filesystem::path>
 mount_point (CFDictionaryRef& description)
 {
 static optional<boost::filesystem::path>
 mount_point (CFDictionaryRef& description)
 {
@@ -372,6 +393,7 @@ mount_point (CFDictionaryRef& description)
        return boost::filesystem::path(mount_path_buffer);
 }
 
        return boost::filesystem::path(mount_path_buffer);
 }
 
+
 /* Here follows some rather intricate and (probably) fragile code to find the list of available
  * "real" drives on macOS that we might want to write a DCP to.
  *
 /* Here follows some rather intricate and (probably) fragile code to find the list of available
  * "real" drives on macOS that we might want to write a DCP to.
  *
@@ -408,6 +430,7 @@ struct Disk
        unsigned long size;
 };
 
        unsigned long size;
 };
 
+
 static void
 disk_appeared (DADiskRef disk, void* context)
 {
 static void
 disk_appeared (DADiskRef disk, void* context)
 {
@@ -463,19 +486,20 @@ disk_appeared (DADiskRef disk, void* context)
        reinterpret_cast<vector<Disk>*>(context)->push_back(this_disk);
 }
 
        reinterpret_cast<vector<Disk>*>(context)->push_back(this_disk);
 }
 
+
 vector<Drive>
 Drive::get ()
 {
        using namespace boost::algorithm;
        vector<Disk> disks;
 
 vector<Drive>
 Drive::get ()
 {
        using namespace boost::algorithm;
        vector<Disk> disks;
 
-       DASessionRef session = DASessionCreate(kCFAllocatorDefault);
+       auto session = DASessionCreate(kCFAllocatorDefault);
        if (!session) {
                return {};
        }
 
        DARegisterDiskAppearedCallback (session, NULL, disk_appeared, &disks);
        if (!session) {
                return {};
        }
 
        DARegisterDiskAppearedCallback (session, NULL, disk_appeared, &disks);
-       CFRunLoopRef run_loop = CFRunLoopGetCurrent ();
+       auto run_loop = CFRunLoopGetCurrent ();
        DASessionScheduleWithRunLoop (session, run_loop, kCFRunLoopDefaultMode);
        CFRunLoopStop (run_loop);
        CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.05, 0);
        DASessionScheduleWithRunLoop (session, run_loop, kCFRunLoopDefaultMode);
        CFRunLoopStop (run_loop);
        CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.05, 0);
@@ -496,7 +520,7 @@ Drive::get ()
        }
 
        /* Make a map of the PRT codes and mount points of mounted, synthesized disks */
        }
 
        /* Make a map of the PRT codes and mount points of mounted, synthesized disks */
-       map<string, vector<boost::filesystem::path> > mounted_synths;
+       map<string, vector<boost::filesystem::path>> mounted_synths;
        for (auto& i: disks) {
                if (!i.real && !i.mount_points.empty()) {
                        LOG_DISK("Found a mounted synth %1 with %2", i.mount_point, i.prt);
        for (auto& i: disks) {
                if (!i.real && !i.mount_points.empty()) {
                        LOG_DISK("Found a mounted synth %1 with %2", i.mount_point, i.prt);
@@ -559,12 +583,12 @@ Drive::unmount ()
 {
        LOG_DISK_NC("Unmount operation started");
 
 {
        LOG_DISK_NC("Unmount operation started");
 
-       DASessionRef session = DASessionCreate(kCFAllocatorDefault);
+       auto session = DASessionCreate(kCFAllocatorDefault);
        if (!session) {
                return false;
        }
 
        if (!session) {
                return false;
        }
 
-       DADiskRef disk = DADiskCreateFromBSDName(kCFAllocatorDefault, session, _device.c_str());
+       auto disk = DADiskCreateFromBSDName(kCFAllocatorDefault, session, _device.c_str());
        if (!disk) {
                return false;
        }
        if (!disk) {
                return false;
        }
index 494924daad4486587bc7fb3200a900c3776390ec..777969c10969f94eec205a84a6d59bf8a8d27e33 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /* Based on code from https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption */
 
 /* Based on code from https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption */
 
+
 #include "crypto.h"
 #include "exceptions.h"
 #include <openssl/conf.h>
 #include "crypto.h"
 #include "exceptions.h"
 #include <openssl/conf.h>
 #include <openssl/rand.h>
 #include <boost/scoped_array.hpp>
 
 #include <openssl/rand.h>
 #include <boost/scoped_array.hpp>
 
+
 using std::string;
 using namespace dcpomatic;
 
 using std::string;
 using namespace dcpomatic;
 
+
 /** The cipher that this code uses */
 #define CIPHER EVP_aes_256_cbc()
 
 /** The cipher that this code uses */
 #define CIPHER EVP_aes_256_cbc()
 
+
 dcp::ArrayData
 dcpomatic::random_iv ()
 {
 dcp::ArrayData
 dcpomatic::random_iv ()
 {
@@ -43,10 +48,11 @@ dcpomatic::random_iv ()
        return iv;
 }
 
        return iv;
 }
 
+
 dcp::ArrayData
 dcpomatic::encrypt (string plaintext, dcp::ArrayData key, dcp::ArrayData iv)
 {
 dcp::ArrayData
 dcpomatic::encrypt (string plaintext, dcp::ArrayData key, dcp::ArrayData iv)
 {
-       EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new ();
+       auto ctx = EVP_CIPHER_CTX_new ();
        if (!ctx) {
                throw CryptoError ("could not create cipher context");
        }
        if (!ctx) {
                throw CryptoError ("could not create cipher context");
        }
@@ -78,10 +84,11 @@ dcpomatic::encrypt (string plaintext, dcp::ArrayData key, dcp::ArrayData iv)
        return ciphertext;
 }
 
        return ciphertext;
 }
 
+
 string
 dcpomatic::decrypt (dcp::ArrayData ciphertext, dcp::ArrayData key, dcp::ArrayData iv)
 {
 string
 dcpomatic::decrypt (dcp::ArrayData ciphertext, dcp::ArrayData key, dcp::ArrayData iv)
 {
-       EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new ();
+       auto ctx = EVP_CIPHER_CTX_new ();
        if (!ctx) {
                throw CryptoError ("could not create cipher context");
        }
        if (!ctx) {
                throw CryptoError ("could not create cipher context");
        }
@@ -115,6 +122,7 @@ dcpomatic::decrypt (dcp::ArrayData ciphertext, dcp::ArrayData key, dcp::ArrayDat
        return string ((char *) plaintext.data());
 }
 
        return string ((char *) plaintext.data());
 }
 
+
 int
 dcpomatic::crypto_key_length ()
 {
 int
 dcpomatic::crypto_key_length ()
 {
index ee0ff9b558d6026e816ff81aac0d6cc0de7d86a1..41a93010d795e1a5c1798a542d3247becb481ffe 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include <dcp/array_data.h>
 
 #include <dcp/array_data.h>
 
+
 namespace dcpomatic {
 
 namespace dcpomatic {
 
+
 dcp::ArrayData random_iv ();
 dcp::ArrayData encrypt (std::string plaintext, dcp::ArrayData key, dcp::ArrayData iv);
 std::string decrypt (dcp::ArrayData ciphertext, dcp::ArrayData key, dcp::ArrayData iv);
 int crypto_key_length ();
 
 dcp::ArrayData random_iv ();
 dcp::ArrayData encrypt (std::string plaintext, dcp::ArrayData key, dcp::ArrayData iv);
 std::string decrypt (dcp::ArrayData ciphertext, dcp::ArrayData key, dcp::ArrayData iv);
 int crypto_key_length ();
 
+
 }
 
 }
 
index 82dca98f888c01ae3dfeb2ef17c4cfbfa4d0f888..60835bea716cc6eab0e696f738dc95550ad06863 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "curl_uploader.h"
 #include "exceptions.h"
 #include "config.h"
 #include "curl_uploader.h"
 #include "exceptions.h"
 #include "config.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::string;
 using std::cout;
 using std::function;
 
 using std::string;
 using std::cout;
 using std::function;
 
+
 static size_t
 read_callback (void* ptr, size_t size, size_t nmemb, void* object)
 {
 static size_t
 read_callback (void* ptr, size_t size, size_t nmemb, void* object)
 {
@@ -38,11 +41,9 @@ read_callback (void* ptr, size_t size, size_t nmemb, void* object)
        return u->read_callback (ptr, size, nmemb);
 }
 
        return u->read_callback (ptr, size, nmemb);
 }
 
+
 CurlUploader::CurlUploader (function<void (string)> set_status, function<void (float)> set_progress)
        : Uploader (set_status, set_progress)
 CurlUploader::CurlUploader (function<void (string)> set_status, function<void (float)> set_progress)
        : Uploader (set_status, set_progress)
-       , _file (0)
-       , _transferred (0)
-       , _total_size (0)
 {
        _curl = curl_easy_init ();
        if (!_curl) {
 {
        _curl = curl_easy_init ();
        if (!_curl) {
@@ -54,10 +55,11 @@ CurlUploader::CurlUploader (function<void (string)> set_status, function<void (f
        curl_easy_setopt (_curl, CURLOPT_UPLOAD, 1L);
        curl_easy_setopt (_curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
        curl_easy_setopt (_curl, CURLOPT_READDATA, this);
        curl_easy_setopt (_curl, CURLOPT_UPLOAD, 1L);
        curl_easy_setopt (_curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
        curl_easy_setopt (_curl, CURLOPT_READDATA, this);
-       curl_easy_setopt (_curl, CURLOPT_USERNAME, Config::instance()->tms_user().c_str ());
-       curl_easy_setopt (_curl, CURLOPT_PASSWORD, Config::instance()->tms_password().c_str ());
+       curl_easy_setopt (_curl, CURLOPT_USERNAME, Config::instance()->tms_user().c_str());
+       curl_easy_setopt (_curl, CURLOPT_PASSWORD, Config::instance()->tms_password().c_str());
 }
 
 }
 
+
 CurlUploader::~CurlUploader ()
 {
        if (_file) {
 CurlUploader::~CurlUploader ()
 {
        if (_file) {
@@ -66,12 +68,14 @@ CurlUploader::~CurlUploader ()
        curl_easy_cleanup (_curl);
 }
 
        curl_easy_cleanup (_curl);
 }
 
+
 void
 CurlUploader::create_directory (boost::filesystem::path)
 {
        /* this is done by libcurl */
 }
 
 void
 CurlUploader::create_directory (boost::filesystem::path)
 {
        /* this is done by libcurl */
 }
 
+
 void
 CurlUploader::upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size)
 {
 void
 CurlUploader::upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size)
 {
@@ -88,7 +92,7 @@ CurlUploader::upload_file (boost::filesystem::path from, boost::filesystem::path
        _transferred = &transferred;
        _total_size = total_size;
 
        _transferred = &transferred;
        _total_size = total_size;
 
-       CURLcode const r = curl_easy_perform (_curl);
+       auto const r = curl_easy_perform (_curl);
        if (r != CURLE_OK) {
                throw NetworkError (String::compose (_("Could not write to remote file (%1)"), curl_easy_strerror (r)));
        }
        if (r != CURLE_OK) {
                throw NetworkError (String::compose (_("Could not write to remote file (%1)"), curl_easy_strerror (r)));
        }
@@ -97,6 +101,7 @@ CurlUploader::upload_file (boost::filesystem::path from, boost::filesystem::path
        _file = 0;
 }
 
        _file = 0;
 }
 
+
 size_t
 CurlUploader::read_callback (void* ptr, size_t size, size_t nmemb)
 {
 size_t
 CurlUploader::read_callback (void* ptr, size_t size, size_t nmemb)
 {
index 14cbce3639606b102f4e72aa9e3d8b463f86d2b9..a3ef3cb229ba6367e622fb4a0402b6bbd35d2a24 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "uploader.h"
 #include <curl/curl.h>
 
 #include "uploader.h"
 #include <curl/curl.h>
 
+
 class CurlUploader : public Uploader
 {
 public:
 class CurlUploader : public Uploader
 {
 public:
@@ -36,7 +38,7 @@ protected:
 private:
        CURL* _curl;
 
 private:
        CURL* _curl;
 
-       FILE* _file;
-       boost::uintmax_t* _transferred;
-       boost::uintmax_t _total_size;
+       FILE* _file = nullptr;
+       boost::uintmax_t* _transferred = nullptr;
+       boost::uintmax_t _total_size = 0;
 };
 };
index ade750ce1f789a6f9d357c33df1f9774de2ecd9b..bfebd5fb385709d178141a16e38ad81520f3e7fb 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "datasat_ap2x.h"
 
 #include "i18n.h"
 
 #include "datasat_ap2x.h"
 
 #include "i18n.h"
 
+
 DatasatAP2x::DatasatAP2x ()
        : CinemaSoundProcessor ("dataset_ap2x", _("Datasat AP20 or AP25"), 3.2f, 20, 5)
 {
 DatasatAP2x::DatasatAP2x ()
        : CinemaSoundProcessor ("dataset_ap2x", _("Datasat AP20 or AP25"), 3.2f, 20, 5)
 {
index 4bbe3952101b36b55775356f112c54305167e4c7..3fbaad1dc9721fcba45eee64e9a210495880525c 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/lib/datasat_ap2x.h
  *  @brief DatasatAP2x class.
  */
 
 /** @file  src/lib/datasat_ap2x.h
  *  @brief DatasatAP2x class.
  */
 
+
 #include "cinema_sound_processor.h"
 
 #include "cinema_sound_processor.h"
 
+
 class DatasatAP2x : public CinemaSoundProcessor
 {
 public:
 class DatasatAP2x : public CinemaSoundProcessor
 {
 public:
index e1b05852cf8c0e614fcfb74d5a5754101ae4c85f..6d7286a488970861930e10a17e1271ebacb001b6 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
+using boost::optional;
 using namespace std;
 
 using namespace std;
 
+
 vector<DCPContentType const *> DCPContentType::_dcp_content_types;
 
 vector<DCPContentType const *> DCPContentType::_dcp_content_types;
 
+
 DCPContentType::DCPContentType (string p, dcp::ContentKind k, string d)
        : _pretty_name (p)
        , _libdcp_kind (k)
 DCPContentType::DCPContentType (string p, dcp::ContentKind k, string d)
        : _pretty_name (p)
        , _libdcp_kind (k)
@@ -39,23 +43,27 @@ DCPContentType::DCPContentType (string p, dcp::ContentKind k, string d)
 
 }
 
 
 }
 
+
 void
 DCPContentType::setup_dcp_content_types ()
 {
 void
 DCPContentType::setup_dcp_content_types ()
 {
-       _dcp_content_types.push_back (new DCPContentType(_("Feature"), dcp::ContentKind::FEATURE, N_("FTR")));
-       _dcp_content_types.push_back (new DCPContentType(_("Short"), dcp::ContentKind::SHORT, N_("SHR")));
-       _dcp_content_types.push_back (new DCPContentType(_("Trailer"), dcp::ContentKind::TRAILER, N_("TLR")));
-       _dcp_content_types.push_back (new DCPContentType(_("Test"), dcp::ContentKind::TEST, N_("TST")));
-       _dcp_content_types.push_back (new DCPContentType(_("Transitional"), dcp::ContentKind::TRANSITIONAL, N_("XSN")));
-       _dcp_content_types.push_back (new DCPContentType(_("Rating"), dcp::ContentKind::RATING, N_("RTG")));
-       _dcp_content_types.push_back (new DCPContentType(_("Teaser"), dcp::ContentKind::TEASER, N_("TSR")));
-       _dcp_content_types.push_back (new DCPContentType(_("Policy"), dcp::ContentKind::POLICY, N_("POL")));
-       _dcp_content_types.push_back (new DCPContentType(_("Public Service Announcement"), dcp::ContentKind::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA")));
-       _dcp_content_types.push_back (new DCPContentType(_("Advertisement"), dcp::ContentKind::ADVERTISEMENT, N_("ADV")));
-       _dcp_content_types.push_back (new DCPContentType(_("Episode"), dcp::ContentKind::EPISODE, N_("EPS")));
-       _dcp_content_types.push_back (new DCPContentType(_("Promo"), dcp::ContentKind::PROMO, N_("PRO")));
+       _dcp_content_types = {
+               new DCPContentType(_("Feature"), dcp::ContentKind::FEATURE, N_("FTR")),
+               new DCPContentType(_("Short"), dcp::ContentKind::SHORT, N_("SHR")),
+               new DCPContentType(_("Trailer"), dcp::ContentKind::TRAILER, N_("TLR")),
+               new DCPContentType(_("Test"), dcp::ContentKind::TEST, N_("TST")),
+               new DCPContentType(_("Transitional"), dcp::ContentKind::TRANSITIONAL, N_("XSN")),
+               new DCPContentType(_("Rating"), dcp::ContentKind::RATING, N_("RTG")),
+               new DCPContentType(_("Teaser"), dcp::ContentKind::TEASER, N_("TSR")),
+               new DCPContentType(_("Policy"), dcp::ContentKind::POLICY, N_("POL")),
+               new DCPContentType(_("Public Service Announcement"), dcp::ContentKind::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA")),
+               new DCPContentType(_("Advertisement"), dcp::ContentKind::ADVERTISEMENT, N_("ADV")),
+               new DCPContentType(_("Episode"), dcp::ContentKind::EPISODE, N_("EPS")),
+               new DCPContentType(_("Promo"), dcp::ContentKind::PROMO, N_("PRO"))
+       };
 }
 
 }
 
+
 DCPContentType const *
 DCPContentType::from_isdcf_name (string n)
 {
 DCPContentType const *
 DCPContentType::from_isdcf_name (string n)
 {
@@ -68,6 +76,7 @@ DCPContentType::from_isdcf_name (string n)
        return 0;
 }
 
        return 0;
 }
 
+
 DCPContentType const *
 DCPContentType::from_libdcp_kind (dcp::ContentKind kind)
 {
 DCPContentType const *
 DCPContentType::from_libdcp_kind (dcp::ContentKind kind)
 {
@@ -78,18 +87,19 @@ DCPContentType::from_libdcp_kind (dcp::ContentKind kind)
        }
 
        DCPOMATIC_ASSERT (false);
        }
 
        DCPOMATIC_ASSERT (false);
-       return 0;
+       return nullptr;
 }
 
 
 DCPContentType const *
 DCPContentType::from_index (int n)
 {
 }
 
 
 DCPContentType const *
 DCPContentType::from_index (int n)
 {
-       DCPOMATIC_ASSERT (n >= 0 && n < int (_dcp_content_types.size ()));
+       DCPOMATIC_ASSERT (n >= 0 && n < int(_dcp_content_types.size()));
        return _dcp_content_types[n];
 }
 
        return _dcp_content_types[n];
 }
 
-int
+
+optional<int>
 DCPContentType::as_index (DCPContentType const * c)
 {
        vector<DCPContentType*>::size_type i = 0;
 DCPContentType::as_index (DCPContentType const * c)
 {
        vector<DCPContentType*>::size_type i = 0;
@@ -97,13 +107,14 @@ DCPContentType::as_index (DCPContentType const * c)
                ++i;
        }
 
                ++i;
        }
 
-       if (i == _dcp_content_types.size ()) {
-               return -1;
+       if (i == _dcp_content_types.size()) {
+               return {};
        }
 
        return i;
 }
 
        }
 
        return i;
 }
 
+
 vector<DCPContentType const *>
 DCPContentType::all ()
 {
 vector<DCPContentType const *>
 DCPContentType::all ()
 {
index f45bbb9f87808bed7a8fe5a0d5241943dedb81fe..03a52e57ce00053a0d122b2a9eee93566e22128a 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -60,7 +60,7 @@ public:
        static DCPContentType const * from_isdcf_name (std::string);
        static DCPContentType const * from_libdcp_kind (dcp::ContentKind);
        static DCPContentType const * from_index (int);
        static DCPContentType const * from_isdcf_name (std::string);
        static DCPContentType const * from_libdcp_kind (dcp::ContentKind);
        static DCPContentType const * from_index (int);
-       static int as_index (DCPContentType const *);
+       static boost::optional<int> as_index (DCPContentType const *);
        static std::vector<DCPContentType const *> all ();
        static void setup_dcp_content_types ();
 
        static std::vector<DCPContentType const *> all ();
        static void setup_dcp_content_types ();
 
index 8704f627ac39e624b02214d4230d5a17f73fb409..30c3075691d4baa1a81130ade548227d63c84e35 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "dkdm_recipient.h"
 #include "kdm_with_metadata.h"
 #include "film.h"
 #include <dcp/raw_convert.h>
 
 
 #include "dkdm_recipient.h"
 #include "kdm_with_metadata.h"
 #include "film.h"
 #include <dcp/raw_convert.h>
 
 
+using std::make_shared;
+using std::shared_ptr;
 using std::string;
 using std::vector;
 using std::string;
 using std::vector;
-using std::shared_ptr;
 using dcp::raw_convert;
 
 
 using dcp::raw_convert;
 
 
@@ -72,7 +74,7 @@ kdm_for_dkdm_recipient (
        dcp::LocalTime const begin(valid_from, recipient->utc_offset_hour, recipient->utc_offset_minute);
        dcp::LocalTime const end  (valid_to,   recipient->utc_offset_hour, recipient->utc_offset_minute);
 
        dcp::LocalTime const begin(valid_from, recipient->utc_offset_hour, recipient->utc_offset_minute);
        dcp::LocalTime const end  (valid_to,   recipient->utc_offset_hour, recipient->utc_offset_minute);
 
-       dcp::EncryptedKDM const kdm = film->make_kdm (
+       auto const kdm = film->make_kdm (
                        recipient->recipient.get(),
                        vector<string>(),
                        cpl,
                        recipient->recipient.get(),
                        vector<string>(),
                        cpl,
@@ -89,6 +91,6 @@ kdm_for_dkdm_recipient (
        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
        name_values['i'] = kdm.cpl_id();
 
        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
        name_values['i'] = kdm.cpl_id();
 
-       return KDMWithMetadataPtr(new KDMWithMetadata(name_values, 0, recipient->emails, kdm));
+       return make_shared<KDMWithMetadata>(name_values, nullptr, recipient->emails, kdm);
 }
 
 }
 
index 7cf59a495e007a581c2b78bc1f17304f7d11a926..d08f82daafa0e618f5b63ffb71b4055099ed6f1f 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "kdm_recipient.h"
 #include "kdm_with_metadata.h"
 
 #include "kdm_recipient.h"
 #include "kdm_with_metadata.h"
 
+
 class Film;
 
 class Film;
 
+
 class DKDMRecipient : public KDMRecipient
 {
 public:
 class DKDMRecipient : public KDMRecipient
 {
 public:
index 8a061738bd14c86bfd6658bc5b194def845c94b0..6ef23c3e0c03a3e20cd241df9453dddfea8501aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2015-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "compose.hpp"
 #include "config.h"
 #include "emailer.h"
 #include "compose.hpp"
 #include "config.h"
 #include "emailer.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
-using std::min;
-using std::list;
+
 using std::cout;
 using std::cout;
+using std::list;
+using std::min;
 using std::pair;
 using std::shared_ptr;
 using std::pair;
 using std::shared_ptr;
+using std::string;
 using dcp::ArrayData;
 
 using dcp::ArrayData;
 
+
 Emailer::Emailer (string from, list<string> to, string subject, string body)
        : _from (from)
        , _to (to)
 Emailer::Emailer (string from, list<string> to, string subject, string body)
        : _from (from)
        , _to (to)
@@ -46,6 +49,7 @@ Emailer::Emailer (string from, list<string> to, string subject, string body)
 
 }
 
 
 }
 
+
 string
 Emailer::fix (string s) const
 {
 string
 Emailer::fix (string s) const
 {
@@ -54,18 +58,21 @@ Emailer::fix (string s) const
        return s;
 }
 
        return s;
 }
 
+
 void
 Emailer::add_cc (string cc)
 {
        _cc.push_back (cc);
 }
 
 void
 Emailer::add_cc (string cc)
 {
        _cc.push_back (cc);
 }
 
+
 void
 Emailer::add_bcc (string bcc)
 {
        _bcc.push_back (bcc);
 }
 
 void
 Emailer::add_bcc (string bcc)
 {
        _bcc.push_back (bcc);
 }
 
+
 void
 Emailer::add_attachment (boost::filesystem::path file, string name, string mime_type)
 {
 void
 Emailer::add_attachment (boost::filesystem::path file, string name, string mime_type)
 {
@@ -76,18 +83,21 @@ Emailer::add_attachment (boost::filesystem::path file, string name, string mime_
        _attachments.push_back (a);
 }
 
        _attachments.push_back (a);
 }
 
+
 static size_t
 curl_data_shim (void* ptr, size_t size, size_t nmemb, void* userp)
 {
        return reinterpret_cast<Emailer*>(userp)->get_data (ptr, size, nmemb);
 }
 
 static size_t
 curl_data_shim (void* ptr, size_t size, size_t nmemb, void* userp)
 {
        return reinterpret_cast<Emailer*>(userp)->get_data (ptr, size, nmemb);
 }
 
+
 static int
 curl_debug_shim (CURL* curl, curl_infotype type, char* data, size_t size, void* userp)
 {
        return reinterpret_cast<Emailer*>(userp)->debug (curl, type, data, size);
 }
 
 static int
 curl_debug_shim (CURL* curl, curl_infotype type, char* data, size_t size, void* userp)
 {
        return reinterpret_cast<Emailer*>(userp)->debug (curl, type, data, size);
 }
 
+
 size_t
 Emailer::get_data (void* ptr, size_t size, size_t nmemb)
 {
 size_t
 Emailer::get_data (void* ptr, size_t size, size_t nmemb)
 {
@@ -97,28 +107,29 @@ Emailer::get_data (void* ptr, size_t size, size_t nmemb)
        return t;
 }
 
        return t;
 }
 
+
 void
 Emailer::send (string server, int port, EmailProtocol protocol, string user, string password)
 {
        char date_buffer[128];
        time_t now = time (0);
 void
 Emailer::send (string server, int port, EmailProtocol protocol, string user, string password)
 {
        char date_buffer[128];
        time_t now = time (0);
-       strftime (date_buffer, sizeof(date_buffer), "%a, %d %b %Y %H:%M:%S ", localtime (&now));
+       strftime (date_buffer, sizeof(date_buffer), "%a, %d %b %Y %H:%M:%S ", localtime(&now));
 
 
-       boost::posix_time::ptime const utc_now = boost::posix_time::second_clock::universal_time ();
-       boost::posix_time::ptime const local_now = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local (utc_now);
-       boost::posix_time::time_duration offset = local_now - utc_now;
+       auto const utc_now = boost::posix_time::second_clock::universal_time ();
+       auto const local_now = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local (utc_now);
+       auto offset = local_now - utc_now;
        sprintf (date_buffer + strlen(date_buffer), "%s%02d%02d", (offset.hours() >= 0 ? "+" : "-"), int(abs(offset.hours())), int(offset.minutes()));
 
        _email = "Date: " + string(date_buffer) + "\r\n"
                "To: " + address_list (_to) + "\r\n"
                "From: " + _from + "\r\n";
 
        sprintf (date_buffer + strlen(date_buffer), "%s%02d%02d", (offset.hours() >= 0 ? "+" : "-"), int(abs(offset.hours())), int(offset.minutes()));
 
        _email = "Date: " + string(date_buffer) + "\r\n"
                "To: " + address_list (_to) + "\r\n"
                "From: " + _from + "\r\n";
 
-       if (!_cc.empty ()) {
-               _email += "Cc: " + address_list (_cc) + "\r\n";
+       if (!_cc.empty()) {
+               _email += "Cc: " + address_list(_cc) + "\r\n";
        }
 
        }
 
-       if (!_bcc.empty ()) {
-               _email += "Bcc: " + address_list (_bcc) + "\r\n";
+       if (!_bcc.empty()) {
+               _email += "Bcc: " + address_list(_bcc) + "\r\n";
        }
 
        string const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        }
 
        string const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
@@ -149,9 +160,9 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
                        "Content-Transfer-Encoding: Base64\r\n"
                        "Content-Disposition: attachment; filename=" + i.name + "\r\n\r\n";
 
                        "Content-Transfer-Encoding: Base64\r\n"
                        "Content-Disposition: attachment; filename=" + i.name + "\r\n\r\n";
 
-               BIO* b64 = BIO_new (BIO_f_base64());
+               auto b64 = BIO_new (BIO_f_base64());
 
 
-               BIO* bio = BIO_new (BIO_s_mem());
+               auto bio = BIO_new (BIO_s_mem());
                bio = BIO_push (b64, bio);
 
                ArrayData data (i.file);
                bio = BIO_push (b64, bio);
 
                ArrayData data (i.file);
@@ -171,7 +182,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
 
        curl_global_init (CURL_GLOBAL_DEFAULT);
 
 
        curl_global_init (CURL_GLOBAL_DEFAULT);
 
-       CURL* curl = curl_easy_init ();
+       auto curl = curl_easy_init ();
        if (!curl) {
                throw NetworkError ("Could not initialise libcurl");
        }
        if (!curl) {
                throw NetworkError ("Could not initialise libcurl");
        }
@@ -192,7 +203,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
 
        curl_easy_setopt (curl, CURLOPT_MAIL_FROM, _from.c_str());
 
 
        curl_easy_setopt (curl, CURLOPT_MAIL_FROM, _from.c_str());
 
-       struct curl_slist* recipients = 0;
+       struct curl_slist* recipients = nullptr;
        for (auto i: _to) {
                recipients = curl_slist_append (recipients, i.c_str());
        }
        for (auto i: _to) {
                recipients = curl_slist_append (recipients, i.c_str());
        }
@@ -218,7 +229,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
        curl_easy_setopt (curl, CURLOPT_DEBUGFUNCTION, curl_debug_shim);
        curl_easy_setopt (curl, CURLOPT_DEBUGDATA, this);
 
        curl_easy_setopt (curl, CURLOPT_DEBUGFUNCTION, curl_debug_shim);
        curl_easy_setopt (curl, CURLOPT_DEBUGDATA, this);
 
-       CURLcode const r = curl_easy_perform (curl);
+       auto const r = curl_easy_perform (curl);
        if (r != CURLE_OK) {
                throw KDMError (_("Failed to send email"), curl_easy_strerror (r));
        }
        if (r != CURLE_OK) {
                throw KDMError (_("Failed to send email"), curl_easy_strerror (r));
        }
@@ -228,6 +239,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
        curl_global_cleanup ();
 }
 
        curl_global_cleanup ();
 }
 
+
 string
 Emailer::address_list (list<string> addresses)
 {
 string
 Emailer::address_list (list<string> addresses)
 {
@@ -239,6 +251,7 @@ Emailer::address_list (list<string> addresses)
        return o.substr (0, o.length() - 2);
 }
 
        return o.substr (0, o.length() - 2);
 }
 
+
 int
 Emailer::debug (CURL *, curl_infotype type, char* data, size_t size)
 {
 int
 Emailer::debug (CURL *, curl_infotype type, char* data, size_t size)
 {
index 4ceedb9beade87a0426dbf61e9d0deb6ea0d4eeb..fa278e535447eb675d0a7767ecec7112a1765073 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2015-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include <curl/curl.h>
 #include <boost/scoped_array.hpp>
 
 #include <curl/curl.h>
 #include <boost/scoped_array.hpp>
 
+
 class Emailer
 {
 public:
 class Emailer
 {
 public:
index 2fab210c94838fe03e53a77ebea5ab0efcb87f87..6faab0e63b829e9b65bef2672f6934295504323e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "encode_server_finder.h"
 #include "exceptions.h"
 #include "util.h"
 #include "encode_server_finder.h"
 #include "exceptions.h"
 #include "util.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
-using std::list;
-using std::vector;
+
 using std::cout;
 using std::cout;
+using std::list;
+using std::make_shared;
 using std::shared_ptr;
 using std::shared_ptr;
-using boost::scoped_array;
+using std::string;
+using std::vector;
 using std::weak_ptr;
 using boost::optional;
 using std::weak_ptr;
 using boost::optional;
+using boost::scoped_array;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using dcp::raw_convert;
 
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using dcp::raw_convert;
 
+
 EncodeServerFinder* EncodeServerFinder::_instance = 0;
 
 EncodeServerFinder* EncodeServerFinder::_instance = 0;
 
+
 EncodeServerFinder::EncodeServerFinder ()
        : _stop (false)
 {
        Config::instance()->Changed.connect (boost::bind (&EncodeServerFinder::config_changed, this, _1));
 }
 
 EncodeServerFinder::EncodeServerFinder ()
        : _stop (false)
 {
        Config::instance()->Changed.connect (boost::bind (&EncodeServerFinder::config_changed, this, _1));
 }
 
+
 void
 EncodeServerFinder::start ()
 {
 void
 EncodeServerFinder::start ()
 {
@@ -71,6 +77,7 @@ EncodeServerFinder::~EncodeServerFinder ()
        stop ();
 }
 
        stop ();
 }
 
+
 void
 EncodeServerFinder::stop ()
 {
 void
 EncodeServerFinder::stop ()
 {
@@ -92,6 +99,7 @@ EncodeServerFinder::stop ()
        _servers.clear ();
 }
 
        _servers.clear ();
 }
 
+
 void
 EncodeServerFinder::search_thread ()
 try
 void
 EncodeServerFinder::search_thread ()
 try
@@ -106,18 +114,18 @@ try
                throw NetworkError ("failed to set up broadcast socket");
        }
 
                throw NetworkError ("failed to set up broadcast socket");
        }
 
-        socket.set_option (boost::asio::ip::udp::socket::reuse_address (true));
-        socket.set_option (boost::asio::socket_base::broadcast (true));
+        socket.set_option (boost::asio::ip::udp::socket::reuse_address(true));
+        socket.set_option (boost::asio::socket_base::broadcast(true));
 
        string const data = DCPOMATIC_HELLO;
        int const interval = 10;
 
        while (!_stop) {
 
        string const data = DCPOMATIC_HELLO;
        int const interval = 10;
 
        while (!_stop) {
-               if (Config::instance()->use_any_servers ()) {
+               if (Config::instance()->use_any_servers()) {
                        /* Broadcast to look for servers */
                        try {
                                boost::asio::ip::udp::endpoint end_point (boost::asio::ip::address_v4::broadcast(), HELLO_PORT);
                        /* Broadcast to look for servers */
                        try {
                                boost::asio::ip::udp::endpoint end_point (boost::asio::ip::address_v4::broadcast(), HELLO_PORT);
-                               socket.send_to (boost::asio::buffer (data.c_str(), data.size() + 1), end_point);
+                               socket.send_to (boost::asio::buffer(data.c_str(), data.size() + 1), end_point);
                        } catch (...) {
 
                        }
                        } catch (...) {
 
                        }
@@ -127,9 +135,9 @@ try
                for (auto const& i: Config::instance()->servers()) {
                        try {
                                boost::asio::ip::udp::resolver resolver (io_service);
                for (auto const& i: Config::instance()->servers()) {
                        try {
                                boost::asio::ip::udp::resolver resolver (io_service);
-                               boost::asio::ip::udp::resolver::query query (i, raw_convert<string> (HELLO_PORT));
-                               boost::asio::ip::udp::endpoint end_point (*resolver.resolve (query));
-                               socket.send_to (boost::asio::buffer (data.c_str(), data.size() + 1), end_point);
+                               boost::asio::ip::udp::resolver::query query (i, raw_convert<string>(HELLO_PORT));
+                               boost::asio::ip::udp::endpoint end_point (*resolver.resolve(query));
+                               socket.send_to (boost::asio::buffer(data.c_str(), data.size() + 1), end_point);
                        } catch (...) {
 
                        }
                        } catch (...) {
 
                        }
@@ -140,10 +148,10 @@ try
                {
                        boost::mutex::scoped_lock lm (_servers_mutex);
 
                {
                        boost::mutex::scoped_lock lm (_servers_mutex);
 
-                       list<EncodeServerDescription>::iterator i = _servers.begin();
+                       auto i = _servers.begin();
                        while (i != _servers.end()) {
                                if (i->last_seen_seconds() > 2 * interval) {
                        while (i != _servers.end()) {
                                if (i->last_seen_seconds() > 2 * interval) {
-                                       list<EncodeServerDescription>::iterator j = i;
+                                       auto j = i;
                                        ++j;
                                        _servers.erase (i);
                                        i = j;
                                        ++j;
                                        _servers.erase (i);
                                        i = j;
@@ -155,11 +163,11 @@ try
                }
 
                if (removed) {
                }
 
                if (removed) {
-                       emit (boost::bind (boost::ref (ServersListChanged)));
+                       emit (boost::bind(boost::ref(ServersListChanged)));
                }
 
                boost::mutex::scoped_lock lm (_search_condition_mutex);
                }
 
                boost::mutex::scoped_lock lm (_search_condition_mutex);
-               _search_condition.timed_wait (lm, boost::get_system_time() + boost::posix_time::seconds (interval));
+               _search_condition.timed_wait (lm, boost::get_system_time() + boost::posix_time::seconds(interval));
        }
 }
 catch (...)
        }
 }
 catch (...)
@@ -167,6 +175,7 @@ catch (...)
        store_current ();
 }
 
        store_current ();
 }
 
+
 void
 EncodeServerFinder::listen_thread ()
 try {
 void
 EncodeServerFinder::listen_thread ()
 try {
@@ -176,7 +185,7 @@ try {
 
        try {
                _listen_acceptor.reset (
 
        try {
                _listen_acceptor.reset (
-                       new tcp::acceptor (_listen_io_service, tcp::endpoint (tcp::v4(), is_batch_converter ? BATCH_SERVER_PRESENCE_PORT : MAIN_SERVER_PRESENCE_PORT))
+                       new tcp::acceptor (_listen_io_service, tcp::endpoint(tcp::v4(), is_batch_converter ? BATCH_SERVER_PRESENCE_PORT : MAIN_SERVER_PRESENCE_PORT))
                        );
        } catch (...) {
                boost::throw_exception (NetworkError (_("Could not listen for remote encode servers.  Perhaps another instance of DCP-o-matic is running.")));
                        );
        } catch (...) {
                boost::throw_exception (NetworkError (_("Could not listen for remote encode servers.  Perhaps another instance of DCP-o-matic is running.")));
@@ -190,16 +199,18 @@ catch (...)
        store_current ();
 }
 
        store_current ();
 }
 
+
 void
 EncodeServerFinder::start_accept ()
 {
 void
 EncodeServerFinder::start_accept ()
 {
-       shared_ptr<Socket> socket (new Socket ());
+       auto socket = make_shared<Socket>();
        _listen_acceptor->async_accept (
                socket->socket(),
        _listen_acceptor->async_accept (
                socket->socket(),
-               boost::bind (&EncodeServerFinder::handle_accept, this, boost::asio::placeholders::error, socket)
+               boost::bind(&EncodeServerFinder::handle_accept, this, boost::asio::placeholders::error, socket)
                );
 }
 
                );
 }
 
+
 void
 EncodeServerFinder::handle_accept (boost::system::error_code ec, shared_ptr<Socket> socket)
 {
 void
 EncodeServerFinder::handle_accept (boost::system::error_code ec, shared_ptr<Socket> socket)
 {
@@ -209,18 +220,18 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec, shared_ptr<Sock
        }
 
        uint32_t length;
        }
 
        uint32_t length;
-       socket->read (reinterpret_cast<uint8_t*> (&length), sizeof (uint32_t));
+       socket->read (reinterpret_cast<uint8_t*>(&length), sizeof(uint32_t));
        length = ntohl (length);
 
        length = ntohl (length);
 
-       scoped_array<char> buffer (new char[length]);
-       socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length);
+       scoped_array<char> buffer(new char[length]);
+       socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);
 
        string s (buffer.get());
 
        string s (buffer.get());
-       shared_ptr<cxml::Document> xml (new cxml::Document ("ServerAvailable"));
+       auto xml = make_shared<cxml::Document>("ServerAvailable");
        xml->read_string (s);
 
        xml->read_string (s);
 
-       string const ip = socket->socket().remote_endpoint().address().to_string ();
-       optional<list<EncodeServerDescription>::iterator> found = server_found (ip);
+       auto const ip = socket->socket().remote_endpoint().address().to_string();
+       auto found = server_found (ip);
        if (found) {
                (*found)->set_seen ();
        } else {
        if (found) {
                (*found)->set_seen ();
        } else {
@@ -229,17 +240,18 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec, shared_ptr<Sock
                        boost::mutex::scoped_lock lm (_servers_mutex);
                        _servers.push_back (sd);
                }
                        boost::mutex::scoped_lock lm (_servers_mutex);
                        _servers.push_back (sd);
                }
-               emit (boost::bind (boost::ref (ServersListChanged)));
+               emit (boost::bind(boost::ref (ServersListChanged)));
        }
 
        start_accept ();
 }
 
        }
 
        start_accept ();
 }
 
+
 optional<list<EncodeServerDescription>::iterator>
 EncodeServerFinder::server_found (string ip)
 {
        boost::mutex::scoped_lock lm (_servers_mutex);
 optional<list<EncodeServerDescription>::iterator>
 EncodeServerFinder::server_found (string ip)
 {
        boost::mutex::scoped_lock lm (_servers_mutex);
-       list<EncodeServerDescription>::iterator i = _servers.begin();
+       auto i = _servers.begin();
        while (i != _servers.end() && i->host_name() != ip) {
                ++i;
        }
        while (i != _servers.end() && i->host_name() != ip) {
                ++i;
        }
@@ -248,9 +260,10 @@ EncodeServerFinder::server_found (string ip)
                return i;
        }
 
                return i;
        }
 
-       return optional<list<EncodeServerDescription>::iterator>();
+       return {};
 }
 
 }
 
+
 EncodeServerFinder*
 EncodeServerFinder::instance ()
 {
 EncodeServerFinder*
 EncodeServerFinder::instance ()
 {
@@ -262,13 +275,15 @@ EncodeServerFinder::instance ()
        return _instance;
 }
 
        return _instance;
 }
 
+
 void
 EncodeServerFinder::drop ()
 {
        delete _instance;
 void
 EncodeServerFinder::drop ()
 {
        delete _instance;
-       _instance = 0;
+       _instance = nullptr;
 }
 
 }
 
+
 list<EncodeServerDescription>
 EncodeServerFinder::servers () const
 {
 list<EncodeServerDescription>
 EncodeServerFinder::servers () const
 {
@@ -276,6 +291,7 @@ EncodeServerFinder::servers () const
        return _servers;
 }
 
        return _servers;
 }
 
+
 void
 EncodeServerFinder::config_changed (Config::Property what)
 {
 void
 EncodeServerFinder::config_changed (Config::Property what)
 {
index a58c75382e35fcf0f30b6296b1b141091ad2d169..533c9219b33fd18e5ce352b4360da8b92e79b61f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/lib/encode_server_finder.h
  *  @brief EncodeServerFinder class.
  */
 
 /** @file  src/lib/encode_server_finder.h
  *  @brief EncodeServerFinder class.
  */
 
-#include "signaller.h"
-#include "encode_server_description.h"
+
 #include "config.h"
 #include "config.h"
+#include "encode_server_description.h"
 #include "exception_store.h"
 #include "exception_store.h"
+#include "signaller.h"
 #include <boost/signals2.hpp>
 #include <boost/thread/condition.hpp>
 
 #include <boost/signals2.hpp>
 #include <boost/thread/condition.hpp>
 
+
 class Socket;
 
 class Socket;
 
+
 /** @class EncodeServerFinder
  *  @brief Locater of encoding servers.
  *
 /** @class EncodeServerFinder
  *  @brief Locater of encoding servers.
  *
index 2da84dacdd0a1946c9e2709ef6e288444787d1c8..4e1b98210b24ded346b8428c298c5be6f7a52c3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "encoded_log_entry.h"
 #include <cstdio>
 
 #include "encoded_log_entry.h"
 #include <cstdio>
 
+
 using std::string;
 
 using std::string;
 
+
 EncodedLogEntry::EncodedLogEntry (int frame, string ip, double receive, double encode, double send)
        : LogEntry (LogEntry::TYPE_GENERAL)
        , _frame (frame)
 EncodedLogEntry::EncodedLogEntry (int frame, string ip, double receive, double encode, double send)
        : LogEntry (LogEntry::TYPE_GENERAL)
        , _frame (frame)
@@ -34,6 +37,7 @@ EncodedLogEntry::EncodedLogEntry (int frame, string ip, double receive, double e
 
 }
 
 
 }
 
+
 string
 EncodedLogEntry::message () const
 {
 string
 EncodedLogEntry::message () const
 {
index 54eb9dfaec09d1be20f1a6ae9bce2c3c79607b32..c4633dbe9dd2b571f4c37d3750c079fb4f2e8763 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "log_entry.h"
 
 #include "log_entry.h"
 
+
 class EncodedLogEntry : public LogEntry
 {
 public:
 class EncodedLogEntry : public LogEntry
 {
 public:
index efe80b243ce53f328609b1d8be2af1975a725b79..fca88aaf18a8b6a769d7a5fcb9cb9494d6ffa709 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2017-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "event_history.h"
 #include "util.h"
 #include <boost/thread/mutex.hpp>
 
 #include "event_history.h"
 #include "util.h"
 #include <boost/thread/mutex.hpp>
 
+
 using boost::optional;
 
 using boost::optional;
 
+
 EventHistory::EventHistory (int size)
        : _size (size)
 {
 
 }
 
 EventHistory::EventHistory (int size)
        : _size (size)
 {
 
 }
 
+
 optional<float>
 EventHistory::rate () const
 {
        boost::mutex::scoped_lock lock (_mutex);
 optional<float>
 EventHistory::rate () const
 {
        boost::mutex::scoped_lock lock (_mutex);
-       if (int (_history.size()) < _size) {
-               return optional<float>();
+       if (int(_history.size()) < _size) {
+               return {};
        }
 
        struct timeval now;
        }
 
        struct timeval now;
@@ -44,6 +48,7 @@ EventHistory::rate () const
        return _size / (seconds (now) - seconds (_history.back ()));
 }
 
        return _size / (seconds (now) - seconds (_history.back ()));
 }
 
+
 void
 EventHistory::event ()
 {
 void
 EventHistory::event ()
 {
@@ -52,7 +57,7 @@ EventHistory::event ()
        struct timeval tv;
        gettimeofday (&tv, 0);
        _history.push_front (tv);
        struct timeval tv;
        gettimeofday (&tv, 0);
        _history.push_front (tv);
-       if (int (_history.size()) > _size) {
+       if (int(_history.size()) > _size) {
                _history.pop_back ();
        }
 }
                _history.pop_back ();
        }
 }
index 4670e7bfe8069b215448d09c62f545af909c7d1c..a98447f4246f58aa37d11514a59406e59a3af326 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2017-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_EVENT_HISTORY_H
 #define DCPOMATIC_EVENT_HISTORY_H
 
 #ifndef DCPOMATIC_EVENT_HISTORY_H
 #define DCPOMATIC_EVENT_HISTORY_H
 
+
 #include <boost/thread/mutex.hpp>
 #include <boost/optional.hpp>
 #include <list>
 
 #include <boost/thread/mutex.hpp>
 #include <boost/optional.hpp>
 #include <list>
 
+
 class EventHistory
 {
 public:
 class EventHistory
 {
 public:
@@ -44,4 +47,5 @@ private:
        int const _size;
 };
 
        int const _size;
 };
 
+
 #endif
 #endif
index 3991c57b97ab98608ed280d02d581827fecdfae5..9350430f9b96fd912b9c4d2181a152e561dac65e 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "exceptions.h"
 #include "compose.hpp"
 
 #include "i18n.h"
 
 #include "exceptions.h"
 #include "compose.hpp"
 
 #include "i18n.h"
 
+
 using std::string;
 using std::runtime_error;
 using boost::optional;
 
 using std::string;
 using std::runtime_error;
 using boost::optional;
 
+
 /** @param f File that we were trying to open */
 OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode)
        : FileError (
 /** @param f File that we were trying to open */
 OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode)
        : FileError (
@@ -41,6 +44,7 @@ OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode)
 
 }
 
 
 }
 
+
 FileNotFoundError::FileNotFoundError (boost::filesystem::path f)
        : runtime_error(String::compose("File %1 not found", f.string()))
        , _file (f)
 FileNotFoundError::FileNotFoundError (boost::filesystem::path f)
        : runtime_error(String::compose("File %1 not found", f.string()))
        , _file (f)
@@ -48,74 +52,86 @@ FileNotFoundError::FileNotFoundError (boost::filesystem::path f)
 
 }
 
 
 }
 
+
 ReadFileError::ReadFileError (boost::filesystem::path f, int e)
 ReadFileError::ReadFileError (boost::filesystem::path f, int e)
-       : FileError (String::compose (_("could not read from file %1 (%2)"), f.string(), strerror (e)), f)
+       : FileError (String::compose(_("could not read from file %1 (%2)"), f.string(), strerror(e)), f)
 {
 
 }
 
 {
 
 }
 
+
 WriteFileError::WriteFileError (boost::filesystem::path f, int e)
 WriteFileError::WriteFileError (boost::filesystem::path f, int e)
-       : FileError (String::compose (_("could not write to file %1 (%2)"), f.string(), strerror (e)), f)
+       : FileError (String::compose(_("could not write to file %1 (%2)"), f.string(), strerror(e)), f)
 {
 
 }
 
 {
 
 }
 
+
 MissingSettingError::MissingSettingError (string s)
 MissingSettingError::MissingSettingError (string s)
-       : SettingError (s, String::compose (_("Missing required setting %1"), s))
+       : SettingError (s, String::compose(_("Missing required setting %1"), s))
 {
 
 }
 
 {
 
 }
 
+
 PixelFormatError::PixelFormatError (string o, AVPixelFormat f)
 PixelFormatError::PixelFormatError (string o, AVPixelFormat f)
-       : runtime_error (String::compose (_("Cannot handle pixel format %1 during %2"), (int) f, o))
+       : runtime_error (String::compose(_("Cannot handle pixel format %1 during %2"), (int) f, o))
 {
 
 }
 
 {
 
 }
 
+
 TextSubtitleError::TextSubtitleError (string saw, string expecting, boost::filesystem::path f)
 TextSubtitleError::TextSubtitleError (string saw, string expecting, boost::filesystem::path f)
-       : FileError (String::compose (_("Error in subtitle file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f)
+       : FileError (String::compose(_("Error in subtitle file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f)
 {
 
 }
 
 {
 
 }
 
+
 InvalidSignerError::InvalidSignerError ()
        : runtime_error (_("The certificate chain for signing is invalid"))
 {
 
 }
 
 InvalidSignerError::InvalidSignerError ()
        : runtime_error (_("The certificate chain for signing is invalid"))
 {
 
 }
 
+
 InvalidSignerError::InvalidSignerError (string reason)
 InvalidSignerError::InvalidSignerError (string reason)
-       : runtime_error (String::compose (_("The certificate chain for signing is invalid (%1)"), reason))
+       : runtime_error (String::compose(_("The certificate chain for signing is invalid (%1)"), reason))
 {
 
 }
 
 {
 
 }
 
+
 ProgrammingError::ProgrammingError (string file, int line, string message)
 ProgrammingError::ProgrammingError (string file, int line, string message)
-       : runtime_error (String::compose (_("Programming error at %1:%2 %3"), file, line, message))
+       : runtime_error (String::compose(_("Programming error at %1:%2 %3"), file, line, message))
 {
 
 }
 
 {
 
 }
 
+
 KDMAsContentError::KDMAsContentError ()
        : runtime_error (_("This file is a KDM.  KDMs should be added to DCP content by right-clicking the content and choosing \"Add KDM\"."))
 {
 
 }
 
 KDMAsContentError::KDMAsContentError ()
        : runtime_error (_("This file is a KDM.  KDMs should be added to DCP content by right-clicking the content and choosing \"Add KDM\"."))
 {
 
 }
 
+
 KDMError::KDMError (string s, string d)
 KDMError::KDMError (string s, string d)
-       : runtime_error (String::compose ("%1 (%2)", s, d))
+       : runtime_error (String::compose("%1 (%2)", s, d))
        , _summary (s)
        , _detail (d)
 {
 
 }
 
        , _summary (s)
        , _detail (d)
 {
 
 }
 
+
 GLError::GLError (char const * last, int e)
        : runtime_error (String::compose("%1 failed %2", last, e))
 {
 
 }
 
 GLError::GLError (char const * last, int e)
        : runtime_error (String::compose("%1 failed %2", last, e))
 {
 
 }
 
+
 CopyError::CopyError (string m, optional<int> n)
        : runtime_error (String::compose("%1%2", m, n ? String::compose(" (%1)", *n) : ""))
        , _message (m)
 CopyError::CopyError (string m, optional<int> n)
        : runtime_error (String::compose("%1%2", m, n ? String::compose(" (%1)", *n) : ""))
        , _message (m)
@@ -124,12 +140,14 @@ CopyError::CopyError (string m, optional<int> n)
 
 }
 
 
 }
 
+
 CommunicationFailedError::CommunicationFailedError ()
        : CopyError (_("Lost communication between main and writer processes"))
 {
 
 }
 
 CommunicationFailedError::CommunicationFailedError ()
        : CopyError (_("Lost communication between main and writer processes"))
 {
 
 }
 
+
 VerifyError::VerifyError (string m, int n)
        : runtime_error (String::compose("%1 (%2)", m, n))
        , _message (m)
 VerifyError::VerifyError (string m, int n)
        : runtime_error (String::compose("%1 (%2)", m, n))
        , _message (m)
index 5b7baf0e50fdc98d75f13608f4f558131601def3..93be3999b29a84feeda8e5584052c29872753aaf 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/lib/exceptions.h
  *  @brief Our exceptions.
  */
 
 /** @file  src/lib/exceptions.h
  *  @brief Our exceptions.
  */
 
+
 #ifndef DCPOMATIC_EXCEPTIONS_H
 #define DCPOMATIC_EXCEPTIONS_H
 
 #ifndef DCPOMATIC_EXCEPTIONS_H
 #define DCPOMATIC_EXCEPTIONS_H
 
+
 #include "compose.hpp"
 extern "C" {
 #include <libavutil/pixfmt.h>
 }
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
 #include "compose.hpp"
 extern "C" {
 #include <libavutil/pixfmt.h>
 }
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
-#include <stdexcept>
 #include <cstring>
 #include <cstring>
+#include <stdexcept>
+
 
 /** @class DecodeError
  *  @brief A low-level problem with the decoder (possibly due to the nature
 
 /** @class DecodeError
  *  @brief A low-level problem with the decoder (possibly due to the nature
@@ -45,15 +49,16 @@ public:
                : std::runtime_error (s)
        {}
 
                : std::runtime_error (s)
        {}
 
-       explicit DecodeError (std::string function, std::string caller)
+       DecodeError (std::string function, std::string caller)
                : std::runtime_error (String::compose("%1 failed [%2", function, caller))
        {}
 
                : std::runtime_error (String::compose("%1 failed [%2", function, caller))
        {}
 
-       explicit DecodeError (std::string function, std::string caller, int error)
+       DecodeError (std::string function, std::string caller, int error)
                : std::runtime_error (String::compose("%1 failed [%2] (%3)", function, caller, error))
        {}
 };
 
                : std::runtime_error (String::compose("%1 failed [%2] (%3)", function, caller, error))
        {}
 };
 
+
 class CryptoError : public std::runtime_error
 {
 public:
 class CryptoError : public std::runtime_error
 {
 public:
@@ -109,6 +114,7 @@ private:
        boost::filesystem::path _file;
 };
 
        boost::filesystem::path _file;
 };
 
+
 class JoinError : public std::runtime_error
 {
 public:
 class JoinError : public std::runtime_error
 {
 public:
@@ -117,6 +123,7 @@ public:
        {}
 };
 
        {}
 };
 
+
 /** @class OpenFileError.
  *  @brief Indicates that some error occurred when trying to open a file.
  */
 /** @class OpenFileError.
  *  @brief Indicates that some error occurred when trying to open a file.
  */
@@ -136,6 +143,7 @@ public:
        OpenFileError (boost::filesystem::path f, int error, Mode mode);
 };
 
        OpenFileError (boost::filesystem::path f, int error, Mode mode);
 };
 
+
 class FileNotFoundError : public std::runtime_error
 {
 public:
 class FileNotFoundError : public std::runtime_error
 {
 public:
@@ -152,6 +160,7 @@ private:
        boost::filesystem::path _file;
 };
 
        boost::filesystem::path _file;
 };
 
+
 /** @class ReadFileError.
  *  @brief Indicates that some error occurred when trying to read from a file
  */
 /** @class ReadFileError.
  *  @brief Indicates that some error occurred when trying to read from a file
  */
@@ -164,6 +173,7 @@ public:
        ReadFileError (boost::filesystem::path f, int e = 0);
 };
 
        ReadFileError (boost::filesystem::path f, int e = 0);
 };
 
+
 /** @class WriteFileError.
  *  @brief Indicates that some error occurred when trying to write to a file
  */
 /** @class WriteFileError.
  *  @brief Indicates that some error occurred when trying to write to a file
  */
@@ -176,6 +186,7 @@ public:
        WriteFileError (boost::filesystem::path f, int e);
 };
 
        WriteFileError (boost::filesystem::path f, int e);
 };
 
+
 /** @class SettingError.
  *  @brief Indicates that something is wrong with a setting.
  */
 /** @class SettingError.
  *  @brief Indicates that something is wrong with a setting.
  */
@@ -201,6 +212,7 @@ private:
        std::string _setting;
 };
 
        std::string _setting;
 };
 
+
 /** @class MissingSettingError.
  *  @brief Indicates that a Film is missing a setting that is required for some operation.
  */
 /** @class MissingSettingError.
  *  @brief Indicates that a Film is missing a setting that is required for some operation.
  */
@@ -211,6 +223,7 @@ public:
        explicit MissingSettingError (std::string s);
 };
 
        explicit MissingSettingError (std::string s);
 };
 
+
 /** @class BadSettingError
  *  @brief Indicates that a setting is bad in some way.
  */
 /** @class BadSettingError
  *  @brief Indicates that a setting is bad in some way.
  */
@@ -225,6 +238,7 @@ public:
        {}
 };
 
        {}
 };
 
+
 /** @class NetworkError
  *  @brief Indicates some problem with communication on the network.
  */
 /** @class NetworkError
  *  @brief Indicates some problem with communication on the network.
  */
@@ -236,6 +250,7 @@ public:
        {}
 };
 
        {}
 };
 
+
 /** @class KDMError
  *  @brief A problem with a KDM.
  */
 /** @class KDMError
  *  @brief A problem with a KDM.
  */
@@ -258,6 +273,7 @@ private:
        std::string _detail;
 };
 
        std::string _detail;
 };
 
+
 /** @class PixelFormatError
  *  @brief A problem with an unsupported pixel format.
  */
 /** @class PixelFormatError
  *  @brief A problem with an unsupported pixel format.
  */
@@ -267,6 +283,7 @@ public:
        PixelFormatError (std::string o, AVPixelFormat f);
 };
 
        PixelFormatError (std::string o, AVPixelFormat f);
 };
 
+
 /** @class TextSubtitleError
  *  @brief An error that occurs while parsing a TextSubtitleError file.
  */
 /** @class TextSubtitleError
  *  @brief An error that occurs while parsing a TextSubtitleError file.
  */
@@ -276,6 +293,7 @@ public:
        TextSubtitleError (std::string, std::string, boost::filesystem::path);
 };
 
        TextSubtitleError (std::string, std::string, boost::filesystem::path);
 };
 
+
 class DCPError : public std::runtime_error
 {
 public:
 class DCPError : public std::runtime_error
 {
 public:
@@ -307,11 +325,13 @@ public:
 };
 
 class ProgrammingError : public std::runtime_error
 };
 
 class ProgrammingError : public std::runtime_error
+
 {
 public:
        ProgrammingError (std::string file, int line, std::string message = "");
 };
 
 {
 public:
        ProgrammingError (std::string file, int line, std::string message = "");
 };
 
+
 class TextEncodingError : public std::runtime_error
 {
 public:
 class TextEncodingError : public std::runtime_error
 {
 public:
@@ -320,6 +340,7 @@ public:
        {}
 };
 
        {}
 };
 
+
 class MetadataError : public std::runtime_error
 {
 public:
 class MetadataError : public std::runtime_error
 {
 public:
@@ -328,6 +349,7 @@ public:
        {}
 };
 
        {}
 };
 
+
 class OldFormatError : public std::runtime_error
 {
 public:
 class OldFormatError : public std::runtime_error
 {
 public:
@@ -336,18 +358,21 @@ public:
        {}
 };
 
        {}
 };
 
+
 class KDMAsContentError : public std::runtime_error
 {
 public:
        KDMAsContentError ();
 };
 
 class KDMAsContentError : public std::runtime_error
 {
 public:
        KDMAsContentError ();
 };
 
+
 class GLError : public std::runtime_error
 {
 public:
        GLError (char const * last, int e);
 };
 
 class GLError : public std::runtime_error
 {
 public:
        GLError (char const * last, int e);
 };
 
+
 /** @class CopyError
  *  @brief An error which occurs when copying a DCP to a distribution drive.
  */
 /** @class CopyError
  *  @brief An error which occurs when copying a DCP to a distribution drive.
  */
@@ -412,4 +437,5 @@ public:
                {}
 };
 
                {}
 };
 
+
 #endif
 #endif
index 481624c2a865136f3cc3aac83b6dc64663efe661..5cc9c556942b4868de44a835ce305f2b0eebab12 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "file_log.h"
 #include "cross.h"
 #include "config.h"
 #include "file_log.h"
 #include "cross.h"
 #include "config.h"
 #include <iostream>
 #include <cerrno>
 
 #include <iostream>
 #include <cerrno>
 
+
 using std::cout;
 using std::string;
 using std::max;
 using std::shared_ptr;
 
 using std::cout;
 using std::string;
 using std::max;
 using std::shared_ptr;
 
+
 /** @param file Filename to write log to */
 FileLog::FileLog (boost::filesystem::path file)
        : _file (file)
 /** @param file Filename to write log to */
 FileLog::FileLog (boost::filesystem::path file)
        : _file (file)
@@ -37,25 +40,28 @@ FileLog::FileLog (boost::filesystem::path file)
        set_types (Config::instance()->log_types());
 }
 
        set_types (Config::instance()->log_types());
 }
 
+
 FileLog::FileLog (boost::filesystem::path file, int types)
        : _file (file)
 {
        set_types (types);
 }
 
 FileLog::FileLog (boost::filesystem::path file, int types)
        : _file (file)
 {
        set_types (types);
 }
 
+
 void
 FileLog::do_log (shared_ptr<const LogEntry> entry)
 {
 void
 FileLog::do_log (shared_ptr<const LogEntry> entry)
 {
-       FILE* f = fopen_boost (_file, "a");
+       auto f = fopen_boost (_file, "a");
        if (!f) {
                cout << "(could not log to " << _file.string() << " error " << errno << "): " << entry->get() << "\n";
                return;
        }
 
        if (!f) {
                cout << "(could not log to " << _file.string() << " error " << errno << "): " << entry->get() << "\n";
                return;
        }
 
-       fprintf (f, "%s\n", entry->get().c_str ());
+       fprintf (f, "%s\n", entry->get().c_str());
        fclose (f);
 }
 
        fclose (f);
 }
 
+
 string
 FileLog::head_and_tail (int amount) const
 {
 string
 FileLog::head_and_tail (int amount) const
 {
@@ -70,14 +76,14 @@ FileLog::head_and_tail (int amount) const
                tail_amount = 0;
        }
 
                tail_amount = 0;
        }
 
-       FILE* f = fopen_boost (_file, "r");
+       auto f = fopen_boost (_file, "r");
        if (!f) {
                return "";
        }
 
        string out;
 
        if (!f) {
                return "";
        }
 
        string out;
 
-       char* buffer = new char[max(head_amount, tail_amount) + 1];
+       auto buffer = new char[max(head_amount, tail_amount) + 1];
 
        int N = fread (buffer, 1, head_amount, f);
        buffer[N] = '\0';
 
        int N = fread (buffer, 1, head_amount, f);
        buffer[N] = '\0';
index 64e6a25051539b4efb4d1dcb38d2571be04b7446..d7667f799ba37cd40e1aecb5c8aa81dd5c09db9f 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "log.h"
 
 #include "log.h"
 
+
 class FileLog : public Log
 {
 public:
 class FileLog : public Log
 {
 public:
index 6869d26c99b582d60250870fc9613992eb28cc0a..1c1039065227c4c5c3fdbc27abf8ded1a331b8c8 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file src/filter.cc
  *  @brief A class to describe one of FFmpeg's video or audio filters.
  */
 
 /** @file src/filter.cc
  *  @brief A class to describe one of FFmpeg's video or audio filters.
  */
 
+
 #include "filter.h"
 extern "C" {
 #include <libavfilter/avfilter.h>
 #include "filter.h"
 extern "C" {
 #include <libavfilter/avfilter.h>
@@ -30,10 +32,13 @@ extern "C" {
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using namespace std;
 
 using namespace std;
 
+
 vector<Filter const *> Filter::_filters;
 
 vector<Filter const *> Filter::_filters;
 
+
 /** @param i Our id.
  *  @param n User-visible name.
  *  @param c User-visible category.
 /** @param i Our id.
  *  @param n User-visible name.
  *  @param c User-visible category.
@@ -48,6 +53,7 @@ Filter::Filter (string i, string n, string c, string f)
 
 }
 
 
 }
 
+
 /** @return All available filters */
 vector<Filter const *>
 Filter::all ()
 /** @return All available filters */
 vector<Filter const *>
 Filter::all ()
@@ -55,6 +61,7 @@ Filter::all ()
        return _filters;
 }
 
        return _filters;
 }
 
+
 /** Set up the static _filters vector; must be called before from_*
  *  methods are used.
  */
 /** Set up the static _filters vector; must be called before from_*
  *  methods are used.
  */
@@ -80,6 +87,7 @@ Filter::setup_filters ()
        maybe_add (N_("ow"),          _("Overcomplete wavelet denoiser"),    _("Noise reduction"), N_("mp=ow"));
 }
 
        maybe_add (N_("ow"),          _("Overcomplete wavelet denoiser"),    _("Noise reduction"), N_("mp=ow"));
 }
 
+
 void
 Filter::maybe_add (string i, string n, string c, string f)
 {
 void
 Filter::maybe_add (string i, string n, string c, string f)
 {
@@ -89,11 +97,12 @@ Filter::maybe_add (string i, string n, string c, string f)
                check_name = check_name.substr (0, end);
        }
 
                check_name = check_name.substr (0, end);
        }
 
-       if (avfilter_get_by_name (check_name.c_str())) {
-               _filters.push_back (new Filter (i, n, c, f));
+       if (avfilter_get_by_name(check_name.c_str())) {
+               _filters.push_back (new Filter(i, n, c, f));
        }
 }
 
        }
 }
 
+
 /** @param filters Set of filters.
  *  @return String to pass to FFmpeg for the video filters.
  */
 /** @param filters Set of filters.
  *  @return String to pass to FFmpeg for the video filters.
  */
@@ -112,19 +121,20 @@ Filter::ffmpeg_string (vector<Filter const *> const & filters)
        return ff;
 }
 
        return ff;
 }
 
+
 /** @param d Our id.
  *  @return Corresponding Filter, or 0.
  */
 Filter const *
 Filter::from_id (string d)
 {
 /** @param d Our id.
  *  @return Corresponding Filter, or 0.
  */
 Filter const *
 Filter::from_id (string d)
 {
-       vector<Filter const *>::iterator i = _filters.begin ();
+       auto i = _filters.begin ();
        while (i != _filters.end() && (*i)->id() != d) {
                ++i;
        }
 
        if (i == _filters.end ()) {
        while (i != _filters.end() && (*i)->id() != d) {
                ++i;
        }
 
        if (i == _filters.end ()) {
-               return 0;
+               return nullptr;
        }
 
        return *i;
        }
 
        return *i;
index 5fbfd9c234e3a999bf04d7cbfa826241d49563bc..3c2a49792d97ac197439b477164304e162eac94c 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index f6a61f24ab541d65ff732a26559732e4ecdde2f7..830b2da346a33d6d13fa8e08e779237ee8a031ec 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index 895493ce27673a7c99f53b1a8527e1b95cb8a796..a3389af20d995acab0e0da7a7db274dfc062174a 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index 7b6d1389274832dc6d86a508bdc15062432db84c..a1ff2ae650a93d7ec19782763f359b4b6a0c883a 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "frame_rate_change.h"
 #include "types.h"
 #include "content.h"
 #include "frame_rate_change.h"
 #include "types.h"
 #include "content.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::string;
 using std::shared_ptr;
 
 using std::string;
 using std::shared_ptr;
 
-static bool
-about_equal (double a, double b)
-{
-       return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON);
-}
 
 FrameRateChange::FrameRateChange ()
 
 FrameRateChange::FrameRateChange ()
-       : source (24)
-       , dcp (24)
-       , skip (false)
-       , repeat (1)
-       , change_speed (false)
-       , speed_up (1)
 {
 
 }
 
 {
 
 }
 
-FrameRateChange::FrameRateChange (double source_, int dcp_)
-       : skip (false)
-       , repeat (1)
-       , change_speed (false)
-{
-       construct (source_, dcp_);
-}
 
 
-void
-FrameRateChange::construct (double source_, int dcp_)
+FrameRateChange::FrameRateChange (double source_, int dcp_)
 {
        source = source_;
        dcp = dcp_;
 
 {
        source = source_;
        dcp = dcp_;
 
-       if (fabs (source / 2.0 - dcp) < fabs (source - dcp)) {
+       if (fabs(source / 2.0 - dcp) < fabs(source - dcp)) {
                /* The difference between source and DCP frame rate will be lower
                   (i.e. better) if we skip.
                */
                skip = true;
                /* The difference between source and DCP frame rate will be lower
                   (i.e. better) if we skip.
                */
                skip = true;
-       } else if (fabs (source * 2 - dcp) < fabs (source - dcp)) {
+       } else if (fabs(source * 2 - dcp) < fabs(source - dcp)) {
                /* The difference between source and DCP frame rate would be better
                   if we repeated each frame once; it may be better still if we
                   repeated more than once.  Work out the required repeat.
                /* The difference between source and DCP frame rate would be better
                   if we repeated each frame once; it may be better still if we
                   repeated more than once.  Work out the required repeat.
@@ -75,23 +58,29 @@ FrameRateChange::construct (double source_, int dcp_)
        }
 
        speed_up = dcp / (source * factor());
        }
 
        speed_up = dcp / (source * factor());
+
+       auto about_equal = [](double a, double b) {
+               return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON);
+       };
+
        change_speed = !about_equal (speed_up, 1.0);
 }
 
        change_speed = !about_equal (speed_up, 1.0);
 }
 
+
 FrameRateChange::FrameRateChange (shared_ptr<const Film> film, shared_ptr<const Content> content)
 FrameRateChange::FrameRateChange (shared_ptr<const Film> film, shared_ptr<const Content> content)
-       : skip (false)
-       , repeat (1)
+       : FrameRateChange (content->active_video_frame_rate(film), film->video_frame_rate())
 {
 {
-       construct (content->active_video_frame_rate(film), film->video_frame_rate());
+
 }
 
 }
 
+
 FrameRateChange::FrameRateChange (shared_ptr<const Film> film, Content const * content)
 FrameRateChange::FrameRateChange (shared_ptr<const Film> film, Content const * content)
-       : skip (false)
-       , repeat (1)
+       : FrameRateChange (content->active_video_frame_rate(film), film->video_frame_rate())
 {
 {
-       construct (content->active_video_frame_rate(film), film->video_frame_rate());
+
 }
 
 }
 
+
 string
 FrameRateChange::description () const
 {
 string
 FrameRateChange::description () const
 {
index d7fed6dd0b45d05c87954f0eea1e8ee835633cac..c28342e92974214aeaebfca5d47186854fc25868 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_FRAME_RATE_CHANGE_H
 #define DCPOMATIC_FRAME_RATE_CHANGE_H
 
 #ifndef DCPOMATIC_FRAME_RATE_CHANGE_H
 #define DCPOMATIC_FRAME_RATE_CHANGE_H
 
@@ -29,6 +30,7 @@
 class Film;
 class Content;
 
 class Film;
 class Content;
 
+
 class FrameRateChange
 {
 public:
 class FrameRateChange
 {
 public:
@@ -48,13 +50,13 @@ public:
                return repeat;
        }
 
                return repeat;
        }
 
-       double source;
-       int dcp;
+       double source = 24;
+       int dcp = 24;
 
        /** true to skip every other frame */
 
        /** true to skip every other frame */
-       bool skip;
+       bool skip = false;
        /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */
        /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */
-       int repeat;
+       int repeat = 1;
        /** true if this DCP will run its video faster or slower than the source
         *  without taking into account `repeat' nor `skip'.
         *  (e.g. change_speed will be true if
        /** true if this DCP will run its video faster or slower than the source
         *  without taking into account `repeat' nor `skip'.
         *  (e.g. change_speed will be true if
@@ -64,17 +66,15 @@ public:
         *          source is 15.00fps, DCP is 30fps
         *          source is 12.50fps, DCP is 25fps)
         */
         *          source is 15.00fps, DCP is 30fps
         *          source is 12.50fps, DCP is 25fps)
         */
-       bool change_speed;
+       bool change_speed = false;
 
        /** Amount by which the video is being sped-up in the DCP; e.g. for a
         *  24fps source in a 25fps DCP this would be 25/24.
         */
 
        /** Amount by which the video is being sped-up in the DCP; e.g. for a
         *  24fps source in a 25fps DCP this would be 25/24.
         */
-       double speed_up;
+       double speed_up = 1.0;
 
        std::string description () const;
 
        std::string description () const;
-
-private:
-       void construct (double source_, int dcp_);
 };
 
 };
 
+
 #endif
 #endif
index fc0305340790c6b3407f2003561a97b320ac33e7..2980e438b084555d5718ddb52900355fc3e79280 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "log_entry.h"
 #include <inttypes.h>
 #include <cstdio>
 
 #include "i18n.h"
 
 #include "log_entry.h"
 #include <inttypes.h>
 #include <cstdio>
 
 #include "i18n.h"
 
+
 int const LogEntry::TYPE_GENERAL      = 0x001;
 int const LogEntry::TYPE_WARNING      = 0x002;
 int const LogEntry::TYPE_ERROR        = 0x004;
 int const LogEntry::TYPE_GENERAL      = 0x001;
 int const LogEntry::TYPE_WARNING      = 0x002;
 int const LogEntry::TYPE_ERROR        = 0x004;
@@ -36,21 +38,24 @@ int const LogEntry::TYPE_DISK         = 0x100;
 int const LogEntry::TYPE_DEBUG_PLAYER = 0x200;
 int const LogEntry::TYPE_DEBUG_AUDIO_ANALYSIS = 0x400;
 
 int const LogEntry::TYPE_DEBUG_PLAYER = 0x200;
 int const LogEntry::TYPE_DEBUG_AUDIO_ANALYSIS = 0x400;
 
+
 using std::string;
 
 using std::string;
 
+
 LogEntry::LogEntry (int type)
        : _type (type)
 {
        gettimeofday (&_time, 0);
 }
 
 LogEntry::LogEntry (int type)
        : _type (type)
 {
        gettimeofday (&_time, 0);
 }
 
+
 string
 LogEntry::get () const
 {
        string s;
        if (_type & TYPE_TIMING) {
                char buffer[64];
 string
 LogEntry::get () const
 {
        string s;
        if (_type & TYPE_TIMING) {
                char buffer[64];
-               snprintf (buffer, sizeof(buffer), "%" PRId64 ":%" PRId64 " ", static_cast<int64_t> (_time.tv_sec), static_cast<int64_t> (_time.tv_usec));
+               snprintf (buffer, sizeof(buffer), "%" PRId64 ":%" PRId64 " ", static_cast<int64_t>(_time.tv_sec), static_cast<int64_t>(_time.tv_usec));
                s += buffer;
        } else {
                char buffer[64];
                s += buffer;
        } else {
                char buffer[64];
@@ -73,6 +78,7 @@ LogEntry::get () const
        return s;
 }
 
        return s;
 }
 
+
 double
 LogEntry::seconds () const
 {
 double
 LogEntry::seconds () const
 {
index a2eb5fbace162531ab850b427478e2665c669988..95c4e4f1f851e31a57230722a1239ce62b1838a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_LOG_ENTRY_H
 #define DCPOMATIC_LOG_ENTRY_H
 
 #ifndef DCPOMATIC_LOG_ENTRY_H
 #define DCPOMATIC_LOG_ENTRY_H
 
+
 #include <sys/time.h>
 #include <string>
 
 #include <sys/time.h>
 #include <string>
 
+
 class LogEntry
 {
 public:
 class LogEntry
 {
 public:
@@ -56,4 +59,5 @@ private:
        int _type;
 };
 
        int _type;
 };
 
+
 #endif
 #endif
index eb87d245b54b7dc6168039157810ad2b68dbb91a..09b528c81676fa0e1c62c3b1d4755632a56a1eee 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "mid_side_decoder.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
 
 #include "i18n.h"
 
 #include "mid_side_decoder.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
 
 #include "i18n.h"
 
-using std::string;
+
+using std::make_shared;
 using std::min;
 using std::min;
-using std::vector;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
+using std::vector;
+
 
 string
 MidSideDecoder::name () const
 
 string
 MidSideDecoder::name () const
@@ -35,33 +39,37 @@ MidSideDecoder::name () const
        return _("Mid-side decoder");
 }
 
        return _("Mid-side decoder");
 }
 
+
 string
 MidSideDecoder::id () const
 {
        return N_("mid-side-decoder");
 }
 
 string
 MidSideDecoder::id () const
 {
        return N_("mid-side-decoder");
 }
 
+
 int
 MidSideDecoder::out_channels () const
 {
        return 3;
 }
 
 int
 MidSideDecoder::out_channels () const
 {
        return 3;
 }
 
+
 shared_ptr<AudioProcessor>
 MidSideDecoder::clone (int) const
 {
 shared_ptr<AudioProcessor>
 MidSideDecoder::clone (int) const
 {
-       return shared_ptr<AudioProcessor> (new MidSideDecoder ());
+       return make_shared<MidSideDecoder>();
 }
 
 }
 
+
 shared_ptr<AudioBuffers>
 MidSideDecoder::run (shared_ptr<const AudioBuffers> in, int channels)
 {
        int const N = min (channels, 3);
 shared_ptr<AudioBuffers>
 MidSideDecoder::run (shared_ptr<const AudioBuffers> in, int channels)
 {
        int const N = min (channels, 3);
-       shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames ()));
+       auto out = make_shared<AudioBuffers>(channels, in->frames ());
        for (int i = 0; i < in->frames(); ++i) {
        for (int i = 0; i < in->frames(); ++i) {
-               float const left = in->data()[0][i];
-               float const right = in->data()[1][i];
-               float const mid = (left + right) / 2;
+               auto const left = in->data()[0][i];
+               auto const right = in->data()[1][i];
+               auto const mid = (left + right) / 2;
                if (N > 0) {
                        out->data()[0][i] = left - mid;
                }
                if (N > 0) {
                        out->data()[0][i] = left - mid;
                }
@@ -80,21 +88,23 @@ MidSideDecoder::run (shared_ptr<const AudioBuffers> in, int channels)
        return out;
 }
 
        return out;
 }
 
+
 void
 MidSideDecoder::make_audio_mapping_default (AudioMapping& mapping) const
 {
        /* Just map the first two input channels to our M/S */
        mapping.make_zero ();
 void
 MidSideDecoder::make_audio_mapping_default (AudioMapping& mapping) const
 {
        /* Just map the first two input channels to our M/S */
        mapping.make_zero ();
-       for (int i = 0; i < min (2, mapping.input_channels()); ++i) {
+       for (int i = 0; i < min(2, mapping.input_channels()); ++i) {
                mapping.set (i, i, 1);
        }
 }
 
                mapping.set (i, i, 1);
        }
 }
 
+
 vector<NamedChannel>
 MidSideDecoder::input_names () const
 {
 vector<NamedChannel>
 MidSideDecoder::input_names () const
 {
-       vector<NamedChannel> n;
-       n.push_back (NamedChannel(_("Left"), 0));
-       n.push_back (NamedChannel(_("Right"), 1));
-       return n;
+       return {
+               NamedChannel(_("Left"), 0),
+               NamedChannel(_("Right"), 1)
+       };
 }
 }
index 8be5db67fb13665067f69decac74796642bf8e95..99821caa463985c12c4067e13cc293f204eabfd6 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "audio_processor.h"
 
 #include "audio_processor.h"
 
+
 class MidSideDecoder : public AudioProcessor
 {
 public:
 class MidSideDecoder : public AudioProcessor
 {
 public:
index 09e7f63ac089ebbfcdffb7406b383a0cbaf64a7c..536629b336804b0675fe37b0682f65d8da8dd9fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "overlaps.h"
 #include "types.h"
 #include "content.h"
 
 #include "overlaps.h"
 #include "types.h"
 #include "content.h"
 
-using std::shared_ptr;
+
 using std::function;
 using std::function;
+using std::shared_ptr;
 using namespace dcpomatic;
 
 using namespace dcpomatic;
 
+
 ContentList overlaps (shared_ptr<const Film> film, ContentList cl, function<bool (shared_ptr<const Content>)> part, DCPTime from, DCPTime to)
 {
        ContentList overlaps;
 ContentList overlaps (shared_ptr<const Film> film, ContentList cl, function<bool (shared_ptr<const Content>)> part, DCPTime from, DCPTime to)
 {
        ContentList overlaps;
index 6c5a85a8bb2a34f9a2fd487b5de435c807b5e04b..bce163a5766014c3f255e4b22bd6cce0e0e2f720 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "types.h"
 #include "dcpomatic_time.h"
 
 #include "types.h"
 #include "dcpomatic_time.h"
 
+
 class ContentPart;
 class Film;
 
 class ContentPart;
 class Film;
 
+
 /** @return Pieces of content with a given part (video, audio,
  *  subtitle) that overlap a specified time range in the given
  *  ContentList
 /** @return Pieces of content with a given part (video, audio,
  *  subtitle) that overlap a specified time range in the given
  *  ContentList
index 667f25b0603f99771f69ba00ac04428c745acaae..fed40c45e7ec783faaa31fa94b55f91810177dc2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "raw_image_proxy.h"
 #include "image.h"
 #include "warnings.h"
 #include "raw_image_proxy.h"
 #include "image.h"
 #include "warnings.h"
@@ -33,55 +34,63 @@ DCPOMATIC_ENABLE_WARNINGS
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
-using std::pair;
+
+using std::dynamic_pointer_cast;
 using std::make_pair;
 using std::make_pair;
+using std::make_shared;
+using std::pair;
 using std::shared_ptr;
 using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
 using boost::optional;
 using dcp::raw_convert;
 
 using boost::optional;
 using dcp::raw_convert;
 
+
 RawImageProxy::RawImageProxy (shared_ptr<Image> image)
        : _image (image)
 {
 
 }
 
 RawImageProxy::RawImageProxy (shared_ptr<Image> image)
        : _image (image)
 {
 
 }
 
+
 RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
 {
        dcp::Size size (
 RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
 {
        dcp::Size size (
-               xml->number_child<int> ("Width"), xml->number_child<int> ("Height")
+               xml->number_child<int>("Width"), xml->number_child<int>("Height")
                );
 
                );
 
-       _image.reset (new Image (static_cast<AVPixelFormat> (xml->number_child<int> ("PixelFormat")), size, true));
+       _image = make_shared<Image>(static_cast<AVPixelFormat>(xml->number_child<int>("PixelFormat")), size, true);
        _image->read_from_socket (socket);
 }
 
        _image->read_from_socket (socket);
 }
 
+
 ImageProxy::Result
 RawImageProxy::image (optional<dcp::Size>) const
 {
        return Result (_image, 0);
 }
 
 ImageProxy::Result
 RawImageProxy::image (optional<dcp::Size>) const
 {
        return Result (_image, 0);
 }
 
+
 void
 RawImageProxy::add_metadata (xmlpp::Node* node) const
 {
 void
 RawImageProxy::add_metadata (xmlpp::Node* node) const
 {
-       node->add_child("Type")->add_child_text (N_("Raw"));
-       node->add_child("Width")->add_child_text (raw_convert<string> (_image->size().width));
-       node->add_child("Height")->add_child_text (raw_convert<string> (_image->size().height));
-       node->add_child("PixelFormat")->add_child_text (raw_convert<string> (static_cast<int> (_image->pixel_format ())));
+       node->add_child("Type")->add_child_text(N_("Raw"));
+       node->add_child("Width")->add_child_text(raw_convert<string>(_image->size().width));
+       node->add_child("Height")->add_child_text(raw_convert<string>(_image->size().height));
+       node->add_child("PixelFormat")->add_child_text(raw_convert<string>(static_cast<int>(_image->pixel_format())));
 }
 
 }
 
+
 void
 RawImageProxy::write_to_socket (shared_ptr<Socket> socket) const
 {
        _image->write_to_socket (socket);
 }
 
 void
 RawImageProxy::write_to_socket (shared_ptr<Socket> socket) const
 {
        _image->write_to_socket (socket);
 }
 
+
 bool
 RawImageProxy::same (shared_ptr<const ImageProxy> other) const
 {
 bool
 RawImageProxy::same (shared_ptr<const ImageProxy> other) const
 {
-       shared_ptr<const RawImageProxy> rp = dynamic_pointer_cast<const RawImageProxy> (other);
+       auto rp = dynamic_pointer_cast<const RawImageProxy> (other);
        if (!rp) {
                return false;
        }
        if (!rp) {
                return false;
        }
@@ -89,6 +98,7 @@ RawImageProxy::same (shared_ptr<const ImageProxy> other) const
        return (*_image.get()) == (*rp->image().image.get());
 }
 
        return (*_image.get()) == (*rp->image().image.get());
 }
 
+
 size_t
 RawImageProxy::memory_used () const
 {
 size_t
 RawImageProxy::memory_used () const
 {
index 7cd9491fa25181da37a3a570a2f80a1723fefc6c..ec30f5a29aa3f8ad945c83f106b81f623c516956 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_RAW_IMAGE_PROXY_H
 #define DCPOMATIC_RAW_IMAGE_PROXY_H
 
 #ifndef DCPOMATIC_RAW_IMAGE_PROXY_H
 #define DCPOMATIC_RAW_IMAGE_PROXY_H
 
+
 #include "image_proxy.h"
 
 #include "image_proxy.h"
 
+
 class RawImageProxy : public ImageProxy
 {
 public:
 class RawImageProxy : public ImageProxy
 {
 public:
@@ -42,4 +45,5 @@ private:
        std::shared_ptr<Image> _image;
 };
 
        std::shared_ptr<Image> _image;
 };
 
+
 #endif
 #endif
index 3fc41725ddd36facf62c41c6850d872469a9cb26..4d82cf721ec00310e9b938df6982f7c63544a38d 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index f3349ce9bbc31e19ae47505dbf01dc5063a25e5d..e3dc0c50dae50f19d173be612b989456d8678533 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index ad4f882a2649ecfadb840e88c66c351dc7b60964..223100ba5f727df6180eab3b1ba191a38f1ff18b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "scoped_temporary.h"
 #include "exceptions.h"
 #include "cross.h"
 
 #include "scoped_temporary.h"
 #include "exceptions.h"
 #include "cross.h"
 
+
 /** Construct a ScopedTemporary.  A temporary filename is decided but the file is not opened
  *  until open() is called.
  */
 ScopedTemporary::ScopedTemporary ()
 /** Construct a ScopedTemporary.  A temporary filename is decided but the file is not opened
  *  until open() is called.
  */
 ScopedTemporary::ScopedTemporary ()
-       : _open (0)
 {
        _file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path ();
 }
 
 {
        _file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path ();
 }
 
+
 /** Close and delete the temporary file */
 ScopedTemporary::~ScopedTemporary ()
 {
 /** Close and delete the temporary file */
 ScopedTemporary::~ScopedTemporary ()
 {
@@ -39,13 +41,15 @@ ScopedTemporary::~ScopedTemporary ()
        boost::filesystem::remove (_file, ec);
 }
 
        boost::filesystem::remove (_file, ec);
 }
 
+
 /** @return temporary filename */
 char const *
 ScopedTemporary::c_str () const
 {
 /** @return temporary filename */
 char const *
 ScopedTemporary::c_str () const
 {
-       return _file.string().c_str ();
+       return _file.string().c_str();
 }
 
 }
 
+
 /** Open the temporary file.
  *  @return File's FILE pointer.
  */
 /** Open the temporary file.
  *  @return File's FILE pointer.
  */
@@ -60,12 +64,13 @@ ScopedTemporary::open (char const * params)
        return _open;
 }
 
        return _open;
 }
 
+
 /** Close the file */
 void
 ScopedTemporary::close ()
 {
        if (_open) {
                fclose (_open);
 /** Close the file */
 void
 ScopedTemporary::close ()
 {
        if (_open) {
                fclose (_open);
-               _open = 0;
+               _open = nullptr;
        }
 }
        }
 }
index 8f7416093aaed085a3d14cbe80c98f2ba256f26e..75d9a272f74dab5341e2e3173bce935a90f501b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -46,5 +46,5 @@ public:
 
 private:
        boost::filesystem::path _file;
 
 private:
        boost::filesystem::path _file;
-       FILE* _open;
+       FILE* _open = nullptr;
 };
 };
index 8e1e83e36697f0e802d05fafc8b1fd2605cff529..504504c8c8cf34e23c0003e87f4705d87103b016 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "screen.h"
 #include "kdm_with_metadata.h"
 #include "film.h"
 #include "screen.h"
 #include "kdm_with_metadata.h"
 #include "film.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 
-using std::string;
-using std::vector;
+
 using std::list;
 using std::list;
+using std::make_shared;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using boost::optional;
 using namespace dcpomatic;
 
 using boost::optional;
 using namespace dcpomatic;
 
+
 Screen::Screen (cxml::ConstNodePtr node)
        : KDMRecipient (node)
 {
 Screen::Screen (cxml::ConstNodePtr node)
        : KDMRecipient (node)
 {
@@ -45,6 +49,7 @@ Screen::Screen (cxml::ConstNodePtr node)
        }
 }
 
        }
 }
 
+
 void
 Screen::as_xml (xmlpp::Element* parent) const
 {
 void
 Screen::as_xml (xmlpp::Element* parent) const
 {
@@ -54,6 +59,7 @@ Screen::as_xml (xmlpp::Element* parent) const
        }
 }
 
        }
 }
 
+
 vector<string>
 Screen::trusted_device_thumbprints () const
 {
 vector<string>
 Screen::trusted_device_thumbprints () const
 {
@@ -78,14 +84,14 @@ kdm_for_screen (
        )
 {
        if (!screen->recipient) {
        )
 {
        if (!screen->recipient) {
-               return KDMWithMetadataPtr();
+               return {};
        }
 
        }
 
-       shared_ptr<const Cinema> cinema = screen->cinema;
+       auto cinema = screen->cinema;
        dcp::LocalTime const begin(valid_from, cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0);
        dcp::LocalTime const end  (valid_to,   cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0);
 
        dcp::LocalTime const begin(valid_from, cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0);
        dcp::LocalTime const end  (valid_to,   cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0);
 
-       dcp::EncryptedKDM const kdm = film->make_kdm (
+       auto const kdm = film->make_kdm (
                        screen->recipient.get(),
                        screen->trusted_device_thumbprints(),
                        cpl,
                        screen->recipient.get(),
                        screen->trusted_device_thumbprints(),
                        cpl,
@@ -106,6 +112,6 @@ kdm_for_screen (
        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
        name_values['i'] = kdm.cpl_id();
 
        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
        name_values['i'] = kdm.cpl_id();
 
-       return KDMWithMetadataPtr(new KDMWithMetadata(name_values, cinema.get(), cinema ? cinema->emails : list<string>(), kdm));
+       return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : list<string>(), kdm);
 }
 
 }
 
index 96b0ce76416c1ab878a8f9c0a5238ba47aa0c1a2..15a0785d566c5292efa5e1ffff5c53a289ecb1b4 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_SCREEN_H
 #define DCPOMATIC_SCREEN_H
 
 #ifndef DCPOMATIC_SCREEN_H
 #define DCPOMATIC_SCREEN_H
 
+
 #include "kdm_with_metadata.h"
 #include "kdm_recipient.h"
 #include "trusted_device.h"
 #include "kdm_with_metadata.h"
 #include "kdm_recipient.h"
 #include "trusted_device.h"
 #include <boost/optional.hpp>
 #include <string>
 
 #include <boost/optional.hpp>
 #include <string>
 
+
 class Cinema;
 class Film;
 
 class Cinema;
 class Film;
 
+
 namespace dcpomatic {
 
 namespace dcpomatic {
 
+
 /** @class Screen
  *  @brief A representation of a Screen for KDM generation.
  *
 /** @class Screen
  *  @brief A representation of a Screen for KDM generation.
  *
@@ -60,6 +65,7 @@ public:
 
 }
 
 
 }
 
+
 KDMWithMetadataPtr
 kdm_for_screen (
        std::shared_ptr<const Film> film,
 KDMWithMetadataPtr
 kdm_for_screen (
        std::shared_ptr<const Film> film,
index e5edc49ee746410c27dafe5368e8983c358f6128..c4d5a65183ca93484e9b225628e46a59d836f3a1 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "send_notification_email_job.h"
 #include "exceptions.h"
 #include "config.h"
 #include "send_notification_email_job.h"
 #include "exceptions.h"
 #include "config.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::string;
 using std::list;
 using std::shared_ptr;
 
 using std::string;
 using std::list;
 using std::shared_ptr;
 
+
 /** @param body Email body */
 SendNotificationEmailJob::SendNotificationEmailJob (string body)
        : Job (shared_ptr<Film>())
 /** @param body Email body */
 SendNotificationEmailJob::SendNotificationEmailJob (string body)
        : Job (shared_ptr<Film>())
@@ -39,27 +42,31 @@ SendNotificationEmailJob::SendNotificationEmailJob (string body)
 
 }
 
 
 }
 
+
 SendNotificationEmailJob::~SendNotificationEmailJob ()
 {
        stop_thread ();
 }
 
 SendNotificationEmailJob::~SendNotificationEmailJob ()
 {
        stop_thread ();
 }
 
+
 string
 SendNotificationEmailJob::name () const
 {
        return _("Email notification");
 }
 
 string
 SendNotificationEmailJob::name () const
 {
        return _("Email notification");
 }
 
+
 string
 SendNotificationEmailJob::json_name () const
 {
        return N_("send_notification_email");
 }
 
 string
 SendNotificationEmailJob::json_name () const
 {
        return N_("send_notification_email");
 }
 
+
 void
 SendNotificationEmailJob::run ()
 {
 void
 SendNotificationEmailJob::run ()
 {
-       Config* config = Config::instance ();
+       auto config = Config::instance ();
 
        if (config->mail_server().empty()) {
                throw NetworkError (_("No mail server configured in preferences"));
 
        if (config->mail_server().empty()) {
                throw NetworkError (_("No mail server configured in preferences"));
@@ -67,13 +74,13 @@ SendNotificationEmailJob::run ()
 
        set_progress_unknown ();
        list<string> to;
 
        set_progress_unknown ();
        list<string> to;
-       to.push_back (config->notification_to ());
+       to.push_back (config->notification_to());
        Emailer email (config->notification_from(), to, config->notification_subject(), _body);
        for (auto i: config->notification_cc()) {
                email.add_cc (i);
        }
        if (!config->notification_bcc().empty()) {
        Emailer email (config->notification_from(), to, config->notification_subject(), _body);
        for (auto i: config->notification_cc()) {
                email.add_cc (i);
        }
        if (!config->notification_bcc().empty()) {
-               email.add_bcc (config->notification_bcc ());
+               email.add_bcc (config->notification_bcc());
        }
 
        email.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
        }
 
        email.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
index 5c116f2eefc2514d72052661dd3e0ae6187790c0..7c1c3e2157bf395eab0fb0adb7d11bb4b11e6e4b 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "job.h"
 
 #include "job.h"
 
+
 class SendNotificationEmailJob : public Job
 {
 public:
        explicit SendNotificationEmailJob (std::string body);
        ~SendNotificationEmailJob ();
 
 class SendNotificationEmailJob : public Job
 {
 public:
        explicit SendNotificationEmailJob (std::string body);
        ~SendNotificationEmailJob ();
 
-       std::string name () const;
-       std::string json_name () const;
-       void run ();
+       std::string name () const override;
+       std::string json_name () const override;
+       void run () override;
 
 private:
        std::string _body;
 
 private:
        std::string _body;
index 7f60a3fdc2e8e91239a2ff92753a31e621af3ecd..e7fc02eb0e0b13437eb45007f417c09cc6710f8a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "send_problem_report_job.h"
 #include "compose.hpp"
 #include "film.h"
 #include "send_problem_report_job.h"
 #include "compose.hpp"
 #include "film.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
+
 using std::list;
 using std::shared_ptr;
 using std::list;
 using std::shared_ptr;
+using std::string;
+
 
 /** @param film Film thta the problem is with, or 0.
  *  @param from Email address to use for From:
 
 /** @param film Film thta the problem is with, or 0.
  *  @param from Email address to use for From:
@@ -51,11 +54,13 @@ SendProblemReportJob::SendProblemReportJob (
 
 }
 
 
 }
 
+
 SendProblemReportJob::~SendProblemReportJob ()
 {
        stop_thread ();
 }
 
 SendProblemReportJob::~SendProblemReportJob ()
 {
        stop_thread ();
 }
 
+
 string
 SendProblemReportJob::name () const
 {
 string
 SendProblemReportJob::name () const
 {
@@ -66,12 +71,14 @@ SendProblemReportJob::name () const
        return String::compose (_("Email problem report for %1"), _film->name());
 }
 
        return String::compose (_("Email problem report for %1"), _film->name());
 }
 
+
 string
 SendProblemReportJob::json_name () const
 {
        return N_("send_problem_report");
 }
 
 string
 SendProblemReportJob::json_name () const
 {
        return N_("send_problem_report");
 }
 
+
 void
 SendProblemReportJob::run ()
 {
 void
 SendProblemReportJob::run ()
 {
@@ -108,17 +115,18 @@ SendProblemReportJob::run ()
        set_state (FINISHED_OK);
 }
 
        set_state (FINISHED_OK);
 }
 
+
 void
 SendProblemReportJob::add_file (string& body, boost::filesystem::path file) const
 {
 void
 SendProblemReportJob::add_file (string& body, boost::filesystem::path file) const
 {
-       FILE* f = fopen_boost (_film->file (file), "r");
+       auto f = fopen_boost (_film->file(file), "r");
        if (!f) {
                return;
        }
 
        body += file.string() + ":\n";
        body += "---<8----\n";
        if (!f) {
                return;
        }
 
        body += file.string() + ":\n";
        body += "---<8----\n";
-       uintmax_t const size = boost::filesystem::file_size (_film->file (file));
+       auto const size = boost::filesystem::file_size (_film->file(file));
        char* buffer = new char[size + 1];
        int const N = fread (buffer, 1, size, f);
        buffer[N] = '\0';
        char* buffer = new char[size + 1];
        int const N = fread (buffer, 1, size, f);
        buffer[N] = '\0';
index 4e66cb58b0de5146a00b101644edf514e2fb3089..5310010aeb96fc669d88cf67007380ff31b0b186 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "job.h"
 #include <dcp/types.h>
 #include <boost/filesystem.hpp>
 
 #include "job.h"
 #include <dcp/types.h>
 #include <boost/filesystem.hpp>
 
+
 class SendProblemReportJob : public Job
 {
 public:
 class SendProblemReportJob : public Job
 {
 public:
@@ -33,9 +35,9 @@ public:
 
        ~SendProblemReportJob ();
 
 
        ~SendProblemReportJob ();
 
-       std::string name () const;
-       std::string json_name () const;
-       void run ();
+       std::string name () const override;
+       std::string json_name () const override;
+       void run () override;
 
 private:
        void add_file (std::string& body, boost::filesystem::path file) const;
 
 private:
        void add_file (std::string& body, boost::filesystem::path file) const;
index 440f9861b882f56e5b0edeebcd6ec43aadc4361c..878bd610f287faa16440b02906a3f641e3e751e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "spl_entry.h"
+
 #include "dcp_content.h"
 #include "dcpomatic_assert.h"
 #include "dcp_content.h"
 #include "dcpomatic_assert.h"
+#include "spl_entry.h"
 #include "warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
 DCPOMATIC_ENABLE_WARNINGS
 
 #include "warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
 DCPOMATIC_ENABLE_WARNINGS
 
+
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
 
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
 
-SPLEntry::SPLEntry (shared_ptr<Content> content)
-{
-       construct (content);
-}
 
 
-void
-SPLEntry::construct (shared_ptr<Content> c)
+SPLEntry::SPLEntry (shared_ptr<Content> c)
+       : content (c)
+       , digest (content->digest())
 {
 {
-       content = c;
-       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (content);
-       digest = content->digest ();
+       auto dcp = dynamic_pointer_cast<DCPContent> (content);
        if (dcp) {
                name = dcp->name ();
                DCPOMATIC_ASSERT (dcp->cpl());
        if (dcp) {
                name = dcp->name ();
                DCPOMATIC_ASSERT (dcp->cpl());
@@ -52,6 +49,7 @@ SPLEntry::construct (shared_ptr<Content> c)
        }
 }
 
        }
 }
 
+
 void
 SPLEntry::as_xml (xmlpp::Element* e)
 {
 void
 SPLEntry::as_xml (xmlpp::Element* e)
 {
index 2650371c45003d9631e95edbe6028fc595dd0681..b2977c8aa2d2b7ca6deea67c49ac97ba9825aaaf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_SPL_ENTRY_H
 #define DCPOMATIC_SPL_ENTRY_H
 
 #ifndef DCPOMATIC_SPL_ENTRY_H
 #define DCPOMATIC_SPL_ENTRY_H
 
+
 #include <libcxml/cxml.h>
 #include <dcp/types.h>
 
 #include <libcxml/cxml.h>
 #include <dcp/types.h>
 
+
 namespace xmlpp {
        class Element;
 }
 
 class Content;
 
 namespace xmlpp {
        class Element;
 }
 
 class Content;
 
+
 class SPLEntry
 {
 public:
 class SPLEntry
 {
 public:
-       SPLEntry (std::shared_ptr<Content> content);
+       SPLEntry (std::shared_ptr<Content> c);
 
        void as_xml (xmlpp::Element* e);
 
 
        void as_xml (xmlpp::Element* e);
 
@@ -50,4 +54,5 @@ private:
        void construct (std::shared_ptr<Content> content);
 };
 
        void construct (std::shared_ptr<Content> content);
 };
 
+
 #endif
 #endif
index f4942a7b4a325d9b766bcffcb70f4cc810e7ed34..50278906fb3f055427d31236c449d7bc929a9fcb 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "stdout_log.h"
 #include "config.h"
 #include <iostream>
 
 #include "stdout_log.h"
 #include "config.h"
 #include <iostream>
 
+
 using std::cout;
 using std::string;
 using std::shared_ptr;
 
 using std::cout;
 using std::string;
 using std::shared_ptr;
 
+
 StdoutLog::StdoutLog ()
 {
        set_types (Config::instance()->log_types());
 }
 
 StdoutLog::StdoutLog ()
 {
        set_types (Config::instance()->log_types());
 }
 
+
 StdoutLog::StdoutLog (int types)
 {
        set_types (types);
 }
 
 StdoutLog::StdoutLog (int types)
 {
        set_types (types);
 }
 
+
 void
 StdoutLog::do_log (shared_ptr<const LogEntry> entry)
 {
 void
 StdoutLog::do_log (shared_ptr<const LogEntry> entry)
 {
index f4335e8e5c1dea356f21994fba6fae4484e08059..0dcc243db6499295df9c3973e4b3e1a9163ab025 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "log.h"
 
 #include "log.h"
 
+
 class StdoutLog : public Log
 {
 public:
 class StdoutLog : public Log
 {
 public:
index 3ee9b5c4c2902b080a93b25dc5670322821eac2c..3022b4e5b4ef559ddd8c7bfd590313c186df470a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "string_log_entry.h"
 
 #include "i18n.h"
 
 #include "string_log_entry.h"
 
 #include "i18n.h"
 
+
 using std::string;
 
 using std::string;
 
+
 StringLogEntry::StringLogEntry (int type, string message)
        : LogEntry (type)
        , _message (message)
 StringLogEntry::StringLogEntry (int type, string message)
        : LogEntry (type)
        , _message (message)
index e3df5fd547b188dfd63d2c6f07b650bcbd2e1cd4..143ada024be67f45c0370311de362413fc15135c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "log_entry.h"
 #include <string>
 
 #include "log_entry.h"
 #include <string>
 
+
 class StringLogEntry : public LogEntry
 {
 public:
 class StringLogEntry : public LogEntry
 {
 public:
index 66957270fe91d0d6d2cbef7e11dd4223842931b8..ba47e1231067f917e2ada7e160c3c2e21302aa94 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2019-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "font_data.h"
-#include "subtitle_encoder.h"
-#include "player.h"
+
 #include "compose.hpp"
 #include "compose.hpp"
+#include "font_data.h"
 #include "job.h"
 #include "job.h"
+#include "player.h"
+#include "subtitle_encoder.h"
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/raw_convert.h>
 #include <dcp/smpte_subtitle_asset.h>
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/raw_convert.h>
 #include <dcp/smpte_subtitle_asset.h>
@@ -31,6 +32,7 @@
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::make_pair;
 using std::make_shared;
 using std::pair;
 using std::make_pair;
 using std::make_shared;
 using std::pair;
@@ -43,6 +45,7 @@ using namespace boost::placeholders;
 #endif
 using dcp::raw_convert;
 
 #endif
 using dcp::raw_convert;
 
+
 /** @param output Directory, if there will be multiple output files, or a filename.
  *  @param initial_name Hint that may be used to create filenames, if @ref output is a directory.
  *  @param include_font true to refer to and export any font file (for Interop; ignored for SMPTE).
 /** @param output Directory, if there will be multiple output files, or a filename.
  *  @param initial_name Hint that may be used to create filenames, if @ref output is a directory.
  *  @param include_font true to refer to and export any font file (for Interop; ignored for SMPTE).
@@ -85,6 +88,7 @@ SubtitleEncoder::SubtitleEncoder (shared_ptr<const Film> film, shared_ptr<Job> j
        _default_font = dcp::ArrayData (default_font_file());
 }
 
        _default_font = dcp::ArrayData (default_font_file());
 }
 
+
 void
 SubtitleEncoder::go ()
 {
 void
 SubtitleEncoder::go ()
 {
@@ -99,33 +103,34 @@ SubtitleEncoder::go ()
        while (!_player->pass()) {}
 
        int reel = 0;
        while (!_player->pass()) {}
 
        int reel = 0;
-       for (vector<pair<shared_ptr<dcp::SubtitleAsset>, boost::filesystem::path> >::iterator i = _assets.begin(); i != _assets.end(); ++i) {
-               if (!i->first) {
+       for (auto& i: _assets) {
+               if (!i.first) {
                        /* No subtitles arrived for this asset; make an empty one so we write something to the output */
                        if (_film->interop()) {
                        /* No subtitles arrived for this asset; make an empty one so we write something to the output */
                        if (_film->interop()) {
-                               shared_ptr<dcp::InteropSubtitleAsset> s (new dcp::InteropSubtitleAsset());
+                               auto s = make_shared<dcp::InteropSubtitleAsset>();
                                s->set_movie_title (_film->name());
                                s->set_reel_number (raw_convert<string>(reel + 1));
                                s->set_movie_title (_film->name());
                                s->set_reel_number (raw_convert<string>(reel + 1));
-                               i->first = s;
+                               i.first = s;
                        } else {
                        } else {
-                               shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset());
+                               auto s = make_shared<dcp::SMPTESubtitleAsset>();
                                s->set_content_title_text (_film->name());
                                s->set_reel_number (reel + 1);
                                s->set_content_title_text (_film->name());
                                s->set_reel_number (reel + 1);
-                               i->first = s;
+                               i.first = s;
                        }
                }
 
                if (!_film->interop() || _include_font) {
                        for (auto j: _player->get_subtitle_fonts()) {
                        }
                }
 
                if (!_film->interop() || _include_font) {
                        for (auto j: _player->get_subtitle_fonts()) {
-                               i->first->add_font (j.id, _default_font);
+                               i.first->add_font (j.id, _default_font);
                        }
                }
 
                        }
                }
 
-               i->first->write (i->second);
+               i.first->write (i.second);
                ++reel;
        }
 }
 
                ++reel;
        }
 }
 
+
 void
 SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period)
 {
 void
 SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period)
 {
@@ -170,7 +175,7 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> tr
                if (_film->interop() && !_include_font) {
                        i.unset_font ();
                }
                if (_film->interop() && !_include_font) {
                        i.unset_font ();
                }
-               _assets[_reel_index].first->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i)));
+               _assets[_reel_index].first->add (make_shared<dcp::SubtitleString>(i));
        }
 
        if (_split_reels && (_reel_index < int(_reels.size()) - 1) && period.from > _reels[_reel_index].from) {
        }
 
        if (_split_reels && (_reel_index < int(_reels.size()) - 1) && period.from > _reels[_reel_index].from) {
@@ -179,12 +184,13 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> tr
 
        _last = period.from;
 
 
        _last = period.from;
 
-       shared_ptr<Job> job = _job.lock ();
+       auto job = _job.lock ();
        if (job) {
                job->set_progress (float(period.from.get()) / _length.get());
        }
 }
 
        if (job) {
                job->set_progress (float(period.from.get()) / _length.get());
        }
 }
 
+
 Frame
 SubtitleEncoder::frames_done () const
 {
 Frame
 SubtitleEncoder::frames_done () const
 {
index 165d5fcb67792f409b3d8e2060b0fa2a707cc565..a88c6c5bfc66f748fb8465b5340448b972e76130 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "types.h"
 #include "player_text.h"
 #include "dcp_text_track.h"
 #include "encoder.h"
 #include "dcpomatic_time.h"
 
 #include "types.h"
 #include "player_text.h"
 #include "dcp_text_track.h"
 #include "encoder.h"
 #include "dcpomatic_time.h"
 
+
 namespace dcp {
        class SubtitleAsset;
 }
 
 namespace dcp {
        class SubtitleAsset;
 }
 
+
 class Film;
 
 class Film;
 
+
 /** @class SubtitleEncoder.
  *  @brief An `encoder' which extracts a film's subtitles to DCP XML format.
  */
 /** @class SubtitleEncoder.
  *  @brief An `encoder' which extracts a film's subtitles to DCP XML format.
  */
@@ -38,7 +42,7 @@ class SubtitleEncoder : public Encoder
 public:
        SubtitleEncoder (std::shared_ptr<const Film> film, std::shared_ptr<Job> job, boost::filesystem::path output, std::string intial_name, bool split_reels, bool include_font);
 
 public:
        SubtitleEncoder (std::shared_ptr<const Film> film, std::shared_ptr<Job> job, boost::filesystem::path output, std::string intial_name, bool split_reels, bool include_font);
 
-       void go ();
+       void go () override;
 
        /** @return the number of frames that are done */
        Frame frames_done () const;
 
        /** @return the number of frames that are done */
        Frame frames_done () const;
index 48a2c8114960daa64d69e725becc60ffdd3cbd5c..3502c3346c48072824f04f22936dba0fcc04ba83 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file src/transcode_job.cc
  *  @brief A job which transcodes from one format to another.
  */
 
 /** @file src/transcode_job.cc
  *  @brief A job which transcodes from one format to another.
  */
 
+
+#include "analytics.h"
+#include "compose.hpp"
 #include "config.h"
 #include "config.h"
-#include "transcode_job.h"
 #include "dcp_encoder.h"
 #include "dcp_encoder.h"
-#include "upload_job.h"
-#include "job_manager.h"
-#include "film.h"
+#include "dcpomatic_log.h"
 #include "encoder.h"
 #include "encoder.h"
+#include "film.h"
+#include "job_manager.h"
 #include "log.h"
 #include "log.h"
-#include "dcpomatic_log.h"
-#include "compose.hpp"
-#include "analytics.h"
-#include <iostream>
+#include "transcode_job.h"
+#include "upload_job.h"
 #include <iomanip>
 #include <iomanip>
+#include <iostream>
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
+
+using std::cout;
 using std::fixed;
 using std::fixed;
+using std::make_shared;
 using std::setprecision;
 using std::setprecision;
-using std::cout;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
 using std::dynamic_pointer_cast;
 
 using boost::optional;
 using std::dynamic_pointer_cast;
 
+
 /** @param film Film to use */
 TranscodeJob::TranscodeJob (shared_ptr<const Film> film)
        : Job (film)
 /** @param film Film to use */
 TranscodeJob::TranscodeJob (shared_ptr<const Film> film)
        : Job (film)
@@ -53,29 +58,34 @@ TranscodeJob::TranscodeJob (shared_ptr<const Film> film)
 
 }
 
 
 }
 
+
 TranscodeJob::~TranscodeJob ()
 {
        stop_thread ();
 }
 
 TranscodeJob::~TranscodeJob ()
 {
        stop_thread ();
 }
 
+
 string
 TranscodeJob::name () const
 {
        return String::compose (_("Transcoding %1"), _film->name());
 }
 
 string
 TranscodeJob::name () const
 {
        return String::compose (_("Transcoding %1"), _film->name());
 }
 
+
 string
 TranscodeJob::json_name () const
 {
        return N_("transcode");
 }
 
 string
 TranscodeJob::json_name () const
 {
        return N_("transcode");
 }
 
+
 void
 TranscodeJob::set_encoder (shared_ptr<Encoder> e)
 {
        _encoder = e;
 }
 
 void
 TranscodeJob::set_encoder (shared_ptr<Encoder> e)
 {
        _encoder = e;
 }
 
+
 void
 TranscodeJob::run ()
 {
 void
 TranscodeJob::run ()
 {
@@ -103,8 +113,7 @@ TranscodeJob::run ()
 
                /* XXX: this shouldn't be here */
                if (Config::instance()->upload_after_make_dcp() && dynamic_pointer_cast<DCPEncoder>(_encoder)) {
 
                /* XXX: this shouldn't be here */
                if (Config::instance()->upload_after_make_dcp() && dynamic_pointer_cast<DCPEncoder>(_encoder)) {
-                       shared_ptr<Job> job (new UploadJob (_film));
-                       JobManager::instance()->add (job);
+                       JobManager::instance()->add(make_shared<UploadJob>(_film));
                }
 
                _encoder.reset ();
                }
 
                _encoder.reset ();
@@ -118,6 +127,7 @@ TranscodeJob::run ()
        }
 }
 
        }
 }
 
+
 string
 TranscodeJob::status () const
 {
 string
 TranscodeJob::status () const
 {
@@ -150,12 +160,13 @@ TranscodeJob::status () const
        return buffer;
 }
 
        return buffer;
 }
 
+
 /** @return Approximate remaining time in seconds */
 int
 TranscodeJob::remaining_time () const
 {
        /* _encoder might be destroyed by the job-runner thread */
 /** @return Approximate remaining time in seconds */
 int
 TranscodeJob::remaining_time () const
 {
        /* _encoder might be destroyed by the job-runner thread */
-       shared_ptr<Encoder> e = _encoder;
+       auto e = _encoder;
 
        if (!e || e->finishing()) {
                /* We aren't doing any actual encoding so just use the job's guess */
 
        if (!e || e->finishing()) {
                /* We aren't doing any actual encoding so just use the job's guess */
@@ -164,7 +175,7 @@ TranscodeJob::remaining_time () const
 
        /* We're encoding so guess based on the current encoding rate */
 
 
        /* We're encoding so guess based on the current encoding rate */
 
-       optional<float> fps = e->current_rate ();
+       auto fps = e->current_rate ();
 
        if (!fps) {
                return 0;
 
        if (!fps) {
                return 0;
index 88f41d6554cf76fb19b28fb8c6692d42503c4c2b..030e22bef092dea8bc67b794bea4bef8668a042f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file src/transcode_job.h
  *  @brief A job which transcodes from one format to another.
  */
 
 /** @file src/transcode_job.h
  *  @brief A job which transcodes from one format to another.
  */
 
+
 #include "job.h"
 
 #include "job.h"
 
+
 class Encoder;
 
 class Encoder;
 
+
 /** @class TranscodeJob
  *  @brief A job which transcodes a Film to another format.
  */
 /** @class TranscodeJob
  *  @brief A job which transcodes a Film to another format.
  */
@@ -35,15 +39,15 @@ public:
        explicit TranscodeJob (std::shared_ptr<const Film> film);
        ~TranscodeJob ();
 
        explicit TranscodeJob (std::shared_ptr<const Film> film);
        ~TranscodeJob ();
 
-       std::string name () const;
-       std::string json_name () const;
-       void run ();
-       std::string status () const;
+       std::string name () const override;
+       std::string json_name () const override;
+       void run () override;
+       std::string status () const override;
 
        void set_encoder (std::shared_ptr<Encoder> t);
 
 private:
 
        void set_encoder (std::shared_ptr<Encoder> t);
 
 private:
-       int remaining_time () const;
+       int remaining_time () const override;
 
        std::shared_ptr<Encoder> _encoder;
 };
 
        std::shared_ptr<Encoder> _encoder;
 };
index 5849b8fd22f7d400e1336fa695f823403a119743..8bfbc34f066e18abf32eb3a7e8a10fef55eb4087 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "trusted_device.h"
 
 #include "trusted_device.h"
 
+
 using std::string;
 
 using std::string;
 
+
 TrustedDevice::TrustedDevice (string thumbprint)
        : _thumbprint (thumbprint)
 {
 
 }
 
 TrustedDevice::TrustedDevice (string thumbprint)
        : _thumbprint (thumbprint)
 {
 
 }
 
+
 TrustedDevice::TrustedDevice (dcp::Certificate certificate)
        : _certificate (certificate)
 {
 
 }
 
 TrustedDevice::TrustedDevice (dcp::Certificate certificate)
        : _certificate (certificate)
 {
 
 }
 
+
 string
 TrustedDevice::as_string () const
 {
 string
 TrustedDevice::as_string () const
 {
@@ -44,6 +49,7 @@ TrustedDevice::as_string () const
        return *_thumbprint;
 }
 
        return *_thumbprint;
 }
 
+
 string
 TrustedDevice::thumbprint () const
 {
 string
 TrustedDevice::thumbprint () const
 {
index 7c6af3ea8b8a802a054462953fad6d632f90e394..51b97c297cbecc3704d96bd20c29639dc4d833c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_TRUSTED_DEVICE_H
 #define DCPOMATIC_TRUSTED_DEVICE_H
 
 #ifndef DCPOMATIC_TRUSTED_DEVICE_H
 #define DCPOMATIC_TRUSTED_DEVICE_H
 
+
 #include <dcp/certificate.h>
 #include <boost/optional.hpp>
 #include <string>
 
 #include <dcp/certificate.h>
 #include <boost/optional.hpp>
 #include <string>
 
+
 class TrustedDevice
 {
 public:
 class TrustedDevice
 {
 public:
@@ -43,4 +46,5 @@ private:
        boost::optional<std::string> _thumbprint;
 };
 
        boost::optional<std::string> _thumbprint;
 };
 
+
 #endif
 #endif
index bd5634669985116de4b74ee9aa6ca9609973bcfe..1b30b2112d6395329ab640cdebcb02356d6768a2 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "cross.h"
 #include "verify_dcp_job.h"
 #include "content.h"
 
 #include "i18n.h"
 
 #include "cross.h"
 #include "verify_dcp_job.h"
 #include "content.h"
 
 #include "i18n.h"
 
+
 using std::string;
 using std::vector;
 using std::shared_ptr;
 using std::string;
 using std::vector;
 using std::shared_ptr;
@@ -32,6 +34,7 @@ using boost::optional;
 using namespace boost::placeholders;
 #endif
 
 using namespace boost::placeholders;
 #endif
 
+
 VerifyDCPJob::VerifyDCPJob (vector<boost::filesystem::path> directories)
        : Job (shared_ptr<Film>())
        , _directories (directories)
 VerifyDCPJob::VerifyDCPJob (vector<boost::filesystem::path> directories)
        : Job (shared_ptr<Film>())
        , _directories (directories)
@@ -39,23 +42,27 @@ VerifyDCPJob::VerifyDCPJob (vector<boost::filesystem::path> directories)
 
 }
 
 
 }
 
+
 VerifyDCPJob::~VerifyDCPJob ()
 {
        stop_thread ();
 }
 
 VerifyDCPJob::~VerifyDCPJob ()
 {
        stop_thread ();
 }
 
+
 string
 VerifyDCPJob::name () const
 {
        return _("Verify DCP");
 }
 
 string
 VerifyDCPJob::name () const
 {
        return _("Verify DCP");
 }
 
+
 string
 VerifyDCPJob::json_name () const
 {
        return N_("verify_dcp");
 }
 
 string
 VerifyDCPJob::json_name () const
 {
        return N_("verify_dcp");
 }
 
+
 void
 VerifyDCPJob::update_stage (string s, optional<boost::filesystem::path> path)
 {
 void
 VerifyDCPJob::update_stage (string s, optional<boost::filesystem::path> path)
 {
@@ -65,6 +72,7 @@ VerifyDCPJob::update_stage (string s, optional<boost::filesystem::path> path)
        sub (s);
 }
 
        sub (s);
 }
 
+
 void
 VerifyDCPJob::run ()
 {
 void
 VerifyDCPJob::run ()
 {
index 3372cd6023b57437f0d308789c1583d1133a1404..b00f0128ba0213a430b95ac7d32f3cbcfbb928de 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "job.h"
 #include <dcp/verify.h>
 
 #include "job.h"
 #include <dcp/verify.h>
 
+
 class Content;
 
 class Content;
 
+
 class VerifyDCPJob : public Job
 {
 public:
        explicit VerifyDCPJob (std::vector<boost::filesystem::path> directories);
        ~VerifyDCPJob ();
 
 class VerifyDCPJob : public Job
 {
 public:
        explicit VerifyDCPJob (std::vector<boost::filesystem::path> directories);
        ~VerifyDCPJob ();
 
-       std::string name () const;
-       std::string json_name () const;
-       void run ();
+       std::string name () const override;
+       std::string json_name () const override;
+       void run () override;
 
        std::vector<dcp::VerificationNote> notes () const {
                return _notes;
 
        std::vector<dcp::VerificationNote> notes () const {
                return _notes;
index a8a301f221bf9b68040a95dec78e079a9df01a9b..c7ee69d8932c647b62835ef5d12b5a82ab0ea391 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "video_mxf_examiner.h"
 #include "video_mxf_content.h"
 #include "video_content.h"
 #include "video_mxf_examiner.h"
 #include "video_mxf_content.h"
 #include "video_content.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::list;
 using std::string;
 using std::shared_ptr;
 using std::list;
 using std::string;
 using std::shared_ptr;
+using std::make_shared;
 using namespace dcpomatic;
 
 using namespace dcpomatic;
 
+
 VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
        : Content (path)
 {
 
 }
 
 VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
        : Content (path)
 {
 
 }
 
+
 VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version)
        : Content (node)
 {
        video = VideoContent::from_xml (this, node, version);
 }
 
 VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version)
        : Content (node)
 {
        video = VideoContent::from_xml (this, node, version);
 }
 
+
 bool
 VideoMXFContent::valid_mxf (boost::filesystem::path path)
 {
        Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
 
        try {
 bool
 VideoMXFContent::valid_mxf (boost::filesystem::path path)
 {
        Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
 
        try {
-               shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (path));
+               dcp::MonoPictureAsset mp (path);
                return true;
        } catch (dcp::MXFFileError& e) {
 
                return true;
        } catch (dcp::MXFFileError& e) {
 
@@ -65,7 +71,7 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path)
 
        try {
                Kumu::DefaultLogSink().SetFilterFlag(0);
 
        try {
                Kumu::DefaultLogSink().SetFilterFlag(0);
-               shared_ptr<dcp::StereoPictureAsset> sp (new dcp::StereoPictureAsset (path));
+               dcp::StereoPictureAsset sp (path);
                return true;
        } catch (dcp::MXFFileError& e) {
 
                return true;
        } catch (dcp::MXFFileError& e) {
 
@@ -78,6 +84,7 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path)
        return false;
 }
 
        return false;
 }
 
+
 void
 VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
 void
 VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
@@ -86,50 +93,57 @@ VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        Content::examine (film, job);
 
        video.reset (new VideoContent (this));
        Content::examine (film, job);
 
        video.reset (new VideoContent (this));
-       shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
+       auto examiner = make_shared<VideoMXFExaminer>(shared_from_this());
        video->take_from_examiner (examiner);
        video->unset_colour_conversion ();
 }
 
        video->take_from_examiner (examiner);
        video->unset_colour_conversion ();
 }
 
+
 string
 VideoMXFContent::summary () const
 {
        return String::compose (_("%1 [video]"), path_summary());
 }
 
 string
 VideoMXFContent::summary () const
 {
        return String::compose (_("%1 [video]"), path_summary());
 }
 
+
 string
 VideoMXFContent::technical_summary () const
 {
 string
 VideoMXFContent::technical_summary () const
 {
-       return Content::technical_summary() + " - " + video->technical_summary ();
+       return Content::technical_summary() + " - " + video->technical_summary();
 }
 
 }
 
+
 string
 VideoMXFContent::identifier () const
 {
        return Content::identifier() + "_" + video->identifier();
 }
 
 string
 VideoMXFContent::identifier () const
 {
        return Content::identifier() + "_" + video->identifier();
 }
 
+
 void
 VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
 void
 VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
-       node->add_child("Type")->add_child_text ("VideoMXF");
+       node->add_child("Type")->add_child_text("VideoMXF");
        Content::as_xml (node, with_paths);
        video->as_xml (node);
 }
 
        Content::as_xml (node, with_paths);
        video->as_xml (node);
 }
 
+
 DCPTime
 VideoMXFContent::full_length (shared_ptr<const Film> film) const
 {
        FrameRateChange const frc (film, shared_from_this());
 DCPTime
 VideoMXFContent::full_length (shared_ptr<const Film> film) const
 {
        FrameRateChange const frc (film, shared_from_this());
-       return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
+       return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
 }
 
 }
 
+
 DCPTime
 VideoMXFContent::approximate_length () const
 {
        return DCPTime::from_frames (video->length_after_3d_combine(), 24);
 }
 
 DCPTime
 VideoMXFContent::approximate_length () const
 {
        return DCPTime::from_frames (video->length_after_3d_combine(), 24);
 }
 
+
 void
 VideoMXFContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
 {
 void
 VideoMXFContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
 {
index 6ec2c0e84414ae83137f40e0ce86447a8ebddd8d..5a04c3da9c292405b83f7e3f0c4e20fe73995077 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "content.h"
 
 #include "content.h"
 
+
 class VideoMXFContent : public Content
 {
 public:
 class VideoMXFContent : public Content
 {
 public:
@@ -27,21 +29,21 @@ public:
        VideoMXFContent (cxml::ConstNodePtr node, int version);
 
        std::shared_ptr<VideoMXFContent> shared_from_this () {
        VideoMXFContent (cxml::ConstNodePtr node, int version);
 
        std::shared_ptr<VideoMXFContent> shared_from_this () {
-               return std::dynamic_pointer_cast<VideoMXFContent> (Content::shared_from_this ());
+               return std::dynamic_pointer_cast<VideoMXFContent>(Content::shared_from_this());
        }
 
        std::shared_ptr<const VideoMXFContent> shared_from_this () const {
        }
 
        std::shared_ptr<const VideoMXFContent> shared_from_this () const {
-               return std::dynamic_pointer_cast<const VideoMXFContent> (Content::shared_from_this ());
+               return std::dynamic_pointer_cast<const VideoMXFContent>(Content::shared_from_this());
        }
 
        }
 
-       void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job);
-       std::string summary () const;
-       std::string technical_summary () const;
-       std::string identifier () const;
-       void as_xml (xmlpp::Node* node, bool with_paths) const;
-       dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const;
-       dcpomatic::DCPTime approximate_length () const;
-       void add_properties (std::shared_ptr<const Film> film, std::list<UserProperty>& p) const;
+       void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job) override;
+       std::string summary () const override;
+       std::string technical_summary () const override;
+       std::string identifier () const override;
+       void as_xml (xmlpp::Node* node, bool with_paths) const override;
+       dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override;
+       dcpomatic::DCPTime approximate_length () const override;
+       void add_properties (std::shared_ptr<const Film> film, std::list<UserProperty>& p) const override;
 
        static bool valid_mxf (boost::filesystem::path path);
 };
 
        static bool valid_mxf (boost::filesystem::path path);
 };
index d3fe2b897355ce8e71af8d680848024ed6e1854b..39c4a37fb865be99d11b0769bdaedec453050b37 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
index 9cb6ddc5546fc3887a598641e9bfc5c0d3ddd996..06147060267d60e7ac17281ce4985a0c73b928e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "wx/wx_util.h"
+
 #include "wx/about_dialog.h"
 #include "wx/about_dialog.h"
-#include "wx/wx_signal_manager.h"
-#include "wx/job_manager_view.h"
+#include "wx/dcpomatic_button.h"
 #include "wx/full_config_dialog.h"
 #include "wx/full_config_dialog.h"
+#include "wx/job_manager_view.h"
 #include "wx/servers_list_dialog.h"
 #include "wx/servers_list_dialog.h"
-#include "wx/dcpomatic_button.h"
-#include "lib/version.h"
+#include "wx/wx_signal_manager.h"
+#include "wx/wx_util.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
-#include "lib/util.h"
+#include "lib/dcpomatic_socket.h"
 #include "lib/film.h"
 #include "lib/film.h"
-#include "lib/job_manager.h"
 #include "lib/job.h"
 #include "lib/job.h"
-#include "lib/dcpomatic_socket.h"
+#include "lib/job_manager.h"
 #include "lib/transcode_job.h"
 #include "lib/transcode_job.h"
+#include "lib/util.h"
+#include "lib/version.h"
 #include <wx/aboutdlg.h>
 #include <wx/aboutdlg.h>
-#include <wx/stdpaths.h>
 #include <wx/cmdline.h>
 #include <wx/cmdline.h>
-#include <wx/splash.h>
 #include <wx/preferences.h>
 #include <wx/preferences.h>
+#include <wx/splash.h>
+#include <wx/stdpaths.h>
 #include <wx/wx.h>
 #include <iostream>
 #include <set>
 
 #include <wx/wx.h>
 #include <iostream>
 #include <set>
 
-using std::exception;
-using std::string;
+
 using std::cout;
 using std::cout;
+using std::dynamic_pointer_cast;
+using std::exception;
 using std::list;
 using std::list;
+using std::make_shared;
 using std::set;
 using std::shared_ptr;
 using std::set;
 using std::shared_ptr;
-using boost::thread;
+using std::string;
 using boost::scoped_array;
 using boost::scoped_array;
-using std::dynamic_pointer_cast;
+using boost::thread;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
+
 static list<boost::filesystem::path> films_to_load;
 
 static list<boost::filesystem::path> films_to_load;
 
+
 enum {
        ID_file_add_film = 1,
        ID_tools_encoding_servers,
        ID_help_about
 };
 
 enum {
        ID_file_add_film = 1,
        ID_tools_encoding_servers,
        ID_help_about
 };
 
+
 void
 setup_menu (wxMenuBar* m)
 {
 void
 setup_menu (wxMenuBar* m)
 {
-       wxMenu* file = new wxMenu;
+       auto file = new wxMenu;
        file->Append (ID_file_add_film, _("&Add Film...\tCtrl-A"));
 #ifdef DCPOMATIC_OSX
        file->Append (wxID_EXIT, _("&Exit"));
        file->Append (ID_file_add_film, _("&Add Film...\tCtrl-A"));
 #ifdef DCPOMATIC_OSX
        file->Append (wxID_EXIT, _("&Exit"));
@@ -78,14 +84,14 @@ setup_menu (wxMenuBar* m)
 #ifdef DCPOMATIC_OSX
        file->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
 #else
 #ifdef DCPOMATIC_OSX
        file->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
 #else
-       wxMenu* edit = new wxMenu;
+       auto edit = new wxMenu;
        edit->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
 #endif
 
        edit->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
 #endif
 
-       wxMenu* tools = new wxMenu;
+       auto tools = new wxMenu;
        tools->Append (ID_tools_encoding_servers, _("Encoding servers..."));
 
        tools->Append (ID_tools_encoding_servers, _("Encoding servers..."));
 
-       wxMenu* help = new wxMenu;
+       auto help = new wxMenu;
        help->Append (ID_help_about, _("About"));
 
        m->Append (file, _("&File"));
        help->Append (ID_help_about, _("About"));
 
        m->Append (file, _("&File"));
@@ -96,16 +102,15 @@ setup_menu (wxMenuBar* m)
        m->Append (help, _("&Help"));
 }
 
        m->Append (help, _("&Help"));
 }
 
+
 class DOMFrame : public wxFrame
 {
 public:
        explicit DOMFrame (wxString const & title)
 class DOMFrame : public wxFrame
 {
 public:
        explicit DOMFrame (wxString const & title)
-               : wxFrame (NULL, -1, title)
-               , _sizer (new wxBoxSizer (wxVERTICAL))
-               , _config_dialog (0)
-               , _servers_list_dialog (0)
+               : wxFrame (nullptr, -1, title)
+               , _sizer (new wxBoxSizer(wxVERTICAL))
        {
        {
-               wxMenuBar* bar = new wxMenuBar;
+               auto bar = new wxMenuBar;
                setup_menu (bar);
                SetMenuBar (bar);
 
                setup_menu (bar);
                SetMenuBar (bar);
 
@@ -117,17 +122,17 @@ public:
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_encoding_servers, this), ID_tools_encoding_servers);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this),       ID_help_about);
 
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_encoding_servers, this), ID_tools_encoding_servers);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this),       ID_help_about);
 
-               wxPanel* panel = new wxPanel (this);
-               wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               auto panel = new wxPanel (this);
+               auto s = new wxBoxSizer (wxHORIZONTAL);
                s->Add (panel, 1, wxEXPAND);
                SetSizer (s);
 
                s->Add (panel, 1, wxEXPAND);
                SetSizer (s);
 
-               JobManagerView* job_manager_view = new JobManagerView (panel, true);
+               auto job_manager_view = new JobManagerView (panel, true);
                _sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6);
 
                _sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6);
 
-               wxSizer* buttons = new wxBoxSizer (wxHORIZONTAL);
-               wxButton* add = new Button (panel, _("Add Film..."));
-               add->Bind (wxEVT_BUTTON, boost::bind (&DOMFrame::add_film, this));
+               auto buttons = new wxBoxSizer (wxHORIZONTAL);
+               auto add = new Button (panel, _("Add Film..."));
+               add->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::add_film, this));
                buttons->Add (add, 1, wxALL, 6);
                _pause = new Button (panel, _("Pause"));
                _pause->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::pause, this));
                buttons->Add (add, 1, wxALL, 6);
                _pause = new Button (panel, _("Pause"));
                _pause->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::pause, this));
@@ -142,8 +147,8 @@ public:
 
                panel->SetSizer (_sizer);
 
 
                panel->SetSizer (_sizer);
 
-               Bind (wxEVT_CLOSE_WINDOW, boost::bind (&DOMFrame::close, this, _1));
-               Bind (wxEVT_SIZE, boost::bind (&DOMFrame::sized, this, _1));
+               Bind (wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1));
+               Bind (wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1));
        }
 
        void setup_sensitivity ()
        }
 
        void setup_sensitivity ()
@@ -154,20 +159,20 @@ public:
 
        void pause ()
        {
 
        void pause ()
        {
-               JobManager::instance()->pause ();
+               JobManager::instance()->pause();
                setup_sensitivity ();
        }
 
        void resume ()
        {
                setup_sensitivity ();
        }
 
        void resume ()
        {
-               JobManager::instance()->resume ();
+               JobManager::instance()->resume();
                setup_sensitivity ();
        }
 
        void start_job (boost::filesystem::path path)
        {
                try {
                setup_sensitivity ();
        }
 
        void start_job (boost::filesystem::path path)
        {
                try {
-                       shared_ptr<Film> film (new Film (path));
+                       auto film = make_shared<Film>(path);
                        film->read_metadata ();
 
                        double total_required;
                        film->read_metadata ();
 
                        double total_required;
@@ -176,7 +181,7 @@ public:
 
                        film->should_be_enough_disk_space (total_required, available, can_hard_link);
 
 
                        film->should_be_enough_disk_space (total_required, available, can_hard_link);
 
-                       set<shared_ptr<const Film> > films;
+                       set<shared_ptr<const Film>> films;
 
                        for (auto i: JobManager::instance()->get()) {
                                films.insert (i->film());
 
                        for (auto i: JobManager::instance()->get()) {
                                films.insert (i->film());
@@ -208,9 +213,9 @@ public:
 
                        film->make_dcp ();
                } catch (std::exception& e) {
 
                        film->make_dcp ();
                } catch (std::exception& e) {
-                       wxString p = std_to_wx (path.string ());
-                       wxCharBuffer b = p.ToUTF8 ();
-                       error_dialog (this, wxString::Format (_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
+                       auto p = std_to_wx (path.string ());
+                       auto b = p.ToUTF8 ();
+                       error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
                }
        }
 
                }
        }
 
@@ -223,11 +228,11 @@ private:
 
        bool should_close ()
        {
 
        bool should_close ()
        {
-               if (!JobManager::instance()->work_to_do ()) {
+               if (!JobManager::instance()->work_to_do()) {
                        return true;
                }
 
                        return true;
                }
 
-               wxMessageDialog* d = new wxMessageDialog (
+               auto d = new wxMessageDialog (
                        0,
                        _("There are unfinished jobs; are you sure you want to quit?"),
                        _("Unfinished jobs"),
                        0,
                        _("There are unfinished jobs; are you sure you want to quit?"),
                        _("Unfinished jobs"),
@@ -241,7 +246,7 @@ private:
 
        void close (wxCloseEvent& ev)
        {
 
        void close (wxCloseEvent& ev)
        {
-               if (!should_close ()) {
+               if (!should_close()) {
                        ev.Veto ();
                        return;
                }
                        ev.Veto ();
                        return;
                }
@@ -256,7 +261,7 @@ private:
 
        void file_quit ()
        {
 
        void file_quit ()
        {
-               if (should_close ()) {
+               if (should_close()) {
                        Close (true);
                }
        }
                        Close (true);
                }
        }
@@ -280,16 +285,16 @@ private:
 
        void help_about ()
        {
 
        void help_about ()
        {
-               AboutDialog* d = new AboutDialog (this);
+               auto d = new AboutDialog (this);
                d->ShowModal ();
                d->Destroy ();
        }
 
        void add_film ()
        {
                d->ShowModal ();
                d->Destroy ();
        }
 
        void add_film ()
        {
-               wxDirDialog* c = new wxDirDialog (this, _("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
+               auto c = new wxDirDialog (this, _("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
                if (_last_parent) {
                if (_last_parent) {
-                       c->SetPath (std_to_wx (_last_parent.get().string ()));
+                       c->SetPath (std_to_wx(_last_parent.get().string()));
                }
 
                int r;
                }
 
                int r;
@@ -320,7 +325,7 @@ private:
                        } catch (exception& e) {
                                error_dialog (
                                        this,
                        } catch (exception& e) {
                                error_dialog (
                                        this,
-                                       wxString::Format (
+                                       wxString::Format(
                                                _("Could not write to cinemas file at %s.  Your changes have not been saved."),
                                                std_to_wx (Config::instance()->cinemas_file().string()).data()
                                                )
                                                _("Could not write to cinemas file at %s.  Your changes have not been saved."),
                                                std_to_wx (Config::instance()->cinemas_file().string()).data()
                                                )
@@ -332,7 +337,7 @@ private:
                        } catch (exception& e) {
                                error_dialog (
                                        this,
                        } catch (exception& e) {
                                error_dialog (
                                        this,
-                                       wxString::Format (
+                                       wxString::Format(
                                                _("Could not write to config file at %s.  Your changes have not been saved."),
                                                std_to_wx (Config::instance()->cinemas_file().string()).data()
                                                )
                                                _("Could not write to config file at %s.  Your changes have not been saved."),
                                                std_to_wx (Config::instance()->cinemas_file().string()).data()
                                                )
@@ -343,17 +348,19 @@ private:
 
        boost::optional<boost::filesystem::path> _last_parent;
        wxSizer* _sizer;
 
        boost::optional<boost::filesystem::path> _last_parent;
        wxSizer* _sizer;
-       wxPreferencesEditor* _config_dialog;
-       ServersListDialog* _servers_list_dialog;
+       wxPreferencesEditor* _config_dialog = nullptr;
+       ServersListDialog* _servers_list_dialog = nullptr;
        wxButton* _pause;
        wxButton* _resume;
 };
 
        wxButton* _pause;
        wxButton* _resume;
 };
 
+
 static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_PARAM, 0, 0, "film to load", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
 };
 
 static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_PARAM, 0, 0, "film to load", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
 };
 
+
 class JobServer : public Server
 {
 public:
 class JobServer : public Server
 {
 public:
@@ -366,11 +373,11 @@ public:
        {
                try {
                        int const length = socket->read_uint32 ();
        {
                try {
                        int const length = socket->read_uint32 ();
-                       scoped_array<char> buffer (new char[length]);
-                       socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length);
+                       scoped_array<char> buffer(new char[length]);
+                       socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);
                        string s (buffer.get());
                        _frame->start_job (s);
                        string s (buffer.get());
                        _frame->start_job (s);
-                       socket->write (reinterpret_cast<uint8_t const *> ("OK"), 3);
+                       socket->write (reinterpret_cast<uint8_t const *>("OK"), 3);
                } catch (...) {
 
                }
                } catch (...) {
 
                }
@@ -380,6 +387,7 @@ private:
        DOMFrame* _frame;
 };
 
        DOMFrame* _frame;
 };
 
+
 class App : public wxApp
 {
        bool OnInit ()
 class App : public wxApp
 {
        bool OnInit ()
@@ -389,10 +397,10 @@ class App : public wxApp
                SetAppName (_("DCP-o-matic Batch Converter"));
                is_batch_converter = true;
 
                SetAppName (_("DCP-o-matic Batch Converter"));
                is_batch_converter = true;
 
-               Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
-               Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
+               Config::FailedToLoad.connect (boost::bind(&App::config_failed_to_load, this));
+               Config::Warning.connect (boost::bind(&App::config_warning, this, _1));
 
 
-               wxSplashScreen* splash = maybe_show_splash ();
+               auto splash = maybe_show_splash ();
 
                if (!wxApp::OnInit()) {
                        return false;
 
                if (!wxApp::OnInit()) {
                        return false;
@@ -430,7 +438,7 @@ class App : public wxApp
                }
                _frame->Show ();
 
                }
                _frame->Show ();
 
-               JobServer* server = new JobServer (_frame);
+               auto server = new JobServer (_frame);
                new thread (boost::bind (&JobServer::run, server));
 
                signal_manager = new wxSignalManager (this);
                new thread (boost::bind (&JobServer::run, server));
 
                signal_manager = new wxSignalManager (this);
@@ -438,15 +446,15 @@ class App : public wxApp
 
                shared_ptr<Film> film;
                for (auto i: films_to_load) {
 
                shared_ptr<Film> film;
                for (auto i: films_to_load) {
-                       if (boost::filesystem::is_directory (i)) {
+                       if (boost::filesystem::is_directory(i)) {
                                try {
                                try {
-                                       film.reset (new Film (i));
+                                       film = make_shared<Film>(i);
                                        film->read_metadata ();
                                        film->make_dcp ();
                                } catch (exception& e) {
                                        error_dialog (
                                                0,
                                        film->read_metadata ();
                                        film->make_dcp ();
                                } catch (exception& e) {
                                        error_dialog (
                                                0,
-                                               std_to_wx (String::compose (wx_to_std (_("Could not load film %1")), i.string())),
+                                               std_to_wx(String::compose(wx_to_std(_("Could not load film %1")), i.string())),
                                                std_to_wx(e.what())
                                                );
                                }
                                                std_to_wx(e.what())
                                                );
                                }
@@ -470,7 +478,7 @@ class App : public wxApp
        bool OnCmdLineParsed (wxCmdLineParser& parser)
        {
                for (size_t i = 0; i < parser.GetParamCount(); ++i) {
        bool OnCmdLineParsed (wxCmdLineParser& parser)
        {
                for (size_t i = 0; i < parser.GetParamCount(); ++i) {
-                       films_to_load.push_back (wx_to_std (parser.GetParam(i)));
+                       films_to_load.push_back (wx_to_std(parser.GetParam(i)));
                }
 
                return true;
                }
 
                return true;
@@ -483,10 +491,11 @@ class App : public wxApp
 
        void config_warning (string m)
        {
 
        void config_warning (string m)
        {
-               message_dialog (_frame, std_to_wx (m));
+               message_dialog (_frame, std_to_wx(m));
        }
 
        DOMFrame* _frame;
 };
 
        }
 
        DOMFrame* _frame;
 };
 
+
 IMPLEMENT_APP (App)
 IMPLEMENT_APP (App)
index 886c1c613b28fe51e683a05afc9d8968aa99d9ec..566ec82f1fe8d90e502c2ceb7e963f98a3bd8d9a 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -37,12 +37,13 @@ DCPOMATIC_ENABLE_WARNINGS
 #include <exception>
 
 
 #include <exception>
 
 
+using std::dynamic_pointer_cast;
 using std::exception;
 using std::exception;
+using std::make_shared;
+using std::shared_ptr;
 using std::string;
 using std::vector;
 using std::string;
 using std::vector;
-using std::dynamic_pointer_cast;
 using boost::optional;
 using boost::optional;
-using std::shared_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
@@ -80,13 +81,13 @@ class DOMFrame : public wxFrame
 {
 public:
        explicit DOMFrame (wxString const & title)
 {
 public:
        explicit DOMFrame (wxString const & title)
-               : wxFrame (0, -1, title)
+               : wxFrame (nullptr, -1, title)
        {
                /* Use a panel as the only child of the Frame so that we avoid
                   the dark-grey background on Windows.
                */
        {
                /* 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);
-               wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               auto overall_panel = new wxPanel (this);
+               auto s = new wxBoxSizer (wxHORIZONTAL);
                s->Add (overall_panel, 1, wxEXPAND);
                SetSizer (s);
 
                s->Add (overall_panel, 1, wxEXPAND);
                SetSizer (s);
 
@@ -103,14 +104,14 @@ public:
                        true
                        );
 
                        true
                        );
 
-               wxBoxSizer* output = new wxBoxSizer (wxHORIZONTAL);
+               auto output = new wxBoxSizer (wxHORIZONTAL);
                add_label_to_sizer (output, overall_panel, _("Output DCP folder"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
                _output = new DirPickerCtrl (overall_panel);
                output->Add (_output, 1, wxEXPAND);
 
                _combine = new Button (overall_panel, _("Combine"));
 
                add_label_to_sizer (output, overall_panel, _("Output DCP folder"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
                _output = new DirPickerCtrl (overall_panel);
                output->Add (_output, 1, wxEXPAND);
 
                _combine = new Button (overall_panel, _("Combine"));
 
-               wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+               auto sizer = new wxBoxSizer (wxVERTICAL);
                sizer->Add (_input, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
                sizer->Add (output, 0, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
                sizer->Add (_combine, 0, wxALL | wxALIGN_RIGHT, DCPOMATIC_DIALOG_BORDER);
                sizer->Add (_input, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
                sizer->Add (output, 0, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
                sizer->Add (_combine, 0, wxALL | wxALIGN_RIGHT, DCPOMATIC_DIALOG_BORDER);
@@ -137,9 +138,11 @@ private:
 
        void combine ()
        {
 
        void combine ()
        {
-               boost::filesystem::path const output = wx_to_std(_output->GetPath());
+               using namespace boost::filesystem;
+
+               path const output = wx_to_std(_output->GetPath());
 
 
-               if (boost::filesystem::is_directory(output) && !boost::filesystem::is_empty(output)) {
+               if (is_directory(output) && !is_empty(output)) {
                        if (!confirm_dialog (
                                    this,
                                    std_to_wx (
                        if (!confirm_dialog (
                                    this,
                                    std_to_wx (
@@ -150,7 +153,7 @@ private:
                                    )) {
                                return;
                        }
                                    )) {
                                return;
                        }
-               } else if (boost::filesystem::is_regular_file(output)) {
+               } else if (is_regular_file(output)) {
                        error_dialog (
                                this,
                                String::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a DCP.")), output.string())
                        error_dialog (
                                this,
                                String::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a DCP.")), output.string())
@@ -158,21 +161,21 @@ private:
                        return;
                }
 
                        return;
                }
 
-               JobManager* jm = JobManager::instance ();
-               jm->add (shared_ptr<Job>(new CombineDCPJob(_inputs, output)));
+               auto jm = JobManager::instance ();
+               jm->add (make_shared<CombineDCPJob>(_inputs, output));
                bool const ok = display_progress (_("DCP-o-matic Combine"), _("Combining DCPs"));
                if (!ok) {
                        return;
                }
 
                DCPOMATIC_ASSERT (!jm->get().empty());
                bool const ok = display_progress (_("DCP-o-matic Combine"), _("Combining DCPs"));
                if (!ok) {
                        return;
                }
 
                DCPOMATIC_ASSERT (!jm->get().empty());
-               shared_ptr<CombineDCPJob> last = dynamic_pointer_cast<CombineDCPJob> (jm->get().back());
+               auto last = dynamic_pointer_cast<CombineDCPJob> (jm->get().back());
                DCPOMATIC_ASSERT (last);
 
                if (last->finished_ok()) {
                        message_dialog (this, _("DCPs combined successfully."));
                } else {
                DCPOMATIC_ASSERT (last);
 
                if (last->finished_ok()) {
                        message_dialog (this, _("DCPs combined successfully."));
                } else {
-                       wxString m = std_to_wx(last->error_summary());
+                       auto m = std_to_wx(last->error_summary());
                        if (!last->error_details().empty()) {
                                m += wxString::Format(" (%s)", std_to_wx(last->error_details()));
                        }
                        if (!last->error_details().empty()) {
                                m += wxString::Format(" (%s)", std_to_wx(last->error_details()));
                        }
@@ -195,11 +198,9 @@ private:
 class App : public wxApp
 {
 public:
 class App : public wxApp
 {
 public:
-       App ()
-               : _frame (0)
-       {}
+       App () {}
 
 
-       bool OnInit ()
+       bool OnInit () override
        {
                try {
                        Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
        {
                try {
                        Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
@@ -249,7 +250,7 @@ public:
                }
                catch (exception& e)
                {
                }
                catch (exception& e)
                {
-                       error_dialog (0, wxString::Format ("DCP-o-matic DCP Combiner could not start."), std_to_wx(e.what()));
+                       error_dialog (nullptr, wxString::Format ("DCP-o-matic DCP Combiner could not start."), std_to_wx(e.what()));
                        return false;
                }
 
                        return false;
                }
 
@@ -279,7 +280,7 @@ public:
                } catch (FileError& e) {
                        error_dialog (
                                0,
                } catch (FileError& e) {
                        error_dialog (
                                0,
-                               wxString::Format (
+                               wxString::Format(
                                        _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what()),
                                        std_to_wx (e.file().string().c_str ())
                                        _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what()),
                                        std_to_wx (e.file().string().c_str ())
@@ -288,29 +289,29 @@ public:
                } catch (exception& e) {
                        error_dialog (
                                0,
                } catch (exception& e) {
                        error_dialog (
                                0,
-                               wxString::Format (
+                               wxString::Format(
                                        _("An exception occurred: %s.\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what ())
                                        )
                                );
                } catch (...) {
                                        _("An exception occurred: %s.\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what ())
                                        )
                                );
                } catch (...) {
-                       error_dialog (0, _("An unknown exception occurred.") + "  " + REPORT_PROBLEM);
+                       error_dialog (nullptr, _("An unknown exception occurred.") + "  " + REPORT_PROBLEM);
                }
        }
 
                }
        }
 
-       bool OnExceptionInMainLoop ()
+       bool OnExceptionInMainLoop () override
        {
                report_exception ();
                /* This will terminate the program */
                return false;
        }
 
        {
                report_exception ();
                /* This will terminate the program */
                return false;
        }
 
-       void OnUnhandledException ()
+       void OnUnhandledException () override
        {
                report_exception ();
        }
 
        {
                report_exception ();
        }
 
-       DOMFrame* _frame;
+       DOMFrame* _frame = nullptr;
 };
 
 IMPLEMENT_APP (App)
 };
 
 IMPLEMENT_APP (App)
index 8e44967994cfc8614ac0e7a9be7731e1ab7fd167..6c7371253fc3df789342bd5e1961dd57049457a9 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "lib/ratio.h"
-#include "lib/film.h"
-#include "lib/filter.h"
-#include "lib/util.h"
-#include "lib/encode_server.h"
+
 #include "lib/dcp_video.h"
 #include "lib/decoder.h"
 #include "lib/dcp_video.h"
 #include "lib/decoder.h"
+#include "lib/encode_server.h"
+#include "lib/encode_server_description.h"
 #include "lib/exceptions.h"
 #include "lib/file_log.h"
 #include "lib/exceptions.h"
 #include "lib/file_log.h"
-#include "lib/video_decoder.h"
+#include "lib/film.h"
+#include "lib/filter.h"
 #include "lib/player.h"
 #include "lib/player_video.h"
 #include "lib/player.h"
 #include "lib/player_video.h"
-#include "lib/encode_server_description.h"
+#include "lib/ratio.h"
+#include "lib/util.h"
+#include "lib/video_decoder.h"
 #include <getopt.h>
 #include <getopt.h>
-#include <iostream>
-#include <iomanip>
 #include <exception>
 #include <exception>
+#include <iomanip>
+#include <iostream>
+
 
 
-using std::cout;
 using std::cerr;
 using std::cerr;
-using std::string;
+using std::cout;
+using std::make_shared;
 using std::pair;
 using std::shared_ptr;
 using std::pair;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
 using boost::bind;
 #if BOOST_VERSION >= 106100
 using boost::optional;
 using boost::bind;
 #if BOOST_VERSION >= 106100
@@ -48,22 +51,24 @@ using namespace boost::placeholders;
 #endif
 using dcp::ArrayData;
 
 #endif
 using dcp::ArrayData;
 
+
 static shared_ptr<Film> film;
 static EncodeServerDescription* server;
 static int frame_count = 0;
 
 static shared_ptr<Film> film;
 static EncodeServerDescription* server;
 static int frame_count = 0;
 
+
 void
 process_video (shared_ptr<PlayerVideo> pvf)
 {
 void
 process_video (shared_ptr<PlayerVideo> pvf)
 {
-       shared_ptr<DCPVideo> local  (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, Resolution::TWO_K));
-       shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, Resolution::TWO_K));
+       auto local = make_shared<DCPVideo>(pvf, frame_count, film->video_frame_rate(), 250000000, Resolution::TWO_K);
+       auto remote = make_shared<DCPVideo>(pvf, frame_count, film->video_frame_rate(), 250000000, Resolution::TWO_K);
 
        cout << "Frame " << frame_count << ": ";
        cout.flush ();
 
        ++frame_count;
 
 
        cout << "Frame " << frame_count << ": ";
        cout.flush ();
 
        ++frame_count;
 
-       ArrayData local_encoded = local->encode_locally ();
+       auto local_encoded = local->encode_locally ();
        ArrayData remote_encoded;
 
        string remote_error;
        ArrayData remote_encoded;
 
        string remote_error;
@@ -73,7 +78,7 @@ process_video (shared_ptr<PlayerVideo> pvf)
                remote_error = e.what ();
        }
 
                remote_error = e.what ();
        }
 
-       if (!remote_error.empty ()) {
+       if (!remote_error.empty()) {
                cout << "\033[0;31mnetwork problem: " << remote_error << "\033[0m\n";
                return;
        }
                cout << "\033[0;31mnetwork problem: " << remote_error << "\033[0m\n";
                return;
        }
@@ -83,8 +88,8 @@ process_video (shared_ptr<PlayerVideo> pvf)
                return;
        }
 
                return;
        }
 
-       uint8_t* p = local_encoded.data();
-       uint8_t* q = remote_encoded.data();
+       auto p = local_encoded.data();
+       auto q = remote_encoded.data();
        for (int i = 0; i < local_encoded.size(); ++i) {
                if (*p++ != *q++) {
                        cout << "\033[0;31mdata differ\033[0m at byte " << i << "\n";
        for (int i = 0; i < local_encoded.size(); ++i) {
                if (*p++ != *q++) {
                        cout << "\033[0;31mdata differ\033[0m at byte " << i << "\n";
@@ -95,6 +100,7 @@ process_video (shared_ptr<PlayerVideo> pvf)
        cout << "\033[0;32mgood\033[0m\n";
 }
 
        cout << "\033[0;32mgood\033[0m\n";
 }
 
+
 static void
 help (string n)
 {
 static void
 help (string n)
 {
@@ -102,6 +108,7 @@ help (string n)
        exit (EXIT_FAILURE);
 }
 
        exit (EXIT_FAILURE);
 }
 
+
 int
 main (int argc, char* argv[])
 {
 int
 main (int argc, char* argv[])
 {
@@ -145,11 +152,11 @@ main (int argc, char* argv[])
 
        try {
                server = new EncodeServerDescription (server_host, 1, SERVER_LINK_VERSION);
 
        try {
                server = new EncodeServerDescription (server_host, 1, SERVER_LINK_VERSION);
-               film.reset (new Film (film_dir));
+               film = make_shared<Film>(film_dir);
                film->read_metadata ();
 
                film->read_metadata ();
 
-               shared_ptr<Player> player (new Player(film));
-               player->Video.connect (bind (&process_video, _1));
+               auto player = make_shared<Player>(film);
+               player->Video.connect (bind(&process_video, _1));
                while (!player->pass ()) {}
        } catch (std::exception& e) {
                cerr << "Error: " << e.what() << "\n";
                while (!player->pass ()) {}
        } catch (std::exception& e) {
                cerr << "Error: " << e.what() << "\n";
index e67fe77ed18626c2390b322d7f7e7ce175004893..0e684334f5a127a10f4b4d52bacba2388e04e394 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "cinema_dialog.h"
 #include "wx_util.h"
 #include "lib/dcpomatic_assert.h"
 #include "lib/util.h"
 
 #include "cinema_dialog.h"
 #include "wx_util.h"
 #include "lib/dcpomatic_assert.h"
 #include "lib/util.h"
 
-using std::string;
-using std::vector;
-using std::copy;
+
 using std::back_inserter;
 using std::back_inserter;
-using std::list;
+using std::copy;
 using std::cout;
 using std::cout;
+using std::list;
+using std::string;
+using std::vector;
 using boost::bind;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
 using boost::bind;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
-static string
-column (string s)
-{
-       return s;
-}
 
 CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<string> emails, string notes, int utc_offset_hour, int utc_offset_minute)
        : wxDialog (parent, wxID_ANY, title)
 {
 
 CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<string> emails, string notes, int utc_offset_hour, int utc_offset_minute)
        : wxDialog (parent, wxID_ANY, title)
 {
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       auto overall_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (overall_sizer);
 
        SetSizer (overall_sizer);
 
-       wxGridBagSizer* sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+       auto sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        int r = 0;
 
        int r = 0;
 
-       add_label_to_sizer (sizer, this, _("Name"), true, wxGBPosition (r, 0));
-       _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (500, -1));
-       sizer->Add (_name, wxGBPosition (r, 1));
+       add_label_to_sizer (sizer, this, _("Name"), true, wxGBPosition(r, 0));
+       _name = new wxTextCtrl (this, wxID_ANY, std_to_wx(name), wxDefaultPosition, wxSize(500, -1));
+       sizer->Add (_name, wxGBPosition(r, 1));
        ++r;
 
        ++r;
 
-       add_label_to_sizer (sizer, this, _("UTC offset (time zone)"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (sizer, this, _("UTC offset (time zone)"), true, wxGBPosition(r, 0));
        _utc_offset = new wxChoice (this, wxID_ANY);
        _utc_offset = new wxChoice (this, wxID_ANY);
-       sizer->Add (_utc_offset, wxGBPosition (r, 1));
+       sizer->Add (_utc_offset, wxGBPosition(r, 1));
        ++r;
 
        ++r;
 
-       add_label_to_sizer (sizer, this, _("Notes"), true, wxGBPosition (r, 0));
-       _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx (notes), wxDefaultPosition, wxSize (500, -1));
-       sizer->Add (_notes, wxGBPosition (r, 1));
+       add_label_to_sizer (sizer, this, _("Notes"), true, wxGBPosition(r, 0));
+       _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx(notes), wxDefaultPosition, wxSize(500, -1));
+       sizer->Add (_notes, wxGBPosition(r, 1));
        ++r;
 
        ++r;
 
-       add_label_to_sizer (sizer, this, _("Email addresses for KDM delivery"), false, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       add_label_to_sizer (sizer, this, _("Email addresses for KDM delivery"), false, wxGBPosition(r, 0), wxGBSpan(1, 2));
        ++r;
 
        copy (emails.begin(), emails.end(), back_inserter (_emails));
        ++r;
 
        copy (emails.begin(), emails.end(), back_inserter (_emails));
@@ -72,15 +69,17 @@ CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<
        vector<EditableListColumn> columns;
        columns.push_back (EditableListColumn(_("Address")));
        _email_list = new EditableList<string, EmailDialog> (
        vector<EditableListColumn> columns;
        columns.push_back (EditableListColumn(_("Address")));
        _email_list = new EditableList<string, EmailDialog> (
-               this, columns, bind (&CinemaDialog::get_emails, this), bind (&CinemaDialog::set_emails, this, _1), bind (&column, _1)
+               this, columns, bind (&CinemaDialog::get_emails, this), bind (&CinemaDialog::set_emails, this, _1), [](string s, int) {
+                       return s;
+               }
                );
 
                );
 
-       sizer->Add (_email_list, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND);
+       sizer->Add (_email_list, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
        ++r;
 
        overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
        ++r;
 
        overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+       auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -102,56 +101,63 @@ CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<
        _name->SetFocus ();
 }
 
        _name->SetFocus ();
 }
 
+
 string
 CinemaDialog::name () const
 {
        return wx_to_std (_name->GetValue());
 }
 
 string
 CinemaDialog::name () const
 {
        return wx_to_std (_name->GetValue());
 }
 
+
 void
 CinemaDialog::set_emails (vector<string> e)
 {
        _emails = e;
 }
 
 void
 CinemaDialog::set_emails (vector<string> e)
 {
        _emails = e;
 }
 
+
 vector<string>
 CinemaDialog::get_emails () const
 {
        return _emails;
 }
 
 vector<string>
 CinemaDialog::get_emails () const
 {
        return _emails;
 }
 
+
 list<string>
 CinemaDialog::emails () const
 {
        list<string> e;
 list<string>
 CinemaDialog::emails () const
 {
        list<string> e;
-       copy (_emails.begin(), _emails.end(), back_inserter (e));
+       copy (_emails.begin(), _emails.end(), back_inserter(e));
        return e;
 }
 
        return e;
 }
 
+
 int
 CinemaDialog::utc_offset_hour () const
 {
        int const sel = _utc_offset->GetSelection();
 int
 CinemaDialog::utc_offset_hour () const
 {
        int const sel = _utc_offset->GetSelection();
-       if (sel < 0 || sel > int (_offsets.size())) {
+       if (sel < 0 || sel > int(_offsets.size())) {
                return 0;
        }
 
        return _offsets[sel].hour;
 }
 
                return 0;
        }
 
        return _offsets[sel].hour;
 }
 
+
 int
 CinemaDialog::utc_offset_minute () const
 {
        int const sel = _utc_offset->GetSelection();
 int
 CinemaDialog::utc_offset_minute () const
 {
        int const sel = _utc_offset->GetSelection();
-       if (sel < 0 || sel > int (_offsets.size())) {
+       if (sel < 0 || sel > int(_offsets.size())) {
                return 0;
        }
 
        return _offsets[sel].minute;
 }
 
                return 0;
        }
 
        return _offsets[sel].minute;
 }
 
+
 string
 CinemaDialog::notes () const
 {
 string
 CinemaDialog::notes () const
 {
-       return wx_to_std (_notes->GetValue ());
+       return wx_to_std (_notes->GetValue());
 }
 }
index d16b0ba9ce13d3f208b2060e2ac0ce8f78a8d8cb..e0594b5d81d059ef69bcf06b2e7c05956c1093a3 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "table_dialog.h"
+
 #include "editable_list.h"
 #include "email_dialog.h"
 #include "editable_list.h"
 #include "email_dialog.h"
+#include "table_dialog.h"
 #include <wx/wx.h>
 #include <list>
 #include <vector>
 
 #include <wx/wx.h>
 #include <list>
 #include <vector>
 
+
 class CinemaDialog : public wxDialog
 {
 public:
 class CinemaDialog : public wxDialog
 {
 public:
index aa3cf4b22d33677b308aa57b2e27f89739d8edb0..4421b81b253f47afc53ad2cb044337521785d1bd 100644 (file)
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "audio_dialog.h"
 #include "check_box.h"
 #include "check_box.h"
 #include "audio_dialog.h"
 #include "check_box.h"
 #include "check_box.h"
@@ -49,6 +50,7 @@
 #include <boost/lexical_cast.hpp>
 #include <iostream>
 
 #include <boost/lexical_cast.hpp>
 #include <iostream>
 
+
 using std::cout;
 using std::list;
 using std::string;
 using std::cout;
 using std::list;
 using std::string;
@@ -64,12 +66,9 @@ using namespace boost::placeholders;
 #endif
 using dcp::locale_convert;
 
 #endif
 using dcp::locale_convert;
 
+
 DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
 DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
-       : _audio_dialog (0)
-       , _markers_dialog (0)
-       , _interop_metadata_dialog (0)
-       , _smpte_metadata_dialog (0)
-       , _film (film)
+       : _film (film)
        , _viewer (viewer)
        , _generally_sensitive (true)
 {
        , _viewer (viewer)
        , _generally_sensitive (true)
 {
@@ -123,19 +122,19 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        _notebook->AddPage (make_video_panel (), _("Video"), false);
        _notebook->AddPage (make_audio_panel (), _("Audio"), false);
 
        _notebook->AddPage (make_video_panel (), _("Video"), false);
        _notebook->AddPage (make_audio_panel (), _("Audio"), false);
 
-       _name->Bind                  (wxEVT_TEXT,     boost::bind (&DCPPanel::name_changed, this));
-       _use_isdcf_name->Bind        (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
-       _copy_isdcf_name_button->Bind(wxEVT_BUTTON,   boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
-       _dcp_content_type->Bind      (wxEVT_CHOICE,   boost::bind (&DCPPanel::dcp_content_type_changed, this));
-       _encrypted->Bind             (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
-       _reel_type->Bind             (wxEVT_CHOICE,   boost::bind (&DCPPanel::reel_type_changed, this));
-       _reel_length->Bind           (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
-       _standard->Bind              (wxEVT_CHOICE,   boost::bind (&DCPPanel::standard_changed, this));
-       _markers->Bind               (wxEVT_BUTTON,   boost::bind (&DCPPanel::markers_clicked, this));
-       _metadata->Bind              (wxEVT_BUTTON,   boost::bind (&DCPPanel::metadata_clicked, this));
+       _name->Bind                  (wxEVT_TEXT,     boost::bind(&DCPPanel::name_changed, this));
+       _use_isdcf_name->Bind        (wxEVT_CHECKBOX, boost::bind(&DCPPanel::use_isdcf_name_toggled, this));
+       _copy_isdcf_name_button->Bind(wxEVT_BUTTON,   boost::bind(&DCPPanel::copy_isdcf_name_button_clicked, this));
+       _dcp_content_type->Bind      (wxEVT_CHOICE,   boost::bind(&DCPPanel::dcp_content_type_changed, this));
+       _encrypted->Bind             (wxEVT_CHECKBOX, boost::bind(&DCPPanel::encrypted_toggled, this));
+       _reel_type->Bind             (wxEVT_CHOICE,   boost::bind(&DCPPanel::reel_type_changed, this));
+       _reel_length->Bind           (wxEVT_SPINCTRL, boost::bind(&DCPPanel::reel_length_changed, this));
+       _standard->Bind              (wxEVT_CHOICE,   boost::bind(&DCPPanel::standard_changed, this));
+       _markers->Bind               (wxEVT_BUTTON,   boost::bind(&DCPPanel::markers_clicked, this));
+       _metadata->Bind              (wxEVT_BUTTON,   boost::bind(&DCPPanel::metadata_clicked, this));
 
        for (auto i: DCPContentType::all()) {
 
        for (auto i: DCPContentType::all()) {
-               _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
+               _dcp_content_type->Append (std_to_wx(i->pretty_name()));
        }
 
        _reel_type->Append (_("Single reel"));
        }
 
        _reel_type->Append (_("Single reel"));
@@ -148,7 +147,7 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        _standard->Append (_("SMPTE"));
        _standard->Append (_("Interop"));
 
        _standard->Append (_("SMPTE"));
        _standard->Append (_("Interop"));
 
-       Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this, _1));
+       Config::instance()->Changed.connect (boost::bind(&DCPPanel::config_changed, this, _1));
 
        add_to_grid ();
 }
 
        add_to_grid ();
 }
@@ -169,39 +168,39 @@ DCPPanel::add_to_grid ()
        flags |= wxALIGN_RIGHT;
 #endif
 
        flags |= wxALIGN_RIGHT;
 #endif
 
-       _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
+       _grid->Add (_use_isdcf_name, wxGBPosition(r, 0), wxDefaultSpan, flags);
        {
                auto s = new wxBoxSizer (wxHORIZONTAL);
                s->Add (_copy_isdcf_name_button, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
        {
                auto s = new wxBoxSizer (wxHORIZONTAL);
                s->Add (_copy_isdcf_name_button, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
-               _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
+               _grid->Add (s, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
        }
        ++r;
 
        _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
        ++r;
 
        }
        ++r;
 
        _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
        ++r;
 
-       add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
-       _grid->Add (_dcp_content_type, wxGBPosition (r, 1));
+       add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition(r, 0));
+       _grid->Add (_dcp_content_type, wxGBPosition(r, 1));
        ++r;
 
        ++r;
 
-       _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       _grid->Add (_encrypted, wxGBPosition(r, 0), wxGBSpan(1, 2));
        ++r;
 
        ++r;
 
-       add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
-       _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       add_label_to_sizer (_grid, _reels_label, true, wxGBPosition(r, 0));
+       _grid->Add (_reel_type, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
        ++r;
 
-       add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
+       add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition(r, 0));
        {
        {
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               auto s = new wxBoxSizer (wxHORIZONTAL);
                s->Add (_reel_length);
                add_label_to_sizer (s, _reel_length_gb_label, false, 0, wxLEFT | wxALIGN_CENTER_VERTICAL);
                s->Add (_reel_length);
                add_label_to_sizer (s, _reel_length_gb_label, false, 0, wxLEFT | wxALIGN_CENTER_VERTICAL);
-               _grid->Add (s, wxGBPosition (r, 1));
+               _grid->Add (s, wxGBPosition(r, 1));
        }
        ++r;
 
        }
        ++r;
 
-       add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
-       _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       add_label_to_sizer (_grid, _standard_label, true, wxGBPosition(r, 0));
+       _grid->Add (_standard, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
        auto extra = new wxBoxSizer (wxHORIZONTAL);
        ++r;
 
        auto extra = new wxBoxSizer (wxHORIZONTAL);
@@ -211,6 +210,7 @@ DCPPanel::add_to_grid ()
        ++r;
 }
 
        ++r;
 }
 
+
 void
 DCPPanel::name_changed ()
 {
 void
 DCPPanel::name_changed ()
 {
@@ -218,9 +218,10 @@ DCPPanel::name_changed ()
                return;
        }
 
                return;
        }
 
-       _film->set_name (string (_name->GetValue().mb_str()));
+       _film->set_name (string(_name->GetValue().mb_str()));
 }
 
 }
 
+
 void
 DCPPanel::j2k_bandwidth_changed ()
 {
 void
 DCPPanel::j2k_bandwidth_changed ()
 {
@@ -231,6 +232,7 @@ DCPPanel::j2k_bandwidth_changed ()
        _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
 }
 
        _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
 }
 
+
 void
 DCPPanel::encrypted_toggled ()
 {
 void
 DCPPanel::encrypted_toggled ()
 {
@@ -238,9 +240,10 @@ DCPPanel::encrypted_toggled ()
                return;
        }
 
                return;
        }
 
-       _film->set_encrypted (_encrypted->GetValue ());
+       _film->set_encrypted (_encrypted->GetValue());
 }
 
 }
 
+
 /** Called when the frame rate choice widget has been changed */
 void
 DCPPanel::frame_rate_choice_changed ()
 /** Called when the frame rate choice widget has been changed */
 void
 DCPPanel::frame_rate_choice_changed ()
@@ -257,6 +260,7 @@ DCPPanel::frame_rate_choice_changed ()
                );
 }
 
                );
 }
 
+
 /** Called when the frame rate spin widget has been changed */
 void
 DCPPanel::frame_rate_spin_changed ()
 /** Called when the frame rate spin widget has been changed */
 void
 DCPPanel::frame_rate_spin_changed ()
@@ -265,9 +269,10 @@ DCPPanel::frame_rate_spin_changed ()
                return;
        }
 
                return;
        }
 
-       _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
+       _film->set_video_frame_rate (_frame_rate_spin->GetValue());
 }
 
 }
 
+
 void
 DCPPanel::audio_channels_changed ()
 {
 void
 DCPPanel::audio_channels_changed ()
 {
@@ -275,9 +280,10 @@ DCPPanel::audio_channels_changed ()
                return;
        }
 
                return;
        }
 
-       _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
+       _film->set_audio_channels (locale_convert<int>(string_client_data(_audio_channels->GetClientObject(_audio_channels->GetSelection()))));
 }
 
 }
 
+
 void
 DCPPanel::resolution_changed ()
 {
 void
 DCPPanel::resolution_changed ()
 {
@@ -288,6 +294,7 @@ DCPPanel::resolution_changed ()
        _film->set_resolution (_resolution->GetSelection() == 0 ? Resolution::TWO_K : Resolution::FOUR_K);
 }
 
        _film->set_resolution (_resolution->GetSelection() == 0 ? Resolution::TWO_K : Resolution::FOUR_K);
 }
 
+
 void
 DCPPanel::standard_changed ()
 {
 void
 DCPPanel::standard_changed ()
 {
@@ -296,6 +303,7 @@ DCPPanel::standard_changed ()
        }
 
        _film->set_interop (_standard->GetSelection() == 1);
        }
 
        _film->set_interop (_standard->GetSelection() == 1);
+
 }
 
 void
 }
 
 void
@@ -303,20 +311,21 @@ DCPPanel::markers_clicked ()
 {
        if (_markers_dialog) {
                _markers_dialog->Destroy ();
 {
        if (_markers_dialog) {
                _markers_dialog->Destroy ();
-               _markers_dialog = 0;
+               _markers_dialog = nullptr;
        }
 
        _markers_dialog = new MarkersDialog (_panel, _film, _viewer);
        _markers_dialog->Show();
 }
 
        }
 
        _markers_dialog = new MarkersDialog (_panel, _film, _viewer);
        _markers_dialog->Show();
 }
 
+
 void
 DCPPanel::metadata_clicked ()
 {
        if (_film->interop()) {
                if (_interop_metadata_dialog) {
                        _interop_metadata_dialog->Destroy ();
 void
 DCPPanel::metadata_clicked ()
 {
        if (_film->interop()) {
                if (_interop_metadata_dialog) {
                        _interop_metadata_dialog->Destroy ();
-                       _interop_metadata_dialog = 0;
+                       _interop_metadata_dialog = nullptr;
                }
 
                _interop_metadata_dialog = new InteropMetadataDialog (_panel, _film);
                }
 
                _interop_metadata_dialog = new InteropMetadataDialog (_panel, _film);
@@ -325,7 +334,7 @@ DCPPanel::metadata_clicked ()
        } else {
                if (_smpte_metadata_dialog) {
                        _smpte_metadata_dialog->Destroy ();
        } else {
                if (_smpte_metadata_dialog) {
                        _smpte_metadata_dialog->Destroy ();
-                       _smpte_metadata_dialog = 0;
+                       _smpte_metadata_dialog = nullptr;
                }
 
                _smpte_metadata_dialog = new SMPTEMetadataDialog (_panel, _film);
                }
 
                _smpte_metadata_dialog = new SMPTEMetadataDialog (_panel, _film);
@@ -334,6 +343,7 @@ DCPPanel::metadata_clicked ()
        }
 }
 
        }
 }
 
+
 void
 DCPPanel::film_changed (Film::Property p)
 {
 void
 DCPPanel::film_changed (Film::Property p)
 {
@@ -348,9 +358,13 @@ DCPPanel::film_changed (Film::Property p)
                setup_dcp_name ();
                break;
        case Film::Property::DCP_CONTENT_TYPE:
                setup_dcp_name ();
                break;
        case Film::Property::DCP_CONTENT_TYPE:
-               checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
+       {
+               auto index = DCPContentType::as_index(_film->dcp_content_type());
+               DCPOMATIC_ASSERT (index);
+               checked_set (_dcp_content_type, *index);
                setup_dcp_name ();
                break;
                setup_dcp_name ();
                break;
+       }
        case Film::Property::ENCRYPTED:
                checked_set (_encrypted, _film->encrypted ());
                break;
        case Film::Property::ENCRYPTED:
                checked_set (_encrypted, _film->encrypted ());
                break;
@@ -364,7 +378,7 @@ DCPPanel::film_changed (Film::Property p)
                break;
        case Film::Property::USE_ISDCF_NAME:
        {
                break;
        case Film::Property::USE_ISDCF_NAME:
        {
-               checked_set (_use_isdcf_name, _film->use_isdcf_name ());
+               checked_set (_use_isdcf_name, _film->use_isdcf_name());
                if (_film->use_isdcf_name()) {
                        /* We are going back to using an ISDCF name.  Remove anything after a _ in the current name,
                           in case the user has clicked 'Copy as name' then re-ticked 'Use ISDCF name' (#1513).
                if (_film->use_isdcf_name()) {
                        /* We are going back to using an ISDCF name.  Remove anything after a _ in the current name,
                           in case the user has clicked 'Copy as name' then re-ticked 'Use ISDCF name' (#1513).
@@ -382,7 +396,7 @@ DCPPanel::film_changed (Film::Property p)
        {
                bool done = false;
                for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
        {
                bool done = false;
                for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
-                       if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
+                       if (wx_to_std(_frame_rate_choice->GetString(i)) == boost::lexical_cast<string>(_film->video_frame_rate())) {
                                checked_set (_frame_rate_choice, i);
                                done = true;
                                break;
                                checked_set (_frame_rate_choice, i);
                                done = true;
                                break;
@@ -400,15 +414,15 @@ DCPPanel::film_changed (Film::Property p)
                break;
        }
        case Film::Property::AUDIO_CHANNELS:
                break;
        }
        case Film::Property::AUDIO_CHANNELS:
-               if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
-                       _film->set_audio_channels (minimum_allowed_audio_channels ());
+               if (_film->audio_channels() < minimum_allowed_audio_channels()) {
+                       _film->set_audio_channels (minimum_allowed_audio_channels());
                } else {
                } else {
-                       checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
+                       checked_set (_audio_channels, locale_convert<string>(max(minimum_allowed_audio_channels(), _film->audio_channels())));
                        setup_dcp_name ();
                }
                break;
        case Film::Property::THREE_D:
                        setup_dcp_name ();
                }
                break;
        case Film::Property::THREE_D:
-               checked_set (_three_d, _film->three_d ());
+               checked_set (_three_d, _film->three_d());
                setup_dcp_name ();
                break;
        case Film::Property::REENCODE_J2K:
                setup_dcp_name ();
                break;
        case Film::Property::REENCODE_J2K:
@@ -420,12 +434,12 @@ DCPPanel::film_changed (Film::Property p)
                _markers->Enable (!_film->interop());
                break;
        case Film::Property::AUDIO_PROCESSOR:
                _markers->Enable (!_film->interop());
                break;
        case Film::Property::AUDIO_PROCESSOR:
-               if (_film->audio_processor ()) {
+               if (_film->audio_processor()) {
                        checked_set (_audio_processor, _film->audio_processor()->id());
                } else {
                        checked_set (_audio_processor, 0);
                }
                        checked_set (_audio_processor, _film->audio_processor()->id());
                } else {
                        checked_set (_audio_processor, 0);
                }
-               setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
+               setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels());
                film_changed (Film::Property::AUDIO_CHANNELS);
                break;
        case Film::Property::REEL_TYPE:
                film_changed (Film::Property::AUDIO_CHANNELS);
                break;
        case Film::Property::REEL_TYPE:
@@ -458,6 +472,7 @@ DCPPanel::film_changed (Film::Property p)
        }
 }
 
        }
 }
 
+
 void
 DCPPanel::film_content_changed (int property)
 {
 void
 DCPPanel::film_content_changed (int property)
 {
@@ -482,25 +497,26 @@ void
 DCPPanel::setup_container ()
 {
        int n = 0;
 DCPPanel::setup_container ()
 {
        int n = 0;
-       vector<Ratio const *> ratios = Ratio::containers ();
-       vector<Ratio const *>::iterator i = ratios.begin ();
-       while (i != ratios.end() && *i != _film->container ()) {
+       auto ratios = Ratio::containers ();
+       auto i = ratios.begin ();
+       while (i != ratios.end() && *i != _film->container()) {
                ++i;
                ++n;
        }
 
        if (i == ratios.end()) {
                checked_set (_container, -1);
                ++i;
                ++n;
        }
 
        if (i == ratios.end()) {
                checked_set (_container, -1);
-               checked_set (_container_size, wxT (""));
+               checked_set (_container_size, wxT(""));
        } else {
                checked_set (_container, n);
        } else {
                checked_set (_container, n);
-               dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
-               checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
+               auto const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
+               checked_set (_container_size, wxString::Format("%dx%d", size.width, size.height));
        }
 
        setup_dcp_name ();
 }
 
        }
 
        setup_dcp_name ();
 }
 
+
 /** Called when the container widget has been changed */
 void
 DCPPanel::container_changed ()
 /** Called when the container widget has been changed */
 void
 DCPPanel::container_changed ()
@@ -511,12 +527,13 @@ DCPPanel::container_changed ()
 
        int const n = _container->GetSelection ();
        if (n >= 0) {
 
        int const n = _container->GetSelection ();
        if (n >= 0) {
-               vector<Ratio const *> ratios = Ratio::containers ();
-               DCPOMATIC_ASSERT (n < int (ratios.size()));
+               auto ratios = Ratio::containers ();
+               DCPOMATIC_ASSERT (n < int(ratios.size()));
                _film->set_container (ratios[n]);
        }
 }
 
                _film->set_container (ratios[n]);
        }
 }
 
+
 /** Called when the DCP content type widget has been changed */
 void
 DCPPanel::dcp_content_type_changed ()
 /** Called when the DCP content type widget has been changed */
 void
 DCPPanel::dcp_content_type_changed ()
@@ -527,10 +544,11 @@ DCPPanel::dcp_content_type_changed ()
 
        int const n = _dcp_content_type->GetSelection ();
        if (n != wxNOT_FOUND) {
 
        int const n = _dcp_content_type->GetSelection ();
        if (n != wxNOT_FOUND) {
-               _film->set_dcp_content_type (DCPContentType::from_index (n));
+               _film->set_dcp_content_type (DCPContentType::from_index(n));
        }
 }
 
        }
 }
 
+
 void
 DCPPanel::set_film (shared_ptr<Film> film)
 {
 void
 DCPPanel::set_film (shared_ptr<Film> film)
 {
@@ -582,6 +600,7 @@ DCPPanel::set_film (shared_ptr<Film> film)
        set_general_sensitivity(static_cast<bool>(_film));
 }
 
        set_general_sensitivity(static_cast<bool>(_film));
 }
 
+
 void
 DCPPanel::set_general_sensitivity (bool s)
 {
 void
 DCPPanel::set_general_sensitivity (bool s)
 {
@@ -589,6 +608,7 @@ DCPPanel::set_general_sensitivity (bool s)
        setup_sensitivity ();
 }
 
        setup_sensitivity ();
 }
 
+
 void
 DCPPanel::setup_sensitivity ()
 {
 void
 DCPPanel::setup_sensitivity ()
 {
@@ -629,6 +649,7 @@ DCPPanel::setup_sensitivity ()
        _show_audio->Enable             (_generally_sensitive && _film);
 }
 
        _show_audio->Enable             (_generally_sensitive && _film);
 }
 
+
 void
 DCPPanel::use_isdcf_name_toggled ()
 {
 void
 DCPPanel::use_isdcf_name_toggled ()
 {
@@ -636,16 +657,17 @@ DCPPanel::use_isdcf_name_toggled ()
                return;
        }
 
                return;
        }
 
-       _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
+       _film->set_use_isdcf_name (_use_isdcf_name->GetValue());
 }
 
 void
 DCPPanel::setup_dcp_name ()
 {
 }
 
 void
 DCPPanel::setup_dcp_name ()
 {
-       _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
-       _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
+       _dcp_name->SetLabel (std_to_wx(_film->dcp_name(true)));
+       _dcp_name->SetToolTip (std_to_wx(_film->dcp_name(true)));
 }
 
 }
 
+
 void
 DCPPanel::best_frame_rate_clicked ()
 {
 void
 DCPPanel::best_frame_rate_clicked ()
 {
@@ -653,9 +675,10 @@ DCPPanel::best_frame_rate_clicked ()
                return;
        }
 
                return;
        }
 
-       _film->set_video_frame_rate (_film->best_video_frame_rate ());
+       _film->set_video_frame_rate (_film->best_video_frame_rate());
 }
 
 }
 
+
 void
 DCPPanel::three_d_changed ()
 {
 void
 DCPPanel::three_d_changed ()
 {
@@ -663,9 +686,10 @@ DCPPanel::three_d_changed ()
                return;
        }
 
                return;
        }
 
-       _film->set_three_d (_three_d->GetValue ());
+       _film->set_three_d (_three_d->GetValue());
 }
 
 }
 
+
 void
 DCPPanel::reencode_j2k_changed ()
 {
 void
 DCPPanel::reencode_j2k_changed ()
 {
@@ -676,6 +700,7 @@ DCPPanel::reencode_j2k_changed ()
        _film->set_reencode_j2k (_reencode_j2k->GetValue());
 }
 
        _film->set_reencode_j2k (_reencode_j2k->GetValue());
 }
 
+
 void
 DCPPanel::config_changed (Config::Property p)
 {
 void
 DCPPanel::config_changed (Config::Property p)
 {
@@ -691,10 +716,11 @@ DCPPanel::config_changed (Config::Property p)
        }
 }
 
        }
 }
 
+
 void
 DCPPanel::setup_frame_rate_widget ()
 {
 void
 DCPPanel::setup_frame_rate_widget ()
 {
-       if (Config::instance()->allow_any_dcp_frame_rate ()) {
+       if (Config::instance()->allow_any_dcp_frame_rate()) {
                _frame_rate_choice->Hide ();
                _frame_rate_spin->Show ();
        } else {
                _frame_rate_choice->Hide ();
                _frame_rate_spin->Show ();
        } else {
@@ -703,6 +729,7 @@ DCPPanel::setup_frame_rate_widget ()
        }
 }
 
        }
 }
 
+
 wxPanel *
 DCPPanel::make_video_panel ()
 {
 wxPanel *
 DCPPanel::make_video_panel ()
 {
@@ -769,6 +796,7 @@ DCPPanel::make_video_panel ()
        return panel;
 }
 
        return panel;
 }
 
+
 void
 DCPPanel::add_video_panel_to_grid ()
 {
 void
 DCPPanel::add_video_panel_to_grid ()
 {
@@ -776,7 +804,7 @@ DCPPanel::add_video_panel_to_grid ()
 
        add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
        {
 
        add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
        {
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               auto s = new wxBoxSizer (wxHORIZONTAL);
                s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
                s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
                _video_grid->Add (s, wxGBPosition(r, 1));
                s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
                s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
                _video_grid->Add (s, wxGBPosition(r, 1));
@@ -809,6 +837,7 @@ DCPPanel::add_video_panel_to_grid ()
        _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
 }
 
        _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
 }
 
+
 int
 DCPPanel::minimum_allowed_audio_channels () const
 {
 int
 DCPPanel::minimum_allowed_audio_channels () const
 {
@@ -824,6 +853,7 @@ DCPPanel::minimum_allowed_audio_channels () const
        return min;
 }
 
        return min;
 }
 
+
 wxPanel *
 DCPPanel::make_audio_panel ()
 {
 wxPanel *
 DCPPanel::make_audio_panel ()
 {
@@ -852,6 +882,7 @@ DCPPanel::make_audio_panel ()
        return panel;
 }
 
        return panel;
 }
 
+
 void
 DCPPanel::add_audio_panel_to_grid ()
 {
 void
 DCPPanel::add_audio_panel_to_grid ()
 {
@@ -869,6 +900,7 @@ DCPPanel::add_audio_panel_to_grid ()
        ++r;
 }
 
        ++r;
 }
 
+
 void
 DCPPanel::copy_isdcf_name_button_clicked ()
 {
 void
 DCPPanel::copy_isdcf_name_button_clicked ()
 {
@@ -876,6 +908,7 @@ DCPPanel::copy_isdcf_name_button_clicked ()
        _film->set_use_isdcf_name (false);
 }
 
        _film->set_use_isdcf_name (false);
 }
 
+
 void
 DCPPanel::audio_processor_changed ()
 {
 void
 DCPPanel::audio_processor_changed ()
 {
@@ -887,6 +920,7 @@ DCPPanel::audio_processor_changed ()
        _film->set_audio_processor (AudioProcessor::from_id (s));
 }
 
        _film->set_audio_processor (AudioProcessor::from_id (s));
 }
 
+
 void
 DCPPanel::show_audio_clicked ()
 {
 void
 DCPPanel::show_audio_clicked ()
 {
@@ -903,6 +937,7 @@ DCPPanel::show_audio_clicked ()
        d->Show ();
 }
 
        d->Show ();
 }
 
+
 void
 DCPPanel::reel_type_changed ()
 {
 void
 DCPPanel::reel_type_changed ()
 {
@@ -910,9 +945,10 @@ DCPPanel::reel_type_changed ()
                return;
        }
 
                return;
        }
 
-       _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
+       _film->set_reel_type (static_cast<ReelType>(_reel_type->GetSelection()));
 }
 
 }
 
+
 void
 DCPPanel::reel_length_changed ()
 {
 void
 DCPPanel::reel_length_changed ()
 {
@@ -923,10 +959,11 @@ DCPPanel::reel_length_changed ()
        _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
 }
 
        _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
 }
 
+
 void
 DCPPanel::add_audio_processors ()
 {
 void
 DCPPanel::add_audio_processors ()
 {
-       _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
+       _audio_processor->Append (_("None"), new wxStringClientData(N_("none")));
        for (auto ap: AudioProcessor::visible()) {
                _audio_processor->Append (std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id())));
        }
        for (auto ap: AudioProcessor::visible()) {
                _audio_processor->Append (std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id())));
        }
index a076e4bb4eabd9acca21b31e1106825cb8881c0d..dc5e9bcbf4f25bdda64d9c66679e34410c9db462 100644 (file)
@@ -43,6 +43,7 @@ class Film;
 class FilmViewer;
 class Ratio;
 
 class FilmViewer;
 class Ratio;
 
+
 class DCPPanel
 {
 public:
 class DCPPanel
 {
 public:
@@ -149,10 +150,10 @@ private:
        wxButton* _metadata;
        wxSizer* _audio_panel_sizer;
 
        wxButton* _metadata;
        wxSizer* _audio_panel_sizer;
 
-       AudioDialog* _audio_dialog;
-       MarkersDialog* _markers_dialog;
-       InteropMetadataDialog* _interop_metadata_dialog;
-       SMPTEMetadataDialog* _smpte_metadata_dialog;
+       AudioDialog* _audio_dialog = nullptr;
+       MarkersDialog* _markers_dialog = nullptr;
+       InteropMetadataDialog* _interop_metadata_dialog = nullptr;
+       SMPTEMetadataDialog* _smpte_metadata_dialog = nullptr;
 
        std::shared_ptr<Film> _film;
        std::weak_ptr<FilmViewer> _viewer;
 
        std::shared_ptr<Film> _film;
        std::weak_ptr<FilmViewer> _viewer;
index dd63ff2dae447bfdaccd6a9842e0f02092fd8d20..8223371dbce0399b2d40ff221dff092eae9d22ec 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
+#include "wx_util.h"
 #include <dcp/util.h>
 
 #include <dcp/util.h>
 
+
 template <class T>
 class FileDialogWrapper
 {
 template <class T>
 class FileDialogWrapper
 {
@@ -34,7 +37,7 @@ public:
 
        boost::optional<T> get ()
        {
 
        boost::optional<T> get ()
        {
-               return T (dcp::file_to_string (wx_to_std (_dialog->GetPath ())));
+               return T (dcp::file_to_string(wx_to_std(_dialog->GetPath())));
        }
 
        int ShowModal ()
        }
 
        int ShowModal ()
index a65f5153a2f95e9733619123997bc2d1180285bc..3dbb482364bcd6e221e82b88fe99be6c6585f7f5 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/filter_dialog.cc
  *  @brief A dialog to select FFmpeg filters.
  */
 
 /** @file  src/filter_dialog.cc
  *  @brief A dialog to select FFmpeg filters.
  */
 
+
 #include "check_box.h"
 #include "filter_dialog.h"
 #include "static_text.h"
 #include "check_box.h"
 #include "filter_dialog.h"
 #include "static_text.h"
@@ -37,35 +39,31 @@ using boost::bind;
 FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> const & active)
        : wxDialog (parent, wxID_ANY, wxString(_("Filters")))
 {
 FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> const & active)
        : wxDialog (parent, wxID_ANY, wxString(_("Filters")))
 {
-       wxPanel* panel = new wxPanel (this);
-       wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       auto panel = new wxPanel (this);
+       auto sizer = new wxBoxSizer (wxVERTICAL);
 
 
-       vector<Filter const *> filters = Filter::all ();
+       auto filters = Filter::all ();
 
 
-       typedef map<string, list<Filter const *> > CategoryMap;
-       CategoryMap categories;
+       map<string, list<Filter const *>> categories;
 
        for (auto i: filters) {
 
        for (auto i: filters) {
-               CategoryMap::iterator j = categories.find (i->category());
+               auto j = categories.find (i->category());
                if (j == categories.end ()) {
                if (j == categories.end ()) {
-                       list<Filter const *> c;
-                       c.push_back (i);
-                       categories[i->category()] = c;
+                       categories[i->category()] = { i };
                } else {
                        j->second.push_back (i);
                }
        }
 
                } else {
                        j->second.push_back (i);
                }
        }
 
-       for (CategoryMap::iterator i = categories.begin(); i != categories.end(); ++i) {
-
-               wxStaticText* c = new StaticText (panel, std_to_wx(i->first));
-               wxFont font = c->GetFont();
+       for (auto const& i: categories) {
+               auto c = new StaticText (panel, std_to_wx(i.first));
+               auto font = c->GetFont();
                font.SetWeight(wxFONTWEIGHT_BOLD);
                c->SetFont(font);
                sizer->Add (c, 1, wxTOP | wxBOTTOM, DCPOMATIC_SIZER_GAP);
 
                font.SetWeight(wxFONTWEIGHT_BOLD);
                c->SetFont(font);
                sizer->Add (c, 1, wxTOP | wxBOTTOM, DCPOMATIC_SIZER_GAP);
 
-               for (auto j: i->second) {
-                       wxCheckBox* b = new CheckBox(panel, std_to_wx(j->name()));
+               for (auto j: i.second) {
+                       auto b = new CheckBox(panel, std_to_wx(j->name()));
                        bool const a = find (active.begin(), active.end(), j) != active.end();
                        b->SetValue (a);
                        _filters[j] = b;
                        bool const a = find (active.begin(), active.end(), j) != active.end();
                        b->SetValue (a);
                        _filters[j] = b;
@@ -76,14 +74,14 @@ FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> const & act
                sizer->AddSpacer (6);
        }
 
                sizer->AddSpacer (6);
        }
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+       auto buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
                sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
 
        panel->SetSizer (sizer);
 
        if (buttons) {
                sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
 
        panel->SetSizer (sizer);
 
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       auto overall_sizer = new wxBoxSizer (wxVERTICAL);
        overall_sizer->Add (panel, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
        SetSizerAndFit (overall_sizer);
 }
        overall_sizer->Add (panel, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
        SetSizerAndFit (overall_sizer);
 }
@@ -100,9 +98,9 @@ vector<Filter const*>
 FilterDialog::active () const
 {
        vector<Filter const *> active;
 FilterDialog::active () const
 {
        vector<Filter const *> active;
-       for (map<Filter const *, wxCheckBox*>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
-               if (i->second->IsChecked()) {
-                       active.push_back(i->first);
+       for (auto const& i: _filters) {
+               if (i.second->IsChecked()) {
+                       active.push_back(i.first);
                }
        }
 
                }
        }
 
index 775995f38f9c1fb4972e0594d32264ad010edcaf..33f92c0a69ae7204b3b43b5f04523c70d79ea75b 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/filter_dialog.h
  *  @brief A dialog to select FFmpeg filters.
  */
 
 /** @file  src/filter_dialog.h
  *  @brief A dialog to select FFmpeg filters.
  */
 
+
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/signals2.hpp>
 
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/signals2.hpp>
 
+
 class Film;
 class Filter;
 
 class Film;
 class Filter;
 
+
 /** @class FilterDialog
  *  @brief A dialog to select FFmpeg filters.
  */
 /** @class FilterDialog
  *  @brief A dialog to select FFmpeg filters.
  */
index 29af6a739d4487e24c49efefd5383c17c462e9b1..e61055ad7f69e794d2588e86163b62ff6b25d358 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "fonts_dialog.h"
 #include "wx_util.h"
 #include "system_font_dialog.h"
 #include "fonts_dialog.h"
 #include "wx_util.h"
 #include "system_font_dialog.h"
 #include <wx/wx.h>
 #include <iostream>
 
 #include <wx/wx.h>
 #include <iostream>
 
+
 using std::list;
 using std::string;
 using std::cout;
 using std::shared_ptr;
 using namespace dcpomatic;
 
 using std::list;
 using std::string;
 using std::cout;
 using std::shared_ptr;
 using namespace dcpomatic;
 
+
 FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<Content> content, shared_ptr<TextContent> caption)
        : wxDialog (parent, wxID_ANY, _("Fonts"))
        , _content (content)
 FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<Content> content, shared_ptr<TextContent> caption)
        : wxDialog (parent, wxID_ANY, _("Fonts"))
        , _content (content)
@@ -57,16 +60,16 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<Content> content, shared_
                _fonts->InsertColumn (1, ip);
        }
 
                _fonts->InsertColumn (1, ip);
        }
 
-       wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL);
+       auto sizer = new wxBoxSizer (wxHORIZONTAL);
        sizer->Add (_fonts, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
 
        _edit = new Button (this, _("Edit..."));
        sizer->Add (_edit, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
 
        sizer->Add (_fonts, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
 
        _edit = new Button (this, _("Edit..."));
        sizer->Add (_edit, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
 
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       auto overall_sizer = new wxBoxSizer (wxVERTICAL);
        overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
 
        overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+       auto buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -80,11 +83,12 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<Content> content, shared_
        setup ();
 }
 
        setup ();
 }
 
+
 void
 FontsDialog::setup ()
 {
 void
 FontsDialog::setup ()
 {
-       shared_ptr<Content> content = _content.lock ();
-       shared_ptr<TextContent> caption = _caption.lock ();
+       auto content = _content.lock ();
+       auto caption = _caption.lock ();
        if (!content || !caption) {
                return;
        }
        if (!content || !caption) {
                return;
        }
@@ -105,12 +109,14 @@ FontsDialog::setup ()
        setup_sensitivity ();
 }
 
        setup_sensitivity ();
 }
 
+
 void
 FontsDialog::selection_changed ()
 {
        setup_sensitivity ();
 }
 
 void
 FontsDialog::selection_changed ()
 {
        setup_sensitivity ();
 }
 
+
 void
 FontsDialog::setup_sensitivity ()
 {
 void
 FontsDialog::setup_sensitivity ()
 {
@@ -118,17 +124,18 @@ FontsDialog::setup_sensitivity ()
        _edit->Enable (item != -1);
 }
 
        _edit->Enable (item != -1);
 }
 
+
 void
 FontsDialog::edit_clicked ()
 {
 void
 FontsDialog::edit_clicked ()
 {
-       shared_ptr<Content> content = _content.lock ();
-       shared_ptr<TextContent> caption = _caption.lock ();
+       auto content = _content.lock ();
+       auto caption = _caption.lock ();
        if (!content || !caption) {
                return;
        }
 
        int const item = _fonts->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if (!content || !caption) {
                return;
        }
 
        int const item = _fonts->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
-       string const id = wx_to_std (_fonts->GetItemText (item, 0));
+       auto const id = wx_to_std (_fonts->GetItemText(item, 0));
        shared_ptr<Font> font;
        for (auto i: caption->fonts()) {
                if (i->id() == id) {
        shared_ptr<Font> font;
        for (auto i: caption->fonts()) {
                if (i->id() == id) {
@@ -155,7 +162,7 @@ FontsDialog::edit_clicked ()
         default_dir = "/System/Library/Fonts";
 #endif
 
         default_dir = "/System/Library/Fonts";
 #endif
 
-       wxFileDialog* d = new wxFileDialog (this, _("Choose a font file"), default_dir, wxT(""), wxT("*.ttf;*.otf"), wxFD_CHANGE_DIR);
+       auto d = new wxFileDialog (this, _("Choose a font file"), default_dir, wxT(""), wxT("*.ttf;*.otf"), wxFD_CHANGE_DIR);
        int const r = d->ShowModal ();
 
        if (r != wxID_OK) {
        int const r = d->ShowModal ();
 
        if (r != wxID_OK) {
index 0ef3658cfd7f572f32fc0bc96398bbd64b8cd739..a77684cb9e6984e8fb3eecc2efb7683d93b8ca0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/listctrl.h>
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/listctrl.h>
@@ -25,9 +26,11 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/filesystem.hpp>
 
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/filesystem.hpp>
 
+
 class Content;
 class TextContent;
 
 class Content;
 class TextContent;
 
+
 class FontsDialog : public wxDialog
 {
 public:
 class FontsDialog : public wxDialog
 {
 public:
index 827e81bc94612b0d547fa6e874f60878ce77a47d..f6b9636227f4a33196cc7453c87708ce27a23674 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "i18n_hook.h"
 #include "instant_i18n_dialog.h"
 #include "wx_util.h"
 #include "i18n_hook.h"
 #include "instant_i18n_dialog.h"
 #include "wx_util.h"
@@ -25,6 +26,7 @@
 #include <wx/wx.h>
 #include <boost/bind/bind.hpp>
 
 #include <wx/wx.h>
 #include <boost/bind/bind.hpp>
 
+
 using std::map;
 using std::string;
 #if BOOST_VERSION >= 106100
 using std::map;
 using std::string;
 #if BOOST_VERSION >= 106100
@@ -41,15 +43,16 @@ I18NHook::I18NHook (wxWindow* window, wxString original)
        _window->Bind (wxEVT_MIDDLE_DOWN, bind(&I18NHook::handle, this, _1));
 }
 
        _window->Bind (wxEVT_MIDDLE_DOWN, bind(&I18NHook::handle, this, _1));
 }
 
+
 void
 I18NHook::handle (wxMouseEvent& ev)
 {
 void
 I18NHook::handle (wxMouseEvent& ev)
 {
-       InstantI18NDialog* d = new InstantI18NDialog (_window, get_text());
+       auto d = new InstantI18NDialog (_window, get_text());
        d->ShowModal();
        set_text (d->get());
        d->Destroy ();
 
        d->ShowModal();
        set_text (d->get());
        d->Destroy ();
 
-       wxWindow* w = _window;
+       auto w = _window;
        while (w) {
                if (w->GetContainingSizer()) {
                        w->GetContainingSizer()->Layout();
        while (w) {
                if (w->GetContainingSizer()) {
                        w->GetContainingSizer()->Layout();
index b2de66172b0971fbee2c05c3aa9e2f786273eed9..bb1bc822799f124f09fe2971ea42efbb705fadee 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_I18N_HOOK_H
 #define DCPOMATIC_I18N_HOOK_H
 
 #ifndef DCPOMATIC_I18N_HOOK_H
 #define DCPOMATIC_I18N_HOOK_H
 
+
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <map>
 
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <map>
 
+
 class I18NHook
 {
 public:
 class I18NHook
 {
 public:
@@ -48,4 +51,5 @@ private:
        static std::map<std::string, std::string> _translations;
 };
 
        static std::map<std::string, std::string> _translations;
 };
 
+
 #endif
 #endif
index 030098920b73e648955b05efb196a6a6ecd62ce5..8da8f061e7c93d47871b49efc02a8a55fdca9401 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "screen_dialog.h"
-#include "wx_util.h"
+
+#include "dcpomatic_button.h"
+#include "download_certificate_dialog.h"
 #include "file_dialog_wrapper.h"
 #include "file_dialog_wrapper.h"
+#include "screen_dialog.h"
 #include "static_text.h"
 #include "static_text.h"
-#include "download_certificate_dialog.h"
 #include "table_dialog.h"
 #include "table_dialog.h"
-#include "dcpomatic_button.h"
+#include "wx_util.h"
 #include "lib/compose.hpp"
 #include "lib/util.h"
 #include "lib/warnings.h"
 #include "lib/compose.hpp"
 #include "lib/util.h"
 #include "lib/warnings.h"
@@ -36,6 +37,7 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <iostream>
 
 DCPOMATIC_ENABLE_WARNINGS
 #include <iostream>
 
+
 using std::string;
 using std::cout;
 using std::vector;
 using std::string;
 using std::cout;
 using std::vector;
@@ -45,11 +47,6 @@ using boost::bind;
 using namespace boost::placeholders;
 #endif
 
 using namespace boost::placeholders;
 #endif
 
-static string
-column (TrustedDevice d)
-{
-       return d.thumbprint ();
-}
 
 class TrustedDeviceDialog : public TableDialog
 {
 
 class TrustedDeviceDialog : public TableDialog
 {
@@ -68,7 +65,7 @@ public:
 
        void load_certificate ()
        {
 
        void load_certificate ()
        {
-               wxFileDialog* d = new wxFileDialog (this, _("Trusted Device certificate"));
+               auto d = new wxFileDialog (this, _("Trusted Device certificate"));
                if (d->ShowModal() == wxID_OK) {
                        try {
                                _certificate = dcp::Certificate(dcp::file_to_string(wx_to_std(d->GetPath())));
                if (d->ShowModal() == wxID_OK) {
                        try {
                                _certificate = dcp::Certificate(dcp::file_to_string(wx_to_std(d->GetPath())));
@@ -87,14 +84,14 @@ public:
 
        optional<TrustedDevice> get ()
        {
 
        optional<TrustedDevice> get ()
        {
-               string const t = wx_to_std (_thumbprint->GetValue ());
+               auto const t = wx_to_std (_thumbprint->GetValue());
                if (_certificate && _certificate->thumbprint() == t) {
                        return TrustedDevice (*_certificate);
                } else if (t.length() == 28) {
                        return TrustedDevice (t);
                }
 
                if (_certificate && _certificate->thumbprint() == t) {
                        return TrustedDevice (*_certificate);
                } else if (t.length() == 28) {
                        return TrustedDevice (t);
                }
 
-               return optional<TrustedDevice> ();
+               return {};
        }
 
 private:
        }
 
 private:
@@ -103,6 +100,7 @@ private:
        boost::optional<dcp::Certificate> _certificate;
 };
 
        boost::optional<dcp::Certificate> _certificate;
 };
 
+
 ScreenDialog::ScreenDialog (
        wxWindow* parent, wxString title, string name, string notes, optional<dcp::Certificate> recipient, vector<TrustedDevice> trusted_devices
        )
 ScreenDialog::ScreenDialog (
        wxWindow* parent, wxString title, string name, string notes, optional<dcp::Certificate> recipient, vector<TrustedDevice> trusted_devices
        )
@@ -110,30 +108,30 @@ ScreenDialog::ScreenDialog (
        , _recipient (recipient)
        , _trusted_devices (trusted_devices)
 {
        , _recipient (recipient)
        , _trusted_devices (trusted_devices)
 {
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       auto overall_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (overall_sizer);
 
        _sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        int r = 0;
 
        SetSizer (overall_sizer);
 
        _sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        int r = 0;
 
-       add_label_to_sizer (_sizer, this, _("Name"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (_sizer, this, _("Name"), true, wxGBPosition(r, 0));
        _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (320, -1));
        _sizer->Add (_name, wxGBPosition (r, 1));
        ++r;
 
        _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (320, -1));
        _sizer->Add (_name, wxGBPosition (r, 1));
        ++r;
 
-       add_label_to_sizer (_sizer, this, _("Notes"), true, wxGBPosition (r, 0));
-       _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx (notes), wxDefaultPosition, wxSize (320, -1));
-       _sizer->Add (_notes, wxGBPosition (r, 1));
+       add_label_to_sizer (_sizer, this, _("Notes"), true, wxGBPosition(r, 0));
+       _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx(notes), wxDefaultPosition, wxSize(320, -1));
+       _sizer->Add (_notes, wxGBPosition(r, 1));
        ++r;
 
         wxClientDC dc (this);
        wxFont font = _name->GetFont ();
        font.SetFamily (wxFONTFAMILY_TELETYPE);
        dc.SetFont (font);
        ++r;
 
         wxClientDC dc (this);
        wxFont font = _name->GetFont ();
        font.SetFamily (wxFONTFAMILY_TELETYPE);
        dc.SetFont (font);
-        wxSize size = dc.GetTextExtent (wxT ("1234567890123456789012345678"));
+        wxSize size = dc.GetTextExtent (wxT("1234567890123456789012345678"));
         size.SetHeight (-1);
 
         size.SetHeight (-1);
 
-       add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition(r, 0));
        wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
        _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
        _recipient_thumbprint->SetFont (font);
        wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
        _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
        _recipient_thumbprint->SetFont (font);
@@ -156,7 +154,9 @@ ScreenDialog::ScreenDialog (
                columns,
                bind (&ScreenDialog::trusted_devices, this),
                bind (&ScreenDialog::set_trusted_devices, this, _1),
                columns,
                bind (&ScreenDialog::trusted_devices, this),
                bind (&ScreenDialog::set_trusted_devices, this, _1),
-               bind (&column, _1),
+               [] (TrustedDevice const& d, int) {
+                       return d.thumbprint();
+               },
                false
                );
 
                false
                );
 
@@ -180,30 +180,34 @@ ScreenDialog::ScreenDialog (
        setup_sensitivity ();
 }
 
        setup_sensitivity ();
 }
 
+
 string
 ScreenDialog::name () const
 {
        return wx_to_std (_name->GetValue());
 }
 
 string
 ScreenDialog::name () const
 {
        return wx_to_std (_name->GetValue());
 }
 
+
 string
 ScreenDialog::notes () const
 {
        return wx_to_std (_notes->GetValue());
 }
 
 string
 ScreenDialog::notes () const
 {
        return wx_to_std (_notes->GetValue());
 }
 
+
 optional<dcp::Certificate>
 ScreenDialog::recipient () const
 {
        return _recipient;
 }
 
 optional<dcp::Certificate>
 ScreenDialog::recipient () const
 {
        return _recipient;
 }
 
+
 void
 ScreenDialog::load_recipient (boost::filesystem::path file)
 {
        try {
                /* Load this as a chain, in case it is one, and then pick the leaf certificate */
 void
 ScreenDialog::load_recipient (boost::filesystem::path file)
 {
        try {
                /* Load this as a chain, in case it is one, and then pick the leaf certificate */
-               dcp::CertificateChain c (dcp::file_to_string (file));
+               dcp::CertificateChain c (dcp::file_to_string(file));
                if (c.unordered().empty()) {
                        error_dialog (this, _("Could not read certificate file."));
                        return;
                if (c.unordered().empty()) {
                        error_dialog (this, _("Could not read certificate file."));
                        return;
@@ -214,38 +218,42 @@ ScreenDialog::load_recipient (boost::filesystem::path file)
        }
 }
 
        }
 }
 
+
 void
 ScreenDialog::get_recipient_from_file ()
 {
 void
 ScreenDialog::get_recipient_from_file ()
 {
-       wxFileDialog* d = new wxFileDialog (this, _("Select Certificate File"));
-       if (d->ShowModal () == wxID_OK) {
-               load_recipient (boost::filesystem::path (wx_to_std (d->GetPath ())));
+       auto d = new wxFileDialog (this, _("Select Certificate File"));
+       if (d->ShowModal() == wxID_OK) {
+               load_recipient (boost::filesystem::path(wx_to_std(d->GetPath())));
        }
        d->Destroy ();
 
        setup_sensitivity ();
 }
 
        }
        d->Destroy ();
 
        setup_sensitivity ();
 }
 
+
 void
 ScreenDialog::download_recipient ()
 {
 void
 ScreenDialog::download_recipient ()
 {
-       DownloadCertificateDialog* d = new DownloadCertificateDialog (this);
+       auto d = new DownloadCertificateDialog (this);
        if (d->ShowModal() == wxID_OK) {
        if (d->ShowModal() == wxID_OK) {
-               set_recipient (d->certificate ());
+               set_recipient (d->certificate());
        }
        d->Destroy ();
        setup_sensitivity ();
 }
 
        }
        d->Destroy ();
        setup_sensitivity ();
 }
 
+
 void
 ScreenDialog::setup_sensitivity ()
 {
 void
 ScreenDialog::setup_sensitivity ()
 {
-       wxButton* ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
+       auto ok = dynamic_cast<wxButton*> (FindWindowById(wxID_OK, this));
        if (ok) {
                ok->Enable (static_cast<bool>(_recipient) && !_name->GetValue().IsEmpty());
        }
 }
 
        if (ok) {
                ok->Enable (static_cast<bool>(_recipient) && !_name->GetValue().IsEmpty());
        }
 }
 
+
 void
 ScreenDialog::set_recipient (optional<dcp::Certificate> r)
 {
 void
 ScreenDialog::set_recipient (optional<dcp::Certificate> r)
 {
index 6665ef39878d8bdba0de7301629495f12ce9ab3e..2c2d8b8bfe45536a65e56a61d45c3e6f45adc00d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "editable_list.h"
 #include "lib/screen.h"
 #include <dcp/certificate.h>
 #include <wx/wx.h>
 #include <boost/optional.hpp>
 
 #include "editable_list.h"
 #include "lib/screen.h"
 #include <dcp/certificate.h>
 #include <wx/wx.h>
 #include <boost/optional.hpp>
 
+
 class Progress;
 class TrustedDeviceDialog;
 
 class Progress;
 class TrustedDeviceDialog;
 
+
 class ScreenDialog : public wxDialog
 {
 public:
 class ScreenDialog : public wxDialog
 {
 public:
@@ -35,7 +38,7 @@ public:
                wxString,
                std::string name = "",
                std::string notes = "",
                wxString,
                std::string name = "",
                std::string notes = "",
-               boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate> (),
+               boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate>(),
                std::vector<TrustedDevice> d = std::vector<TrustedDevice>()
                );
 
                std::vector<TrustedDevice> d = std::vector<TrustedDevice>()
                );
 
index 6a98ecec63f12b1d3c627f8e31dcf3582c84d1d7..df5b8e21b647a531ec2914592f0079876f4c0cdc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "system_font_dialog.h"
 #include "wx_util.h"
 #include <wx/listctrl.h>
 #include <boost/filesystem.hpp>
 #include <iostream>
 
 #include "system_font_dialog.h"
 #include "wx_util.h"
 #include <wx/listctrl.h>
 #include <boost/filesystem.hpp>
 #include <iostream>
 
+
 using std::cout;
 using std::string;
 using boost::optional;
 
 using std::cout;
 using std::string;
 using boost::optional;
 
+
 SystemFontDialog::SystemFontDialog (wxWindow* parent)
        : wxDialog (parent, wxID_ANY, _("Choose a font"))
 {
 SystemFontDialog::SystemFontDialog (wxWindow* parent)
        : wxDialog (parent, wxID_ANY, _("Choose a font"))
 {
-       wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       auto sizer = new wxBoxSizer (wxVERTICAL);
 
        boost::filesystem::path fonts = "c:\\Windows\\Fonts";
 
        boost::filesystem::path fonts = "c:\\Windows\\Fonts";
-       char* windir = getenv ("windir");
+       auto windir = getenv ("windir");
        if (windir) {
                fonts = boost::filesystem::path (windir) / "Fonts";
        }
 
        if (windir) {
                fonts = boost::filesystem::path (windir) / "Fonts";
        }
 
-       for (
-               boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (fonts);
-               i != boost::filesystem::directory_iterator ();
-               ++i
-               ) {
-
-               string ext = i->path().extension().string ();
+       for (auto i: boost::filesystem::directory_iterator (fonts)) {
+               auto ext = i.path().extension().string();
                transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
 
                if (ext == ".ttf") {
                transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
 
                if (ext == ".ttf") {
-                       _fonts.push_back (i->path());
+                       _fonts.push_back (i.path());
                }
        }
 
                }
        }
 
-       sort (_fonts.begin (), _fonts.end ());
+       sort (_fonts.begin(), _fonts.end());
 
        _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
        _list->InsertColumn (0, wxT (""));
 
        _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
        _list->InsertColumn (0, wxT (""));
@@ -65,7 +63,7 @@ SystemFontDialog::SystemFontDialog (wxWindow* parent)
                _list->InsertItem (n++, std_to_wx (i.leaf().stem().string ()));
        }
 
                _list->InsertItem (n++, std_to_wx (i.leaf().stem().string ()));
        }
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+       auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
        if (buttons) {
                sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
        if (buttons) {
                sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -78,25 +76,27 @@ SystemFontDialog::SystemFontDialog (wxWindow* parent)
        setup_sensitivity ();
 }
 
        setup_sensitivity ();
 }
 
+
 optional<boost::filesystem::path>
 SystemFontDialog::get_font () const
 {
        int const s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if (s == -1) {
 optional<boost::filesystem::path>
 SystemFontDialog::get_font () const
 {
        int const s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if (s == -1) {
-               return optional<boost::filesystem::path> ();
+               return {};
        }
 
        }
 
-       if (s < int (_fonts.size ())) {
+       if (s < int(_fonts.size())) {
                return _fonts[s];
        }
 
                return _fonts[s];
        }
 
-       return optional<boost::filesystem::path> ();
+       return {};
 }
 
 }
 
+
 void
 SystemFontDialog::setup_sensitivity ()
 {
 void
 SystemFontDialog::setup_sensitivity ()
 {
-       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+       auto ok = dynamic_cast<wxButton *> (FindWindowById(wxID_OK, this));
        if (ok) {
                ok->Enable (_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1);
        }
        if (ok) {
                ok->Enable (_list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1);
        }
index da51c9c3a072322cb1a28d371f212130f5877978..59639d2b0b95cb0fa7d8c12517f35fee39d7550e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 /** @class SystemFontDialog
  *  @brief A dialog box to select one of the "system" fonts on Windows.
  *
 /** @class SystemFontDialog
  *  @brief A dialog box to select one of the "system" fonts on Windows.
  *
@@ -26,6 +27,7 @@
  *  one of those fonts.
  */
 
  *  one of those fonts.
  */
 
+
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
@@ -34,8 +36,10 @@ DCPOMATIC_ENABLE_WARNINGS
 #include <boost/optional.hpp>
 #include <vector>
 
 #include <boost/optional.hpp>
 #include <vector>
 
+
 class wxListCtrl;
 
 class wxListCtrl;
 
+
 class SystemFontDialog : public wxDialog
 {
 public:
 class SystemFontDialog : public wxDialog
 {
 public:
index 0acc922b6d30de2448de05c2ae71c519510c49f6..1e56df38777460703eae238ff6e478f91db43ecf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/audio_mapping_test.cc
  *  @brief Test AudioMapping class.
  *  @ingroup selfcontained
  */
 
 /** @file  test/audio_mapping_test.cc
  *  @brief Test AudioMapping class.
  *  @ingroup selfcontained
  */
 
+
 #include <boost/test/unit_test.hpp>
 #include "lib/audio_mapping.h"
 #include "lib/util.h"
 
 #include <boost/test/unit_test.hpp>
 #include "lib/audio_mapping.h"
 #include "lib/util.h"
 
+
 using std::list;
 using std::string;
 using boost::optional;
 
 using std::list;
 using std::string;
 using boost::optional;
 
+
 BOOST_AUTO_TEST_CASE (audio_mapping_test)
 {
        AudioMapping none;
 BOOST_AUTO_TEST_CASE (audio_mapping_test)
 {
        AudioMapping none;
@@ -43,11 +47,11 @@ BOOST_AUTO_TEST_CASE (audio_mapping_test)
 
        for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
 
        for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
-                       BOOST_CHECK_EQUAL (four.get (i, j), (i == 0 && j == 1) ? 1 : 0);
+                       BOOST_CHECK_EQUAL (four.get(i, j), (i == 0 && j == 1) ? 1 : 0);
                }
        }
 
                }
        }
 
-       list<int> mapped = four.mapped_output_channels ();
+       auto mapped = four.mapped_output_channels ();
        BOOST_CHECK_EQUAL (mapped.size(), 1U);
        BOOST_CHECK_EQUAL (mapped.front(), 1);
 
        BOOST_CHECK_EQUAL (mapped.size(), 1U);
        BOOST_CHECK_EQUAL (mapped.front(), 1);
 
@@ -60,17 +64,19 @@ BOOST_AUTO_TEST_CASE (audio_mapping_test)
        }
 }
 
        }
 }
 
+
 static void
 static void
-guess_check (string filename, int output_channel)
+guess_check (boost::filesystem::path filename, int output_channel)
 {
        AudioMapping m (1, 8);
 {
        AudioMapping m (1, 8);
-       m.make_default (0, optional<boost::filesystem::path>(filename));
+       m.make_default (0, filename);
        for (int i = 0; i < 8; ++i) {
                BOOST_TEST_INFO (filename);
                BOOST_CHECK_CLOSE (m.get(0, i), i == output_channel ? 1 : 0, 0.01);
        }
 }
 
        for (int i = 0; i < 8; ++i) {
                BOOST_TEST_INFO (filename);
                BOOST_CHECK_CLOSE (m.get(0, i), i == output_channel ? 1 : 0, 0.01);
        }
 }
 
+
 BOOST_AUTO_TEST_CASE (audio_mapping_guess_test)
 {
        guess_check ("stuff_L_nonsense.wav", 0);
 BOOST_AUTO_TEST_CASE (audio_mapping_guess_test)
 {
        guess_check ("stuff_L_nonsense.wav", 0);
index b17fd19f9b77b95062feadf56cd6f92b23ff6056..b53917641b4e463c53b19b312b20d1d59818b3d0 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
+#include "lib/datasat_ap2x.h"
 #include "lib/dolby_cp750.h"
 #include "lib/usl.h"
 #include "lib/dolby_cp750.h"
 #include "lib/usl.h"
-#include "lib/datasat_ap2x.h"
 #include <boost/test/unit_test.hpp>
 
 #include <boost/test/unit_test.hpp>
 
+
 BOOST_AUTO_TEST_CASE (dolby_cp750_test)
 {
        DolbyCP750 ap;
 BOOST_AUTO_TEST_CASE (dolby_cp750_test)
 {
        DolbyCP750 ap;
@@ -43,6 +45,7 @@ BOOST_AUTO_TEST_CASE (dolby_cp750_test)
        BOOST_CHECK_CLOSE (ap.db_for_fader_change(6, 3), -(20 + 6.66666666666666666), 0.1);
 }
 
        BOOST_CHECK_CLOSE (ap.db_for_fader_change(6, 3), -(20 + 6.66666666666666666), 0.1);
 }
 
+
 BOOST_AUTO_TEST_CASE (usl_test)
 {
        USL ap;
 BOOST_AUTO_TEST_CASE (usl_test)
 {
        USL ap;
@@ -63,6 +66,7 @@ BOOST_AUTO_TEST_CASE (usl_test)
        BOOST_CHECK_CLOSE (ap.db_for_fader_change(6, 3), -(2.5 * 10 + 0.5 * 3.333333333333333333), 0.1);
 }
 
        BOOST_CHECK_CLOSE (ap.db_for_fader_change(6, 3), -(2.5 * 10 + 0.5 * 3.333333333333333333), 0.1);
 }
 
+
 BOOST_AUTO_TEST_CASE (datasat_ap2x_test)
 {
        DatasatAP2x ap;
 BOOST_AUTO_TEST_CASE (datasat_ap2x_test)
 {
        DatasatAP2x ap;
index 28545b3f0c30a60fed4ae8ceaa3a231e68a61833..c48a0b63a6c19b6d171e16a0f70717638b46a6b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/colour_conversion_test.cc
  *  @brief Test ColourConversion class.
  *  @ingroup selfcontained
  */
 
 /** @file  test/colour_conversion_test.cc
  *  @brief Test ColourConversion class.
  *  @ingroup selfcontained
  */
 
+
 #include "lib/colour_conversion.h"
 #include "lib/film.h"
 #include <dcp/gamma_transfer_function.h>
 #include "lib/colour_conversion.h"
 #include "lib/film.h"
 #include <dcp/gamma_transfer_function.h>
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
+
 using std::cout;
 using std::cout;
+using std::make_shared;
 using std::shared_ptr;
 
 using std::shared_ptr;
 
+
 BOOST_AUTO_TEST_CASE (colour_conversion_test1)
 {
 BOOST_AUTO_TEST_CASE (colour_conversion_test1)
 {
-       ColourConversion A (dcp::ColourConversion::srgb_to_xyz ());
-       ColourConversion B (dcp::ColourConversion::rec709_to_xyz ());
+       ColourConversion A (dcp::ColourConversion::srgb_to_xyz());
+       ColourConversion B (dcp::ColourConversion::rec709_to_xyz());
 
        BOOST_CHECK_EQUAL (A.identifier(), "9840c601d2775bf1b3847254bbaa36a9");
        BOOST_CHECK_EQUAL (B.identifier(), "58151ac92fdf333663a62c9a8ba5c5f4");
 }
 
 
        BOOST_CHECK_EQUAL (A.identifier(), "9840c601d2775bf1b3847254bbaa36a9");
        BOOST_CHECK_EQUAL (B.identifier(), "58151ac92fdf333663a62c9a8ba5c5f4");
 }
 
+
 BOOST_AUTO_TEST_CASE (colour_conversion_test2)
 {
        ColourConversion A (dcp::ColourConversion::srgb_to_xyz ());
        xmlpp::Document doc;
 BOOST_AUTO_TEST_CASE (colour_conversion_test2)
 {
        ColourConversion A (dcp::ColourConversion::srgb_to_xyz ());
        xmlpp::Document doc;
-       xmlpp::Element* root = doc.create_root_node ("Test");
+       auto root = doc.create_root_node ("Test");
        A.as_xml (root);
        BOOST_CHECK_EQUAL (
                doc.write_to_string_formatted ("UTF-8"),
        A.as_xml (root);
        BOOST_CHECK_EQUAL (
                doc.write_to_string_formatted ("UTF-8"),
@@ -73,11 +79,12 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test2)
                );
 }
 
                );
 }
 
+
 BOOST_AUTO_TEST_CASE (colour_conversion_test3)
 {
 BOOST_AUTO_TEST_CASE (colour_conversion_test3)
 {
-       ColourConversion A (dcp::ColourConversion::rec709_to_xyz ());
+       ColourConversion A (dcp::ColourConversion::rec709_to_xyz());
        xmlpp::Document doc;
        xmlpp::Document doc;
-       xmlpp::Element* root = doc.create_root_node ("Test");
+       auto root = doc.create_root_node ("Test");
        A.as_xml (root);
        BOOST_CHECK_EQUAL (
                doc.write_to_string_formatted ("UTF-8"),
        A.as_xml (root);
        BOOST_CHECK_EQUAL (
                doc.write_to_string_formatted ("UTF-8"),
@@ -101,15 +108,16 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test3)
                );
 }
 
                );
 }
 
+
 /** Test a round trip via the XML representation */
 BOOST_AUTO_TEST_CASE (colour_conversion_test4)
 {
 /** Test a round trip via the XML representation */
 BOOST_AUTO_TEST_CASE (colour_conversion_test4)
 {
-       for (auto const& i: PresetColourConversion::all ()) {
+       for (auto const& i: PresetColourConversion::all()) {
                xmlpp::Document out;
                xmlpp::Document out;
-               xmlpp::Element* out_root = out.create_root_node ("Test");
+               auto out_root = out.create_root_node("Test");
                i.conversion.as_xml (out_root);
                i.conversion.as_xml (out_root);
-               shared_ptr<cxml::Document> in (new cxml::Document ("Test"));
-               in->read_string (out.write_to_string ("UTF-8"));
-               BOOST_CHECK (ColourConversion::from_xml (in, Film::current_state_version).get () == i.conversion);
+               auto in = make_shared<cxml::Document> ("Test");
+               in->read_string (out.write_to_string("UTF-8"));
+               BOOST_CHECK (ColourConversion::from_xml(in, Film::current_state_version).get() == i.conversion);
        }
 }
        }
 }
index 1e587e93ed179da17da97664bfca61c1c6ea428c..ef1b623e78ffc8f7a67ef1f46dbd9ae37628ecb9 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "lib/film.h"
+
 #include "lib/butler.h"
 #include "lib/butler.h"
-#include "lib/player.h"
 #include "lib/dcp_content.h"
 #include "lib/dcp_content.h"
+#include "lib/film.h"
+#include "lib/player.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
+
+using std::make_shared;
 using std::pair;
 using std::shared_ptr;
 using boost::optional;
 using std::pair;
 using std::shared_ptr;
 using boost::optional;
@@ -33,28 +36,29 @@ using namespace boost::placeholders;
 #endif
 using namespace dcpomatic;
 
 #endif
 using namespace dcpomatic;
 
+
 /** Simulate the work that the player does, for profiling */
 BOOST_AUTO_TEST_CASE (dcp_playback_test)
 {
 /** Simulate the work that the player does, for profiling */
 BOOST_AUTO_TEST_CASE (dcp_playback_test)
 {
-       shared_ptr<Film> film = new_test_film ("dcp_playback_test");
-       shared_ptr<DCPContent> content (new DCPContent(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+       auto film = new_test_film ("dcp_playback_test");
+       auto content = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       shared_ptr<Butler> butler (
-               new Butler(
-                       film,
-                       shared_ptr<Player>(new Player(film)),
-                       AudioMapping(6, 6),
-                       6,
-                       bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
-                       VideoRange::FULL,
-                       false,
-                       true)
+       auto butler = std::make_shared<Butler>(
+               film,
+               shared_ptr<Player>(new Player(film)),
+               AudioMapping(6, 6),
+               6,
+               bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
+               VideoRange::FULL,
+               false,
+               true
                );
                );
-       float* audio_buffer = new float[2000*6];
+
+       auto audio_buffer = new float[2000 * 6];
        while (true) {
        while (true) {
-               pair<shared_ptr<PlayerVideo>, DCPTime> p = butler->get_video (true, 0);
+               auto p = butler->get_video (true, 0);
                if (!p.first) {
                        break;
                }
                if (!p.first) {
                        break;
                }
index 1d42741b65745783d47e67a7963b349b3a48e994..f974a37256b3ae19ed6f71f28e4fba1cbb066f36 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/file_group_test.cc
  *  @brief Test FileGroup class.
  *  @ingroup selfcontained
  */
 
 /** @file  test/file_group_test.cc
  *  @brief Test FileGroup class.
  *  @ingroup selfcontained
  */
 
-#include <stdint.h>
-#include <cstdio>
+
+#include "lib/file_group.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/test/unit_test.hpp>
 #include <boost/filesystem.hpp>
-#include "lib/file_group.h"
+#include <stdint.h>
+#include <cstdio>
+
 
 using std::vector;
 
 
 using std::vector;
 
+
 BOOST_AUTO_TEST_CASE (file_group_test)
 {
        /* Random data; must be big enough for all the files */
 BOOST_AUTO_TEST_CASE (file_group_test)
 {
        /* Random data; must be big enough for all the files */
@@ -53,16 +57,17 @@ BOOST_AUTO_TEST_CASE (file_group_test)
                total_length += length[i];
        }
 
                total_length += length[i];
        }
 
-       vector<boost::filesystem::path> name;
        boost::filesystem::create_directories ("build/test/file_group_test");
        boost::filesystem::create_directories ("build/test/file_group_test");
-       name.push_back ("build/test/file_group_test/A");
-       name.push_back ("build/test/file_group_test/B");
-       name.push_back ("build/test/file_group_test/C");
-       name.push_back ("build/test/file_group_test/D");
+       vector<boost::filesystem::path> name = {
+               "build/test/file_group_test/A",
+               "build/test/file_group_test/B",
+               "build/test/file_group_test/C",
+               "build/test/file_group_test/D"
+       };
 
        int base = 0;
        for (int i = 0; i < num_files; ++i) {
 
        int base = 0;
        for (int i = 0; i < num_files; ++i) {
-               FILE* f = fopen (name[i].string().c_str(), "wb");
+               auto f = fopen (name[i].string().c_str(), "wb");
                fwrite (data + base, 1, length[i], f);
                fclose (f);
                base += length[i];
                fwrite (data + base, 1, length[i], f);
                fclose (f);
                base += length[i];
@@ -74,51 +79,51 @@ BOOST_AUTO_TEST_CASE (file_group_test)
        int pos = 0;
 
        /* Basic read from 0 */
        int pos = 0;
 
        /* Basic read from 0 */
-       BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
-       BOOST_CHECK_EQUAL (memcmp (data, test, 64), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+       BOOST_CHECK_EQUAL (memcmp(data, test, 64), 0);
        pos += 64;
 
        /* Another read following the previous */
        pos += 64;
 
        /* Another read following the previous */
-       BOOST_CHECK_EQUAL (fg.read (test, 4), 4);
-       BOOST_CHECK_EQUAL (memcmp (data + pos, test, 4), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, 4), 4);
+       BOOST_CHECK_EQUAL (memcmp(data + pos, test, 4), 0);
        pos += 4;
 
        /* Read overlapping A and B */
        pos += 4;
 
        /* Read overlapping A and B */
-       BOOST_CHECK_EQUAL (fg.read (test, 128), 128);
-       BOOST_CHECK_EQUAL (memcmp (data + pos, test, 128), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, 128), 128);
+       BOOST_CHECK_EQUAL (memcmp(data + pos, test, 128), 0);
        pos += 128;
 
        /* Read overlapping B/C/D and over-reading by a lot */
        pos += 128;
 
        /* Read overlapping B/C/D and over-reading by a lot */
-       BOOST_CHECK_EQUAL (fg.read (test, total_length * 3), total_length - pos);
-       BOOST_CHECK_EQUAL (memcmp (data + pos, test, total_length - pos), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, total_length * 3), total_length - pos);
+       BOOST_CHECK_EQUAL (memcmp(data + pos, test, total_length - pos), 0);
 
        /* Over-read by a little */
 
        /* Over-read by a little */
-       BOOST_CHECK_EQUAL (fg.seek (0, SEEK_SET), 0);
-       BOOST_CHECK_EQUAL (fg.read (test, total_length), total_length);
-       BOOST_CHECK_EQUAL (fg.read (test, 1), 0);
+       BOOST_CHECK_EQUAL (fg.seek(0, SEEK_SET), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, total_length), total_length);
+       BOOST_CHECK_EQUAL (fg.read(test, 1), 0);
 
        /* Seeking off the end of the file should not give an error */
 
        /* Seeking off the end of the file should not give an error */
-       BOOST_CHECK_EQUAL (fg.seek (total_length * 2, SEEK_SET), total_length * 2);
+       BOOST_CHECK_EQUAL (fg.seek(total_length * 2, SEEK_SET), total_length * 2);
        /* and attempting to read should return nothing */
        /* and attempting to read should return nothing */
-       BOOST_CHECK_EQUAL (fg.read (test, 64), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, 64), 0);
        /* but the requested seek should be remembered, so if we now go back (relatively) */
        /* but the requested seek should be remembered, so if we now go back (relatively) */
-       BOOST_CHECK_EQUAL (fg.seek (-total_length * 2, SEEK_CUR), 0);
+       BOOST_CHECK_EQUAL (fg.seek(-total_length * 2, SEEK_CUR), 0);
        /* we should be at the start again */
        /* we should be at the start again */
-       BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
-       BOOST_CHECK_EQUAL (memcmp (data, test, 64), 0);
+       BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+       BOOST_CHECK_EQUAL (memcmp(data, test, 64), 0);
 
        /* SEEK_SET */
 
        /* SEEK_SET */
-       BOOST_CHECK_EQUAL (fg.seek (999, SEEK_SET), 999);
-       BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
-       BOOST_CHECK_EQUAL (memcmp (data + 999, test, 64), 0);
+       BOOST_CHECK_EQUAL (fg.seek(999, SEEK_SET), 999);
+       BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+       BOOST_CHECK_EQUAL (memcmp(data + 999, test, 64), 0);
 
        /* SEEK_CUR */
 
        /* SEEK_CUR */
-       BOOST_CHECK_EQUAL (fg.seek (42, SEEK_CUR), 999 + 64 + 42);
-       BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
-       BOOST_CHECK_EQUAL (memcmp (data + 999 + 64 + 42, test, 64), 0);
+       BOOST_CHECK_EQUAL (fg.seek(42, SEEK_CUR), 999 + 64 + 42);
+       BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+       BOOST_CHECK_EQUAL (memcmp(data + 999 + 64 + 42, test, 64), 0);
 
        /* SEEK_END */
 
        /* SEEK_END */
-       BOOST_CHECK_EQUAL (fg.seek (1077, SEEK_END), total_length - 1077);
-       BOOST_CHECK_EQUAL (fg.read (test, 256), 256);
-       BOOST_CHECK_EQUAL (memcmp (data + total_length - 1077, test, 256), 0);
+       BOOST_CHECK_EQUAL (fg.seek(1077, SEEK_END), total_length - 1077);
+       BOOST_CHECK_EQUAL (fg.read(test, 256), 256);
+       BOOST_CHECK_EQUAL (memcmp(data + total_length - 1077, test, 256), 0);
 }
 }
index e0eeba0101ef074e91e3a242a27f614c5f6d1570..dca1d43866c83371e14e77b276e80c5abbd46f89 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/file_log_test.cc
  *  @brief Test FileLog.
  *  @ingroup selfcontained
  */
 
 /** @file  test/file_log_test.cc
  *  @brief Test FileLog.
  *  @ingroup selfcontained
  */
 
+
 #include "lib/file_log.h"
 #include <boost/test/unit_test.hpp>
 #include "lib/file_log.h"
 #include <boost/test/unit_test.hpp>
-#include <iostream>
 
 
-using std::cout;
 
 BOOST_AUTO_TEST_CASE (file_log_test)
 {
        FileLog log ("test/data/short.log");
 
 BOOST_AUTO_TEST_CASE (file_log_test)
 {
        FileLog log ("test/data/short.log");
-       BOOST_CHECK_EQUAL (log.head_and_tail (1024), "This is a short log.\nWith only two lines.\n");
-       BOOST_CHECK_EQUAL (log.head_and_tail (8), "This is \n .\n .\n .\no lines.\n");
+       BOOST_CHECK_EQUAL (log.head_and_tail(1024), "This is a short log.\nWith only two lines.\n");
+       BOOST_CHECK_EQUAL (log.head_and_tail(8), "This is \n .\n .\n .\no lines.\n");
 }
 }
index 7512fdffbc289dbdc82b3508f6497450f291e0f9..eb662a120e14da3c86f26b8330b0f3e57d44af92 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/image_filename_sorter_test.cc
  *  @brief Test ImageFilenameSorter
  *  @ingroup selfcontained
  */
 
 /** @file  test/image_filename_sorter_test.cc
  *  @brief Test ImageFilenameSorter
  *  @ingroup selfcontained
  */
 
+
 #include "lib/image_filename_sorter.h"
 #include "lib/compose.hpp"
 #include <boost/test/unit_test.hpp>
 
 #include "lib/image_filename_sorter.h"
 #include "lib/compose.hpp"
 #include <boost/test/unit_test.hpp>
 
+
 using std::random_shuffle;
 using std::sort;
 using std::vector;
 
 using std::random_shuffle;
 using std::sort;
 using std::vector;
 
+
 BOOST_AUTO_TEST_CASE (image_filename_sorter_test1)
 {
        ImageFilenameSorter x;
 BOOST_AUTO_TEST_CASE (image_filename_sorter_test1)
 {
        ImageFilenameSorter x;
-       BOOST_CHECK (x ("abc0000000001", "abc0000000002"));
-       BOOST_CHECK (x ("1", "2"));
-       BOOST_CHECK (x ("1", "0002"));
-       BOOST_CHECK (x ("0001", "2"));
-       BOOST_CHECK (x ("1", "999"));
-       BOOST_CHECK (x ("00057.tif", "00166.tif"));
-       BOOST_CHECK (x ("/my/numeric999/path/00057.tif", "/my/numeric999/path/00166.tif"));
-       BOOST_CHECK (x ("1_01.tif", "1_02.tif"));
-       BOOST_CHECK (x ("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000001.j2c"));
-       BOOST_CHECK (x ("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx"));
-
-       BOOST_CHECK (!x ("abc0000000002", "abc0000000001"));
-       BOOST_CHECK (!x ("2", "1"));
-       BOOST_CHECK (!x ("0002", "1"));
-       BOOST_CHECK (!x ("2", "0001"));
-       BOOST_CHECK (!x ("999", "1"));
-       BOOST_CHECK (!x ("/my/numeric999/path/00166.tif", "/my/numeric999/path/00057.tif"));
-       BOOST_CHECK (!x ("1_02.tif", "1_01.tif"));
-       BOOST_CHECK (!x ("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000000.j2c"));
-       BOOST_CHECK (!x ("EWS_DCP_092815_000100.j2c", "EWS_DCP_092815_000000.j2c"));
-       BOOST_CHECK (!x ("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx"));
+       BOOST_CHECK (x("abc0000000001", "abc0000000002"));
+       BOOST_CHECK (x("1", "2"));
+       BOOST_CHECK (x("1", "0002"));
+       BOOST_CHECK (x("0001", "2"));
+       BOOST_CHECK (x("1", "999"));
+       BOOST_CHECK (x("00057.tif", "00166.tif"));
+       BOOST_CHECK (x("/my/numeric999/path/00057.tif", "/my/numeric999/path/00166.tif"));
+       BOOST_CHECK (x("1_01.tif", "1_02.tif"));
+       BOOST_CHECK (x("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000001.j2c"));
+       BOOST_CHECK (x("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx"));
+
+       BOOST_CHECK (!x("abc0000000002", "abc0000000001"));
+       BOOST_CHECK (!x("2", "1"));
+       BOOST_CHECK (!x("0002", "1"));
+       BOOST_CHECK (!x("2", "0001"));
+       BOOST_CHECK (!x("999", "1"));
+       BOOST_CHECK (!x("/my/numeric999/path/00166.tif", "/my/numeric999/path/00057.tif"));
+       BOOST_CHECK (!x("1_02.tif", "1_01.tif"));
+       BOOST_CHECK (!x("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000000.j2c"));
+       BOOST_CHECK (!x("EWS_DCP_092815_000100.j2c", "EWS_DCP_092815_000000.j2c"));
+       BOOST_CHECK (!x("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx"));
 }
 
 }
 
+
 /** Test a sort of a lot of paths.  Mostly useful for profiling. */
 BOOST_AUTO_TEST_CASE (image_filename_sorter_test2)
 {
 /** Test a sort of a lot of paths.  Mostly useful for profiling. */
 BOOST_AUTO_TEST_CASE (image_filename_sorter_test2)
 {
index 750b77561ad823fc8986831df8c75f56b6d417f5..a9872b958047c30f162f7f414e8dd836530d655d 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
@@ -25,6 +25,7 @@
 #include <boost/test/unit_test.hpp>
 
 
 #include <boost/test/unit_test.hpp>
 
 
+using std::make_shared;
 using std::shared_ptr;
 
 
 using std::shared_ptr;
 
 
@@ -37,14 +38,14 @@ BOOST_AUTO_TEST_CASE (j2k_image_proxy_same_test)
        /* The files don't matter here, we just need some data to compare */
 
        {
        /* The files don't matter here, we just need some data to compare */
 
        {
-               shared_ptr<J2KImageProxy> proxy1(new J2KImageProxy(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
-               shared_ptr<J2KImageProxy> proxy2(new J2KImageProxy(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
+               auto proxy1 = make_shared<J2KImageProxy>(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
+               auto proxy2 = make_shared<J2KImageProxy>(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
                BOOST_CHECK (proxy1->same(proxy2));
        }
 
        {
                BOOST_CHECK (proxy1->same(proxy2));
        }
 
        {
-               shared_ptr<J2KImageProxy> proxy1(new J2KImageProxy(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
-               shared_ptr<J2KImageProxy> proxy2(new J2KImageProxy(data_file1, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
+               auto proxy1 = make_shared<J2KImageProxy>(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
+               auto proxy2 = make_shared<J2KImageProxy>(data_file1, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
                BOOST_CHECK (!proxy1->same(proxy2));
        }
 }
                BOOST_CHECK (!proxy1->same(proxy2));
        }
 }
@@ -53,14 +54,14 @@ BOOST_AUTO_TEST_CASE (j2k_image_proxy_same_test)
 BOOST_AUTO_TEST_CASE (ffmpeg_image_proxy_same_test)
 {
        {
 BOOST_AUTO_TEST_CASE (ffmpeg_image_proxy_same_test)
 {
        {
-               shared_ptr<FFmpegImageProxy> proxy1(new FFmpegImageProxy(data_file0, VideoRange::FULL));
-               shared_ptr<FFmpegImageProxy> proxy2(new FFmpegImageProxy(data_file0, VideoRange::FULL));
+               auto proxy1 = make_shared<FFmpegImageProxy>(data_file0, VideoRange::FULL);
+               auto proxy2 = make_shared<FFmpegImageProxy>(data_file0, VideoRange::FULL);
                BOOST_CHECK (proxy1->same(proxy2));
        }
 
        {
                BOOST_CHECK (proxy1->same(proxy2));
        }
 
        {
-               shared_ptr<FFmpegImageProxy> proxy1(new FFmpegImageProxy(data_file0, VideoRange::FULL));
-               shared_ptr<FFmpegImageProxy> proxy2(new FFmpegImageProxy(data_file1, VideoRange::FULL));
+               auto proxy1 = make_shared<FFmpegImageProxy>(data_file0, VideoRange::FULL);
+               auto proxy2 = make_shared<FFmpegImageProxy>(data_file1, VideoRange::FULL);
                BOOST_CHECK (!proxy1->same(proxy2));
        }
 }
                BOOST_CHECK (!proxy1->same(proxy2));
        }
 }
index e146d2916f63f8f3931e4a1faeb5e7935e2b7ffd..bc90dab4294b66369f679e231a7b051a7fb2a587 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/interrupt_encoder_test.cc
  *  @brief Test clean shutdown of threads if a DCP encode is interrupted.
  *  @ingroup feature
  */
 
 /** @file  test/interrupt_encoder_test.cc
  *  @brief Test clean shutdown of threads if a DCP encode is interrupted.
  *  @ingroup feature
  */
 
-#include "lib/film.h"
+
+#include "lib/audio_content.h"
+#include "lib/cross.h"
 #include "lib/dcp_content_type.h"
 #include "lib/dcp_content_type.h"
-#include "lib/ratio.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ffmpeg_content.h"
-#include "lib/audio_content.h"
+#include "lib/film.h"
 #include "lib/job_manager.h"
 #include "lib/job_manager.h"
-#include "lib/cross.h"
+#include "lib/ratio.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
+
+using std::make_shared;
 using std::shared_ptr;
 
 using std::shared_ptr;
 
+
 /** Interrupt a DCP encode when it is in progress, as this used to (still does?)
  *  sometimes give an error related to pthreads.
  */
 BOOST_AUTO_TEST_CASE (interrupt_encoder_test)
 {
 /** Interrupt a DCP encode when it is in progress, as this used to (still does?)
  *  sometimes give an error related to pthreads.
  */
 BOOST_AUTO_TEST_CASE (interrupt_encoder_test)
 {
-       shared_ptr<Film> film = new_test_film ("interrupt_encoder_test");
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
-       film->set_container (Ratio::from_id ("185"));
+       auto film = new_test_film ("interrupt_encoder_test");
+       film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR"));
+       film->set_container (Ratio::from_id("185"));
        film->set_name ("interrupt_encoder_test");
 
        film->set_name ("interrupt_encoder_test");
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent(TestPaths::private_data() / "prophet_long_clip.mkv"));
+       auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "prophet_long_clip.mkv");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
index c58de34711c509a5d4ab4b554683f5abaec14dcf..f692c165d6edde466efde8dcf97a58ea036c7e82 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "lib/cinema.h"
 #include "lib/cinema.h"
-#include "lib/screen.h"
 #include "lib/config.h"
 #include "lib/content_factory.h"
 #include "lib/film.h"
 #include "lib/kdm_with_metadata.h"
 #include "lib/config.h"
 #include "lib/content_factory.h"
 #include "lib/film.h"
 #include "lib/kdm_with_metadata.h"
+#include "lib/screen.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
 
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
 
+using std::dynamic_pointer_cast;
 using std::list;
 using std::list;
+using std::make_shared;
+using std::shared_ptr;
 using std::string;
 using std::vector;
 using std::string;
 using std::vector;
-using std::shared_ptr;
 using boost::optional;
 using boost::optional;
-using std::dynamic_pointer_cast;
+
 
 static
 bool
 
 static
 bool
@@ -42,39 +45,41 @@ confirm_overwrite (boost::filesystem::path)
        return true;
 }
 
        return true;
 }
 
+
 static shared_ptr<dcpomatic::Screen> cinema_a_screen_1;
 static shared_ptr<dcpomatic::Screen> cinema_a_screen_2;
 static shared_ptr<dcpomatic::Screen> cinema_b_screen_x;
 static shared_ptr<dcpomatic::Screen> cinema_b_screen_y;
 static shared_ptr<dcpomatic::Screen> cinema_b_screen_z;
 
 static shared_ptr<dcpomatic::Screen> cinema_a_screen_1;
 static shared_ptr<dcpomatic::Screen> cinema_a_screen_2;
 static shared_ptr<dcpomatic::Screen> cinema_b_screen_x;
 static shared_ptr<dcpomatic::Screen> cinema_b_screen_y;
 static shared_ptr<dcpomatic::Screen> cinema_b_screen_z;
 
+
 BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
 {
 BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
 {
-       Config* c = Config::instance();
+       auto c = Config::instance();
 
 
-       dcp::Certificate cert = c->decryption_chain()->leaf();
+       auto cert = c->decryption_chain()->leaf();
 
        /* Cinema A: UTC +4:30 */
 
        /* Cinema A: UTC +4:30 */
-       shared_ptr<Cinema> cinema_a (new Cinema("Cinema A", list<string>(), "", 4, 30));
-       cinema_a_screen_1.reset(new dcpomatic::Screen("Screen 1", "", cert, vector<TrustedDevice>()));
+       auto cinema_a = make_shared<Cinema>("Cinema A", list<string>(), "", 4, 30);
+       cinema_a_screen_1 = make_shared<dcpomatic::Screen>("Screen 1", "", cert, vector<TrustedDevice>());
        cinema_a->add_screen (cinema_a_screen_1);
        cinema_a->add_screen (cinema_a_screen_1);
-       cinema_a_screen_2.reset(new dcpomatic::Screen("Screen 2", "", cert, vector<TrustedDevice>()));
+       cinema_a_screen_2 = make_shared<dcpomatic::Screen>("Screen 2", "", cert, vector<TrustedDevice>());
        cinema_a->add_screen (cinema_a_screen_2);
        c->add_cinema (cinema_a);
 
        /* Cinema B: UTC -1:00 */
        cinema_a->add_screen (cinema_a_screen_2);
        c->add_cinema (cinema_a);
 
        /* Cinema B: UTC -1:00 */
-       shared_ptr<Cinema> cinema_b (new Cinema("Cinema B", list<string>(), "", -1, 0));
-       cinema_b_screen_x.reset(new dcpomatic::Screen("Screen X", "", cert, vector<TrustedDevice>()));
+       auto cinema_b = make_shared<Cinema>("Cinema B", list<string>(), "", -1, 0);
+       cinema_b_screen_x = make_shared<dcpomatic::Screen>("Screen X", "", cert, vector<TrustedDevice>());
        cinema_b->add_screen (cinema_b_screen_x);
        cinema_b->add_screen (cinema_b_screen_x);
-       cinema_b_screen_y.reset(new dcpomatic::Screen("Screen Y", "", cert, vector<TrustedDevice>()));
+       cinema_b_screen_y = make_shared<dcpomatic::Screen>("Screen Y", "", cert, vector<TrustedDevice>());
        cinema_b->add_screen (cinema_b_screen_y);
        cinema_b->add_screen (cinema_b_screen_y);
-       cinema_b_screen_z.reset(new dcpomatic::Screen("Screen Z", "", cert, vector<TrustedDevice>()));
+       cinema_b_screen_z = make_shared<dcpomatic::Screen>("Screen Z", "", cert, vector<TrustedDevice>());
        cinema_b->add_screen (cinema_b_screen_z);
        c->add_cinema (cinema_a);
 
        /* Film */
        boost::filesystem::remove_all ("build/test/single_kdm_naming_test");
        cinema_b->add_screen (cinema_b_screen_z);
        c->add_cinema (cinema_a);
 
        /* Film */
        boost::filesystem::remove_all ("build/test/single_kdm_naming_test");
-       shared_ptr<Film> film = new_test_film2 ("single_kdm_naming_test");
+       auto film = new_test_film2 ("single_kdm_naming_test");
        film->set_name ("my_great_film");
        film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
        BOOST_REQUIRE (!wait_for_jobs());
        film->set_name ("my_great_film");
        film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
        BOOST_REQUIRE (!wait_for_jobs());
@@ -88,8 +93,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
        dcp::LocalTime until (cert.not_after());
        until.add_months (-2);
 
        dcp::LocalTime until (cert.not_after());
        until.add_months (-2);
 
-       string const from_string = from.date() + " " + from.time_of_day(true, false);
-       string const until_string = until.date() + " " + until.time_of_day(true, false);
+       auto const from_string = from.date() + " " + from.time_of_day(true, false);
+       auto const until_string = until.date() + " " + until.time_of_day(true, false);
 
        auto cpl = cpls.front().cpl_file;
        auto kdm = kdm_for_screen (
 
        auto cpl = cpls.front().cpl_file;
        auto kdm = kdm_for_screen (
@@ -110,12 +115,12 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
                &confirm_overwrite
                );
 
                &confirm_overwrite
                );
 
-       string from_time = from.time_of_day (true, false);
+       auto from_time = from.time_of_day (true, false);
        boost::algorithm::replace_all (from_time, ":", "-");
        boost::algorithm::replace_all (from_time, ":", "-");
-       string until_time = until.time_of_day (true, false);
+       auto until_time = until.time_of_day (true, false);
        boost::algorithm::replace_all (until_time, ":", "-");
 
        boost::algorithm::replace_all (until_time, ":", "-");
 
-       string const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time);
+       auto const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time);
        BOOST_CHECK_MESSAGE (boost::filesystem::exists("build/test/single_kdm_naming_test/" + ref), "File " << ref << " not found");
 }
 
        BOOST_CHECK_MESSAGE (boost::filesystem::exists("build/test/single_kdm_naming_test/" + ref), "File " << ref << " not found");
 }
 
@@ -124,7 +129,7 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
 {
        using boost::filesystem::path;
 
 {
        using boost::filesystem::path;
 
-       dcp::Certificate cert = Config::instance()->decryption_chain()->leaf();
+       auto cert = Config::instance()->decryption_chain()->leaf();
 
        /* Film */
        boost::filesystem::remove_all ("build/test/directory_kdm_naming_test");
 
        /* Film */
        boost::filesystem::remove_all ("build/test/directory_kdm_naming_test");
index 3c21675c77ae0cf89e022a521ac05c0ed519904b..2cc914f84f1c4d619819c9480ecc7d9f3bf4d20a 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index 6fa571500c2c5d5d9d1b067d324e9b6a4e3ecacd..18a3275630342deb0479cb8575aaf87790f0cabf 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/reel_writer_test.cc
  *  @brief Test ReelWriter class.
  *  @ingroup selfcontained
  */
 
 /** @file  test/reel_writer_test.cc
  *  @brief Test ReelWriter class.
  *  @ingroup selfcontained
  */
 
-#include "lib/reel_writer.h"
-#include "lib/film.h"
-#include "lib/cross.h"
-#include "lib/content_factory.h"
-#include "lib/content.h"
+
 #include "lib/audio_content.h"
 #include "lib/audio_content.h"
+#include "lib/content.h"
+#include "lib/content_factory.h"
+#include "lib/cross.h"
+#include "lib/film.h"
+#include "lib/reel_writer.h"
 #include "lib/video_content.h"
 #include "test.h"
 #include <dcp/dcp.h>
 #include "lib/video_content.h"
 #include "test.h"
 #include <dcp/dcp.h>
 #include <dcp/reel_sound_asset.h>
 #include <boost/test/unit_test.hpp>
 
 #include <dcp/reel_sound_asset.h>
 #include <boost/test/unit_test.hpp>
 
-using std::string;
+
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
 
 using boost::optional;
 
+
 static bool equal (dcp::FrameInfo a, ReelWriter const & writer, shared_ptr<InfoFileHandle> file, Frame frame, Eyes eyes)
 {
 static bool equal (dcp::FrameInfo a, ReelWriter const & writer, shared_ptr<InfoFileHandle> file, Frame frame, Eyes eyes)
 {
-       dcp::FrameInfo b = writer.read_frame_info(file, frame, eyes);
+       auto b = writer.read_frame_info(file, frame, eyes);
        return a.offset == b.offset && a.size == b.size && a.hash == b.hash;
 }
 
        return a.offset == b.offset && a.size == b.size && a.hash == b.hash;
 }
 
+
 BOOST_AUTO_TEST_CASE (write_frame_info_test)
 {
        auto film = new_test_film2 ("write_frame_info_test");
 BOOST_AUTO_TEST_CASE (write_frame_info_test)
 {
        auto film = new_test_film2 ("write_frame_info_test");
@@ -97,30 +102,27 @@ BOOST_AUTO_TEST_CASE (write_frame_info_test)
        }
 }
 
        }
 }
 
+
 /** Check that the reel writer correctly re-uses a video asset changed if we remake
  *  a DCP with no video changes.
  */
 BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
 {
        /* Make a DCP */
 /** Check that the reel writer correctly re-uses a video asset changed if we remake
  *  a DCP with no video changes.
  */
 BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
 {
        /* Make a DCP */
-       auto film = new_test_film2 ("reel_reuse_video_test");
        auto video = content_factory("test/data/flat_red.png").front();
        auto video = content_factory("test/data/flat_red.png").front();
-       film->examine_and_add_content (video);
-       BOOST_REQUIRE (!wait_for_jobs());
        auto audio = content_factory("test/data/white.wav").front();
        auto audio = content_factory("test/data/white.wav").front();
-       film->examine_and_add_content (audio);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 ("reel_reuse_video_test", { video, audio });
        make_and_verify_dcp (film);
 
        /* Find main picture and sound asset IDs */
        dcp::DCP dcp1 (film->dir(film->dcp_name()));
        dcp1.read ();
        BOOST_REQUIRE_EQUAL (dcp1.cpls().size(), 1U);
        make_and_verify_dcp (film);
 
        /* Find main picture and sound asset IDs */
        dcp::DCP dcp1 (film->dir(film->dcp_name()));
        dcp1.read ();
        BOOST_REQUIRE_EQUAL (dcp1.cpls().size(), 1U);
-       BOOST_REQUIRE_EQUAL (dcp1.cpls().front()->reels().size(), 1U);
-       BOOST_REQUIRE (dcp1.cpls().front()->reels().front()->main_picture());
-       BOOST_REQUIRE (dcp1.cpls().front()->reels().front()->main_sound());
-       string const picture_id = dcp1.cpls().front()->reels().front()->main_picture()->asset()->id();
-       string const sound_id = dcp1.cpls().front()->reels().front()->main_sound()->asset()->id();
+       BOOST_REQUIRE_EQUAL (dcp1.cpls()[0]->reels().size(), 1U);
+       BOOST_REQUIRE (dcp1.cpls()[0]->reels()[0]->main_picture());
+       BOOST_REQUIRE (dcp1.cpls()[0]->reels()[0]->main_sound());
+       auto const picture_id = dcp1.cpls()[0]->reels()[0]->main_picture()->asset()->id();
+       auto const sound_id = dcp1.cpls()[0]->reels()[0]->main_sound()->asset()->id();
 
        /* Change the audio and re-make */
        audio->audio->set_gain (-3);
 
        /* Change the audio and re-make */
        audio->audio->set_gain (-3);
@@ -130,11 +132,11 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
        dcp::DCP dcp2 (film->dir(film->dcp_name()));
        dcp2.read ();
        BOOST_REQUIRE_EQUAL (dcp2.cpls().size(), 1U);
        dcp::DCP dcp2 (film->dir(film->dcp_name()));
        dcp2.read ();
        BOOST_REQUIRE_EQUAL (dcp2.cpls().size(), 1U);
-       BOOST_REQUIRE_EQUAL (dcp2.cpls().front()->reels().size(), 1U);
-       BOOST_REQUIRE (dcp2.cpls().front()->reels().front()->main_picture());
-       BOOST_REQUIRE (dcp2.cpls().front()->reels().front()->main_sound());
-       BOOST_CHECK_EQUAL (picture_id, dcp2.cpls().front()->reels().front()->main_picture()->asset()->id());
-       BOOST_CHECK (sound_id != dcp2.cpls().front()->reels().front()->main_sound()->asset()->id());
+       BOOST_REQUIRE_EQUAL (dcp2.cpls()[0]->reels().size(), 1U);
+       BOOST_REQUIRE (dcp2.cpls()[0]->reels()[0]->main_picture());
+       BOOST_REQUIRE (dcp2.cpls()[0]->reels()[0]->main_sound());
+       BOOST_CHECK_EQUAL (picture_id, dcp2.cpls()[0]->reels()[0]->main_picture()->asset()->id());
+       BOOST_CHECK (sound_id != dcp2.cpls()[0]->reels().front()->main_sound()->asset()->id());
 
        /* Crop video and re-make */
        video->video->set_left_crop (5);
 
        /* Crop video and re-make */
        video->video->set_left_crop (5);
@@ -144,9 +146,9 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
        dcp::DCP dcp3 (film->dir(film->dcp_name()));
        dcp3.read ();
        BOOST_REQUIRE_EQUAL (dcp3.cpls().size(), 1U);
        dcp::DCP dcp3 (film->dir(film->dcp_name()));
        dcp3.read ();
        BOOST_REQUIRE_EQUAL (dcp3.cpls().size(), 1U);
-       BOOST_REQUIRE_EQUAL (dcp3.cpls().front()->reels().size(), 1U);
-       BOOST_REQUIRE (dcp3.cpls().front()->reels().front()->main_picture());
-       BOOST_REQUIRE (dcp3.cpls().front()->reels().front()->main_sound());
-       BOOST_CHECK (picture_id != dcp3.cpls().front()->reels().front()->main_picture()->asset()->id());
-       BOOST_CHECK (sound_id != dcp3.cpls().front()->reels().front()->main_sound()->asset()->id());
+       BOOST_REQUIRE_EQUAL (dcp3.cpls()[0]->reels().size(), 1U);
+       BOOST_REQUIRE (dcp3.cpls()[0]->reels()[0]->main_picture());
+       BOOST_REQUIRE (dcp3.cpls()[0]->reels()[0]->main_sound());
+       BOOST_CHECK (picture_id != dcp3.cpls()[0]->reels()[0]->main_picture()->asset()->id());
+       BOOST_CHECK (sound_id != dcp3.cpls()[0]->reels().front()->main_sound()->asset()->id());
 }
 }
index 2978d27f96ea8c259ef0c2d2bab81ee13555dd50..8009cc9f9418609f5079171e227e3c04ced8228b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/resampler_test.cc
  *  @brief Check that the timings that come back from Resampler correspond
  *  to the number of samples it generates.
  *  @ingroup selfcontained
  */
 
 /** @file  test/resampler_test.cc
  *  @brief Check that the timings that come back from Resampler correspond
  *  to the number of samples it generates.
  *  @ingroup selfcontained
  */
 
-#include <boost/test/unit_test.hpp>
+
 #include "lib/audio_buffers.h"
 #include "lib/resampler.h"
 #include "lib/audio_buffers.h"
 #include "lib/resampler.h"
+#include <boost/test/unit_test.hpp>
 #include <iostream>
 
 #include <iostream>
 
-using std::pair;
+
 using std::cout;
 using std::cout;
+using std::make_shared;
+using std::pair;
 using std::shared_ptr;
 
 using std::shared_ptr;
 
+
 static void
 resampler_test_one (int from, int to)
 {
 static void
 resampler_test_one (int from, int to)
 {
@@ -43,12 +48,13 @@ resampler_test_one (int from, int to)
 
        /* XXX: no longer checks anything */
        for (int64_t i = 0; i < N; i += 1000) {
 
        /* XXX: no longer checks anything */
        for (int64_t i = 0; i < N; i += 1000) {
-               shared_ptr<AudioBuffers> a (new AudioBuffers (1, 1000));
+               auto a = make_shared<AudioBuffers> (1, 1000);
                a->make_silent ();
                a->make_silent ();
-               pair<shared_ptr<const AudioBuffers>, Frame> r = resamp.run (a, 0);
+               auto r = resamp.run (a, 0);
        }
 }
 
        }
 }
 
+
 BOOST_AUTO_TEST_CASE (resampler_test)
 {
        resampler_test_one (44100, 48000);
 BOOST_AUTO_TEST_CASE (resampler_test)
 {
        resampler_test_one (44100, 48000);
index b9aaba9d25d388fed38a80bbf066a9442f92f5ca..64c15480841513ed6a90f7ed5410250e89926cb9 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "lib/server.h"
+
 #include "lib/dcpomatic_socket.h"
 #include "lib/dcpomatic_socket.h"
+#include "lib/server.h"
 #include <dcp/raw_convert.h>
 #include <dcp/raw_convert.h>
-#include <boost/thread.hpp>
 #include <boost/test/unit_test.hpp>
 #include <boost/test/unit_test.hpp>
+#include <boost/thread.hpp>
 #include <cstring>
 #include <iostream>
 
 
 #include <cstring>
 #include <iostream>
 
 
-using std::string;
+using std::make_shared;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
 using boost::bind;
 
 
 using boost::bind;
 
 
@@ -115,6 +117,7 @@ send (shared_ptr<Socket> socket, char const* message)
        socket->write (reinterpret_cast<uint8_t const *>(message), strlen(message) + 1);
 }
 
        socket->write (reinterpret_cast<uint8_t const *>(message), strlen(message) + 1);
 }
 
+
 /** Basic test to see if Socket can send and receive data */
 BOOST_AUTO_TEST_CASE (socket_basic_test)
 {
 /** Basic test to see if Socket can send and receive data */
 BOOST_AUTO_TEST_CASE (socket_basic_test)
 {
@@ -128,7 +131,7 @@ BOOST_AUTO_TEST_CASE (socket_basic_test)
        tcp::resolver::query query ("127.0.0.1", dcp::raw_convert<string>(TEST_SERVER_PORT));
        tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
 
        tcp::resolver::query query ("127.0.0.1", dcp::raw_convert<string>(TEST_SERVER_PORT));
        tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
 
-       shared_ptr<Socket> socket (new Socket);
+       auto socket = make_shared<Socket>();
        socket->connect (*endpoint_iterator);
        send (socket, "Hello world!");
 
        socket->connect (*endpoint_iterator);
        send (socket, "Hello world!");
 
index ada358a6360be84c909dd64825f6815de8b8ea90..8233bf023c9b7b1df9d74c4aa232b8ce09860bc7 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
-#include "test.h"
+
 #include "lib/content.h"
 #include "lib/content.h"
-#include "lib/film.h"
 #include "lib/content_factory.h"
 #include "lib/content_factory.h"
+#include "lib/film.h"
 #include "lib/string_text_file.h"
 #include "lib/string_text_file_content.h"
 #include "lib/string_text_file.h"
 #include "lib/string_text_file_content.h"
+#include "test.h"
 #include <boost/test/unit_test.hpp>
 
 #include <boost/test/unit_test.hpp>
 
+
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
 
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
 
+
 /** Test parsing of UTF16 CR/LF input */
 BOOST_AUTO_TEST_CASE (subtitle_charset_test1)
 {
 /** Test parsing of UTF16 CR/LF input */
 BOOST_AUTO_TEST_CASE (subtitle_charset_test1)
 {
-       shared_ptr<Film> film = new_test_film2 ("subtitle_charset_test1");
-       shared_ptr<Content> content = content_factory (TestPaths::private_data() / "PADDINGTON soustitresVFdef.srt").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto content = content_factory (TestPaths::private_data() / "PADDINGTON soustitresVFdef.srt").front();
+       auto film = new_test_film2 ("subtitle_charset_test1", { content });
 }
 
 }
 
+
 /** Test parsing of OSX input */
 BOOST_AUTO_TEST_CASE (subtitle_charset_test2)
 {
 /** Test parsing of OSX input */
 BOOST_AUTO_TEST_CASE (subtitle_charset_test2)
 {
-       shared_ptr<Film> film = new_test_film2 ("subtitle_charset_test2");
-       shared_ptr<Content> content = content_factory ("test/data/osx.srt").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs ());
-       shared_ptr<StringTextFileContent> ts = dynamic_pointer_cast<StringTextFileContent> (content);
+       auto content = content_factory ("test/data/osx.srt").front();
+       auto film = new_test_film2 ("subtitle_charset_test2", { content });
+       auto ts = dynamic_pointer_cast<StringTextFileContent> (content);
        BOOST_REQUIRE (ts);
        /* Make sure we got the subtitle data from the file */
        BOOST_REQUIRE_EQUAL (content->full_length(film).get(), 6052032);
        BOOST_REQUIRE (ts);
        /* Make sure we got the subtitle data from the file */
        BOOST_REQUIRE_EQUAL (content->full_length(film).get(), 6052032);
index af5dee001f7c173b369c302e9d0096e8bafc327a..e198b78f93c9cd350cb8923dc4c8f9c8f1f8e888 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
index 35224ff234a6c2f0bceceeed708834d5bdaac4c6..0dc4962751eadb736c3a22cedfb5448125235708 100644 (file)
@@ -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.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  test/upmixer_a_test.cc
  *  @brief Check the Upmixer A against some reference sound files.
  *  @ingroup selfcontained
  */
 
 /** @file  test/upmixer_a_test.cc
  *  @brief Check the Upmixer A against some reference sound files.
  *  @ingroup selfcontained
  */
 
-#include <boost/test/unit_test.hpp>
-#include <sndfile.h>
-#include "lib/film.h"
-#include "lib/ratio.h"
+
+#include "lib/audio_buffers.h"
 #include "lib/dcp_content_type.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/ffmpeg_content.h"
+#include "lib/film.h"
 #include "lib/player.h"
 #include "lib/player.h"
-#include "lib/audio_buffers.h"
+#include "lib/ratio.h"
 #include "lib/upmixer_a.h"
 #include "test.h"
 #include "lib/upmixer_a.h"
 #include "test.h"
+#include <sndfile.h>
+#include <boost/test/unit_test.hpp>
 
 
+
+using std::make_shared;
 using std::shared_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using namespace dcpomatic;
 
 using std::shared_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using namespace dcpomatic;
 
+
 static SNDFILE* L;
 static SNDFILE* R;
 static SNDFILE* C;
 static SNDFILE* L;
 static SNDFILE* R;
 static SNDFILE* C;
@@ -47,6 +52,7 @@ static SNDFILE* Lfe;
 static SNDFILE* Ls;
 static SNDFILE* Rs;
 
 static SNDFILE* Ls;
 static SNDFILE* Rs;
 
+
 static void
 write (shared_ptr<AudioBuffers> b, DCPTime)
 {
 static void
 write (shared_ptr<AudioBuffers> b, DCPTime)
 {
@@ -59,14 +65,15 @@ write (shared_ptr<AudioBuffers> b, DCPTime)
 
 }
 
 
 }
 
+
 BOOST_AUTO_TEST_CASE (upmixer_a_test)
 {
 BOOST_AUTO_TEST_CASE (upmixer_a_test)
 {
-       shared_ptr<Film> film = new_test_film ("upmixer_a_test");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
+       auto film = new_test_film ("upmixer_a_test");
+       film->set_container (Ratio::from_id("185"));
+       film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR"));
        film->set_name ("frobozz");
        film->set_name ("frobozz");
-       film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
-       shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/white.wav"));
+       film->set_audio_processor (AudioProcessor::from_id("stereo-5.1-upmix-a"));
+       auto content = make_shared<FFmpegContent>("test/data/white.wav");
        film->examine_and_add_content (content);
 
        BOOST_REQUIRE (!wait_for_jobs());
        film->examine_and_add_content (content);
 
        BOOST_REQUIRE (!wait_for_jobs());
@@ -82,7 +89,7 @@ BOOST_AUTO_TEST_CASE (upmixer_a_test)
        Ls = sf_open ("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info);
        Rs = sf_open ("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info);
 
        Ls = sf_open ("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info);
        Rs = sf_open ("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info);
 
-       shared_ptr<Player> player (new Player(film));
+       auto player = make_shared<Player>(film);
        player->Audio.connect (bind (&write, _1, _2));
        while (!player->pass()) {}
 
        player->Audio.connect (bind (&write, _1, _2));
        while (!player->pass()) {}