C++11 tidying.
authorCarl Hetherington <cth@carlh.net>
Fri, 30 Apr 2021 23:31:35 +0000 (01:31 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 30 Apr 2021 23:31:35 +0000 (01:31 +0200)
93 files changed:
src/lib/analytics.cc
src/lib/analytics.h
src/lib/audio_delay.cc
src/lib/audio_delay.h
src/lib/audio_point.cc
src/lib/audio_point.h
src/lib/audio_processor.cc
src/lib/audio_processor.h
src/lib/butler.cc
src/lib/butler.h
src/lib/cross.h
src/lib/cross_linux.cc
src/lib/cross_osx.cc
src/lib/curl_uploader.cc
src/lib/curl_uploader.h
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/lib/dcp_subtitle.cc
src/lib/dcp_subtitle.h
src/lib/dcpomatic_log.cc
src/lib/dcpomatic_log.h
src/lib/decoder_part.cc
src/lib/decoder_part.h
src/lib/ffmpeg_audio_stream.cc
src/lib/ffmpeg_audio_stream.h
src/lib/file_group.cc
src/lib/file_group.h
src/lib/frame_interval_checker.cc
src/lib/internet.cc
src/lib/internet.h
src/lib/j2k_image_proxy.cc
src/lib/j2k_image_proxy.h
src/lib/job.cc
src/lib/job.h
src/lib/job_manager.cc
src/lib/job_manager.h
src/lib/kdm_with_metadata.cc
src/lib/kdm_with_metadata.h
src/lib/overlaps.cc
src/lib/overlaps.h
src/lib/player_video.cc
src/lib/player_video.h
src/lib/position_image.cc
src/lib/position_image.h
src/lib/reel_writer.cc
src/lib/reel_writer.h
src/lib/rgba.cc
src/lib/rgba.h
src/lib/shuffler.cc
src/lib/shuffler.h
src/lib/text_decoder.cc
src/lib/text_decoder.h
src/lib/text_ring_buffers.cc
src/lib/text_ring_buffers.h
src/lib/uploader.cc
src/lib/uploader.h
src/lib/upmixer_b.cc
src/lib/upmixer_b.h
src/lib/util.cc
src/lib/util.h
src/lib/writer.cc
src/lib/writer.h
src/tools/dcpomatic.cc
src/wx/config_dialog.cc
src/wx/config_dialog.h
src/wx/content_widget.h
src/wx/credentials_download_certificate_panel.cc
src/wx/credentials_download_certificate_panel.h
src/wx/dkdm_output_panel.cc
src/wx/dkdm_output_panel.h
src/wx/dolby_doremi_certificate_panel.cc
src/wx/download_certificate_panel.cc
src/wx/editable_list.h
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/full_config_dialog.cc
src/wx/full_config_dialog.h
src/wx/job_view_dialog.cc
src/wx/job_view_dialog.h
src/wx/kdm_output_panel.cc
src/wx/kdm_output_panel.h
src/wx/nag_dialog.cc
src/wx/nag_dialog.h
src/wx/player_config_dialog.cc
src/wx/suspender.cc
src/wx/suspender.h
src/wx/wx_util.h
test/audio_merger_test.cc
test/data
test/ffmpeg_examiner_test.cc
test/reels_test.cc
test/required_disk_space_test.cc
test/util_test.cc

index f20b213e4ab13f511d73f351df99ef7b4533bc92..ac0abc22273c182be40e3294934f2d4a701214d8 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.
 
 
 */
 
+
 #include "analytics.h"
-#include "exceptions.h"
 #include "compose.hpp"
+#include "exceptions.h"
 #include "warnings.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
 DCPOMATIC_ENABLE_WARNINGS
-#include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/filesystem.hpp>
 
 #include "i18n.h"
 
+
 using std::string;
 using dcp::raw_convert;
 using boost::algorithm::trim;
 
+
 Analytics* Analytics::_instance;
 int const Analytics::_current_version = 1;
 
+
 Analytics::Analytics ()
-       : _successful_dcp_encodes (0)
 {
 
 }
 
+
 void
 Analytics::successful_dcp_encode ()
 {
@@ -81,11 +85,12 @@ Analytics::successful_dcp_encode ()
        }
 }
 
+
 void
 Analytics::write () const
 {
        xmlpp::Document doc;
-       xmlpp::Element* root = doc.create_root_node ("Analytics");
+       auto root = doc.create_root_node ("Analytics");
 
        root->add_child("Version")->add_child_text(raw_convert<string>(_current_version));
        root->add_child("SuccessfulDCPEncodes")->add_child_text(raw_convert<string>(_successful_dcp_encodes));
@@ -99,6 +104,7 @@ Analytics::write () const
        }
 }
 
+
 void
 Analytics::read ()
 try
@@ -110,6 +116,7 @@ try
        /* Never mind */
 }
 
+
 Analytics*
 Analytics::instance ()
 {
index be41e3a1b3f7d6416c6c297216e98ba6b21a51be..c0a3e17eff1776c1fb633c085a4c4038ceb26279 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.
 
 
 */
 
-#include "state.h"
+
 #include "signaller.h"
+#include "state.h"
 #include <boost/signals2.hpp>
 
+
 class Analytics : public State, public Signaller
 {
 public:
@@ -37,7 +39,7 @@ public:
        static Analytics* instance ();
 
 private:
-       int _successful_dcp_encodes;
+       int _successful_dcp_encodes = 0;
 
        static Analytics* _instance;
        static int const _current_version;
index 167c522e8f7ebfa01f0ba3b86f2f15855e937962..90214470cd279185cd2e4a3ef4f7ef825c978a16 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.
 
 
 */
 
+
 #include "audio_delay.h"
 #include "audio_buffers.h"
 #include "dcpomatic_assert.h"
 #include <iostream>
 
+
 using std::cout;
+using std::make_shared;
 using std::shared_ptr;
 
+
 AudioDelay::AudioDelay (int samples)
        : _samples (samples)
 {
 
 }
 
+
 shared_ptr<AudioBuffers>
 AudioDelay::run (shared_ptr<const AudioBuffers> in)
 {
@@ -55,7 +60,7 @@ AudioDelay::run (shared_ptr<const AudioBuffers> in)
 
                /* Keep tail */
                if (!_tail) {
-                       _tail.reset (new AudioBuffers (in->channels(), _samples));
+                       _tail = make_shared<AudioBuffers>(in->channels(), _samples);
                }
                _tail->copy_from (in.get(), _samples, in->frames() - _samples, 0);
 
@@ -66,7 +71,7 @@ AudioDelay::run (shared_ptr<const AudioBuffers> in)
                        out->copy_from (_tail.get(), out->frames(), 0, 0);
                } else {
                        out->make_silent ();
-                       _tail.reset (new AudioBuffers (out->channels(), _samples));
+                       _tail = make_shared<AudioBuffers>(out->channels(), _samples);
                        _tail->make_silent ();
                }
 
@@ -80,6 +85,7 @@ AudioDelay::run (shared_ptr<const AudioBuffers> in)
        return out;
 }
 
+
 void
 AudioDelay::flush ()
 {
index 3731013e5e7df01472a9e53c0efd36b92aa894c1..5f3f89a6596d9037e86a1c217ce1f8008c60e20a 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.
 
@@ -24,8 +24,9 @@
 
 class AudioBuffers;
 
+
 /** @class AudioDelay
- *  @brief An audio delay line.
+ *  @brief An audio delay line
  */
 class AudioDelay
 {
index 722673b961337a5057a42beb8bc5164fd0f5058d..abf8485e34f3dc997753a067ae1fe741872b83ba 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "audio_point.h"
 #include "warnings.h"
 #include <dcp/raw_convert.h>
@@ -25,9 +26,11 @@ DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
 DCPOMATIC_ENABLE_WARNINGS
 
+
 using std::string;
 using dcp::raw_convert;
 
+
 AudioPoint::AudioPoint ()
 {
        for (int i = 0; i < COUNT; ++i) {
@@ -35,12 +38,14 @@ AudioPoint::AudioPoint ()
        }
 }
 
+
 AudioPoint::AudioPoint (cxml::ConstNodePtr node)
 {
-       _data[PEAK] = node->number_child<float> ("Peak");
-       _data[RMS] = node->number_child<float> ("RMS");
+       _data[PEAK] = node->number_child<float>("Peak");
+       _data[RMS] = node->number_child<float>("RMS");
 }
 
+
 AudioPoint::AudioPoint (AudioPoint const & other)
 {
        for (int i = 0; i < COUNT; ++i) {
@@ -48,6 +53,7 @@ AudioPoint::AudioPoint (AudioPoint const & other)
        }
 }
 
+
 AudioPoint &
 AudioPoint::operator= (AudioPoint const & other)
 {
@@ -62,9 +68,10 @@ AudioPoint::operator= (AudioPoint const & other)
        return *this;
 }
 
+
 void
 AudioPoint::as_xml (xmlpp::Element* parent) const
 {
-       parent->add_child ("Peak")->add_child_text (raw_convert<string> (_data[PEAK]));
-       parent->add_child ("RMS")->add_child_text (raw_convert<string> (_data[RMS]));
+       parent->add_child("Peak")->add_child_text(raw_convert<string>(_data[PEAK]));
+       parent->add_child("RMS")->add_child_text(raw_convert<string>(_data[RMS]));
 }
index 91f0cb0e9caebd7188189ced776b6f35f63438e5..e7c232728a778604bbbe95a8332a4eea20933ad6 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_AUDIO_POINT_H
 #define DCPOMATIC_AUDIO_POINT_H
 
+
 #include <libcxml/cxml.h>
 
+
 namespace xmlpp {
        class Element;
 }
 
+
 class AudioPoint
 {
 public:
@@ -51,4 +55,5 @@ private:
        float _data[COUNT];
 };
 
+
 #endif
index 6cccbdc80f5842fef0f1cfb4597ac78d00ba0aa0..1eb796b38ef7ce68e5e0169422a65e6ae81dc848 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.
 
 
 */
 
+
 #include "audio_processor.h"
+#include "config.h"
 #include "mid_side_decoder.h"
 #include "upmixer_a.h"
 #include "upmixer_b.h"
-#include "config.h"
+
 
 using std::string;
 using std::list;
 
+
 list<AudioProcessor const *> AudioProcessor::_all;
 list<AudioProcessor const *> AudioProcessor::_non_experimental;
 
+
 void
 AudioProcessor::setup_audio_processors ()
 {
-       AudioProcessor* mid_side = new MidSideDecoder ();
+       auto mid_side = new MidSideDecoder ();
        _all.push_back (mid_side);
        _non_experimental.push_back (mid_side);
 
-       _all.push_back (new UpmixerA (48000));
-       _all.push_back (new UpmixerB (48000));
+       _all.push_back (new UpmixerA(48000));
+       _all.push_back (new UpmixerB(48000));
 }
 
+
 AudioProcessor const *
 AudioProcessor::from_id (string id)
 {
-       for (list<AudioProcessor const *>::const_iterator i = _all.begin(); i != _all.end(); ++i) {
-               if ((*i)->id() == id) {
-                       return *i;
+       for (auto i: _all) {
+               if (i->id() == id) {
+                       return i;
                }
        }
 
-       return 0;
+       return nullptr;
 }
 
+
 list<AudioProcessor const *>
 AudioProcessor::visible ()
 {
@@ -63,6 +69,7 @@ AudioProcessor::visible ()
        return _non_experimental;
 }
 
+
 list<AudioProcessor const *>
 AudioProcessor::all ()
 {
index e2f1c48ebf6eefb5aa456de185f014ee7787e8d3..ca80c92b2436b8a10009236289713614cea5b554 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.
 
 
 */
 
+
 /** @file  src/lib/audio_processor.h
  *  @brief AudioProcessor class.
  */
 
+
 #ifndef DCPOMATIC_AUDIO_PROCESSOR_H
 #define DCPOMATIC_AUDIO_PROCESSOR_H
 
+
 #include "types.h"
 #include <list>
 #include <string>
 #include <vector>
 
+
 class AudioBuffers;
 class AudioMapping;
 
+
 /** @class AudioProcessor
  *  @brief A parent class for processors of audio data.
  *
@@ -70,4 +75,5 @@ private:
        static std::list<AudioProcessor const *> _non_experimental;
 };
 
+
 #endif
index 6de5d57904efb7ecb32dfb167aff7f9112db953d..b2128efdb28f0b9cb7660d7ff42d94c94c6648ee 100644 (file)
@@ -37,7 +37,7 @@ using std::weak_ptr;
 using std::shared_ptr;
 using boost::bind;
 using boost::optional;
-using boost::function;
+using std::function;
 using namespace dcpomatic;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
index ac83cecec7ebedff3afacaee84b9a9834c1e5455..29966b956b2b491d7c7d82c85f2adc5128842927 100644 (file)
@@ -40,7 +40,7 @@ public:
                std::shared_ptr<Player> player,
                AudioMapping map,
                int audio_channels,
-               boost::function<AVPixelFormat (AVPixelFormat)> pixel_format,
+               std::function<AVPixelFormat (AVPixelFormat)> pixel_format,
                VideoRange video_range,
                bool aligned,
                bool fast
@@ -119,7 +119,7 @@ private:
 
        bool _disable_audio;
 
-       boost::function<AVPixelFormat (AVPixelFormat)> _pixel_format;
+       std::function<AVPixelFormat (AVPixelFormat)> _pixel_format;
        VideoRange _video_range;
        bool _aligned;
        bool _fast;
index bdcae353786103146d40f632c7d6e6a096193c73..b70d84a0e23111012a4d7084286d55fbeaf3840e 100644 (file)
@@ -31,7 +31,6 @@
 #include <boost/filesystem.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/optional.hpp>
-#include <boost/function.hpp>
 
 #ifdef DCPOMATIC_WINDOWS
 #define WEXITSTATUS(w) (w)
index 816573230adc1dabfb71f002fa83791e190b6482..a3dbdebf2a4b9fb5e3c10a1959d0d2b5985c19c0 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.
 
 
 */
 
-#include "cross.h"
+
 #include "compose.hpp"
-#include "log.h"
-#include "dcpomatic_log.h"
 #include "config.h"
-#include "exceptions.h"
+#include "cross.h"
+#include "dcpomatic_log.h"
 #include "dcpomatic_log.h"
+#include "exceptions.h"
+#include "log.h"
 #include <dcp/raw_convert.h>
 #include <glib.h>
 extern "C" {
 #include <libavformat/avio.h>
 }
 #include <boost/algorithm/string.hpp>
-#include <boost/function.hpp>
 #if BOOST_VERSION >= 106100
 #include <boost/dll/runtime_symbol_info.hpp>
 #endif
@@ -46,19 +46,21 @@ extern "C" {
 
 #include "i18n.h"
 
-using std::pair;
-using std::list;
-using std::ifstream;
-using std::string;
-using std::wstring;
-using std::make_pair;
-using std::vector;
+
 using std::cerr;
 using std::cout;
+using std::function;
+using std::ifstream;
+using std::list;
+using std::make_pair;
+using std::pair;
 using std::runtime_error;
 using std::shared_ptr;
+using std::string;
+using std::vector;
+using std::wstring;
 using boost::optional;
-using boost::function;
+
 
 /** @param s Number of seconds to sleep for */
 void
@@ -67,12 +69,14 @@ dcpomatic_sleep_seconds (int s)
        sleep (s);
 }
 
+
 void
 dcpomatic_sleep_milliseconds (int ms)
 {
        usleep (ms * 1000);
 }
 
+
 /** @return A string of CPU information (model name etc.) */
 string
 cpu_info ()
@@ -97,6 +101,7 @@ cpu_info ()
        return info;
 }
 
+
 boost::filesystem::path
 resources_path ()
 {
@@ -135,12 +140,13 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
        }
 }
 
-list<pair<string, string> >
+
+list<pair<string, string>>
 mount_info ()
 {
-       list<pair<string, string> > m;
+       list<pair<string, string>> m;
 
-       FILE* f = setmntent ("/etc/mtab", "r");
+       auto f = setmntent ("/etc/mtab", "r");
        if (!f) {
                return m;
        }
@@ -176,7 +182,7 @@ directory_containing_executable ()
 boost::filesystem::path
 openssl_path ()
 {
-       boost::filesystem::path p = directory_containing_executable() / "dcpomatic2_openssl";
+       auto p = directory_containing_executable() / "dcpomatic2_openssl";
        if (boost::filesystem::is_regular_file(p)) {
                return p;
        }
@@ -201,26 +207,30 @@ disk_writer_path ()
 FILE *
 fopen_boost (boost::filesystem::path p, string t)
 {
-        return fopen (p.c_str(), t.c_str ());
+        return fopen(p.c_str(), t.c_str());
 }
 
+
 int
 dcpomatic_fseek (FILE* stream, int64_t offset, int whence)
 {
        return fseek (stream, offset, whence);
 }
 
+
 void
 Waker::nudge ()
 {
 
 }
 
+
 Waker::Waker ()
 {
 
 }
 
+
 Waker::~Waker ()
 {
 
@@ -230,7 +240,7 @@ Waker::~Waker ()
 void
 start_tool (string executable)
 {
-       boost::filesystem::path batch = directory_containing_executable() / executable;
+       auto batch = directory_containing_executable() / executable;
 
        pid_t pid = fork ();
        if (pid == 0) {
@@ -260,6 +270,7 @@ thread_id ()
        return (uint64_t) pthread_self ();
 }
 
+
 int
 avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags)
 {
@@ -273,6 +284,7 @@ home_directory ()
        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 ()
@@ -283,10 +295,10 @@ running_32_on_64 ()
 
 
 static
-vector<pair<string, string> >
+vector<pair<string, string>>
 get_mounts (string prefix)
 {
-       vector<pair<string, string> > mounts;
+       vector<pair<string, string>> mounts;
 
        std::ifstream f("/proc/mounts");
        string line;
@@ -382,6 +394,7 @@ unprivileged ()
 
 bool PrivilegeEscalator::test = false;
 
+
 PrivilegeEscalator::~PrivilegeEscalator ()
 {
        if (!test) {
@@ -389,6 +402,7 @@ PrivilegeEscalator::~PrivilegeEscalator ()
        }
 }
 
+
 PrivilegeEscalator::PrivilegeEscalator ()
 {
        if (!test) {
@@ -399,6 +413,7 @@ PrivilegeEscalator::PrivilegeEscalator ()
        }
 }
 
+
 boost::filesystem::path
 config_path ()
 {
@@ -415,6 +430,7 @@ disk_write_finished ()
 
 }
 
+
 string
 dcpomatic::get_process_id ()
 {
index bd31541c5e8b9a700d895f8bf54dde0270ba5ce6..58ec8e3c46cd6cb6d4b2a228de5086eab0469b2c 100644 (file)
@@ -65,7 +65,7 @@ using std::runtime_error;
 using std::map;
 using std::shared_ptr;
 using boost::optional;
-using boost::function;
+using std::function;
 
 /** @param s Number of seconds to sleep for */
 void
index 1fd8ced017f285504532432e99cb56108a21fcaf..82dca98f888c01ae3dfeb2ef17c4cfbfa4d0f888 100644 (file)
@@ -29,7 +29,7 @@
 
 using std::string;
 using std::cout;
-using boost::function;
+using std::function;
 
 static size_t
 read_callback (void* ptr, size_t size, size_t nmemb, void* object)
index 9fb3022f2f7ab0048224849c511f093ad56d6d8c..14cbce3639606b102f4e72aa9e3d8b463f86d2b9 100644 (file)
@@ -24,7 +24,7 @@
 class CurlUploader : public Uploader
 {
 public:
-       CurlUploader (boost::function<void (std::string)> set_status, boost::function<void (float)> set_progress);
+       CurlUploader (std::function<void (std::string)> set_status, std::function<void (float)> set_progress);
        ~CurlUploader ();
 
        size_t read_callback (void* ptr, size_t size, size_t nmemb);
index 0da42502f821fe3d0510c649b3f0cc7b3ae8b69e..f6a74501c7cae8b13102e0f9a586bd9bd08d90cf 100644 (file)
@@ -56,7 +56,7 @@ using std::string;
 using std::vector;
 using boost::scoped_ptr;
 using boost::optional;
-using boost::function;
+using std::function;
 using std::dynamic_pointer_cast;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
index 136c527a5c3d7bf84931ca3b2c3fc4b34483684d..69520fbd65a017fde85da1099105a3945d0286d2 100644 (file)
@@ -176,7 +176,7 @@ private:
        std::list<dcpomatic::DCPTimePeriod> reels (std::shared_ptr<const Film> film) const;
        bool can_reference (
                std::shared_ptr<const Film> film,
-               boost::function <bool (std::shared_ptr<const Content>)>,
+               std::function <bool (std::shared_ptr<const Content>)>,
                std::string overlapping,
                std::string& why_not
                ) const;
index 6f579b2d3600aee9a05b039791220a748609409f..0943a6b08721c49c0c0132acb90273cd14901d6c 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "dcp_subtitle.h"
 #include "exceptions.h"
 #include "compose.hpp"
 
 #include "i18n.h"
 
-using std::string;
+
 using std::exception;
 using std::shared_ptr;
+using std::string;
+using std::make_shared;
+
 
 shared_ptr<dcp::SubtitleAsset>
 DCPSubtitle::load (boost::filesystem::path file) const
@@ -38,21 +42,21 @@ DCPSubtitle::load (boost::filesystem::path file) const
        string smpte_error;
 
        try {
-               sc.reset (new dcp::InteropSubtitleAsset (file));
+               sc = make_shared<dcp::InteropSubtitleAsset>(file);
        } catch (exception& e) {
                interop_error = e.what ();
        }
 
        if (!sc) {
                try {
-                       sc.reset (new dcp::SMPTESubtitleAsset (file));
+                       sc = make_shared<dcp::SMPTESubtitleAsset>(file);
                } catch (exception& e) {
                        smpte_error = e.what();
                }
        }
 
        if (!sc) {
-               throw FileError (String::compose (_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file);
+               throw FileError(String::compose(_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file);
        }
 
        return sc;
index 9cd0685aadbddd01b834d2e10550feb69b6d41ab..2011759aa13082ab7e39485e03638d08bfb155e4 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_DCP_SUBTITLE_H
 #define DCPOMATIC_DCP_SUBTITLE_H
 
+
 #include <boost/filesystem.hpp>
 
+
 namespace dcp {
        class SubtitleAsset;
 }
 
+
 class DCPSubtitle
 {
 protected:
        std::shared_ptr<dcp::SubtitleAsset> load (boost::filesystem::path) const;
 };
 
+
 #endif
index a64dc907c7b69b24b8234b73d6905cbe9fb563b0..cffc79830f449482a747291c3f8386b78b0cc1a0 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.
 
 
 */
 
+
 #include "dcpomatic_log.h"
 #include "null_log.h"
 
+
 /** The current log; set up by the front-ends when they have a Film to log into */
 std::shared_ptr<Log> dcpomatic_log (new NullLog());
index 605f951223894a009ae8e64319cbabffe9f33e54..6a1c3a6ec54ccf170d24a56ebf2e7a0d7cca33d3 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.
 
 
 */
 
+
 #include "log.h"
 #include "compose.hpp"
 
+
 /** The current log; set up by the front-ends when they have a Film to log into */
 extern std::shared_ptr<Log> dcpomatic_log;
 
+
 #define LOG_GENERAL(...)      dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
 #define LOG_GENERAL_NC(...)   dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_GENERAL);
 #define LOG_ERROR(...)        dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_ERROR);
index 2bab1603ec2d84d00d54782bcbc24c63f38e0b80..bcddcb785dde11b1c81e1cb5bc2d67b251b82520 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.
 
 
 */
 
+
 #include "decoder_part.h"
 #include "decoder.h"
 
-using std::shared_ptr;
 
 DecoderPart::DecoderPart (Decoder* parent)
        : _parent (parent)
index 96225f3dd78e681b7213bccf8ba7296560f5a68f..57ddee781968556087e6d307043ddad6850a260e 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_DECODER_PART_H
 #define DCPOMATIC_DECODER_PART_H
 
+
 #include "dcpomatic_time.h"
 #include <boost/optional.hpp>
 
+
 class Decoder;
 class Log;
 class Film;
 
+
 class DecoderPart
 {
 public:
@@ -52,4 +56,5 @@ private:
        bool _ignore;
 };
 
+
 #endif
index 32828f13a84878e3dda72ae54a997fa983ae11e1..91020e288a4fa113856b77733304c73ddb20342d 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "ffmpeg_audio_stream.h"
 #include <dcp/raw_convert.h>
 #include "warnings.h"
@@ -26,37 +27,40 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <libcxml/cxml.h>
 
+
 using std::string;
 using boost::optional;
 using dcp::raw_convert;
 using namespace dcpomatic;
 
+
 FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
        : FFmpegStream (node)
        , AudioStream (
-               node->number_child<int> ("FrameRate"),
-               node->optional_number_child<Frame>("Length").get_value_or (0),
-               AudioMapping (node->node_child ("Mapping"), version)
+               node->number_child<int>("FrameRate"),
+               node->optional_number_child<Frame>("Length").get_value_or(0),
+               AudioMapping (node->node_child("Mapping"), version)
                )
 {
-       optional<ContentTime::Type> const f = node->optional_number_child<ContentTime::Type> ("FirstAudio");
+       optional<ContentTime::Type> const f = node->optional_number_child<ContentTime::Type>("FirstAudio");
        if (f) {
-               first_audio = ContentTime (f.get ());
+               first_audio = ContentTime(f.get());
        }
        codec_name = node->optional_string_child("CodecName");
 }
 
+
 void
 FFmpegAudioStream::as_xml (xmlpp::Node* root) const
 {
        FFmpegStream::as_xml (root);
-       root->add_child("FrameRate")->add_child_text (raw_convert<string> (frame_rate ()));
-       root->add_child("Length")->add_child_text (raw_convert<string> (length ()));
+       root->add_child("FrameRate")->add_child_text(raw_convert<string>(frame_rate()));
+       root->add_child("Length")->add_child_text(raw_convert<string>(length()));
        mapping().as_xml (root->add_child("Mapping"));
        if (first_audio) {
-               root->add_child("FirstAudio")->add_child_text (raw_convert<string> (first_audio.get().get ()));
+               root->add_child("FirstAudio")->add_child_text(raw_convert<string>(first_audio.get().get()));
        }
        if (codec_name) {
-               root->add_child("CodecName")->add_child_text (codec_name.get());
+               root->add_child("CodecName")->add_child_text(codec_name.get());
        }
 }
index 65c4aba5ead97b8459925bc63fc4b25c5e6366bd..a5ed90c972e46f0a6297ff31eb17810bd8026fa3 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.
 
 
 */
 
-#include "ffmpeg_stream.h"
+
 #include "audio_stream.h"
 #include "dcpomatic_time.h"
+#include "ffmpeg_stream.h"
+
 
 struct ffmpeg_pts_offset_test;
 
+
 class FFmpegAudioStream : public FFmpegStream, public AudioStream
 {
 public:
@@ -61,3 +64,4 @@ private:
                , AudioStream (0, 0, 0)
        {}
 };
+
index aaf94acf4b17a2eaf25595ba61fe9c4d5d964ed4..7dae1da92c26690f40ccdff9c4dd7d026d3d24d1 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.
 
 
 */
 
+
 /** @file  src/lib/file_group.cc
  *  @brief FileGroup class.
  */
 
-#include "file_group.h"
-#include "exceptions.h"
-#include "cross.h"
+
 #include "compose.hpp"
+#include "cross.h"
 #include "dcpomatic_assert.h"
+#include "exceptions.h"
+#include "file_group.h"
 #include <sndfile.h>
 #include <cstdio>
 
+
 using std::vector;
 
+
 /** Construct a FileGroup with no files */
 FileGroup::FileGroup ()
-       : _current_path (0)
-       , _current_file (0)
-       , _current_size (0)
-       , _position (0)
 {
 
 }
 
+
 /** Construct a FileGroup with a single file */
 FileGroup::FileGroup (boost::filesystem::path p)
-       : _current_path (0)
-       , _current_file (0)
-       , _current_size (0)
 {
        _paths.push_back (p);
        ensure_open_path (0);
        seek (0, SEEK_SET);
 }
 
+
 /** Construct a FileGroup with multiple files */
 FileGroup::FileGroup (vector<boost::filesystem::path> const & p)
        : _paths (p)
-       , _current_path (0)
-       , _current_file (0)
 {
        ensure_open_path (0);
        seek (0, SEEK_SET);
 }
 
+
 /** Destroy a FileGroup, closing any open file */
 FileGroup::~FileGroup ()
 {
@@ -71,6 +69,7 @@ FileGroup::~FileGroup ()
        }
 }
 
+
 void
 FileGroup::set_paths (vector<boost::filesystem::path> const & p)
 {
@@ -79,6 +78,7 @@ FileGroup::set_paths (vector<boost::filesystem::path> const & p)
        seek (0, SEEK_SET);
 }
 
+
 /** Ensure that the given path index in the content is the _current_file */
 void
 FileGroup::ensure_open_path (size_t p) const
@@ -94,12 +94,13 @@ FileGroup::ensure_open_path (size_t p) const
 
        _current_path = p;
        _current_file = fopen_boost (_paths[_current_path], "rb");
-       if (_current_file == 0) {
+       if (!_current_file) {
                throw OpenFileError (_paths[_current_path], errno, OpenFileError::READ);
        }
        _current_size = boost::filesystem::file_size (_paths[_current_path]);
 }
 
+
 int64_t
 FileGroup::seek (int64_t pos, int whence) const
 {
@@ -138,6 +139,7 @@ FileGroup::seek (int64_t pos, int whence) const
        return _position;
 }
 
+
 /** Try to read some data from the current position into a buffer.
  *  @param buffer Buffer to write data into.
  *  @param amount Number of bytes to read.
@@ -195,6 +197,7 @@ FileGroup::read (uint8_t* buffer, int amount) const
        return read;
 }
 
+
 /** @return Combined length of all the files */
 int64_t
 FileGroup::length () const
index a696343a0ca14e118109496f2e0a5fed33a8a069..9521da7ec88c85b016dc2ef6889030d7c048a97a 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.
 
 
 */
 
+
 /** @file  src/lib/file_group.h
  *  @brief FileGroup class.
  */
 
+
 #ifndef DCPOMATIC_FILE_GROUP_H
 #define DCPOMATIC_FILE_GROUP_H
 
+
 #include <boost/filesystem.hpp>
 #include <vector>
 
+
 /** @class FileGroup
  *  @brief A class to make a list of files behave like they were concatenated.
  */
@@ -53,10 +57,11 @@ private:
 
        std::vector<boost::filesystem::path> _paths;
        /** Index of path that we are currently reading from */
-       mutable size_t _current_path;
-       mutable FILE* _current_file;
-       mutable size_t _current_size;
-       mutable int64_t _position;
+       mutable size_t _current_path = 0;
+       mutable FILE* _current_file = nullptr;
+       mutable size_t _current_size = 0;
+       mutable int64_t _position = 0;
 };
 
+
 #endif
index dcb9aeaf5e4be5c71fb58e6810065335db34857e..e40958a427bd866006684e571d5e98af6a8cb606 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.
 
 
 */
 
+
 #include "frame_interval_checker.h"
 
+
 using namespace dcpomatic;
 
+
 int const FrameIntervalChecker::_frames = 16;
 
+
 void
 FrameIntervalChecker::feed (ContentTime time, double frame_rate)
 {
@@ -39,6 +43,7 @@ FrameIntervalChecker::feed (ContentTime time, double frame_rate)
        _last = time;
 }
 
+
 FrameIntervalChecker::Guess
 FrameIntervalChecker::guess () const
 {
@@ -46,7 +51,7 @@ FrameIntervalChecker::guess () const
                /* How soon can you land?
                 * I can't tell.
                 * You can tell me, I'm a doctor.
-                * Nom I mean I'm just not sure.
+                * No I mean I'm just not sure.
                 * Can't you take a guess?
                 * Well, not for another two hours.
                 * You can't take a guess for another two hours?
index 943363d1a67da48109f246ed3b900c5e23312135..ca72399f3f547076bafcceb707dfa7f7e44d70e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "scoped_temporary.h"
 #include "compose.hpp"
 #include "exceptions.h"
@@ -25,7 +26,6 @@
 #include "util.h"
 #include <curl/curl.h>
 #include <zip.h>
-#include <boost/function.hpp>
 #include <boost/optional.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
 
 #include "i18n.h"
 
-using std::string;
+
+using std::function;
 using std::list;
+using std::string;
 using boost::optional;
-using boost::function;
 using boost::algorithm::trim;
 
+
 static size_t
 ls_url_data (void* buffer, size_t size, size_t nmemb, void* output)
 {
@@ -50,17 +52,18 @@ ls_url_data (void* buffer, size_t size, size_t nmemb, void* output)
        return nmemb;
 }
 
+
 list<string>
 ls_url (string url)
 {
-       CURL* curl = curl_easy_init ();
+       auto curl = curl_easy_init ();
        curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
        curl_easy_setopt (curl, CURLOPT_DIRLISTONLY, 1);
 
        string ls;
        curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ls_url_data);
        curl_easy_setopt (curl, CURLOPT_WRITEDATA, &ls);
-       CURLcode const cr = curl_easy_perform (curl);
+       auto const cr = curl_easy_perform (curl);
 
        if (cr != CURLE_OK) {
                return list<string>();
@@ -80,20 +83,22 @@ ls_url (string url)
        return result;
 }
 
+
 static size_t
 get_from_url_data (void* buffer, size_t size, size_t nmemb, void* stream)
 {
-       FILE* f = reinterpret_cast<FILE*> (stream);
+       auto f = reinterpret_cast<FILE*> (stream);
        return fwrite (buffer, size, nmemb, f);
 }
 
+
 optional<string>
 get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
 {
-       CURL* curl = curl_easy_init ();
+       auto curl = curl_easy_init ();
        curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
 
-       FILE* f = temp.open ("wb");
+       auto f = temp.open ("wb");
        curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, get_from_url_data);
        curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
        curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
@@ -124,7 +129,7 @@ optional<string>
 get_from_url (string url, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path)> load)
 {
        ScopedTemporary temp;
-       optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp);
+       auto e = get_from_url (url, pasv, skip_pasv_ip, temp);
        if (e) {
                return e;
        }
@@ -141,7 +146,7 @@ get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, functio
 {
        /* Download the ZIP file to temp_zip */
        ScopedTemporary temp_zip;
-       optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
+       auto e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
        if (e) {
                return e;
        }
@@ -154,19 +159,19 @@ get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, functio
           Centos 6, Centos 7, Debian 7 and Debian 8.
        */
 
-       FILE* zip_file = fopen_boost (temp_zip.file (), "rb");
+       auto zip_file = fopen_boost (temp_zip.file (), "rb");
        if (!zip_file) {
                return optional<string> (_("Could not open downloaded ZIP file"));
        }
 
-       zip_source_t* zip_source = zip_source_filep_create (zip_file, 0, -1, 0);
+       auto zip_source = zip_source_filep_create (zip_file, 0, -1, 0);
        if (!zip_source) {
                return optional<string> (_("Could not open downloaded ZIP file"));
        }
 
        zip_error_t error;
        zip_error_init (&error);
-       zip_t* zip = zip_open_from_source (zip_source, ZIP_RDONLY, &error);
+       auto zip = zip_open_from_source (zip_source, ZIP_RDONLY, &error);
        if (!zip) {
                return String::compose (_("Could not open downloaded ZIP file (%1:%2: %3)"), error.zip_err, error.sys_err, error.str ? error.str : "");
        }
@@ -181,7 +186,7 @@ get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, functio
        }
 
        ScopedTemporary temp_cert;
-       FILE* f = temp_cert.open ("wb");
+       auto f = temp_cert.open ("wb");
        char buffer[4096];
        while (true) {
                int const N = zip_fread (file_in_zip, buffer, sizeof (buffer));
index 8aa7264c61372d07c75f46a40cf5f59cf4ab3f55..25513e6667d8e0489ebc4557d848b97ed99cbe7e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 */
 
 #include <boost/optional.hpp>
-#include <boost/function.hpp>
 #include <boost/filesystem.hpp>
 
+
 class ScopedTemporary;
 
+
 boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp);
-boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, boost::function<boost::optional<std::string> (boost::filesystem::path)> load);
-boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, boost::function<boost::optional<std::string> (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, std::function<boost::optional<std::string> (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, std::function<boost::optional<std::string> (boost::filesystem::path)> load);
 std::list<std::string> ls_url (std::string url);
index fcd1689cbf2df23190fbe5f10ae46d64d8075968..144da396d24ee619970c679de49731378a69963c 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "j2k_image_proxy.h"
 #include "dcpomatic_socket.h"
 #include "image.h"
@@ -38,17 +39,20 @@ DCPOMATIC_ENABLE_WARNINGS
 
 #include "i18n.h"
 
-using std::string;
+
 using std::cout;
+using std::dynamic_pointer_cast;
+using std::make_pair;
+using std::make_shared;
 using std::max;
 using std::pair;
-using std::make_pair;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
-using std::dynamic_pointer_cast;
 using dcp::ArrayData;
 using dcp::raw_convert;
 
+
 /** Construct a J2KImageProxy from a JPEG2000 file */
 J2KImageProxy::J2KImageProxy (boost::filesystem::path path, dcp::Size size, AVPixelFormat pixel_format)
        : _data (new dcp::ArrayData(path))
@@ -100,9 +104,9 @@ J2KImageProxy::J2KImageProxy (
 J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
        : _error (false)
 {
-       _size = dcp::Size (xml->number_child<int> ("Width"), xml->number_child<int> ("Height"));
-       if (xml->optional_number_child<int> ("Eye")) {
-               _eye = static_cast<dcp::Eye> (xml->number_child<int> ("Eye"));
+       _size = dcp::Size (xml->number_child<int>("Width"), xml->number_child<int>("Height"));
+       if (xml->optional_number_child<int>("Eye")) {
+               _eye = static_cast<dcp::Eye>(xml->number_child<int>("Eye"));
        }
        shared_ptr<ArrayData> data(new ArrayData(xml->number_child<int>("Size")));
        /* This only matters when we are using J2KImageProxy for the preview, which
@@ -114,6 +118,7 @@ J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
        _data = data;
 }
 
+
 int
 J2KImageProxy::prepare (optional<dcp::Size> target_size) const
 {
@@ -139,7 +144,7 @@ J2KImageProxy::prepare (optional<dcp::Size> target_size) const
 
        try {
                /* XXX: should check that potentially trashing _data here doesn't matter */
-               shared_ptr<dcp::OpenJPEGImage> decompressed = dcp::decompress_j2k (const_cast<uint8_t*>(_data->data()), _data->size(), reduce);
+               auto decompressed = dcp::decompress_j2k (const_cast<uint8_t*>(_data->data()), _data->size(), reduce);
                _image.reset (new Image (_pixel_format, decompressed->size(), true));
 
                int const shift = 16 - decompressed->precision (0);
@@ -155,7 +160,7 @@ J2KImageProxy::prepare (optional<dcp::Size> target_size) const
                int* decomp_1 = decompressed->data (1);
                int* decomp_2 = decompressed->data (2);
                for (int y = 0; y < decompressed->size().height; ++y) {
-                       uint16_t* q = (uint16_t *) (_image->data()[0] + y * _image->stride()[0]);
+                       auto q = reinterpret_cast<uint16_t *>(_image->data()[0] + y * _image->stride()[0]);
                        for (int x = 0; x < width; ++x) {
                                *q++ = decomp_0[p] << shift;
                                *q++ = decomp_1[p] << shift;
@@ -164,7 +169,7 @@ J2KImageProxy::prepare (optional<dcp::Size> target_size) const
                        }
                }
        } catch (dcp::J2KDecompressionError& e) {
-               _image.reset (new Image (_pixel_format, _size, true));
+               _image = make_shared<Image>(_pixel_format, _size, true);
                _image->make_black ();
                _error = true;
        }
@@ -191,25 +196,27 @@ J2KImageProxy::image (optional<dcp::Size> target_size) const
 void
 J2KImageProxy::add_metadata (xmlpp::Node* node) const
 {
-       node->add_child("Type")->add_child_text (N_("J2K"));
-       node->add_child("Width")->add_child_text (raw_convert<string> (_size.width));
-       node->add_child("Height")->add_child_text (raw_convert<string> (_size.height));
+       node->add_child("Type")->add_child_text(N_("J2K"));
+       node->add_child("Width")->add_child_text(raw_convert<string>(_size.width));
+       node->add_child("Height")->add_child_text(raw_convert<string>(_size.height));
        if (_eye) {
-               node->add_child("Eye")->add_child_text (raw_convert<string> (static_cast<int> (_eye.get ())));
+               node->add_child("Eye")->add_child_text(raw_convert<string>(static_cast<int>(_eye.get())));
        }
-       node->add_child("Size")->add_child_text (raw_convert<string>(_data->size()));
+       node->add_child("Size")->add_child_text(raw_convert<string>(_data->size()));
 }
 
+
 void
 J2KImageProxy::write_to_socket (shared_ptr<Socket> socket) const
 {
        socket->write (_data->data(), _data->size());
 }
 
+
 bool
 J2KImageProxy::same (shared_ptr<const ImageProxy> other) const
 {
-       shared_ptr<const J2KImageProxy> jp = dynamic_pointer_cast<const J2KImageProxy> (other);
+       auto jp = dynamic_pointer_cast<const J2KImageProxy>(other);
        if (!jp) {
                return false;
        }
@@ -217,6 +224,7 @@ J2KImageProxy::same (shared_ptr<const ImageProxy> other) const
        return *_data == *jp->_data;
 }
 
+
 J2KImageProxy::J2KImageProxy (ArrayData data, dcp::Size size, AVPixelFormat pixel_format)
        : _data (new ArrayData(data))
        , _size (size)
@@ -227,6 +235,7 @@ J2KImageProxy::J2KImageProxy (ArrayData data, dcp::Size size, AVPixelFormat pixe
        DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB48 || _pixel_format == AV_PIX_FMT_XYZ12LE);
 }
 
+
 size_t
 J2KImageProxy::memory_used () const
 {
index 437a563ebb770a85e1627c576a3cd261b694fe09..5235d8e42522d02c42dd7566ec18bc6c8301853c 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.
 
 
 */
 
+
 #include "image_proxy.h"
 #include <dcp/array_data.h>
 #include <dcp/util.h>
 #include <boost/thread/mutex.hpp>
 
+
 namespace dcp {
        class MonoPictureFrame;
        class StereoPictureFrame;
 }
 
+
 class J2KImageProxy : public ImageProxy
 {
 public:
index b0ca8a7375b5679718efb13a58c6762831e7cbe9..52558046ae8ec66ecd580194bf3f51558efd504e 100644 (file)
@@ -44,7 +44,7 @@ using std::list;
 using std::cout;
 using std::shared_ptr;
 using boost::optional;
-using boost::function;
+using std::function;
 using namespace dcpomatic;
 
 /** @param film Associated film, or 0 */
index 6d8435c60fe29be840a244c18ba949e281614e2d..96f0acbe5a0c886d54a9b96128eed3c5a11a439d 100644 (file)
@@ -86,7 +86,7 @@ public:
                return _film;
        }
 
-       void when_finished (boost::signals2::connection& connection, boost::function<void()> finished);
+       void when_finished (boost::signals2::connection& connection, std::function<void()> finished);
 
        boost::signals2::signal<void()> Progress;
        /** Emitted from the UI thread when the job is finished */
index 4ed360bed4b913b595f2ff4184816a6032690a0c..d8c0b02f2f210a58c863fe81d072dfecdd883468 100644 (file)
 
 
 using std::dynamic_pointer_cast;
+using std::function;
 using std::list;
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
 using std::weak_ptr;
 using boost::bind;
-using boost::function;
 using boost::optional;
 
 
index 4fe1e45d6b337302611d2c500721dfb719df0e88..ff5800aa84a6d2da70eed283eead48c9de6e2609 100644 (file)
@@ -70,14 +70,14 @@ public:
                std::shared_ptr<const Playlist> playlist,
                bool from_zero,
                boost::signals2::connection& connection,
-               boost::function<void()> ready
+               std::function<void()> ready
                );
 
        void analyse_subtitles (
                std::shared_ptr<const Film> film,
                std::shared_ptr<Content> content,
                boost::signals2::connection& connection,
-               boost::function<void()> ready
+               std::function<void()> ready
                );
 
        boost::signals2::signal<void (std::weak_ptr<Job>)> JobAdded;
index fbd2e4bd49e7d417849159c46653a67c978d2416..3159b4c7271bceabe706f6d782627a226ccb1a41 100644 (file)
@@ -27,8 +27,6 @@
 #include "config.h"
 #include "dcpomatic_log.h"
 #include "emailer.h"
-#include <boost/function.hpp>
-#include <boost/function.hpp>
 
 #include "i18n.h"
 
@@ -38,7 +36,7 @@ using std::cout;
 using std::list;
 using std::shared_ptr;
 using boost::optional;
-using boost::function;
+using std::function;
 
 
 int
@@ -46,7 +44,7 @@ write_files (
        list<KDMWithMetadataPtr> kdms,
        boost::filesystem::path directory,
        dcp::NameFormat name_format,
-       boost::function<bool (boost::filesystem::path)> confirm_overwrite
+       std::function<bool (boost::filesystem::path)> confirm_overwrite
        )
 {
        int written = 0;
index 99c2ef8dcf6da0f00bd6f38307979047b121716d..3e0b7e554674e072686e63bff461a2af672371f9 100644 (file)
@@ -75,7 +75,7 @@ typedef std::shared_ptr<KDMWithMetadata> KDMWithMetadataPtr;
 
 int write_files (
        std::list<KDMWithMetadataPtr> screen_kdms, boost::filesystem::path directory,
-       dcp::NameFormat name_format, boost::function<bool (boost::filesystem::path)> confirm_overwrite
+       dcp::NameFormat name_format, std::function<bool (boost::filesystem::path)> confirm_overwrite
        );
 
 
@@ -90,7 +90,7 @@ int write_directories (
                boost::filesystem::path directory,
                dcp::NameFormat container_name_format,
                dcp::NameFormat filename_format,
-               boost::function<bool (boost::filesystem::path)> confirm_overwrite
+               std::function<bool (boost::filesystem::path)> confirm_overwrite
                );
 
 
@@ -99,7 +99,7 @@ int write_zip_files (
                boost::filesystem::path directory,
                dcp::NameFormat container_name_format,
                dcp::NameFormat filename_format,
-               boost::function<bool (boost::filesystem::path)> confirm_overwrite
+               std::function<bool (boost::filesystem::path)> confirm_overwrite
                );
 
 
index 32801de39e5c0449a6b85fbb1de02b7c1a1c831b..09e7f63ac089ebbfcdffb7406b383a0cbaf64a7c 100644 (file)
@@ -23,7 +23,7 @@
 #include "content.h"
 
 using std::shared_ptr;
-using boost::function;
+using std::function;
 using namespace dcpomatic;
 
 ContentList overlaps (shared_ptr<const Film> film, ContentList cl, function<bool (shared_ptr<const Content>)> part, DCPTime from, DCPTime to)
index 60c0cd5370167d7eba327577b4c8ac903d7c9091..6c5a85a8bb2a34f9a2fd487b5de435c807b5e04b 100644 (file)
@@ -29,5 +29,5 @@ class Film;
  *  ContentList
  */
 ContentList overlaps (
-       std::shared_ptr<const Film> film, ContentList cl, boost::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime from, dcpomatic::DCPTime to
+       std::shared_ptr<const Film> film, ContentList cl, std::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime from, dcpomatic::DCPTime to
        );
index f91b990c8b1d32c8df8ac723ddc820dac71da0c2..e473b8750474a975f53c3fdf6f1521ec2407e1b8 100644 (file)
@@ -41,7 +41,7 @@ using std::shared_ptr;
 using std::string;
 using std::weak_ptr;
 using boost::optional;
-using boost::function;
+using std::function;
 using dcp::Data;
 using dcp::raw_convert;
 
index df0007ddfd9676a6d25ac69699e5e131575911e0..f296848320a77a053d863d5ded423c05015d7dbc 100644 (file)
@@ -71,8 +71,8 @@ public:
 
        void set_text (PositionImage);
 
-       void prepare (boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast);
-       std::shared_ptr<Image> image (boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
+       void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast);
+       std::shared_ptr<Image> image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
 
        static AVPixelFormat force (AVPixelFormat, AVPixelFormat);
        static AVPixelFormat keep_xyz_or_rgb (AVPixelFormat);
@@ -118,7 +118,7 @@ public:
        }
 
 private:
-       void make_image (boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
+       void make_image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
 
        std::shared_ptr<const ImageProxy> _in;
        Crop _crop;
index c342e1866a8e9312cb87b9e050d1c19a9b0c98cd..9ba2e9c3f9f2d2fdb343bc4fb98e7c0fb1ceed66 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.
 
 
 */
 
+
 #include "position_image.h"
 #include "image.h"
-#include <iostream>
 
-using std::cout;
 
 bool
 PositionImage::same (PositionImage const & other) const
index b78effbd53715f4277f37a76b47f7ec80c3d62fb..2b7e7080a68df0bcb8e7228ae21cd2f6827c344b 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #ifndef DCPOMATIC_POSITION_IMAGE_H
 #define DCPOMATIC_POSITION_IMAGE_H
 
@@ -28,6 +29,7 @@
 
 class Image;
 
+
 class PositionImage
 {
 public:
@@ -44,4 +46,5 @@ public:
        bool same (PositionImage const & other) const;
 };
 
+
 #endif
index a3d499abe51a6ce3a0a9b514601ad7c5aec6b5be..0b367ae38581a15649b9e3eef7de8c545561c1cf 100644 (file)
@@ -744,7 +744,7 @@ ReelWriter::create_reel (
 }
 
 void
-ReelWriter::calculate_digests (boost::function<void (float)> set_progress)
+ReelWriter::calculate_digests (std::function<void (float)> set_progress)
 try
 {
        if (_picture_asset) {
index 5eb0e1b08215c1e2aa87358bd67e6b9ee0ee99a5..804a93c05d3c6103b5e4c0e4fc77364f6a02906d 100644 (file)
@@ -81,7 +81,7 @@ public:
                bool ensure_subtitles,
                std::set<DCPTextTrack> ensure_closed_captions
                );
-       void calculate_digests (boost::function<void (float)> set_progress);
+       void calculate_digests (std::function<void (float)> set_progress);
 
        Frame start () const;
 
index 1076af4335574a65c165cdbe81415cb8cfe073bc..4d2c28085eb74fa4a2dc8b8b58c45fdbf746f4e8 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "rgba.h"
 #include "warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
@@ -25,26 +26,30 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/lexical_cast.hpp>
 
+
 using std::string;
 using boost::lexical_cast;
 
+
 RGBA::RGBA (cxml::ConstNodePtr node)
 {
-       r = node->number_child<int> ("R");
-       g = node->number_child<int> ("G");
-       b = node->number_child<int> ("B");
-       a = node->number_child<int> ("A");
+       r = node->number_child<int>("R");
+       g = node->number_child<int>("G");
+       b = node->number_child<int>("B");
+       a = node->number_child<int>("A");
 }
 
+
 void
 RGBA::as_xml (xmlpp::Node* parent) const
 {
-       parent->add_child("R")->add_child_text (lexical_cast<string> (int (r)));
-       parent->add_child("G")->add_child_text (lexical_cast<string> (int (g)));
-       parent->add_child("B")->add_child_text (lexical_cast<string> (int (b)));
-       parent->add_child("A")->add_child_text (lexical_cast<string> (int (a)));
+       parent->add_child("R")->add_child_text(lexical_cast<string>(int(r)));
+       parent->add_child("G")->add_child_text(lexical_cast<string>(int(g)));
+       parent->add_child("B")->add_child_text(lexical_cast<string>(int(b)));
+       parent->add_child("A")->add_child_text(lexical_cast<string>(int(a)));
 }
 
+
 bool
 RGBA::operator< (RGBA const & other) const
 {
index c9521f311b0151648de41447efbb85d5500307a9..96fed710ef4582e3cc5676bc77d0aa0f5429e147 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_RGBA_H
 #define DCPOMATIC_RGBA_H
 
+
 #include <libcxml/cxml.h>
 #include <stdint.h>
 
+
 /** @class RGBA
  *  @brief A 32-bit RGBA colour.
  */
-
 class RGBA
 {
 public:
-       RGBA ()
-               : r (0)
-               , g (0)
-               , b (0)
-               , a (0)
-       {}
+       RGBA () {}
 
        RGBA (uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_)
                : r (r_)
@@ -49,12 +46,13 @@ public:
 
        void as_xml (xmlpp::Node* parent) const;
 
-       uint8_t r;
-       uint8_t g;
-       uint8_t b;
-       uint8_t a;
+       uint8_t r = 0;
+       uint8_t g = 0;
+       uint8_t b = 0;
+       uint8_t a = 0;
 
        bool operator< (RGBA const & other) const;
 };
 
+
 #endif
index a13e7f6de82c7f539f673f1e5dd9970a6a64141a..5a4faf4d15fa4c0f74617bd2bd03ecd57f1ba114 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.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "shuffler.h"
 #include "content_video.h"
 #include "dcpomatic_assert.h"
 #include <string>
 #include <iostream>
 
+
 using std::make_pair;
+using std::shared_ptr;
 using std::string;
 using std::weak_ptr;
-using std::shared_ptr;
 using boost::optional;
 
+
 int const Shuffler::_max_size = 64;
 
+
 struct Comparator
 {
        bool operator()(Shuffler::Store const & a, Shuffler::Store const & b) {
@@ -43,6 +47,7 @@ struct Comparator
        }
 };
 
+
 void
 Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
 {
@@ -54,7 +59,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
                return;
        }
 
-       shared_ptr<Piece> piece = weak_piece.lock ();
+       auto piece = weak_piece.lock ();
        DCPOMATIC_ASSERT (piece);
 
        if (!_last && video.eyes == Eyes::LEFT) {
@@ -103,6 +108,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
        }
 }
 
+
 void
 Shuffler::clear ()
 {
@@ -111,6 +117,7 @@ Shuffler::clear ()
        _last = optional<ContentVideo>();
 }
 
+
 void
 Shuffler::flush ()
 {
index b0a416b80f33edb9957919f6dc82d4cc1e6ef3eb..2b37b70a11149a7d84394134bb8583d273451aec 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.
 
 
 */
 
+
 #include "types.h"
 #include "content_video.h"
 #include <boost/signals2.hpp>
 
+
 struct shuffler_test5;
 
+
 class Piece;
 
+
 class Shuffler
 {
 public:
index 099e3ee74e34af098188c8e3c8b6b51111c03f74..0a7bdf95da75ffc32f428d095929d8b891bb4b0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "text_decoder.h"
 #include "text_content.h"
 #include "util.h"
@@ -27,6 +28,7 @@
 #include <boost/algorithm/string.hpp>
 #include <iostream>
 
+
 using std::list;
 using std::cout;
 using std::string;
@@ -34,9 +36,10 @@ using std::min;
 using std::max;
 using std::shared_ptr;
 using boost::optional;
-using boost::function;
+using std::function;
 using namespace dcpomatic;
 
+
 TextDecoder::TextDecoder (
        Decoder* parent,
        shared_ptr<const TextContent> c,
@@ -49,6 +52,7 @@ TextDecoder::TextDecoder (
 
 }
 
+
 /** Called by subclasses when an image subtitle is starting.
  *  @param from From time of the subtitle.
  *  @param image Subtitle image.
@@ -63,6 +67,7 @@ TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpom
        _position = from;
 }
 
+
 void
 TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
 {
@@ -97,6 +102,7 @@ TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
        _position = from;
 }
 
+
 void
 TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
 {
@@ -250,12 +256,14 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
        emit_plain_start (from, out);
 }
 
+
 void
 TextDecoder::emit_stop (ContentTime to)
 {
        Stop (to);
 }
 
+
 void
 TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s)
 {
@@ -263,6 +271,7 @@ TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s)
        emit_stop (period.to);
 }
 
+
 void
 TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
 {
@@ -270,6 +279,7 @@ TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
        emit_stop (period.to);
 }
 
+
 /*  @param rect Area expressed as a fraction of the video frame that this subtitle
  *  is for (e.g. a width of 0.5 means the width of the subtitle is half the width
  *  of the video frame)
@@ -281,6 +291,7 @@ TextDecoder::emit_bitmap (ContentTimePeriod period, shared_ptr<Image> image, dcp
        emit_stop (period.to);
 }
 
+
 void
 TextDecoder::seek ()
 {
index 3fb27b653e4d279084ea73d9885ec08bc3ff2a68..6e96b6b914abd109f52a2c3f4af4c161a9cc385f 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_CAPTION_DECODER_H
 #define DCPOMATIC_CAPTION_DECODER_H
 
+
 #include "decoder.h"
 #include "rect.h"
 #include "types.h"
 #include <dcp/subtitle_string.h>
 #include <boost/signals2.hpp>
 
+
 namespace sub {
        class Subtitle;
 }
 
 class Image;
 
+
 class TextDecoder : public DecoderPart
 {
 public:
@@ -71,4 +75,5 @@ private:
        boost::optional<dcpomatic::ContentTime> _position;
 };
 
+
 #endif
index ba727cc41c4154a62c4a9868db213a6abaedd9aa..e2be7bf418a86b9fec1fc157f08a8a39c813f688 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.
 
 
 */
 
+
 #include "text_ring_buffers.h"
 
+
 using std::pair;
 using boost::optional;
 using namespace dcpomatic;
 
+
 void
 TextRingBuffers::put (PlayerText text, DCPTextTrack track, DCPTimePeriod period)
 {
@@ -31,19 +34,21 @@ TextRingBuffers::put (PlayerText text, DCPTextTrack track, DCPTimePeriod period)
        _data.push_back (Data(text, track, period));
 }
 
+
 optional<TextRingBuffers::Data>
 TextRingBuffers::get ()
 {
        boost::mutex::scoped_lock lm (_mutex);
-       if (_data.empty ()) {
-               return optional<Data>();
+       if (_data.empty()) {
+               return {};
        }
 
-       Data r = _data.front ();
-       _data.pop_front ();
+       auto r = _data.front();
+       _data.pop_front();
        return r;
 }
 
+
 void
 TextRingBuffers::clear ()
 {
index 7d685d8242b4b9cbbdd1efca4a698dfe92a8e143..2014dacc5e9886a30c00e69cbc735146b13928db 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_TEXT_RING_BUFFERS_H
 #define DCPOMATIC_TEXT_RING_BUFFERS_H
 
-#include "player_text.h"
+
 #include "dcp_text_track.h"
+#include "player_text.h"
 #include <boost/thread.hpp>
 #include <utility>
 
+
 class TextRingBuffers
 {
 public:
@@ -52,4 +55,5 @@ private:
        std::list<Data> _data;
 };
 
+
 #endif
index 9618e5beb371c239f397aec941c99e5edfa84c25..c5448e469b8c3175ab750496ae4672964cceeb08 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.
 
 
 */
 
+
 #include "uploader.h"
 #include "dcpomatic_assert.h"
 #include "compose.hpp"
 
 #include "i18n.h"
 
+
 using std::string;
 using std::shared_ptr;
-using boost::function;
+using std::function;
+
 
 Uploader::Uploader (function<void (string)> set_status, function<void (float)> set_progress)
        : _set_progress (set_progress)
@@ -35,6 +38,7 @@ Uploader::Uploader (function<void (string)> set_status, function<void (float)> s
        _set_status (_("connecting"));
 }
 
+
 boost::uintmax_t
 Uploader::count_file_sizes (boost::filesystem::path directory) const
 {
@@ -42,40 +46,43 @@ Uploader::count_file_sizes (boost::filesystem::path directory) const
 
        boost::uintmax_t size = 0;
 
-       for (directory_iterator i = directory_iterator (directory); i != directory_iterator (); ++i) {
-               if (is_directory (i->path ())) {
-                       size += count_file_sizes (i->path ());
+       for (auto i: directory_iterator(directory)) {
+               if (is_directory (i.path())) {
+                       size += count_file_sizes (i.path());
                } else {
-                       size += file_size (*i);
+                       size += file_size (i);
                }
        }
 
        return size;
 }
 
+
 void
 Uploader::upload (boost::filesystem::path directory)
 {
        boost::uintmax_t transferred = 0;
-       upload_directory (directory.parent_path (), directory, transferred, count_file_sizes (directory));
+       upload_directory (directory.parent_path(), directory, transferred, count_file_sizes(directory));
 }
 
+
 void
 Uploader::upload_directory (boost::filesystem::path base, boost::filesystem::path directory, boost::uintmax_t& transferred, boost::uintmax_t total_size)
 {
        using namespace boost::filesystem;
 
-       create_directory (remove_prefix (base, directory));
-       for (directory_iterator i = directory_iterator (directory); i != directory_iterator (); ++i) {
-               if (is_directory (i->path ())) {
-                       upload_directory (base, i->path (), transferred, total_size);
+       create_directory (remove_prefix(base, directory));
+       for (auto i: directory_iterator(directory)) {
+               if (is_directory(i.path())) {
+                       upload_directory (base, i.path(), transferred, total_size);
                } else {
-                       _set_status (String::compose (_("copying %1"), i->path().leaf ()));
-                       upload_file (i->path (), remove_prefix (base, i->path ()), transferred, total_size);
+                       _set_status (String::compose(_("copying %1"), i.path().leaf()));
+                       upload_file (i.path(), remove_prefix (base, i.path()), transferred, total_size);
                }
        }
 }
 
+
 boost::filesystem::path
 Uploader::remove_prefix (boost::filesystem::path prefix, boost::filesystem::path target) const
 {
@@ -83,8 +90,8 @@ Uploader::remove_prefix (boost::filesystem::path prefix, boost::filesystem::path
 
        path result;
 
-       path::iterator i = target.begin ();
-       for (path::iterator j = prefix.begin (); j != prefix.end(); ++j) {
+       auto i = target.begin ();
+       for (auto j = prefix.begin (); j != prefix.end(); ++j) {
                DCPOMATIC_ASSERT (*i == *j);
                ++i;
        }
index f57ed8c4fe6f47034dc9ebe6fea99bbd4ff264d5..a68be8dd0b59169666f2e78851d9f481187decdf 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.
 
 
 */
 
+
 #ifndef DCPOMATIC_UPLOADER_H
 #define DCPOMATIC_UPLOADER_H
 
+
 #include <boost/filesystem.hpp>
-#include <boost/function.hpp>
+
 
 class Job;
 
+
 class Uploader
 {
 public:
-       Uploader (boost::function<void (std::string)> set_status, boost::function<void (float)> set_progress);
+       Uploader (std::function<void (std::string)> set_status, std::function<void (float)> set_progress);
        virtual ~Uploader () {}
 
        void upload (boost::filesystem::path directory);
@@ -39,14 +42,14 @@ protected:
        virtual void create_directory (boost::filesystem::path directory) = 0;
        virtual void upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size) = 0;
 
-       boost::function<void (float)> _set_progress;
+       std::function<void (float)> _set_progress;
 
 private:
        void upload_directory (boost::filesystem::path base, boost::filesystem::path directory, boost::uintmax_t& transferred, boost::uintmax_t total_size);
        boost::uintmax_t count_file_sizes (boost::filesystem::path) const;
        boost::filesystem::path remove_prefix (boost::filesystem::path prefix, boost::filesystem::path target) const;
 
-       boost::function<void (std::string)> _set_status;
+       std::function<void (std::string)> _set_status;
 };
 
 #endif
index 317108f41799a6a85f2feff1d4b38fdf7c54a9da..3b0c2d94f8c7e55ce2196a61e31e6c1f7f9290ee 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.
 
 
 */
 
+
 #include "upmixer_b.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
 
 #include "i18n.h"
 
+
 using std::string;
+using std::make_shared;
 using std::min;
 using std::vector;
 using std::shared_ptr;
 
+
 UpmixerB::UpmixerB (int sampling_rate)
        : _lfe (0.01, 150.0 / sampling_rate)
        , _delay (0.02 * sampling_rate)
@@ -36,6 +40,7 @@ UpmixerB::UpmixerB (int sampling_rate)
 
 }
 
+
 string
 UpmixerB::name () const
 {
@@ -49,25 +54,28 @@ UpmixerB::id () const
        return N_("stereo-5.1-upmix-b");
 }
 
+
 int
 UpmixerB::out_channels () const
 {
        return 6;
 }
 
+
 shared_ptr<AudioProcessor>
 UpmixerB::clone (int sampling_rate) const
 {
-       return shared_ptr<AudioProcessor> (new UpmixerB (sampling_rate));
+       return make_shared<UpmixerB>(sampling_rate);
 }
 
+
 shared_ptr<AudioBuffers>
 UpmixerB::run (shared_ptr<const AudioBuffers> in, int channels)
 {
-       shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames()));
+       auto out = make_shared<AudioBuffers>(channels, in->frames());
 
        /* L + R minus 6dB (in terms of amplitude) */
-       shared_ptr<AudioBuffers> in_LR = in->channel(0);
+       auto in_LR = in->channel(0);
        in_LR->accumulate_frames (in->channel(1).get(), in->frames(), 0, 0);
        in_LR->apply_gain (-6);
 
@@ -94,7 +102,7 @@ UpmixerB::run (shared_ptr<const AudioBuffers> in, int channels)
        shared_ptr<AudioBuffers> S;
        if (channels > 4) {
                /* Ls is L - R with some delay */
-               shared_ptr<AudioBuffers> sub (new AudioBuffers (1, in->frames()));
+               auto sub = make_shared<AudioBuffers>(1, in->frames());
                sub->copy_channel_from (in.get(), 0, 0);
                float* p = sub->data (0);
                float const * q = in->data (1);
@@ -113,6 +121,7 @@ UpmixerB::run (shared_ptr<const AudioBuffers> in, int channels)
        return out;
 }
 
+
 void
 UpmixerB::flush ()
 {
@@ -120,6 +129,7 @@ UpmixerB::flush ()
        _delay.flush ();
 }
 
+
 void
 UpmixerB::make_audio_mapping_default (AudioMapping& mapping) const
 {
@@ -130,11 +140,12 @@ UpmixerB::make_audio_mapping_default (AudioMapping& mapping) const
        }
 }
 
+
 vector<NamedChannel>
 UpmixerB::input_names () const
 {
-       vector<NamedChannel> n;
-       n.push_back (NamedChannel(_("Upmix L"), 0));
-       n.push_back (NamedChannel(_("Upmix R"), 1));
-       return n;
+       return {
+               NamedChannel(_("Upmix L"), 0),
+               NamedChannel(_("Upmix R"), 1)
+       };
 }
index c4c4fd1ac1535d605782b2f2c1fd66299eb95324..fc30e2a28e88bc7e08c3a082b23b8df9c926db99 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.
 
 
 */
 
+
 /** @file  src/lib/upmixer_b.h
  *  @brief UpmixerB class.
  */
 
+
 #include "audio_processor.h"
 #include "audio_filter.h"
 #include "audio_delay.h"
 
+
 class UpmixerB : public AudioProcessor
 {
 public:
@@ -44,3 +47,4 @@ private:
        LowPassAudioFilter _lfe;
        AudioDelay _delay;
 };
+
index 8a039764d0a77f4bec576e579b4b801c2f211ba3..2b686da698518495bd77cde42b8b6862213127df 100644 (file)
@@ -1040,7 +1040,7 @@ show_jobs_on_console (bool progress)
 
 /** XXX: could use mmap? */
 void
-copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)> progress)
+copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)> progress)
 {
        auto f = fopen_boost (from, "rb");
        if (!f) {
index a6b010e43a6011c9e256af37e2489b79173cc609..fa0d9fdf2383d778d8ffe18e0961f6788609e209 100644 (file)
@@ -118,7 +118,7 @@ extern size_t utf8_strlen (std::string s);
 extern std::string day_of_week_to_string (boost::gregorian::greg_weekday d);
 extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
 extern bool show_jobs_on_console (bool progress);
-extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)>);
+extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
 extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container);
 extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
 extern boost::filesystem::path default_font_file ();
index b749968a7c79f4388ea17c8de0b00444835b172a..bc299414bb8e72975e8399ee0ebc166041ed986a 100644 (file)
@@ -546,7 +546,7 @@ Writer::calculate_digests ()
                pool.create_thread (boost::bind (&boost::asio::io_service::run, &service));
        }
 
-       boost::function<void (float)> set_progress;
+       std::function<void (float)> set_progress;
        if (job) {
                set_progress = boost::bind (&Writer::set_digest_progress, this, job.get(), _1);
        } else {
@@ -948,7 +948,7 @@ Writer::set_digest_progress (Job* job, float progress)
 
 /** Calculate hashes for any referenced MXF assets which do not already have one */
 void
-Writer::calculate_referenced_digests (boost::function<void (float)> set_progress)
+Writer::calculate_referenced_digests (std::function<void (float)> set_progress)
 try
 {
        for (auto const& i: _reel_assets) {
index 0ff011fa1de22037b392db91bfd479010362a91f..1e25c3bdf644d455434622e761629af9fcc3cb90 100644 (file)
@@ -128,7 +128,7 @@ private:
        size_t video_reel (int frame) const;
        void set_digest_progress (Job* job, float progress);
        void write_cover_sheet (boost::filesystem::path output_dcp);
-       void calculate_referenced_digests (boost::function<void (float)> set_progress);
+       void calculate_referenced_digests (std::function<void (float)> set_progress);
        void write_hanging_text (ReelWriter& reel);
        void calculate_digests ();
 
index 56c1db7b106da239a88cccefe7e1c3df759bb5c6..714bebc3dae6194200b988134931100151982c55 100644 (file)
 
 */
 
+
 /** @file  src/tools/dcpomatic.cc
  *  @brief The main DCP-o-matic GUI.
  */
 
+
 #include "wx/standard_controls.h"
 #include "wx/film_viewer.h"
 #include "wx/film_editor.h"
@@ -112,21 +114,22 @@ DCPOMATIC_ENABLE_WARNINGS
 #undef check
 #endif
 
+
 using std::cout;
-using std::wcout;
+using std::dynamic_pointer_cast;
+using std::exception;
+using std::function;
+using std::list;
+using std::make_pair;
+using std::make_shared;
+using std::map;
+using std::shared_ptr;
 using std::string;
 using std::vector;
+using std::wcout;
 using std::wstring;
 using std::wstringstream;
-using std::map;
-using std::make_pair;
-using std::list;
-using std::exception;
-using std::make_shared;
-using std::shared_ptr;
-using std::dynamic_pointer_cast;
 using boost::optional;
-using boost::function;
 using boost::is_any_of;
 using boost::algorithm::find;
 #if BOOST_VERSION >= 106100
@@ -134,14 +137,15 @@ using namespace boost::placeholders;
 #endif
 using dcp::raw_convert;
 
+
 class FilmChangedClosingDialog
 {
 public:
        explicit FilmChangedClosingDialog (string name)
        {
                _dialog = new wxMessageDialog (
-                       0,
-                       wxString::Format (_("Save changes to film \"%s\" before closing?"), std_to_wx (name).data()),
+                       nullptr,
+                       wxString::Format(_("Save changes to film \"%s\" before closing?"), std_to_wx (name).data()),
                        /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
                        /// project (Film) has been changed since it was last saved.
                        _("Film changed"),
@@ -177,8 +181,8 @@ public:
        explicit FilmChangedDuplicatingDialog (string name)
        {
                _dialog = new wxMessageDialog (
-                       0,
-                       wxString::Format (_("Save changes to film \"%s\" before duplicating?"), std_to_wx (name).data()),
+                       nullptr,
+                       wxString::Format(_("Save changes to film \"%s\" before duplicating?"), std_to_wx (name).data()),
                        /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
                        /// project (Film) has been changed since it was last saved.
                        _("Film changed"),
@@ -207,6 +211,7 @@ private:
        wxMessageDialog* _dialog;
 };
 
+
 #define ALWAYS                        0x0
 #define NEEDS_FILM                    0x1
 #define NOT_DURING_DCP_CREATION       0x2
@@ -217,6 +222,7 @@ private:
 #define NEEDS_CLIPBOARD               0x40
 #define NEEDS_ENCRYPTION              0x80
 
+
 map<wxMenuItem*, int> menu_items;
 
 enum {
@@ -261,28 +267,15 @@ enum {
        ID_forward_frame
 };
 
+
 class DOMFrame : public wxFrame
 {
 public:
-       explicit DOMFrame (wxString const & title)
-               : wxFrame (NULL, -1, title)
-               , _video_waveform_dialog (0)
-               , _system_information_dialog (0)
-               , _hints_dialog (0)
-               , _servers_list_dialog (0)
-               , _config_dialog (0)
-               , _kdm_dialog (0)
-               , _dkdm_dialog (0)
-               , _templates_dialog (0)
-               , _file_menu (0)
-               , _history_items (0)
-               , _history_position (0)
-               , _history_separator (0)
-               , _update_news_requested (false)
-               , _first_shown_called (false)
+       explicit DOMFrame (wxString const& title)
+               : wxFrame (nullptr, -1, title)
        {
 #if defined(DCPOMATIC_WINDOWS)
-               if (Config::instance()->win32_console ()) {
+               if (Config::instance()->win32_console()) {
                        AllocConsole();
 
                        HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -309,7 +302,7 @@ public:
                SetIcon (wxIcon (std_to_wx ("id")));
 #endif
 
-               _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this, _1));
+               _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this, _1));
                config_changed (Config::OTHER);
 
                _analytics_message_connection = Analytics::instance()->Message.connect(boost::bind(&DOMFrame::analytics_message, this, _1, _2));
@@ -355,7 +348,7 @@ public:
                /* Use a panel as the only child of the Frame so that we avoid
                   the dark-grey background on Windows.
                */
-               wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
+               auto overall_panel = new wxPanel (this, wxID_ANY);
 
                _film_viewer.reset (new FilmViewer (overall_panel));
                _controls = new StandardControls (overall_panel, _film_viewer, true);
@@ -486,7 +479,7 @@ public:
                _controls->set_film (_film);
                if (_video_waveform_dialog) {
                        _video_waveform_dialog->Destroy ();
-                       _video_waveform_dialog = 0;
+                       _video_waveform_dialog = nullptr;
                }
                set_menu_sensitivity ();
                if (_film && _film->directory()) {
@@ -788,8 +781,8 @@ private:
                }
 
                /* Remove any existing DCP if the user agrees */
-               boost::filesystem::path const dcp_dir = _film->dir (_film->dcp_name(), false);
-               if (boost::filesystem::exists (dcp_dir)) {
+               auto const dcp_dir = _film->dir (_film->dcp_name(), false);
+               if (boost::filesystem::exists(dcp_dir)) {
                        if (!confirm_dialog (this, wxString::Format (_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) {
                                return;
                        }
@@ -832,7 +825,7 @@ private:
 
                if (_dkdm_dialog) {
                        _dkdm_dialog->Destroy ();
-                       _dkdm_dialog = 0;
+                       _dkdm_dialog = nullptr;
                }
 
                _dkdm_dialog = new DKDMDialog (this, _film);
@@ -967,7 +960,7 @@ private:
                if (kdm) {
                        if (d->internal ()) {
                                auto dkdms = Config::instance()->dkdms();
-                               dkdms->add (shared_ptr<DKDM> (new DKDM (kdm.get())));
+                               dkdms->add (make_shared<DKDM>(kdm.get()));
                                Config::instance()->changed ();
                        } else {
                                auto path = d->directory() / (_film->dcp_name(false) + "_DKDM.xml");
@@ -1525,26 +1518,27 @@ private:
        FilmEditor* _film_editor;
        std::shared_ptr<FilmViewer> _film_viewer;
        StandardControls* _controls;
-       VideoWaveformDialog* _video_waveform_dialog;
-       SystemInformationDialog* _system_information_dialog;
-       HintsDialog* _hints_dialog;
-       ServersListDialog* _servers_list_dialog;
-       wxPreferencesEditor* _config_dialog;
-       KDMDialog* _kdm_dialog;
-       DKDMDialog* _dkdm_dialog;
-       TemplatesDialog* _templates_dialog;
-       wxMenu* _file_menu;
+       VideoWaveformDialog* _video_waveform_dialog = nullptr;
+       SystemInformationDialog* _system_information_dialog = nullptr;
+       HintsDialog* _hints_dialog = nullptr;
+       ServersListDialog* _servers_list_dialog = nullptr;
+       wxPreferencesEditor* _config_dialog = nullptr;
+       KDMDialog* _kdm_dialog = nullptr;
+       DKDMDialog* _dkdm_dialog = nullptr;
+       TemplatesDialog* _templates_dialog = nullptr;
+       wxMenu* _file_menu = nullptr;
        shared_ptr<Film> _film;
-       int _history_items;
-       int _history_position;
-       wxMenuItem* _history_separator;
+       int _history_items = 0;
+       int _history_position = 0;
+       wxMenuItem* _history_separator = nullptr;
        boost::signals2::scoped_connection _config_changed_connection;
        boost::signals2::scoped_connection _analytics_message_connection;
-       bool _update_news_requested;
+       bool _update_news_requested = false;
        shared_ptr<Content> _clipboard;
-       bool _first_shown_called;
+       bool _first_shown_called = false;
 };
 
+
 static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_OPTION, "c", "content", "add content file / directory", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
@@ -1555,6 +1549,7 @@ static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
 };
 
+
 /** @class App
  *  @brief The magic App class for wxWidgets.
  */
@@ -1563,8 +1558,6 @@ class App : public wxApp
 public:
        App ()
                : wxApp ()
-               , _frame (0)
-               , _splash (0)
        {
 #ifdef DCPOMATIC_LINUX
                XInitThreads ();
@@ -1641,23 +1634,23 @@ private:
                        signal_manager = new wxSignalManager (this);
                        Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
 
-                       if (!_film_to_load.empty() && boost::filesystem::is_directory (_film_to_load)) {
+                       if (!_film_to_load.empty() && boost::filesystem::is_directory(_film_to_load)) {
                                try {
                                        _frame->load_film (_film_to_load);
                                } catch (exception& e) {
-                                       error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what()));
+                                       error_dialog (nullptr, std_to_wx(String::compose(wx_to_std(_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what()));
                                }
                        }
 
                        if (!_film_to_create.empty ()) {
-                               _frame->new_film (_film_to_create, optional<string> ());
-                               if (!_content_to_add.empty ()) {
+                               _frame->new_film (_film_to_create, optional<string>());
+                               if (!_content_to_add.empty()) {
                                        for (auto i: content_factory(_content_to_add)) {
-                                               _frame->film()->examine_and_add_content (i);
+                                               _frame->film()->examine_and_add_content(i);
                                        }
                                }
                                if (!_dcp_to_add.empty ()) {
-                                       _frame->film()->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent(_dcp_to_add)));
+                                       _frame->film()->examine_and_add_content(make_shared<DCPContent>(_dcp_to_add));
                                }
                        }
 
@@ -1867,8 +1860,8 @@ private:
                }
        }
 
-       DOMFrame* _frame;
-       wxSplashScreen* _splash;
+       DOMFrame* _frame = nullptr;
+       wxSplashScreen* _splash = nullptr;
        shared_ptr<wxTimer> _timer;
        string _film_to_load;
        string _film_to_create;
@@ -1876,4 +1869,5 @@ private:
        string _dcp_to_add;
 };
 
+
 IMPLEMENT_APP (App)
index 576e979e9f8fd4bef6f7474588aebded8fa948d4..a81e8a65cf46b5cea0361dc94e5730f8a8166651 100644 (file)
@@ -36,7 +36,7 @@ using std::make_shared;
 using boost::bind;
 using boost::optional;
 using std::shared_ptr;
-using boost::function;
+using std::function;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
index 818ab4def911545f714138859779832495f436f2..dd0e92152f191b936dc7ccf8d15a73f5645a7cc5 100644 (file)
@@ -113,9 +113,9 @@ public:
                wxWindow* parent,
                wxString title,
                int border,
-               boost::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
-               boost::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
-               boost::function<bool (void)> nag_alter
+               std::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
+               std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
+               std::function<bool (void)> nag_alter
                );
 
        void add_button (wxWindow* button);
@@ -144,9 +144,9 @@ private:
        wxStaticText* _private_key_bad;
        wxSizer* _sizer;
        wxBoxSizer* _button_sizer;
-       boost::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
-       boost::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
-       boost::function<bool (void)> _nag_alter;
+       std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
+       std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
+       std::function<bool (void)> _nag_alter;
 };
 
 class KeysPage : public Page
index 2a2bc9cf7549779621effe09ca75f15902a7b565..34755e4b5a7e1707b710f45487bc9cdf4934dfd3 100644 (file)
@@ -30,7 +30,6 @@
 #include <wx/wx.h>
 #include <wx/gbsizer.h>
 #include <wx/spinctrl.h>
-#include <boost/function.hpp>
 #include <vector>
 
 /** @class ContentWidget
@@ -60,12 +59,12 @@ public:
                wxWindow* parent,
                T* wrapped,
                int property,
-               boost::function<std::shared_ptr<S> (Content*)> part,
-               boost::function<U (S*)> model_getter,
-               boost::function<void (S*, U)> model_setter,
-               boost::function<void ()> view_changed,
-               boost::function<U (V)> view_to_model,
-               boost::function<V (U)> model_to_view
+               std::function<std::shared_ptr<S> (Content*)> part,
+               std::function<U (S*)> model_getter,
+               std::function<void (S*, U)> model_setter,
+               std::function<void ()> view_changed,
+               std::function<U (V)> view_to_model,
+               std::function<V (U)> model_to_view
                )
                : _wrapped (wrapped)
                , _sizer (0)
@@ -217,12 +216,12 @@ private:
        wxButton* _button;
        List _content;
        int _property;
-       boost::function<std::shared_ptr<S> (Content *)> _part;
-       boost::function<U (S*)> _model_getter;
-       boost::function<void (S*, U)> _model_setter;
-       boost::function<void ()> _view_changed;
-       boost::function<U (V)> _view_to_model;
-       boost::function<V (U)> _model_to_view;
+       std::function<std::shared_ptr<S> (Content *)> _part;
+       std::function<U (S*)> _model_getter;
+       std::function<void (S*, U)> _model_setter;
+       std::function<void ()> _view_changed;
+       std::function<U (V)> _view_to_model;
+       std::function<V (U)> _model_to_view;
        std::list<boost::signals2::connection> _connections;
        bool _ignore_model_changes;
 };
@@ -241,10 +240,10 @@ public:
                wxWindow* parent,
                wxSpinCtrl* wrapped,
                int property,
-               boost::function<std::shared_ptr<S> (Content *)> part,
-               boost::function<int (S*)> getter,
-               boost::function<void (S*, int)> setter,
-               boost::function<void ()> view_changed = boost::function<void ()>()
+               std::function<std::shared_ptr<S> (Content *)> part,
+               std::function<int (S*)> getter,
+               std::function<void (S*, int)> setter,
+               std::function<void ()> view_changed = std::function<void ()>()
                )
                : ContentWidget<S, wxSpinCtrl, int, int> (
                        parent,
@@ -269,10 +268,10 @@ public:
                wxWindow* parent,
                wxSpinCtrlDouble* wrapped,
                int property,
-               boost::function<std::shared_ptr<S> (Content *)> part,
-               boost::function<double (S*)> getter,
-               boost::function<void (S*, double)> setter,
-               boost::function<void ()> view_changed = boost::function<void ()>()
+               std::function<std::shared_ptr<S> (Content *)> part,
+               std::function<double (S*)> getter,
+               std::function<void (S*, double)> setter,
+               std::function<void ()> view_changed = std::function<void ()>()
                )
                : ContentWidget<S, wxSpinCtrlDouble, double, double> (
                        parent,
@@ -297,12 +296,12 @@ public:
                wxWindow* parent,
                wxChoice* wrapped,
                int property,
-               boost::function<std::shared_ptr<S> (Content *)> part,
-               boost::function<U (S*)> getter,
-               boost::function<void (S*, U)> setter,
-               boost::function<U (int)> view_to_model,
-               boost::function<int (U)> model_to_view,
-               boost::function<void ()> view_changed = boost::function<void()>()
+               std::function<std::shared_ptr<S> (Content *)> part,
+               std::function<U (S*)> getter,
+               std::function<void (S*, U)> setter,
+               std::function<U (int)> view_to_model,
+               std::function<int (U)> model_to_view,
+               std::function<void ()> view_changed = std::function<void()>()
                )
                : ContentWidget<S, wxChoice, U, int> (
                        parent,
index 9032b1f81ef5860f7092c4ec3be2f284ad41a56f..77c18e3c1ddd0459cfeeb5546f81d8c7a32db340 100644 (file)
@@ -24,7 +24,7 @@
 #include "wx_util.h"
 
 using std::string;
-using boost::function;
+using std::function;
 using boost::optional;
 
 CredentialsDownloadCertificatePanel::CredentialsDownloadCertificatePanel (
index 68472462a100cdad7f8552a46d06f309d67d9257..b802768e924bd5cfed44d8553819016bc1076e6f 100644 (file)
@@ -22,7 +22,6 @@
 #define CREDENTIALS_DOWNLOAD_CERTIFICATE_PANEL_H
 
 #include "download_certificate_panel.h"
-#include <boost/function.hpp>
 
 class PasswordEntry;
 
@@ -31,12 +30,12 @@ class CredentialsDownloadCertificatePanel : public DownloadCertificatePanel
 public:
        CredentialsDownloadCertificatePanel (
                        DownloadCertificateDialog* dialog,
-                       boost::function<boost::optional<std::string> ()> get_username,
-                       boost::function<void (std::string)> set_username,
-                       boost::function<void ()> unset_username,
-                       boost::function<boost::optional<std::string> ()> get_password,
-                       boost::function<void (std::string)> set_password,
-                       boost::function<void ()> unset_password
+                       std::function<boost::optional<std::string> ()> get_username,
+                       std::function<void (std::string)> set_username,
+                       std::function<void ()> unset_username,
+                       std::function<boost::optional<std::string> ()> get_password,
+                       std::function<void (std::string)> set_password,
+                       std::function<void ()> unset_password
                        );
 
        virtual bool ready_to_download () const;
@@ -45,12 +44,12 @@ private:
        void username_changed ();
        void password_changed ();
 
-       boost::function<boost::optional<std::string> (void)> _get_username;
-       boost::function<void (std::string)> _set_username;
-       boost::function<void ()> _unset_username;
-       boost::function<boost::optional<std::string> (void)> _get_password;
-       boost::function<void (std::string)> _set_password;
-       boost::function<void ()> _unset_password;
+       std::function<boost::optional<std::string> (void)> _get_username;
+       std::function<void (std::string)> _set_username;
+       std::function<void ()> _unset_username;
+       std::function<boost::optional<std::string> (void)> _get_password;
+       std::function<void (std::string)> _set_password;
+       std::function<void ()> _unset_password;
 
        wxTextCtrl* _username;
        PasswordEntry* _password;
index 964662f0e7647766038cbd02e914ca53975813b1..cf6189efa7192a961f5727a224441ef543fb9fe4 100644 (file)
@@ -45,7 +45,7 @@ using std::list;
 using std::exception;
 using std::make_pair;
 using std::shared_ptr;
-using boost::function;
+using std::function;
 
 
 DKDMOutputPanel::DKDMOutputPanel (wxWindow* parent)
index 57a9418188dc65939532549975dfdb9ea10925a4..43e66a172dd4c5255896d02b9e5768affa5c4735 100644 (file)
@@ -44,7 +44,7 @@ public:
        std::pair<std::shared_ptr<Job>, int> make (
                std::list<KDMWithMetadataPtr > kdms,
                std::string name,
-               boost::function<bool (boost::filesystem::path)> confirm_overwrite
+               std::function<bool (boost::filesystem::path)> confirm_overwrite
                );
 
 private:
index 68be51a07eac06b52f9b78808c6f680d3a4dd76e..817867cc108055bfb2d37d3747c6484047dbad24 100644 (file)
 #include "download_certificate_dialog.h"
 #include "wx_util.h"
 #include "lib/compose.hpp"
-#include "lib/util.h"
-#include "lib/signal_manager.h"
 #include "lib/internet.h"
+#include "lib/signal_manager.h"
+#include "lib/util.h"
 #include <dcp/raw_convert.h>
 #include <curl/curl.h>
 #include <zip.h>
 #include <iostream>
 
 
-using std::string;
 using std::cout;
+using std::function;
 using std::list;
-using boost::function;
+using std::string;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
index b9680e2983f9325a0c9679b10c1da8f8930c5bce..c30b050081db913327807ff6ec36ae66fa075892 100644 (file)
 */
 
 
-#include "wx_util.h"
-#include "download_certificate_panel.h"
 #include "download_certificate_dialog.h"
-#include "lib/signal_manager.h"
+#include "download_certificate_panel.h"
+#include "wx_util.h"
 #include "lib/compose.hpp"
-#include <dcp/util.h>
+#include "lib/signal_manager.h"
 #include <dcp/certificate_chain.h>
 #include <dcp/exceptions.h>
+#include <dcp/util.h>
 #include <boost/bind/bind.hpp>
 
 
 using std::string;
-using boost::function;
 using boost::optional;
 
 
index f90d219f81a9a0f7defc398f287efa478edd2ab8..3f2ea0ca2fe0afad40f7a1e2b5512e6c817282ac 100644 (file)
@@ -25,7 +25,6 @@
 #include "dcpomatic_button.h"
 #include <wx/wx.h>
 #include <wx/listctrl.h>
-#include <boost/function.hpp>
 #include <vector>
 
 class EditableListColumn
@@ -60,9 +59,9 @@ public:
        EditableList (
                wxWindow* parent,
                std::vector<EditableListColumn> columns,
-               boost::function<std::vector<T> ()> get,
-               boost::function<void (std::vector<T>)> set,
-               boost::function<std::string (T, int)> column,
+               std::function<std::vector<T> ()> get,
+               std::function<void (std::vector<T>)> set,
+               std::function<std::string (T, int)> column,
                bool can_edit = true,
                bool title = true
                )
@@ -289,10 +288,10 @@ private:
                ev.Skip ();
        }
 
-       boost::function <std::vector<T> ()> _get;
-       boost::function <void (std::vector<T>)> _set;
+       std::function <std::vector<T> ()> _get;
+       std::function <void (std::vector<T>)> _set;
        std::vector<EditableListColumn> _columns;
-       boost::function<std::string (T, int)> _column;
+       std::function<std::string (T, int)> _column;
 
        wxButton* _add;
        wxButton* _edit;
index 767676fff100c76260fbd6ac083f446dd9d94e16..d604f678df508908b54e27b076d7536d2e054a10 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.
 
 
 */
 
+
 /** @file src/wx/film_editor.cc
  *  @brief FilmEditor class.
  */
 
+
 #include "wx_util.h"
 #include "film_editor.h"
 #include "dcp_panel.h"
@@ -34,6 +36,7 @@
 #include <wx/notebook.h>
 #include <iostream>
 
+
 using std::cout;
 using std::string;
 using std::list;
@@ -44,10 +47,11 @@ using boost::optional;
 using namespace boost::placeholders;
 #endif
 
+
 FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer)
        : wxPanel (parent)
 {
-       wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+       auto s = new wxBoxSizer (wxVERTICAL);
 
        _main_notebook = new wxNotebook (this, wxID_ANY);
        s->Add (_main_notebook, 1);
@@ -58,7 +62,7 @@ FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer)
        _main_notebook->AddPage (_dcp_panel->panel (), _("DCP"), false);
 
        JobManager::instance()->ActiveJobsChanged.connect (
-               bind (&FilmEditor::active_jobs_changed, this, _2)
+               bind(&FilmEditor::active_jobs_changed, this, _2)
                );
 
        set_film (shared_ptr<Film> ());
@@ -92,6 +96,7 @@ FilmEditor::film_change (ChangeType type, Film::Property p)
        }
 }
 
+
 void
 FilmEditor::film_content_change (ChangeType type, int property)
 {
@@ -112,11 +117,12 @@ FilmEditor::film_content_change (ChangeType type, int property)
        _dcp_panel->film_content_changed (property);
 }
 
+
 /** Sets the Film that we are editing */
 void
 FilmEditor::set_film (shared_ptr<Film> film)
 {
-       set_general_sensitivity (film != 0);
+       set_general_sensitivity (film != nullptr);
 
        if (_film == film) {
                return;
@@ -132,8 +138,8 @@ FilmEditor::set_film (shared_ptr<Film> film)
                return;
        }
 
-       _film->Change.connect (bind (&FilmEditor::film_change, this, _1, _2));
-       _film->ContentChange.connect (bind (&FilmEditor::film_content_change, this, _1, _3));
+       _film->Change.connect (bind(&FilmEditor::film_change, this, _1, _2));
+       _film->ContentChange.connect (bind(&FilmEditor::film_content_change, this, _1, _3));
 
        if (_film->directory()) {
                FileChanged (_film->directory().get());
@@ -142,10 +148,11 @@ FilmEditor::set_film (shared_ptr<Film> film)
        }
 
        if (!_film->content().empty()) {
-               _content_panel->set_selection (_film->content().front ());
+               _content_panel->set_selection (_film->content().front());
        }
 }
 
+
 void
 FilmEditor::set_general_sensitivity (bool s)
 {
@@ -153,6 +160,7 @@ FilmEditor::set_general_sensitivity (bool s)
        _dcp_panel->set_general_sensitivity (s);
 }
 
+
 void
 FilmEditor::active_jobs_changed (optional<string> j)
 {
index a5232d2e54681bfb330f32c68c1694d6cec316ec..6aff127d8a6cfe4156a478e8a971220aad133fae 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.
 
 
 */
 
+
 /** @file src/wx/film_editor.h
  *  @brief FilmEditor class.
  */
 
+
 #include "lib/film.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
@@ -29,12 +31,14 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/signals2.hpp>
 
+
 class wxNotebook;
 class Film;
 class ContentPanel;
 class DCPPanel;
 class FilmViewer;
 
+
 /** @class FilmEditor
  *  @brief A wx widget to edit a film's metadata, and perform various functions.
  */
index 155472a38edd82f5f0c3e019533aaef67d16fe65..dd8da276037bf2a1d0d668d67d7483de7741ff1f 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.
 
 
 */
 
+
 /** @file src/full_config_dialog.cc
  *  @brief A dialogue to edit all DCP-o-matic configuration.
  */
 
-#include "full_config_dialog.h"
-#include "wx_util.h"
-#include "editable_list.h"
-#include "filter_dialog.h"
+
+#include "check_box.h"
+#include "config_dialog.h"
+#include "config_move_dialog.h"
+#include "dcpomatic_button.h"
 #include "dir_picker_ctrl.h"
+#include "editable_list.h"
+#include "email_dialog.h"
 #include "file_picker_ctrl.h"
-#include "server_dialog.h"
+#include "filter_dialog.h"
+#include "full_config_dialog.h"
 #include "make_chain_dialog.h"
-#include "email_dialog.h"
-#include "name_format_editor.h"
 #include "nag_dialog.h"
-#include "config_move_dialog.h"
-#include "config_dialog.h"
-#include "static_text.h"
-#include "check_box.h"
-#include "dcpomatic_button.h"
+#include "name_format_editor.h"
 #include "password_entry.h"
+#include "server_dialog.h"
+#include "static_text.h"
+#include "wx_util.h"
 #include "lib/config.h"
-#include "lib/ratio.h"
-#include "lib/filter.h"
+#include "lib/cross.h"
 #include "lib/dcp_content_type.h"
+#include "lib/exceptions.h"
+#include "lib/filter.h"
 #include "lib/log.h"
+#include "lib/ratio.h"
 #include "lib/util.h"
-#include "lib/cross.h"
-#include "lib/exceptions.h"
-#include <dcp/locale_convert.h>
-#include <dcp/exceptions.h>
 #include <dcp/certificate_chain.h>
-#include <wx/stdpaths.h>
+#include <dcp/exceptions.h>
+#include <dcp/locale_convert.h>
+#include <wx/filepicker.h>
 #include <wx/preferences.h>
 #include <wx/spinctrl.h>
-#include <wx/filepicker.h>
+#include <wx/stdpaths.h>
 #include <RtAudio.h>
 #include <boost/filesystem.hpp>
 #include <iostream>
 
-using std::vector;
-using std::string;
-using std::list;
+
 using std::cout;
-using std::pair;
+using std::function;
+using std::list;
 using std::make_pair;
 using std::map;
-using boost::bind;
+using std::pair;
 using std::shared_ptr;
-using boost::function;
+using std::string;
+using std::vector;
+using boost::bind;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using dcp::locale_convert;
 
+
 class FullGeneralPage : public GeneralPage
 {
 public:
@@ -84,7 +88,7 @@ public:
 private:
        void setup ()
        {
-               wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
 
                int r = 0;
@@ -124,8 +128,8 @@ private:
 
                add_update_controls (table, r);
 
-               _config_file->Bind  (wxEVT_FILEPICKER_CHANGED, boost::bind (&FullGeneralPage::config_file_changed,   this));
-               _cinemas_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind (&FullGeneralPage::cinemas_file_changed,  this));
+               _config_file->Bind  (wxEVT_FILEPICKER_CHANGED, boost::bind(&FullGeneralPage::config_file_changed,  this));
+               _cinemas_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind(&FullGeneralPage::cinemas_file_changed, this));
 
                _master_encoding_threads->SetRange (1, 128);
                _master_encoding_threads->Bind (wxEVT_SPINCTRL, boost::bind (&FullGeneralPage::master_encoding_threads_changed, this));
@@ -141,7 +145,7 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
                checked_set (_master_encoding_threads, config->master_encoding_threads ());
                checked_set (_server_encoding_threads, config->server_encoding_threads ());
@@ -157,8 +161,8 @@ private:
 
        void export_cinemas_file ()
        {
-               wxFileDialog* d = new wxFileDialog (
-                       _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT ("XML files (*.xml)|*.xml"),
+               auto d = new wxFileDialog (
+                       _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"),
                        wxFD_SAVE | wxFD_OVERWRITE_PROMPT
                 );
 
@@ -171,35 +175,35 @@ private:
 #ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
        void analyse_ebur128_changed ()
        {
-               Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue ());
+               Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue());
        }
 #endif
 
        void automatic_audio_analysis_changed ()
        {
-               Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue ());
+               Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue());
        }
 
        void master_encoding_threads_changed ()
        {
-               Config::instance()->set_master_encoding_threads (_master_encoding_threads->GetValue ());
+               Config::instance()->set_master_encoding_threads (_master_encoding_threads->GetValue());
        }
 
        void server_encoding_threads_changed ()
        {
-               Config::instance()->set_server_encoding_threads (_server_encoding_threads->GetValue ());
+               Config::instance()->set_server_encoding_threads (_server_encoding_threads->GetValue());
        }
 
        void config_file_changed ()
        {
-               Config* config = Config::instance();
+               auto config = Config::instance();
                boost::filesystem::path new_file = wx_to_std(_config_file->GetPath());
                if (new_file == config->config_file()) {
                        return;
                }
                bool copy_and_link = true;
                if (boost::filesystem::exists(new_file)) {
-                       ConfigMoveDialog* d = new ConfigMoveDialog (_panel, new_file);
+                       auto d = new ConfigMoveDialog (_panel, new_file);
                        if (d->ShowModal() == wxID_OK) {
                                copy_and_link = false;
                        }
@@ -231,6 +235,7 @@ private:
        wxCheckBox* _automatic_audio_analysis;
 };
 
+
 class DefaultsPage : public Page
 {
 public:
@@ -253,13 +258,13 @@ public:
 private:
        void setup ()
        {
-               wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                table->AddGrowableCol (1, 1);
                _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
 
                {
                        add_label_to_sizer (table, _panel, _("Default duration of still images"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+                       auto s = new wxBoxSizer (wxHORIZONTAL);
                        _still_length = new wxSpinCtrl (_panel);
                        s->Add (_still_length);
                        add_label_to_sizer (s, _panel, _("s"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -288,7 +293,7 @@ private:
 
                {
                        add_label_to_sizer (table, _panel, _("Default JPEG2000 bandwidth"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+                       auto s = new wxBoxSizer (wxHORIZONTAL);
                        _j2k_bandwidth = new wxSpinCtrl (_panel);
                        s->Add (_j2k_bandwidth);
                        add_label_to_sizer (s, _panel, _("Mbit/s"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -297,7 +302,7 @@ private:
 
                {
                        add_label_to_sizer (table, _panel, _("Default audio delay"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+                       auto s = new wxBoxSizer (wxHORIZONTAL);
                        _audio_delay = new wxSpinCtrl (_panel);
                        s->Add (_audio_delay);
                        add_label_to_sizer (s, _panel, _("ms"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -351,18 +356,18 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
-               vector<Ratio const *> containers = Ratio::containers ();
+               auto containers = Ratio::containers ();
                for (size_t i = 0; i < containers.size(); ++i) {
-                       if (containers[i] == config->default_container ()) {
+                       if (containers[i] == config->default_container()) {
                                _container->SetSelection (i);
                        }
                }
 
-               vector<DCPContentType const *> const ct = DCPContentType::all ();
+               auto const ct = DCPContentType::all ();
                for (size_t i = 0; i < ct.size(); ++i) {
-                       if (ct[i] == config->default_dcp_content_type ()) {
+                       if (ct[i] == config->default_dcp_content_type()) {
                                _dcp_content_type->SetSelection (i);
                        }
                }
@@ -392,7 +397,7 @@ private:
                int const s = _dcp_audio_channels->GetSelection ();
                if (s != wxNOT_FOUND) {
                        Config::instance()->set_default_dcp_audio_channels (
-                               locale_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s)))
+                               locale_convert<int>(string_client_data(_dcp_audio_channels->GetClientObject(s)))
                                );
                }
        }
@@ -414,13 +419,13 @@ private:
 
        void container_changed ()
        {
-               vector<Ratio const *> ratio = Ratio::containers ();
+               auto ratio = Ratio::containers ();
                Config::instance()->set_default_container (ratio[_container->GetSelection()]);
        }
 
        void dcp_content_type_changed ()
        {
-               vector<DCPContentType const *> ct = DCPContentType::all ();
+               auto ct = DCPContentType::all ();
                Config::instance()->set_default_dcp_content_type (ct[_dcp_content_type->GetSelection()]);
        }
 
@@ -445,6 +450,7 @@ private:
        wxChoice* _standard;
 };
 
+
 class EncodingServersPage : public Page
 {
 public:
@@ -482,7 +488,7 @@ private:
 
                _panel->GetSizer()->Add (_servers_list, 1, wxEXPAND | wxALL, _border);
 
-               _use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind (&EncodingServersPage::use_any_servers_changed, this));
+               _use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind(&EncodingServersPage::use_any_servers_changed, this));
        }
 
        void config_changed ()
@@ -505,6 +511,7 @@ private:
        EditableList<string, ServerDialog>* _servers_list;
 };
 
+
 class TMSPage : public Page
 {
 public:
@@ -567,7 +574,7 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
                checked_set (_upload, config->upload_after_make_dcp());
                checked_set (_tms_protocol, static_cast<int>(config->tms_protocol()));
@@ -615,11 +622,6 @@ private:
        PasswordEntry* _tms_password;
 };
 
-static string
-column (string s)
-{
-       return s;
-}
 
 class EmailPage : public Page
 {
@@ -643,7 +645,7 @@ public:
 private:
        void setup ()
        {
-               wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                table->AddGrowableCol (1, 1);
                _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border);
 
@@ -675,19 +677,19 @@ private:
                _password = new PasswordEntry (_panel);
                table->Add (_password->get_panel(), 1, wxEXPAND | wxALL);
 
-               _server->Bind (wxEVT_TEXT, boost::bind (&EmailPage::server_changed, this));
-               _port->Bind (wxEVT_SPINCTRL, boost::bind (&EmailPage::port_changed, this));
-               _protocol->Bind (wxEVT_CHOICE, boost::bind (&EmailPage::protocol_changed, this));
-               _user->Bind (wxEVT_TEXT, boost::bind (&EmailPage::user_changed, this));
-               _password->Changed.connect (boost::bind (&EmailPage::password_changed, this));
+               _server->Bind (wxEVT_TEXT, boost::bind(&EmailPage::server_changed, this));
+               _port->Bind (wxEVT_SPINCTRL, boost::bind(&EmailPage::port_changed, this));
+               _protocol->Bind (wxEVT_CHOICE, boost::bind(&EmailPage::protocol_changed, this));
+               _user->Bind (wxEVT_TEXT, boost::bind(&EmailPage::user_changed, this));
+               _password->Changed.connect (boost::bind(&EmailPage::password_changed, this));
        }
 
        void config_changed ()
        {
                auto config = Config::instance ();
 
-               checked_set (_server, config->mail_server ());
-               checked_set (_port, config->mail_port ());
+               checked_set (_server, config->mail_server());
+               checked_set (_port, config->mail_port());
                switch (config->mail_protocol()) {
                case EmailProtocol::AUTO:
                        checked_set (_protocol, 0);
@@ -702,18 +704,18 @@ private:
                        checked_set (_protocol, 3);
                        break;
                }
-               checked_set (_user, config->mail_user ());
+               checked_set (_user, config->mail_user());
                checked_set (_password, config->mail_password());
        }
 
        void server_changed ()
        {
-               Config::instance()->set_mail_server (wx_to_std (_server->GetValue ()));
+               Config::instance()->set_mail_server(wx_to_std(_server->GetValue()));
        }
 
        void port_changed ()
        {
-               Config::instance()->set_mail_port (_port->GetValue ());
+               Config::instance()->set_mail_port(_port->GetValue());
        }
 
        void protocol_changed ()
@@ -751,6 +753,7 @@ private:
        PasswordEntry* _password;
 };
 
+
 class KDMEmailPage : public Page
 {
 public:
@@ -799,8 +802,9 @@ private:
                        columns,
                        bind (&Config::kdm_cc, Config::instance()),
                        bind (&Config::set_kdm_cc, Config::instance(), _1),
-                       bind (&column, _1)
-                       );
+                       [] (string s, int) {
+                               return s;
+                       });
                table->Add (_cc, 1, wxEXPAND | wxALL);
 
                add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -872,6 +876,7 @@ private:
        wxButton* _reset_email;
 };
 
+
 class NotificationsPage : public Page
 {
 public:
@@ -899,7 +904,7 @@ public:
 private:
        void setup ()
        {
-               wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                table->AddGrowableCol (1, 1);
                _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border);
 
@@ -931,8 +936,9 @@ private:
                        columns,
                        bind (&Config::notification_cc, Config::instance()),
                        bind (&Config::set_notification_cc, Config::instance(), _1),
-                       bind (&column, _1)
-                       );
+                       [] (string s, int) {
+                               return s;
+                       });
                table->Add (_cc, 1, wxEXPAND | wxALL);
 
                add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -974,7 +980,7 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
                checked_set (_enable_message_box, config->notification(Config::MESSAGE_BOX));
                checked_set (_enable_email, config->notification(Config::EMAIL));
@@ -989,39 +995,39 @@ private:
 
        void notification_subject_changed ()
        {
-               Config::instance()->set_notification_subject (wx_to_std (_subject->GetValue ()));
+               Config::instance()->set_notification_subject(wx_to_std(_subject->GetValue()));
        }
 
        void notification_from_changed ()
        {
-               Config::instance()->set_notification_from (wx_to_std (_from->GetValue ()));
+               Config::instance()->set_notification_from(wx_to_std(_from->GetValue()));
        }
 
        void notification_to_changed ()
        {
-               Config::instance()->set_notification_to (wx_to_std (_to->GetValue ()));
+               Config::instance()->set_notification_to(wx_to_std(_to->GetValue()));
        }
 
        void notification_bcc_changed ()
        {
-               Config::instance()->set_notification_bcc (wx_to_std (_bcc->GetValue ()));
+               Config::instance()->set_notification_bcc(wx_to_std(_bcc->GetValue()));
        }
 
        void notification_email_changed ()
        {
-               if (_email->GetValue().IsEmpty ()) {
+               if (_email->GetValue().IsEmpty()) {
                        /* Sometimes we get sent an erroneous notification that the email
                           is empty; I don't know why.
                        */
                        return;
                }
-               Config::instance()->set_notification_email (wx_to_std (_email->GetValue ()));
+               Config::instance()->set_notification_email(wx_to_std(_email->GetValue()));
        }
 
        void reset_email ()
        {
-               Config::instance()->reset_notification_email ();
-               checked_set (_email, Config::instance()->notification_email ());
+               Config::instance()->reset_notification_email();
+               checked_set (_email, Config::instance()->notification_email());
        }
 
        void type_changed (wxCheckBox* b, Config::Notification n)
@@ -1042,6 +1048,7 @@ private:
        wxButton* _reset_email;
 };
 
+
 class CoverSheetPage : public Page
 {
 public:
@@ -1082,7 +1089,7 @@ private:
 
        void config_changed ()
        {
-               checked_set (_cover_sheet, Config::instance()->cover_sheet ());
+               checked_set (_cover_sheet, Config::instance()->cover_sheet());
        }
 
        void cover_sheet_changed ()
@@ -1093,13 +1100,13 @@ private:
                        */
                        return;
                }
-               Config::instance()->set_cover_sheet (wx_to_std (_cover_sheet->GetValue ()));
+               Config::instance()->set_cover_sheet(wx_to_std(_cover_sheet->GetValue()));
        }
 
        void reset_cover_sheet ()
        {
-               Config::instance()->reset_cover_sheet ();
-               checked_set (_cover_sheet, Config::instance()->cover_sheet ());
+               Config::instance()->reset_cover_sheet();
+               checked_set (_cover_sheet, Config::instance()->cover_sheet());
        }
 
        wxTextCtrl* _cover_sheet;
@@ -1129,7 +1136,7 @@ public:
 private:
        void setup ()
        {
-               wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                table->AddGrowableCol (1, 1);
 
                add_label_to_sizer (table, _panel, _("Issuer"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -1174,7 +1181,7 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
                checked_set (_issuer, config->dcp_issuer ());
                checked_set (_creator, config->dcp_creator ());
                checked_set (_company_name, config->dcp_company_name ());
@@ -1185,27 +1192,27 @@ private:
 
        void issuer_changed ()
        {
-               Config::instance()->set_dcp_issuer (wx_to_std (_issuer->GetValue ()));
+               Config::instance()->set_dcp_issuer(wx_to_std(_issuer->GetValue()));
        }
 
        void creator_changed ()
        {
-               Config::instance()->set_dcp_creator (wx_to_std (_creator->GetValue ()));
+               Config::instance()->set_dcp_creator(wx_to_std(_creator->GetValue()));
        }
 
        void company_name_changed ()
        {
-               Config::instance()->set_dcp_company_name (wx_to_std(_company_name->GetValue()));
+               Config::instance()->set_dcp_company_name(wx_to_std(_company_name->GetValue()));
        }
 
        void product_name_changed ()
        {
-               Config::instance()->set_dcp_product_name (wx_to_std(_product_name->GetValue()));
+               Config::instance()->set_dcp_product_name(wx_to_std(_product_name->GetValue()));
        }
 
        void product_version_changed ()
        {
-               Config::instance()->set_dcp_product_version (wx_to_std(_product_version->GetValue()));
+               Config::instance()->set_dcp_product_version(wx_to_std(_product_version->GetValue()));
        }
 
        void j2k_comment_changed ()
@@ -1230,21 +1237,6 @@ class AdvancedPage : public Page
 public:
        AdvancedPage (wxSize panel_size, int border)
                : Page (panel_size, border)
-               , _maximum_j2k_bandwidth (0)
-               , _allow_any_dcp_frame_rate (0)
-               , _allow_any_container (0)
-               , _show_experimental_audio_processors (0)
-               , _only_servers_encode (0)
-               , _log_general (0)
-               , _log_warning (0)
-               , _log_error (0)
-               , _log_timing (0)
-               , _log_debug_threed (0)
-               , _log_debug_encode (0)
-               , _log_debug_email (0)
-               , _log_debug_video_view (0)
-               , _log_debug_player (0)
-               , _log_debug_audio_analysis (0)
        {}
 
        wxString GetName () const
@@ -1273,7 +1265,7 @@ private:
 
        void setup ()
        {
-               wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                table->AddGrowableCol (1, 1);
                _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
 
@@ -1290,8 +1282,8 @@ private:
                _video_display_mode = new wxChoice (_panel, wxID_ANY);
                table->Add (_video_display_mode);
 
-               wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to change display mode)"), false);
-               wxFont font = restart->GetFont();
+               auto restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to change display mode)"), false);
+               auto font = restart->GetFont();
                font.SetStyle (wxFONTSTYLE_ITALIC);
                font.SetPointSize (font.GetPointSize() - 1);
                restart->SetFont (font);
@@ -1319,7 +1311,7 @@ private:
 
                {
                        add_label_to_sizer (table, _panel, _("Maximum number of frames to store per thread"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+                       auto s = new wxBoxSizer (wxHORIZONTAL);
                        _frames_in_memory_multiplier = new wxSpinCtrl (_panel);
                        s->Add (_frames_in_memory_multiplier, 1);
                        table->Add (s, 1);
@@ -1357,7 +1349,7 @@ private:
 
                {
                        add_top_aligned_label_to_sizer (table, _panel, _("Log"));
-                       wxBoxSizer* t = new wxBoxSizer (wxVERTICAL);
+                       auto t = new wxBoxSizer (wxVERTICAL);
                        _log_general = new CheckBox (_panel, _("General"));
                        t->Add (_log_general, 1, wxEXPAND | wxALL);
                        _log_warning = new CheckBox (_panel, _("Warnings"));
@@ -1417,7 +1409,7 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
                checked_set (_maximum_j2k_bandwidth, config->maximum_j2k_bandwidth() / 1000000);
                switch (config->video_view_type()) {
@@ -1450,51 +1442,51 @@ private:
 
        void maximum_j2k_bandwidth_changed ()
        {
-               Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000);
+               Config::instance()->set_maximum_j2k_bandwidth(_maximum_j2k_bandwidth->GetValue() * 1000000);
        }
 
        void video_display_mode_changed ()
        {
                if (_video_display_mode->GetSelection() == 0) {
-                       Config::instance()->set_video_view_type (Config::VIDEO_VIEW_SIMPLE);
+                       Config::instance()->set_video_view_type(Config::VIDEO_VIEW_SIMPLE);
                } else {
-                       Config::instance()->set_video_view_type (Config::VIDEO_VIEW_OPENGL);
+                       Config::instance()->set_video_view_type(Config::VIDEO_VIEW_OPENGL);
                }
        }
 
        void frames_in_memory_multiplier_changed ()
        {
-               Config::instance()->set_frames_in_memory_multiplier (_frames_in_memory_multiplier->GetValue());
+               Config::instance()->set_frames_in_memory_multiplier(_frames_in_memory_multiplier->GetValue());
        }
 
        void allow_any_dcp_frame_rate_changed ()
        {
-               Config::instance()->set_allow_any_dcp_frame_rate (_allow_any_dcp_frame_rate->GetValue ());
+               Config::instance()->set_allow_any_dcp_frame_rate(_allow_any_dcp_frame_rate->GetValue());
        }
 
        void allow_any_container_changed ()
        {
-               Config::instance()->set_allow_any_container (_allow_any_container->GetValue ());
+               Config::instance()->set_allow_any_container(_allow_any_container->GetValue());
        }
 
        void show_experimental_audio_processors_changed ()
        {
-               Config::instance()->set_show_experimental_audio_processors (_show_experimental_audio_processors->GetValue ());
+               Config::instance()->set_show_experimental_audio_processors(_show_experimental_audio_processors->GetValue());
        }
 
        void only_servers_encode_changed ()
        {
-               Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue ());
+               Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue());
        }
 
        void dcp_metadata_filename_format_changed ()
        {
-               Config::instance()->set_dcp_metadata_filename_format (_dcp_metadata_filename_format->get ());
+               Config::instance()->set_dcp_metadata_filename_format(_dcp_metadata_filename_format->get());
        }
 
        void dcp_asset_filename_format_changed ()
        {
-               Config::instance()->set_dcp_asset_filename_format (_dcp_asset_filename_format->get ());
+               Config::instance()->set_dcp_asset_filename_format(_dcp_asset_filename_format->get());
        }
 
        void log_changed ()
@@ -1536,38 +1528,39 @@ private:
 #ifdef DCPOMATIC_WINDOWS
        void win32_console_changed ()
        {
-               Config::instance()->set_win32_console (_win32_console->GetValue ());
+               Config::instance()->set_win32_console(_win32_console->GetValue());
        }
 #endif
 
-       wxSpinCtrl* _maximum_j2k_bandwidth;
-       wxChoice* _video_display_mode;
-       wxSpinCtrl* _frames_in_memory_multiplier;
-       wxCheckBox* _allow_any_dcp_frame_rate;
-       wxCheckBox* _allow_any_container;
-       wxCheckBox* _show_experimental_audio_processors;
-       wxCheckBox* _only_servers_encode;
-       NameFormatEditor* _dcp_metadata_filename_format;
-       NameFormatEditor* _dcp_asset_filename_format;
-       wxCheckBox* _log_general;
-       wxCheckBox* _log_warning;
-       wxCheckBox* _log_error;
-       wxCheckBox* _log_timing;
-       wxCheckBox* _log_debug_threed;
-       wxCheckBox* _log_debug_encode;
-       wxCheckBox* _log_debug_email;
-       wxCheckBox* _log_debug_video_view;
-       wxCheckBox* _log_debug_player;
-       wxCheckBox* _log_debug_audio_analysis;
+       wxSpinCtrl* _maximum_j2k_bandwidth = nullptr;
+       wxChoice* _video_display_mode = nullptr;
+       wxSpinCtrl* _frames_in_memory_multiplier = nullptr;
+       wxCheckBox* _allow_any_dcp_frame_rate = nullptr;
+       wxCheckBox* _allow_any_container = nullptr;
+       wxCheckBox* _show_experimental_audio_processors = nullptr;
+       wxCheckBox* _only_servers_encode = nullptr;
+       NameFormatEditor* _dcp_metadata_filename_format = nullptr;
+       NameFormatEditor* _dcp_asset_filename_format = nullptr;
+       wxCheckBox* _log_general = nullptr;
+       wxCheckBox* _log_warning = nullptr;
+       wxCheckBox* _log_error = nullptr;
+       wxCheckBox* _log_timing = nullptr;
+       wxCheckBox* _log_debug_threed = nullptr;
+       wxCheckBox* _log_debug_encode = nullptr;
+       wxCheckBox* _log_debug_email = nullptr;
+       wxCheckBox* _log_debug_video_view = nullptr;
+       wxCheckBox* _log_debug_player = nullptr;
+       wxCheckBox* _log_debug_audio_analysis = nullptr;
 #ifdef DCPOMATIC_WINDOWS
-       wxCheckBox* _win32_console;
+       wxCheckBox* _win32_console = nullptr;
 #endif
 };
 
+
 wxPreferencesEditor*
 create_full_config_dialog ()
 {
-       wxPreferencesEditor* e = new wxPreferencesEditor ();
+       auto e = new wxPreferencesEditor ();
 
 #ifdef DCPOMATIC_OSX
        /* Width that we force some of the config panels to be on OSX so that
@@ -1581,17 +1574,17 @@ create_full_config_dialog ()
        int const border = 8;
 #endif
 
-       e->AddPage (new FullGeneralPage (ps, border));
-       e->AddPage (new SoundPage (ps, border));
-       e->AddPage (new DefaultsPage (ps, border));
-       e->AddPage (new EncodingServersPage (ps, border));
-       e->AddPage (new KeysPage (ps, border));
-       e->AddPage (new TMSPage (ps, border));
-       e->AddPage (new EmailPage (ps, border));
-       e->AddPage (new KDMEmailPage (ps, border));
-       e->AddPage (new NotificationsPage (ps, border));
-       e->AddPage (new CoverSheetPage (ps, border));
-       e->AddPage (new IdentifiersPage (ps, border));
-       e->AddPage (new AdvancedPage (ps, border));
+       e->AddPage (new FullGeneralPage    (ps, border));
+       e->AddPage (new SoundPage          (ps, border));
+       e->AddPage (new DefaultsPage       (ps, border));
+       e->AddPage (new EncodingServersPage(ps, border));
+       e->AddPage (new KeysPage           (ps, border));
+       e->AddPage (new TMSPage            (ps, border));
+       e->AddPage (new EmailPage          (ps, border));
+       e->AddPage (new KDMEmailPage       (ps, border));
+       e->AddPage (new NotificationsPage  (ps, border));
+       e->AddPage (new CoverSheetPage     (ps, border));
+       e->AddPage (new IdentifiersPage    (ps, border));
+       e->AddPage (new AdvancedPage       (ps, border));
        return e;
 }
index 5191b145621f1d069b2e7fa4b5a721ff92403c2e..ae275b188a1aad7f4859607dfcfe4ec25490a2d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file src/full_config_dialog.h
  *  @brief A dialogue to edit all DCP-o-matic configuration.
  */
 
+
 class wxPreferencesEditor;
 
+
 wxPreferencesEditor* create_full_config_dialog ();
+
index 455998c5cab002bccfea7550a0018b652ce6b102..3d900e1d3e8d84a17abab8266d4b66b9bf7d0369 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.
 
 
 */
 
+
 #include "job_view_dialog.h"
 #include "normal_job_view.h"
 #include "lib/job.h"
 
+
 using std::shared_ptr;
 
+
 JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job> job)
        : TableDialog (parent, title, 4, 0, false)
        , _job (job)
@@ -33,29 +36,31 @@ JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job>
        layout ();
        SetMinSize (wxSize (960, -1));
 
-       Bind (wxEVT_TIMER, boost::bind (&JobViewDialog::periodic, this));
-       _timer.reset (new wxTimer (this));
+       Bind (wxEVT_TIMER, boost::bind(&JobViewDialog::periodic, this));
+       _timer.reset (new wxTimer(this));
        _timer->Start (1000);
 
        /* Start off with OK disabled and it will be enabled when the job is finished */
-       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+       auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
        if (ok) {
                ok->Enable (false);
        }
 }
 
+
 JobViewDialog::~JobViewDialog ()
 {
        delete _view;
 }
 
+
 void
 JobViewDialog::periodic ()
 {
        _view->maybe_pulse ();
 
-       shared_ptr<Job> job = _job.lock ();
-       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+       auto job = _job.lock ();
+       auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
        if (job && ok) {
                ok->Enable (job->finished ());
        }
index b72ad298d0682bdcfb2871f43edea3e19ffc0e5b..66a3ea6c658fe302bdaf4518ae207812b83251f1 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.
 
@@ -26,6 +26,7 @@
 class JobView;
 class Job;
 
+
 class JobViewDialog : public TableDialog
 {
 public:
@@ -35,7 +36,7 @@ public:
 private:
        void periodic ();
 
-       JobView* _view;
+       JobView* _view = nullptr;
        std::weak_ptr<Job> _job;
        std::shared_ptr<wxTimer> _timer;
 };
index 8c7f4007ba3576fec18b79dc341c40c8842f1fa9..92aa86bf32b937d409b8337ba6e2850062991b23 100644 (file)
@@ -49,7 +49,7 @@ using std::list;
 using std::exception;
 using std::make_pair;
 using std::shared_ptr;
-using boost::function;
+using std::function;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
index cc4453d0267ece10a36bedeb96d58424c12aa636..b01913354c9e11befb23c2d840688e544c1bb254 100644 (file)
@@ -54,7 +54,7 @@ public:
        std::pair<std::shared_ptr<Job>, int> make (
                std::list<KDMWithMetadataPtr > screen_kdms,
                std::string name,
-               boost::function<bool (boost::filesystem::path)> confirm_overwrite
+               std::function<bool (boost::filesystem::path)> confirm_overwrite
                );
 
 private:
index 1fb15f2d04d52a8763f963de4ace8c88eeab15db..edaf8f83f6a41f97d0da29b7ae6d422be5478d3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "nag_dialog.h"
 #include "wx_util.h"
 #include "static_text.h"
 #include "check_box.h"
 
+
 using std::shared_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -48,7 +50,7 @@ NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool
        if (can_cancel) {
                flags |= wxCANCEL;
        }
-       wxSizer* buttons = CreateSeparatedButtonSizer (flags);
+       auto buttons = CreateSeparatedButtonSizer (flags);
        if (buttons) {
                sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -61,12 +63,14 @@ NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool
        sizer->SetSizeHints (this);
 }
 
+
 void
 NagDialog::shut_up (wxCommandEvent& ev)
 {
        Config::instance()->set_nagged (_nag, ev.IsChecked());
 }
 
+
 /** @return true if the user clicked Cancel */
 bool
 NagDialog::maybe_nag (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel)
index bc5ae69621395653bbee9a512f0f31e47aab05b2..11fb907f067c4dd0e55a4a3e4b697396fb7c7b86 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "lib/config.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 
+
 class NagDialog : public wxDialog
 {
 public:
index 557e6b8e71236126b71628ad8bd7ece03ff6de95..802ab6b3bcb7ee40ee3d68818db43eabaa5ab221 100644 (file)
@@ -63,7 +63,7 @@ using std::make_pair;
 using std::map;
 using boost::bind;
 using std::shared_ptr;
-using boost::function;
+using std::function;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
index 88128874cf2f4d0fedc8b4f6a39a3402b129a1e6..7680c147b097c9e36a3f14d9a7ae84f93039a086 100644 (file)
@@ -22,9 +22,8 @@
 #include "suspender.h"
 
 
-Suspender::Suspender(boost::function<void (int)> handler)
+Suspender::Suspender(std::function<void (int)> handler)
        : _handler (handler)
-       , _count (0)
 {
 
 }
index 947d7a367fd6d13732702b5db09c8a5249368156..e01888823b5abe7231b6b8553481478f9e619c4d 100644 (file)
 */
 
 
-#include <boost/function.hpp>
+#include <functional>
 #include <set>
 
 
 class Suspender
 {
 public:
-       Suspender (boost::function<void (int)> handler);
+       Suspender (std::function<void (int)> handler);
 
        bool check (int property);
 
@@ -47,7 +47,7 @@ private:
        void increment ();
        void decrement ();
 
-       boost::function<void (int)> _handler;
-       int _count;
+       std::function<void (int)> _handler;
+       int _count = 0;
        std::set<int> _pending;
 };
index 97ddd51516420012ebfde3c82852ab8a25c0c0a9..1c459595e20ebcdc7a91247868a873cac480e54b 100644 (file)
@@ -34,7 +34,6 @@ DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <wx/gbsizer.h>
-#include <boost/function.hpp>
 #include <boost/thread.hpp>
 #include <boost/signals2.hpp>
 
index 4472f02c152327337232a61fad1fa67aa0724df1..3a677bf820d034323761e322dc6e741481bbe5b2 100644 (file)
@@ -33,7 +33,6 @@
 #include <dcp/raw_convert.h>
 #include <boost/test/unit_test.hpp>
 #include <boost/bind/bind.hpp>
-#include <boost/function.hpp>
 #include <boost/signals2.hpp>
 #include <iostream>
 
index 3596fb230c71b820ee5ced44d08d76a4ca3821d1..1ba6c3a1d4b3b507ef868aaacf9fa0383a7f22a9 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 3596fb230c71b820ee5ced44d08d76a4ca3821d1
+Subproject commit 1ba6c3a1d4b3b507ef868aaacf9fa0383a7f22a9
index 9c3311719ea0d5c73d316e0d7ee4479b6591b050..73e73cbad1fad5358e5b6afc80c8e03c6776ab27 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.
 
 
 */
 
+
 /** @file  test/ffmpeg_examiner_test.cc
  *  @brief FFmpegExaminer tests
  *  @ingroup selfcontained
  */
 
+
 #include <boost/test/unit_test.hpp>
 #include "lib/ffmpeg_examiner.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ffmpeg_audio_stream.h"
 #include "test.h"
 
+
+using std::make_shared;
 using std::shared_ptr;
 using namespace dcpomatic;
 
+
 /** Check that the FFmpegExaminer can extract the first video and audio time
  *  correctly from data/count300bd24.m2ts.
  */
 BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test)
 {
-       shared_ptr<Film> film = new_test_film ("ffmpeg_examiner_test");
-       shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/count300bd24.m2ts"));
-       shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (content));
+       auto film = new_test_film ("ffmpeg_examiner_test");
+       auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts");
+       auto examiner = make_shared<FFmpegExaminer>(content);
 
        BOOST_CHECK_EQUAL (examiner->first_video().get().get(), ContentTime::from_seconds(600).get());
        BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 1U);
        BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->first_audio.get().get(), ContentTime::from_seconds(600).get());
 }
 
+
 /** Check that audio sampling rate and channel counts are correctly picked up from
  *  a problematic file.  When we used to specify analyzeduration and probesize
  *  this file's details were picked up incorrectly.
  */
 BOOST_AUTO_TEST_CASE (ffmpeg_examiner_probesize_test)
 {
-       shared_ptr<FFmpegContent> content (new FFmpegContent(TestPaths::private_data() / "RockyTop10 Playlist Flat.m4v"));
-       shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer(content));
+       auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "RockyTop10 Playlist Flat.m4v");
+       auto examiner = make_shared<FFmpegExaminer>(content);
 
        BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 2U);
        BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->frame_rate(), 48000);
index a37e14067c8eff7612f37f7f6d62409198cb3f69..5bb119f463965ec81d6fe204ba8b0cde17acf685 100644 (file)
@@ -45,7 +45,7 @@ using std::vector;
 using std::string;
 using std::shared_ptr;
 using std::make_shared;
-using boost::function;
+using std::function;
 using namespace dcpomatic;
 
 
index 5510864d9b94576e78b66b3b3a53a893a574a837..cad2e2ee5bdffbaac3a4ab826ebfc5bdd21989cf 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.
 
 
 */
 
+
 /** @file  test/required_disk_space_test.cc
  *  @brief Check Film::required_disk_space
  *  @ingroup selfcontained
  */
 
+
 #include "lib/content_factory.h"
 #include "lib/dcp_content.h"
 #include "lib/film.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
+
+using std::dynamic_pointer_cast;
 using std::make_shared;
 using std::shared_ptr;
-using std::dynamic_pointer_cast;
+
 
 void check_within_n (int64_t a, int64_t b, int64_t n)
 {
index a46337ab7366190835f530892d893ad2b486f72c..67c1a5265f03f4711800436945e63087e9b82bcc 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.
 
 
 */
 
+
 /** @file  test/util_test.cc
  *  @brief Test various utility methods.
  *  @ingroup selfcontained
  */
 
+
 #include "lib/util.h"
 #include "lib/cross.h"
 #include "lib/exceptions.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/bind/bind.hpp>
 
-using std::string;
-using std::vector;
+
 using std::list;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using namespace dcpomatic;
 
+
 BOOST_AUTO_TEST_CASE (digest_head_tail_test)
 {
        vector<boost::filesystem::path> p;
@@ -61,27 +65,30 @@ BOOST_AUTO_TEST_CASE (digest_head_tail_test)
        BOOST_CHECK_THROW (digest_head_tail (p, 1024), OpenFileError);
 }
 
+
 BOOST_AUTO_TEST_CASE (timecode_test)
 {
-       DCPTime t = DCPTime::from_seconds (2 * 60 * 60 + 4 * 60 + 31) + DCPTime::from_frames (19, 24);
+       auto t = DCPTime::from_seconds (2 * 60 * 60 + 4 * 60 + 31) + DCPTime::from_frames (19, 24);
        BOOST_CHECK_EQUAL (t.timecode (24), "02:04:31:19");
 }
 
+
 BOOST_AUTO_TEST_CASE (seconds_to_approximate_hms_test)
 {
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1), "1s");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2), "2s");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (60), "1m");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1.5 * 60), "1m 30s");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 60), "2m");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (17 * 60 + 20), "17m");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1 * 3600), "1h");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (3600 + 40 * 60), "1h 40m");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 3600), "2h");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 3600 - 1), "2h");
-       BOOST_CHECK_EQUAL (seconds_to_approximate_hms (13 * 3600 + 40 * 60), "14h");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(1), "1s");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2), "2s");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(60), "1m");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(1.5 * 60), "1m 30s");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2 * 60), "2m");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(17 * 60 + 20), "17m");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(1 * 3600), "1h");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(3600 + 40 * 60), "1h 40m");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2 * 3600), "2h");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(2 * 3600 - 1), "2h");
+       BOOST_CHECK_EQUAL (seconds_to_approximate_hms(13 * 3600 + 40 * 60), "14h");
 }
 
+
 BOOST_AUTO_TEST_CASE (time_to_hmsf_test)
 {
        BOOST_CHECK_EQUAL (time_to_hmsf(DCPTime::from_frames(12, 24), 24), "0:00:00.12");
@@ -91,6 +98,7 @@ BOOST_AUTO_TEST_CASE (time_to_hmsf_test)
        BOOST_CHECK_EQUAL (time_to_hmsf(DCPTime::from_seconds(2 * 60 * 60 + 92), 24), "2:01:32.0");
 }
 
+
 BOOST_AUTO_TEST_CASE (tidy_for_filename_test)
 {
        BOOST_CHECK_EQUAL (tidy_for_filename ("fish\\chips"), "fish_chips");
@@ -99,6 +107,7 @@ BOOST_AUTO_TEST_CASE (tidy_for_filename_test)
        BOOST_CHECK_EQUAL (tidy_for_filename ("abcdefghï"), "abcdefghï");
 }
 
+
 BOOST_AUTO_TEST_CASE (utf8_strlen_test)
 {
        BOOST_CHECK_EQUAL (utf8_strlen("hello world"), 11U);
@@ -106,6 +115,7 @@ BOOST_AUTO_TEST_CASE (utf8_strlen_test)
        BOOST_CHECK_EQUAL (utf8_strlen("hëłlo wørld"), 11U);
 }
 
+
 BOOST_AUTO_TEST_CASE (careful_string_filter_test)
 {
        BOOST_CHECK_EQUAL ("hello_world", careful_string_filter("hello_world"));
@@ -116,6 +126,7 @@ BOOST_AUTO_TEST_CASE (careful_string_filter_test)
        BOOST_CHECK_EQUAL ("hello_world_CcGgIOoSsUu", careful_string_filter("hello_world_ÇçĞğİÖöŞşÜü"));
 }
 
+
 static list<float> progress_values;
 
 static void
@@ -124,6 +135,7 @@ progress (float p)
        progress_values.push_back (p);
 }
 
+
 BOOST_AUTO_TEST_CASE (copy_in_bits_test)
 {
        for (int i = 0; i < 32; ++i) {