C++11 and whitespace cleanups.
authorCarl Hetherington <cth@carlh.net>
Sat, 2 Apr 2022 22:04:31 +0000 (00:04 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 3 Apr 2022 21:25:19 +0000 (23:25 +0200)
59 files changed:
src/lib/active_text.cc
src/lib/active_text.h
src/lib/atmos_metadata.cc
src/lib/audio_content.cc
src/lib/audio_delay.cc
src/lib/audio_filter_graph.cc
src/lib/audio_ring_buffers.h
src/lib/check_content_change_job.cc
src/lib/cinema.h
src/lib/config.cc
src/lib/config.h
src/lib/content.cc
src/lib/content.h
src/lib/cross.h
src/lib/dcp_content.cc
src/lib/dcp_decoder.cc
src/lib/dcp_examiner.cc
src/lib/dcp_video.cc
src/lib/dcp_video.h
src/lib/decoder_factory.cc
src/lib/dkdm_recipient.cc
src/lib/ext.cc
src/lib/ffmpeg.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_decoder.h
src/lib/ffmpeg_encoder.h
src/lib/film.cc
src/lib/film.h
src/lib/frame_rate_change.cc
src/lib/image.cc
src/lib/image_content.cc
src/lib/image_decoder.cc
src/lib/image_examiner.cc
src/lib/image_filename_sorter.cc
src/lib/image_proxy.cc
src/lib/internet.cc
src/lib/j2k_encoder.cc
src/lib/j2k_image_proxy.cc
src/lib/job.cc
src/lib/json_server.cc
src/lib/log.cc
src/lib/mid_side_decoder.cc
src/lib/nanomsg.cc
src/lib/overlaps.cc
src/lib/player.cc
src/lib/player.h
src/lib/player_text.cc
src/lib/player_video.cc
src/lib/playlist.cc
src/wx/recipient_dialog.cc
src/wx/subtitle_appearance_dialog.cc
src/wx/timecode.h
src/wx/timeline_content_view.cc
src/wx/timeline_time_axis_view.h
src/wx/wx_util.cc
test/dcp_decoder_test.cc
test/overlap_video_test.cc
test/reels_test.cc
test/test.cc

index 1180ce7b0bc42f3c6b1deb7ef1fb0fdbb789eecd..1e0fd6adbcc1bc80b4d90c08a293893bfaf48370 100644 (file)
@@ -31,6 +31,7 @@ using std::shared_ptr;
 using boost::optional;
 using namespace dcpomatic;
 
+
 /** Get the open captions that should be burnt into a given period.
  *  @param period Period of interest.
  *  @param always_burn_captions Always burn captions even if their content is not set to burn.
@@ -42,9 +43,9 @@ ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const
 
        list<PlayerText> ps;
 
-       for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) {
+       for (auto const& i: _data) {
 
-               shared_ptr<const TextContent> caption = i->first.lock ();
+               auto caption = i.first.lock ();
                if (!caption) {
                        continue;
                }
@@ -54,9 +55,9 @@ ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const
                        continue;
                }
 
-               for (auto j: i->second) {
+               for (auto j: i.second) {
                        DCPTimePeriod test (j.from, j.to.get_value_or(DCPTime::max()));
-                       optional<DCPTimePeriod> overlap = period.overlap (test);
+                       auto overlap = period.overlap (test);
                        if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) {
                                ps.push_back (j.subs);
                        }
@@ -66,6 +67,7 @@ ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const
        return ps;
 }
 
+
 /** Remove subtitles that finish before a given time from our list.
  *  @param time Time to remove before.
  */
@@ -75,20 +77,21 @@ ActiveText::clear_before (DCPTime time)
        boost::mutex::scoped_lock lm (_mutex);
 
        Map updated;
-       for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) {
+       for (auto const& i: _data) {
                list<Period> as;
-               for (auto j: i->second) {
+               for (auto j: i.second) {
                        if (!j.to || j.to.get() >= time) {
                                as.push_back (j);
                        }
                }
                if (!as.empty ()) {
-                       updated[i->first] = as;
+                       updated[i.first] = as;
                }
        }
        _data = updated;
 }
 
+
 /** Add a new subtitle with a from time.
  *  @param content Content that the subtitle is from.
  *  @param ps Subtitles.
@@ -105,6 +108,7 @@ ActiveText::add_from (weak_ptr<const TextContent> content, PlayerText ps, DCPTim
        _data[content].push_back (Period (ps, from));
 }
 
+
 /** Add the to time for the last subtitle added from a piece of content.
  *  @param content Content that the subtitle is from.
  *  @param to To time for the last subtitle submitted to add_from for this content.
@@ -126,6 +130,7 @@ ActiveText::add_to (weak_ptr<const TextContent> content, DCPTime to)
        return make_pair (_data[content].back().subs, _data[content].back().from);
 }
 
+
 /** @param content Some content.
  *  @return true if we have any active subtitles from this content.
  */
@@ -134,7 +139,7 @@ ActiveText::have (weak_ptr<const TextContent> content) const
 {
        boost::mutex::scoped_lock lm (_mutex);
 
-       Map::const_iterator i = _data.find(content);
+       auto i = _data.find(content);
        if (i == _data.end()) {
                return false;
        }
@@ -142,6 +147,7 @@ ActiveText::have (weak_ptr<const TextContent> content) const
        return !i->second.empty();
 }
 
+
 void
 ActiveText::clear ()
 {
index b54957b3ff270da744b6f6e29e4bb4a722f63277..d5ce4cb0759895d2b235a9e205c9a8a264e14767 100644 (file)
 
 */
 
+
 /** @file  src/lib/active_captions.h
  *  @brief ActiveText class.
  */
 
+
 #include "dcpomatic_time.h"
 #include "player_text.h"
 #include <boost/thread/mutex.hpp>
 #include <list>
 #include <map>
 
+
 class TextContent;
 
+
 /** @class ActiveText
  *  @brief A class to maintain information on active subtitles for Player.
  */
index 0fe23f3b0f4b8e4d5404922ed83e251bf44aa41d..0ab04a8259dcb03282b3dfe0afcc98d52c9bf1db 100644 (file)
@@ -23,6 +23,7 @@
 #include <dcp/atmos_asset.h>
 
 
+using std::make_shared;
 using std::shared_ptr;
 
 
@@ -39,5 +40,5 @@ AtmosMetadata::AtmosMetadata (shared_ptr<const dcp::AtmosAsset> asset)
 shared_ptr<dcp::AtmosAsset>
 AtmosMetadata::create (dcp::Fraction edit_rate) const
 {
-       return shared_ptr<dcp::AtmosAsset> (new dcp::AtmosAsset(edit_rate, _first_frame, _max_channel_count, _max_object_count, _atmos_version));
+       return make_shared<dcp::AtmosAsset>(edit_rate, _first_frame, _max_channel_count, _max_object_count, _atmos_version);
 }
index 748cbb7d0d6403b487ec540abd2ab2e8768b3d66..f2510b494ea3c75149603013a140b68bcf77f620 100644 (file)
@@ -98,7 +98,7 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node)
 }
 
 
-AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
+AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content>> c)
        : ContentPart (parent)
 {
        auto ref = c[0]->audio;
index 90214470cd279185cd2e4a3ef4f7ef825c978a16..d06d9e73023055d8d060ae322bd64cc63e379f0c 100644 (file)
@@ -43,7 +43,7 @@ AudioDelay::run (shared_ptr<const AudioBuffers> in)
        /* You can't call this with varying channel counts */
        DCPOMATIC_ASSERT (!_tail || in->channels() == _tail->channels());
 
-       shared_ptr<AudioBuffers> out (new AudioBuffers (in->channels(), in->frames()));
+       auto out = make_shared<AudioBuffers>(in->channels(), in->frames());
 
        if (in->frames() > _samples) {
 
index fc43b5a344a972a9ef20d69e1257441024616412..95f6730cf4f24d99d43a981e6056c8058366406f 100644 (file)
@@ -18,8 +18,9 @@
 
 */
 
-#include "audio_filter_graph.h"
+
 #include "audio_buffers.h"
+#include "audio_filter_graph.h"
 #include "compose.hpp"
 extern "C" {
 #include <libavfilter/buffersink.h>
@@ -31,9 +32,12 @@ extern "C" {
 
 #include "i18n.h"
 
-using std::string;
+
 using std::cout;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
+
 
 AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
        : _sample_rate (sample_rate)
@@ -113,7 +117,7 @@ AudioFilterGraph::process (shared_ptr<const AudioBuffers> buffers)
                   the constructor) so we need to create new buffers with some extra
                   silent channels.
                */
-               shared_ptr<AudioBuffers> extended_buffers (new AudioBuffers (process_channels, buffers->frames()));
+               auto extended_buffers = make_shared<AudioBuffers>(process_channels, buffers->frames());
                for (int i = 0; i < buffers->channels(); ++i) {
                        extended_buffers->copy_channel_from (buffers.get(), i, i);
                }
index 4c90ed7911d4137d3acd3e5de96591f5a234bbc3..6fb84e0d76dc8684757827742d183943e7b62a51 100644 (file)
@@ -48,7 +48,7 @@ public:
 
 private:
        mutable boost::mutex _mutex;
-       std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime> > _buffers;
+       std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime>> _buffers;
        int _used_in_head = 0;
 };
 
index e755a394529c8b55c76a244a370ad2b42e1c1bfb..16ef8d86485391bb6724eb190055f4fdb94ce6d2 100644 (file)
 
 */
 
+
 #include "check_content_change_job.h"
-#include "job_manager.h"
-#include "examine_content_job.h"
 #include "content.h"
+#include "examine_content_job.h"
 #include "film.h"
+#include "job_manager.h"
 #include <iostream>
 
 #include "i18n.h"
 
+
 using std::cout;
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
 
+
 CheckContentChangeJob::CheckContentChangeJob (shared_ptr<const Film> film)
        : Job (film)
 {
index a89408f3f28f94610f9f6470beacb5f83856e87c..c17454db980f957aff708857ed4d4bcab76f85bd 100644 (file)
@@ -76,7 +76,7 @@ public:
                return _utc_offset_minute;
        }
 
-       std::list<std::shared_ptr<dcpomatic::Screen> > screens () const {
+       std::list<std::shared_ptr<dcpomatic::Screen>> screens () const {
                return _screens;
        }
 
index 6e654d5bed95a66b044b668174ebc91b5718cb53..b6df1a88d871c25b6aefcf797a27ca4b635d87e1 100644 (file)
 
 */
 
+
+#include "cinema.h"
+#include "colour_conversion.h"
+#include "compose.hpp"
 #include "config.h"
+#include "cross.h"
+#include "crypto.h"
+#include "dcp_content_type.h"
+#include "dkdm_recipient.h"
+#include "dkdm_wrapper.h"
+#include "film.h"
 #include "filter.h"
+#include "log.h"
 #include "ratio.h"
 #include "types.h"
-#include "log.h"
-#include "dcp_content_type.h"
-#include "colour_conversion.h"
-#include "cinema.h"
 #include "util.h"
-#include "cross.h"
-#include "film.h"
-#include "dkdm_wrapper.h"
-#include "compose.hpp"
-#include "crypto.h"
-#include "dkdm_recipient.h"
 #include "zipper.h"
 #include <dcp/certificate_chain.h>
 #include <dcp/name_format.h>
 
 #include "i18n.h"
 
-using std::vector;
+
 using std::cout;
+using std::dynamic_pointer_cast;
 using std::ifstream;
-using std::string;
 using std::list;
-using std::min;
+using std::make_shared;
 using std::max;
+using std::min;
 using std::remove;
 using std::shared_ptr;
-using std::make_shared;
-using boost::optional;
-using std::dynamic_pointer_cast;
+using std::string;
+using std::vector;
 using boost::algorithm::trim;
+using boost::optional;
 using dcp::raw_convert;
 
+
 Config* Config::_instance = 0;
 int const Config::_current_version = 3;
 boost::signals2::signal<void ()> Config::FailedToLoad;
 boost::signals2::signal<void (string)> Config::Warning;
 boost::signals2::signal<bool (Config::BadReason)> Config::Bad;
 
+
 /** Construct default configuration */
 Config::Config ()
         /* DKDMs are not considered a thing to reset on set_defaults() */
@@ -477,7 +481,7 @@ try
                _dkdms = dynamic_pointer_cast<DKDMGroup> (DKDMBase::read (f.node_child("DKDMGroup")));
        } else {
                /* Old-style: one or more DKDM nodes */
-               _dkdms.reset (new DKDMGroup ("root"));
+               _dkdms = make_shared<DKDMGroup>("root");
                for (auto i: f.node_children("DKDM")) {
                        _dkdms->add (DKDMBase::read (i));
                }
@@ -604,7 +608,7 @@ catch (...) {
 Config *
 Config::instance ()
 {
-       if (_instance == 0) {
+       if (_instance == nullptr) {
                _instance = new Config;
                _instance->read ();
        }
@@ -1264,7 +1268,7 @@ Config::read_dkdm_recipients (cxml::Document const & f)
 {
        _dkdm_recipients.clear ();
        for (auto i: f.node_children("DKDMRecipient")) {
-               _dkdm_recipients.push_back (shared_ptr<DKDMRecipient>(new DKDMRecipient(i)));
+               _dkdm_recipients.push_back (make_shared<DKDMRecipient>(i));
        }
 }
 
index 2ad201c35e76d0849a39f8a38b5e102bdb767a81..29f401755b06cf814db5c1cb2207848099053d9e 100644 (file)
@@ -147,11 +147,11 @@ public:
                return _tms_password;
        }
 
-       std::list<std::shared_ptr<Cinema> > cinemas () const {
+       std::list<std::shared_ptr<Cinema>> cinemas () const {
                return _cinemas;
        }
 
-       std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
+       std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
                return _dkdm_recipients;
        }
 
@@ -1222,8 +1222,8 @@ private:
        */
        boost::optional<boost::filesystem::path> _default_kdm_directory;
        bool _upload_after_make_dcp;
-       std::list<std::shared_ptr<Cinema> > _cinemas;
-       std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
+       std::list<std::shared_ptr<Cinema>> _cinemas;
+       std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
        std::string _mail_server;
        int _mail_port;
        EmailProtocol _mail_protocol;
index 370139d12b72579f180837466458556fe88f7f81..a56891689c201f2d23e1f8eec6c20ae2d3c4e788 100644 (file)
@@ -48,8 +48,6 @@
 using std::cout;
 using std::list;
 using std::make_shared;
-using std::max;
-using std::pair;
 using std::shared_ptr;
 using std::string;
 using std::vector;
index d17b0d0e5a22f86360e8a678073add3a620f9084..7fad2ff792f7ea0823d7f68f542298eba87db6a0 100644 (file)
 #ifndef DCPOMATIC_CONTENT_H
 #define DCPOMATIC_CONTENT_H
 
-#include "types.h"
-#include "signaller.h"
-#include "dcpomatic_time.h"
+
 #include "change_signaller.h"
+#include "dcpomatic_time.h"
+#include "signaller.h"
+#include "types.h"
 #include "user_property.h"
 #include <libcxml/cxml.h>
 #include <boost/filesystem.hpp>
index 99c6bc29979c3a938c2a91b40f858c2d6a49e3b4..83cda4a04b41d723572ea43b890558d5dba048ca 100644 (file)
@@ -43,7 +43,7 @@ extern void dcpomatic_sleep_seconds (int);
 extern void dcpomatic_sleep_milliseconds (int);
 extern std::string cpu_info ();
 extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path);
-extern std::list<std::pair<std::string, std::string> > mount_info ();
+extern std::list<std::pair<std::string, std::string>> mount_info ();
 extern boost::filesystem::path openssl_path ();
 extern void make_foreground_application ();
 #ifdef DCPOMATIC_DISK
index eb1c5f42c2a3a5b525da1f01fe219fc72ef8e7fd..6df0588e972fb439f6eb0b501bc9e1c7b5d99ea4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 
 #include "atmos_content.h"
-#include "dcp_content.h"
-#include "video_content.h"
 #include "audio_content.h"
-#include "dcp_examiner.h"
-#include "job.h"
-#include "film.h"
-#include "config.h"
-#include "overlaps.h"
 #include "compose.hpp"
+#include "config.h"
+#include "dcp_content.h"
 #include "dcp_decoder.h"
-#include "log.h"
+#include "dcp_examiner.h"
 #include "dcpomatic_log.h"
+#include "film.h"
+#include "job.h"
+#include "log.h"
+#include "overlaps.h"
 #include "text_content.h"
+#include "video_content.h"
 #include <dcp/dcp.h>
 #include <dcp/raw_convert.h>
 #include <dcp/exceptions.h>
@@ -176,10 +176,10 @@ DCPContent::read_directory (boost::filesystem::path p)
        bool have_assetmap = false;
        bool have_metadata = false;
 
-       for (directory_iterator i(p); i != directory_iterator(); ++i) {
-               if (i->path().filename() == "ASSETMAP" || i->path().filename() == "ASSETMAP.xml") {
+       for (auto i: directory_iterator(p)) {
+               if (i.path().filename() == "ASSETMAP" || i.path().filename() == "ASSETMAP.xml") {
                        have_assetmap = true;
-               } else if (i->path().filename() == "metadata.xml") {
+               } else if (i.path().filename() == "metadata.xml") {
                        have_metadata = true;
                }
        }
@@ -690,7 +690,7 @@ DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) c
 {
        shared_ptr<DCPDecoder> decoder;
        try {
-               decoder.reset (new DCPDecoder (film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()));
+               decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>());
        } catch (dcp::ReadError &) {
                /* We couldn't read the DCP, so it's probably missing */
                return false;
@@ -725,7 +725,7 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri
 {
        shared_ptr<DCPDecoder> decoder;
        try {
-               decoder.reset (new DCPDecoder (film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()));
+               decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>());
        } catch (dcp::ReadError &) {
                /* We couldn't read the DCP, so it's probably missing */
                return false;
index 59b44ae975ee5080c48ec6599535bf21d390c915..85c5d3297d0d6a8acb704f523bf70d01524446e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "atmos_decoder.h"
-#include "dcp_decoder.h"
-#include "dcp_content.h"
 #include "audio_content.h"
-#include "video_decoder.h"
 #include "audio_decoder.h"
-#include "j2k_image_proxy.h"
-#include "text_decoder.h"
-#include "ffmpeg_image_proxy.h"
-#include "image.h"
 #include "config.h"
+#include "dcp_content.h"
+#include "dcp_decoder.h"
 #include "digester.h"
+#include "ffmpeg_image_proxy.h"
 #include "frame_interval_checker.h"
-#include <dcp/dcp.h>
+#include "image.h"
+#include "j2k_image_proxy.h"
+#include "text_decoder.h"
+#include "video_decoder.h"
 #include <dcp/cpl.h>
-#include <dcp/reel.h>
+#include <dcp/dcp.h>
+#include <dcp/decrypted_kdm.h>
 #include <dcp/mono_picture_asset.h>
 #include <dcp/mono_picture_asset_reader.h>
-#include <dcp/stereo_picture_asset.h>
-#include <dcp/stereo_picture_asset_reader.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/reel.h>
+#include <dcp/reel_atmos_asset.h>
+#include <dcp/reel_closed_caption_asset.h>
 #include <dcp/reel_picture_asset.h>
 #include <dcp/reel_sound_asset.h>
 #include <dcp/reel_subtitle_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
-#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_frame.h>
-#include <dcp/sound_frame.h>
 #include <dcp/sound_asset_reader.h>
+#include <dcp/sound_frame.h>
+#include <dcp/stereo_picture_asset.h>
+#include <dcp/stereo_picture_asset_reader.h>
+#include <dcp/stereo_picture_frame.h>
 #include <dcp/subtitle_image.h>
-#include <dcp/decrypted_kdm.h>
-#include <dcp/reel_atmos_asset.h>
 #include <iostream>
 
 #include "i18n.h"
 
-using std::list;
+
 using std::cout;
+using std::dynamic_pointer_cast;
+using std::list;
+using std::make_shared;
 using std::map;
+using std::shared_ptr;
 using std::string;
 using std::vector;
-using std::shared_ptr;
-using std::dynamic_pointer_cast;
-using std::make_shared;
 using boost::optional;
 using namespace dcpomatic;
 
-DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> c, bool fast, bool tolerant, shared_ptr<DCPDecoder> old)
-       : DCP (c, tolerant)
+
+DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> content, bool fast, bool tolerant, shared_ptr<DCPDecoder> old)
+       : DCP (content, tolerant)
        , Decoder (film)
 {
-       if (c->can_be_played()) {
-               if (c->video) {
-                       video = make_shared<VideoDecoder>(this, c);
+       if (content->can_be_played()) {
+               if (content->video) {
+                       video = make_shared<VideoDecoder>(this, content);
                }
-               if (c->audio) {
-                       audio = make_shared<AudioDecoder>(this, c->audio, fast);
+               if (content->audio) {
+                       audio = make_shared<AudioDecoder>(this, content->audio, fast);
                }
-               for (auto i: c->text) {
+               for (auto i: content->text) {
                        /* XXX: this time here should be the time of the first subtitle, not 0 */
                        text.push_back (make_shared<TextDecoder>(this, i, ContentTime()));
                }
-               if (c->atmos) {
-                       atmos = make_shared<AtmosDecoder>(this, c);
+               if (content->atmos) {
+                       atmos = make_shared<AtmosDecoder>(this, content);
                }
        }
 
@@ -92,7 +95,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
           the same before we re-use _reels.
        */
 
-       _lazy_digest = calculate_lazy_digest (c);
+       _lazy_digest = calculate_lazy_digest (content);
 
        if (old && old->lazy_digest() == _lazy_digest) {
                _reels = old->_reels;
@@ -142,12 +145,12 @@ DCPDecoder::pass ()
                return true;
        }
 
-       double const vfr = _dcp_content->active_video_frame_rate (film());
+       auto const vfr = _dcp_content->active_video_frame_rate (film());
 
        /* Frame within the (played part of the) reel that is coming up next */
-       int64_t const frame = _next.frames_round (vfr);
+       auto const frame = _next.frames_round (vfr);
 
-       shared_ptr<dcp::PictureAsset> picture_asset = (*_reel)->main_picture()->asset();
+       auto picture_asset = (*_reel)->main_picture()->asset();
        DCPOMATIC_ASSERT (picture_asset);
 
        /* We must emit texts first as when we emit the video for this frame
@@ -156,7 +159,7 @@ DCPDecoder::pass ()
        pass_texts (_next, picture_asset->size());
 
        if ((_mono_reader || _stereo_reader) && (_decode_referenced || !_dcp_content->reference_video())) {
-               int64_t const entry_point = (*_reel)->main_picture()->entry_point().get_value_or(0);
+               auto const entry_point = (*_reel)->main_picture()->entry_point().get_value_or(0);
                if (_mono_reader) {
                        video->emit (
                                film(),
@@ -196,14 +199,14 @@ DCPDecoder::pass ()
        }
 
        if (_sound_reader && (_decode_referenced || !_dcp_content->reference_audio())) {
-               int64_t const entry_point = (*_reel)->main_sound()->entry_point().get_value_or(0);
-               shared_ptr<const dcp::SoundFrame> sf = _sound_reader->get_frame (entry_point + frame);
-               uint8_t const * from = sf->data ();
+               auto const entry_point = (*_reel)->main_sound()->entry_point().get_value_or(0);
+               auto sf = _sound_reader->get_frame (entry_point + frame);
+               auto from = sf->data ();
 
                int const channels = _dcp_content->audio->stream()->channels ();
                int const frames = sf->size() / (3 * channels);
-               shared_ptr<AudioBuffers> data (new AudioBuffers (channels, frames));
-               float** data_data = data->data();
+               auto data = make_shared<AudioBuffers>(channels, frames);
+               auto data_data = data->data();
                for (int i = 0; i < frames; ++i) {
                        for (int j = 0; j < channels; ++j) {
                                data_data[j][i] = static_cast<int> ((from[0] << 8) | (from[1] << 16) | (from[2] << 24)) / static_cast<float> (INT_MAX - 256);
@@ -216,7 +219,7 @@ DCPDecoder::pass ()
 
        if (_atmos_reader) {
                DCPOMATIC_ASSERT (_atmos_metadata);
-               int64_t const entry_point = (*_reel)->atmos()->entry_point().get_value_or(0);
+               auto const entry_point = (*_reel)->atmos()->entry_point().get_value_or(0);
                atmos->emit (film(), _atmos_reader->get_frame(entry_point + frame), _offset + frame, *_atmos_metadata);
        }
 
@@ -232,6 +235,7 @@ DCPDecoder::pass ()
        return false;
 }
 
+
 void
 DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
 {
@@ -268,9 +272,9 @@ DCPDecoder::pass_texts (
        ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size
        )
 {
-       double const vfr = _dcp_content->active_video_frame_rate (film());
+       auto const vfr = _dcp_content->active_video_frame_rate (film());
        /* Frame within the (played part of the) reel that is coming up next */
-       int64_t const frame = next.frames_round (vfr);
+       auto const frame = next.frames_round (vfr);
 
        if (_decode_referenced || !reference) {
                auto subs = asset->subtitles_during (
@@ -331,6 +335,7 @@ DCPDecoder::pass_texts (
        }
 }
 
+
 void
 DCPDecoder::next_reel ()
 {
@@ -339,6 +344,7 @@ DCPDecoder::next_reel ()
        get_readers ();
 }
 
+
 void
 DCPDecoder::get_readers ()
 {
@@ -351,9 +357,9 @@ DCPDecoder::get_readers ()
        }
 
        if ((*_reel)->main_picture()) {
-               shared_ptr<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset ();
-               shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
-               shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
+               auto asset = (*_reel)->main_picture()->asset ();
+               auto mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
+               auto stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
                DCPOMATIC_ASSERT (mono || stereo);
                if (mono) {
                        _mono_reader = mono->start_read ();
@@ -377,7 +383,7 @@ DCPDecoder::get_readers ()
        }
 
        if ((*_reel)->atmos()) {
-               shared_ptr<dcp::AtmosAsset> asset = (*_reel)->atmos()->asset();
+               auto asset = (*_reel)->atmos()->asset();
                _atmos_reader = asset->start_read();
                _atmos_reader->set_check_hmac (false);
                _atmos_metadata = AtmosMetadata (asset);
@@ -387,6 +393,7 @@ DCPDecoder::get_readers ()
        }
 }
 
+
 void
 DCPDecoder::seek (ContentTime t, bool accurate)
 {
@@ -404,7 +411,7 @@ DCPDecoder::seek (ContentTime t, bool accurate)
 
        /* Pre-roll for subs */
 
-       ContentTime pre = t - ContentTime::from_seconds (pre_roll_seconds);
+       auto pre = t - ContentTime::from_seconds (pre_roll_seconds);
        if (pre < ContentTime()) {
                pre = ContentTime ();
        }
@@ -416,7 +423,7 @@ DCPDecoder::seek (ContentTime t, bool accurate)
                pre >= ContentTime::from_frames ((*_reel)->main_picture()->actual_duration(), _dcp_content->active_video_frame_rate(film()))
                ) {
 
-               ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->actual_duration(), _dcp_content->active_video_frame_rate(film()));
+               auto rd = ContentTime::from_frames ((*_reel)->main_picture()->actual_duration(), _dcp_content->active_video_frame_rate(film()));
                pre -= rd;
                t -= rd;
                next_reel ();
@@ -424,7 +431,7 @@ DCPDecoder::seek (ContentTime t, bool accurate)
 
        /* Pass texts in the pre-roll */
 
-       double const vfr = _dcp_content->active_video_frame_rate (film());
+       auto const vfr = _dcp_content->active_video_frame_rate (film());
        for (int i = 0; i < pre_roll_seconds * vfr; ++i) {
                pass_texts (pre, (*_reel)->main_picture()->asset()->size());
                pre += ContentTime::from_frames (1, vfr);
@@ -444,6 +451,7 @@ DCPDecoder::seek (ContentTime t, bool accurate)
        _next = t;
 }
 
+
 void
 DCPDecoder::set_decode_referenced (bool r)
 {
@@ -457,12 +465,14 @@ DCPDecoder::set_decode_referenced (bool r)
        }
 }
 
+
 void
 DCPDecoder::set_forced_reduction (optional<int> reduction)
 {
        _forced_reduction = reduction;
 }
 
+
 string
 DCPDecoder::calculate_lazy_digest (shared_ptr<const DCPContent> c) const
 {
@@ -480,6 +490,7 @@ DCPDecoder::calculate_lazy_digest (shared_ptr<const DCPContent> c) const
        return d.get ();
 }
 
+
 ContentTime
 DCPDecoder::position () const
 {
@@ -493,9 +504,8 @@ DCPDecoder::fonts () const
        vector<FontData> data;
        for (auto i: _reels) {
                if (i->main_subtitle() && i->main_subtitle()->asset()) {
-                       map<string, dcp::ArrayData> fm = i->main_subtitle()->asset()->font_data();
-                       for (map<string, dcp::ArrayData>::const_iterator j = fm.begin(); j != fm.end(); ++j) {
-                               data.push_back (FontData(j->first, j->second));
+                       for (auto const& j: i->main_subtitle()->asset()->font_data()) {
+                               data.push_back (FontData(j.first, j.second));
                        }
                }
        }
index 04711130b9e2357412ce1624e924f2e444ebdd13..cf4835c062057fd99b278882737001e9b1d7c15c 100644 (file)
 */
 
 
-#include "dcp_examiner.h"
+#include "config.h"
 #include "dcp_content.h"
+#include "dcp_examiner.h"
 #include "dcpomatic_log.h"
 #include "exceptions.h"
 #include "image.h"
-#include "config.h"
 #include "util.h"
+#include <dcp/cpl.h>
 #include <dcp/dcp.h>
 #include <dcp/decrypted_kdm.h>
-#include <dcp/cpl.h>
-#include <dcp/reel.h>
-#include <dcp/reel_picture_asset.h>
-#include <dcp/reel_sound_asset.h>
 #include <dcp/mono_picture_asset.h>
 #include <dcp/mono_picture_asset_reader.h>
 #include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_asset.h>
-#include <dcp/stereo_picture_asset_reader.h>
-#include <dcp/stereo_picture_frame.h>
-#include <dcp/sound_asset.h>
-#include <dcp/sound_asset_reader.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/reel.h>
 #include <dcp/reel_atmos_asset.h>
-#include <dcp/reel_subtitle_asset.h>
 #include <dcp/reel_closed_caption_asset.h>
 #include <dcp/reel_markers_asset.h>
+#include <dcp/reel_picture_asset.h>
+#include <dcp/reel_sound_asset.h>
+#include <dcp/reel_subtitle_asset.h>
 #include <dcp/sound_asset.h>
+#include <dcp/sound_asset.h>
+#include <dcp/sound_asset_reader.h>
+#include <dcp/stereo_picture_asset.h>
+#include <dcp/stereo_picture_asset_reader.h>
+#include <dcp/stereo_picture_frame.h>
+#include <dcp/subtitle_asset.h>
 #include <iostream>
 
 #include "i18n.h"
index 3a85a5ac6acf553eb7adc8dadc66d8530671d216..4a41e17b9c514fe728a081d0e9f7c453fb05c76b 100644 (file)
@@ -125,7 +125,7 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
  *  @return Encoded data.
  */
 ArrayData
-DCPVideo::encode_locally ()
+DCPVideo::encode_locally () const
 {
        auto const comment = Config::instance()->dcp_j2k_comment();
 
@@ -204,7 +204,7 @@ DCPVideo::encode_locally ()
  *  @return Encoded data.
  */
 ArrayData
-DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
+DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout) const
 {
        boost::asio::io_service io_service;
        boost::asio::ip::tcp::resolver resolver (io_service);
index 0bb583c57488432e86b27fbf2411430660d6a147..862b787d2f1db7b87c264aa8da9346acc8580f5d 100644 (file)
@@ -48,8 +48,8 @@ public:
        DCPVideo (DCPVideo const&) = delete;
        DCPVideo& operator= (DCPVideo const&) = delete;
 
-       dcp::ArrayData encode_locally ();
-       dcp::ArrayData encode_remotely (EncodeServerDescription, int timeout = 30);
+       dcp::ArrayData encode_locally () const;
+       dcp::ArrayData encode_remotely (EncodeServerDescription, int timeout = 30) const;
 
        int index () const {
                return _index;
index 1acef6f4fbe9326d8b50d0f59050f0489a55e6bc..1bda93c9477c26de99946674b5481005cc389059 100644 (file)
 
 */
 
+
 #include "atmos_mxf_content.h"
 #include "atmos_mxf_decoder.h"
-#include "ffmpeg_content.h"
-#include "ffmpeg_decoder.h"
 #include "dcp_content.h"
 #include "dcp_decoder.h"
+#include "dcp_subtitle_content.h"
+#include "dcp_subtitle_decoder.h"
+#include "ffmpeg_content.h"
+#include "ffmpeg_decoder.h"
 #include "image_content.h"
 #include "image_decoder.h"
 #include "string_text_file_content.h"
 #include "string_text_file_decoder.h"
-#include "dcp_subtitle_content.h"
-#include "dcp_subtitle_decoder.h"
+#include "timer.h"
 #include "video_mxf_content.h"
 #include "video_mxf_decoder.h"
-#include "timer.h"
 
+
+using std::dynamic_pointer_cast;
 using std::list;
+using std::make_shared;
 using std::shared_ptr;
-using std::dynamic_pointer_cast;
+
 
 template <class T>
 shared_ptr<T>
 maybe_cast (shared_ptr<Decoder> d)
 {
        if (!d) {
-               return shared_ptr<T> ();
+               return {};
        }
        return dynamic_pointer_cast<T> (d);
 }
@@ -55,45 +59,45 @@ maybe_cast (shared_ptr<Decoder> d)
 shared_ptr<Decoder>
 decoder_factory (shared_ptr<const Film> film, shared_ptr<const Content> content, bool fast, bool tolerant, shared_ptr<Decoder> old_decoder)
 {
-       shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
+       auto fc = dynamic_pointer_cast<const FFmpegContent> (content);
        if (fc) {
-               return shared_ptr<Decoder> (new FFmpegDecoder(film, fc, fast));
+               return make_shared<FFmpegDecoder>(film, fc, fast);
        }
 
-       shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
+       auto dc = dynamic_pointer_cast<const DCPContent> (content);
        if (dc) {
                try {
-                       return shared_ptr<Decoder> (new DCPDecoder(film, dc, fast, tolerant, maybe_cast<DCPDecoder>(old_decoder)));
+                       return make_shared<DCPDecoder>(film, dc, fast, tolerant, maybe_cast<DCPDecoder>(old_decoder));
                } catch (KDMError& e) {
                        /* This will be found and reported to the user when the content is examined */
-                       return shared_ptr<Decoder>();
+                       return {};
                }
        }
 
-       shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
+       auto ic = dynamic_pointer_cast<const ImageContent> (content);
        if (ic) {
-               return shared_ptr<Decoder> (new ImageDecoder(film, ic));
+               return make_shared<ImageDecoder>(film, ic);
        }
 
-       shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
+       auto rc = dynamic_pointer_cast<const StringTextFileContent> (content);
        if (rc) {
-               return shared_ptr<Decoder> (new StringTextFileDecoder(film, rc));
+               return make_shared<StringTextFileDecoder>(film, rc);
        }
 
-       shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
+       auto dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
        if (dsc) {
-               return shared_ptr<Decoder> (new DCPSubtitleDecoder(film, dsc));
+               return make_shared<DCPSubtitleDecoder>(film, dsc);
        }
 
-       shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
+       auto vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
        if (vmc) {
-               return shared_ptr<Decoder> (new VideoMXFDecoder(film, vmc));
+               return make_shared<VideoMXFDecoder>(film, vmc);
        }
 
-       shared_ptr<const AtmosMXFContent> amc = dynamic_pointer_cast<const AtmosMXFContent> (content);
+       auto amc = dynamic_pointer_cast<const AtmosMXFContent> (content);
        if (amc) {
-               return shared_ptr<Decoder> (new AtmosMXFDecoder(film, amc));
+               return make_shared<AtmosMXFDecoder>(film, amc);
        }
 
-       return shared_ptr<Decoder> ();
+       return {};
 }
index b15487c8ab4935864334ec27957ba0b4fc5ba4a2..ff19aa265b050e05d7c267cebe67dd9eebdcb66d 100644 (file)
@@ -20,8 +20,8 @@
 
 
 #include "dkdm_recipient.h"
-#include "kdm_with_metadata.h"
 #include "film.h"
+#include "kdm_with_metadata.h"
 #include <dcp/raw_convert.h>
 
 
@@ -68,7 +68,7 @@ kdm_for_dkdm_recipient (
        )
 {
        if (!recipient->recipient) {
-               return KDMWithMetadataPtr();
+               return {};
        }
 
        dcp::LocalTime const begin(valid_from, recipient->utc_offset_hour, recipient->utc_offset_minute);
index ec34f147216d97af091fdaaeec060c9620403fef..af5229f72f41c02941f6905911eb34495be91d61 100644 (file)
@@ -248,8 +248,8 @@ copy (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_
                }
                set_timestamps_to_now (cr);
 
-               for (directory_iterator i = directory_iterator(from); i != directory_iterator(); ++i) {
-                       copy (i->path(), cr, total_remaining, total, copied_files, nanomsg);
+               for (auto i: directory_iterator(from)) {
+                       copy (i.path(), cr, total_remaining, total, copied_files, nanomsg);
                }
        } else {
                string const write_digest = write (from, cr, total_remaining, total, nanomsg);
index 0f63ea1727ee5374ce3d41ecd3c96a9f874386cf..77717a38f3c1dcf8af1cf367ba59e3e7211d7b29 100644 (file)
 */
 
 
+#include "compose.hpp"
+#include "config.h"
+#include "dcpomatic_log.h"
+#include "digester.h"
+#include "exceptions.h"
 #include "ffmpeg.h"
+#include "ffmpeg_audio_stream.h"
 #include "ffmpeg_content.h"
+#include "ffmpeg_subtitle_stream.h"
 #include "film.h"
-#include "exceptions.h"
-#include "util.h"
 #include "log.h"
-#include "dcpomatic_log.h"
-#include "ffmpeg_subtitle_stream.h"
-#include "ffmpeg_audio_stream.h"
-#include "digester.h"
-#include "compose.hpp"
-#include "config.h"
+#include "util.h"
 #include <dcp/raw_convert.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
index d49878217338fb40e29eab6892b62d44c788ef9d..30a4b1823e8873193051ec2c6e91f9bbfe68f4c8 100644 (file)
@@ -144,7 +144,7 @@ FFmpegDecoder::flush ()
                auto const f = full_length.frames_round (vfr);
                auto v = video->position(film()).get_value_or(ContentTime()).frames_round(vfr) + 1;
                while (v < f) {
-                       video->emit (film(), shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
+                       video->emit (film(), make_shared<const RawImageProxy>(_black_image), v);
                        ++v;
                }
        }
index 29e0d22e6339d6bc957c8f9a9552805c468bdd16..b4b0faa3bee5bdd44eb91cdc2657ffce87289b1b 100644 (file)
@@ -73,7 +73,7 @@ private:
 
        void maybe_add_subtitle ();
 
-       std::list<std::shared_ptr<VideoFilterGraph> > _filter_graphs;
+       std::list<std::shared_ptr<VideoFilterGraph>> _filter_graphs;
        boost::mutex _filter_graphs_mutex;
 
        dcpomatic::ContentTime _pts_offset;
index f450c8022de62e53f05540a3060a392b9799c05e..393a6d72eaa58bd1d09670015315a43a18097824 100644 (file)
@@ -73,7 +73,7 @@ private:
                void audio (std::shared_ptr<AudioBuffers>);
 
        private:
-               std::map<Eyes, std::shared_ptr<FFmpegFileEncoder> > _encoders;
+               std::map<Eyes, std::shared_ptr<FFmpegFileEncoder>> _encoders;
        };
 
        int _output_audio_channels;
index d9ed8c53000b8430c0f02f3838b6f4bdf59b09cb..718d6c61db1d6281f4f33c96a80bdd29cbe8b9a4 100644 (file)
 #include <boost/filesystem.hpp>
 #include <boost/regex.hpp>
 #include <unistd.h>
-#include <stdexcept>
-#include <iostream>
 #include <algorithm>
 #include <cstdlib>
 #include <iomanip>
+#include <iostream>
 #include <set>
+#include <stdexcept>
 
 #include "i18n.h"
 
index 55bbb406959a65167626c894515ec99833f0b5d9..7103f627115e51fe5a5d8305589f5601ec4e3848 100644 (file)
 
 */
 
+
 /** @file  src/film.h
  *  @brief A representation of some audio and video content, and details of
  *  how they should be presented in a DCP.
  */
 
+
 #ifndef DCPOMATIC_FILM_H
 #define DCPOMATIC_FILM_H
 
+
 #include "change_signaller.h"
 #include "dcp_text_track.h"
 #include "frame_rate_change.h"
@@ -45,6 +48,7 @@
 #include <string>
 #include <vector>
 
+
 namespace xmlpp {
        class Document;
 }
@@ -66,6 +70,7 @@ struct isdcf_name_test;
 struct recover_test_2d_encrypted;
 struct atmos_encrypted_passthrough_test;
 
+
 class InfoFileHandle
 {
 public:
@@ -413,7 +418,6 @@ public:
                return _isdcf_date;
        }
 
-
        /* SET */
 
        void set_directory (boost::filesystem::path);
index a1ff2ae650a93d7ec19782763f359b4b6a0c883a..99424a9c1d55e969245c9c2cec2b2f2581a28b3b 100644 (file)
 */
 
 
-#include "frame_rate_change.h"
-#include "types.h"
+#include "compose.hpp"
 #include "content.h"
 #include "film.h"
-#include "compose.hpp"
+#include "frame_rate_change.h"
+#include "types.h"
 #include <cmath>
 
 #include "i18n.h"
 
 
-using std::string;
 using std::shared_ptr;
+using std::string;
 
 
 FrameRateChange::FrameRateChange ()
index a4e04bb626d5a146e0cd0405aa94eec850feb5c7..1adcabc065a2f1d3293c504a7c5df001cb05e0fc 100644 (file)
@@ -107,6 +107,7 @@ Image::horizontal_factor (int n) const
        return lrintf(powf(2.0f, d->log2_chroma_w));
 }
 
+
 /** @param n Component index.
  *  @return Number of samples (i.e. pixels, unless sub-sampled) in each direction for this component.
  */
@@ -119,19 +120,20 @@ Image::sample_size (int n) const
                );
 }
 
+
 /** @return Number of planes */
 int
 Image::planes () const
 {
+       if (_pixel_format == AV_PIX_FMT_PAL8) {
+               return 2;
+       }
+
        auto d = av_pix_fmt_desc_get(_pixel_format);
        if (!d) {
                throw PixelFormatError ("planes()", _pixel_format);
        }
 
-       if (_pixel_format == AV_PIX_FMT_PAL8) {
-               return 2;
-       }
-
        if ((d->flags & AV_PIX_FMT_FLAG_PLANAR) == 0) {
                return 1;
        }
@@ -309,12 +311,14 @@ Image::crop_scale_window (
        return out;
 }
 
+
 shared_ptr<Image>
 Image::convert_pixel_format (dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_format, Alignment out_alignment, bool fast) const
 {
        return scale(size(), yuv_to_rgb, out_format, out_alignment, fast);
 }
 
+
 /** @param out_size Size to scale to.
  *  @param yuv_to_rgb YUVToRGB transform transform to use, if required.
  *  @param out_format Output pixel format.
@@ -373,6 +377,7 @@ Image::scale (dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_fo
        return scaled;
 }
 
+
 /** Blacken a YUV image whose bits per pixel is rounded up to 16 */
 void
 Image::yuv_16_black (uint16_t v, bool alpha)
@@ -395,12 +400,14 @@ Image::yuv_16_black (uint16_t v, bool alpha)
        }
 }
 
+
 uint16_t
 Image::swap_16 (uint16_t v)
 {
        return ((v >> 8) & 0xff) | ((v & 0xff) << 8);
 }
 
+
 void
 Image::make_part_black (int const start, int const width)
 {
@@ -471,6 +478,7 @@ Image::make_part_black (int const start, int const width)
        }
 }
 
+
 void
 Image::make_black ()
 {
@@ -586,6 +594,7 @@ Image::make_black ()
        }
 }
 
+
 void
 Image::make_transparent ()
 {
@@ -596,6 +605,7 @@ Image::make_transparent ()
        memset (data()[0], 0, sample_size(0).height * stride()[0]);
 }
 
+
 void
 Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
 {
@@ -842,6 +852,7 @@ Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
        }
 }
 
+
 void
 Image::copy (shared_ptr<const Image> other, Position<int> position)
 {
@@ -857,6 +868,7 @@ Image::copy (shared_ptr<const Image> other, Position<int> position)
        }
 }
 
+
 void
 Image::read_from_socket (shared_ptr<Socket> socket)
 {
@@ -870,6 +882,7 @@ Image::read_from_socket (shared_ptr<Socket> socket)
        }
 }
 
+
 void
 Image::write_to_socket (shared_ptr<Socket> socket) const
 {
@@ -883,6 +896,7 @@ Image::write_to_socket (shared_ptr<Socket> socket) const
        }
 }
 
+
 float
 Image::bytes_per_pixel (int c) const
 {
@@ -929,6 +943,7 @@ Image::bytes_per_pixel (int c) const
        return bpp[c];
 }
 
+
 /** Construct a Image of a given size and format, allocating memory
  *  as required.
  *
@@ -1008,6 +1023,7 @@ Image::allocate ()
        }
 }
 
+
 Image::Image (Image const & other)
        : std::enable_shared_from_this<Image>(other)
        , _size (other._size)
@@ -1028,6 +1044,7 @@ Image::Image (Image const & other)
        }
 }
 
+
 Image::Image (AVFrame const * frame, Alignment alignment)
        : _size (frame->width, frame->height)
        , _pixel_format (static_cast<AVPixelFormat>(frame->format))
@@ -1050,6 +1067,7 @@ Image::Image (AVFrame const * frame, Alignment alignment)
        }
 }
 
+
 Image::Image (shared_ptr<const Image> other, Alignment alignment)
        : _size (other->_size)
        , _pixel_format (other->_pixel_format)
@@ -1070,6 +1088,7 @@ Image::Image (shared_ptr<const Image> other, Alignment alignment)
        }
 }
 
+
 Image&
 Image::operator= (Image const & other)
 {
@@ -1082,6 +1101,7 @@ Image::operator= (Image const & other)
        return *this;
 }
 
+
 void
 Image::swap (Image & other)
 {
@@ -1097,6 +1117,7 @@ Image::swap (Image & other)
        std::swap (_alignment, other._alignment);
 }
 
+
 Image::~Image ()
 {
        for (int i = 0; i < planes(); ++i) {
@@ -1108,30 +1129,35 @@ Image::~Image ()
        av_free (_stride);
 }
 
+
 uint8_t * const *
 Image::data () const
 {
        return _data;
 }
 
+
 int const *
 Image::line_size () const
 {
        return _line_size;
 }
 
+
 int const *
 Image::stride () const
 {
        return _stride;
 }
 
+
 dcp::Size
 Image::size () const
 {
        return _size;
 }
 
+
 Image::Alignment
 Image::alignment () const
 {
@@ -1194,6 +1220,7 @@ operator== (Image const & a, Image const & b)
        return true;
 }
 
+
 /** Fade the image.
  *  @param f Amount to fade by; 0 is black, 1 is no fade.
  */
@@ -1336,6 +1363,7 @@ Image::memory_used () const
        return m;
 }
 
+
 class Memory
 {
 public:
@@ -1353,6 +1381,7 @@ public:
        size_t size;
 };
 
+
 static void
 png_write_data (png_structp png_ptr, png_bytep data, png_size_t length)
 {
@@ -1373,24 +1402,28 @@ png_write_data (png_structp png_ptr, png_bytep data, png_size_t length)
        mem->size += length;
 }
 
+
 static void
 png_flush (png_structp)
 {
 
 }
 
+
 static void
 png_error_fn (png_structp png_ptr, char const * message)
 {
        reinterpret_cast<Image*>(png_get_error_ptr(png_ptr))->png_error (message);
 }
 
+
 void
 Image::png_error (char const * message)
 {
        throw EncodeError (String::compose ("Error during PNG write: %1", message));
 }
 
+
 dcp::ArrayData
 Image::as_png () const
 {
index 517d6792f89715d16f83edcaa60779f40a7e99ee..9464babd4656fe61f3aa65fa6bfd7775f095b334 100644 (file)
 
 */
 
-#include "image_content.h"
-#include "video_content.h"
-#include "image_examiner.h"
+
 #include "compose.hpp"
+#include "exceptions.h"
 #include "film.h"
-#include "job.h"
 #include "frame_rate_change.h"
-#include "exceptions.h"
+#include "image_content.h"
+#include "image_examiner.h"
 #include "image_filename_sorter.h"
+#include "job.h"
+#include "video_content.h"
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <iostream>
 
 #include "i18n.h"
 
-using std::string;
+
 using std::cout;
 using std::list;
-using std::vector;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using namespace dcpomatic;
 
+
 ImageContent::ImageContent (boost::filesystem::path p)
 {
-       video.reset (new VideoContent (this));
+       video = make_shared<VideoContent>(this);
 
        if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
                add_path (p);
@@ -60,6 +64,7 @@ ImageContent::ImageContent (cxml::ConstNodePtr node, int version)
        video = VideoContent::from_xml (this, node, version);
 }
 
+
 string
 ImageContent::summary () const
 {
@@ -74,6 +79,7 @@ ImageContent::summary () const
        return s;
 }
 
+
 string
 ImageContent::technical_summary () const
 {
@@ -89,6 +95,7 @@ ImageContent::technical_summary () const
        return s;
 }
 
+
 void
 ImageContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
@@ -100,6 +107,7 @@ ImageContent::as_xml (xmlpp::Node* node, bool with_paths) const
        }
 }
 
+
 void
 ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
@@ -107,9 +115,9 @@ ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                job->sub (_("Scanning image files"));
                vector<boost::filesystem::path> paths;
                int n = 0;
-               for (boost::filesystem::directory_iterator i(*_path_to_scan); i != boost::filesystem::directory_iterator(); ++i) {
-                       if (boost::filesystem::is_regular_file (i->path()) && valid_image_file (i->path())) {
-                               paths.push_back (i->path());
+               for (auto i: boost::filesystem::directory_iterator(*_path_to_scan)) {
+                       if (boost::filesystem::is_regular_file(i.path()) && valid_image_file (i.path())) {
+                               paths.push_back (i.path());
                        }
                        ++n;
                        if ((n % 1000) == 0) {
@@ -127,11 +135,12 @@ ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 
        Content::examine (film, job);
 
-       shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
+       auto examiner = make_shared<ImageExaminer>(film, shared_from_this(), job);
        video->take_from_examiner (examiner);
        set_default_colour_conversion ();
 }
 
+
 DCPTime
 ImageContent::full_length (shared_ptr<const Film> film) const
 {
@@ -139,12 +148,14 @@ ImageContent::full_length (shared_ptr<const Film> film) const
        return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
 }
 
+
 DCPTime
 ImageContent::approximate_length () const
 {
        return DCPTime::from_frames (video->length_after_3d_combine(), 24);
 }
 
+
 string
 ImageContent::identifier () const
 {
@@ -153,12 +164,14 @@ ImageContent::identifier () const
        return buffer;
 }
 
+
 bool
 ImageContent::still () const
 {
        return number_of_paths() == 1;
 }
 
+
 void
 ImageContent::set_default_colour_conversion ()
 {
@@ -181,6 +194,7 @@ ImageContent::set_default_colour_conversion ()
        }
 }
 
+
 void
 ImageContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
 {
index e1106f86d08f616455aa2323180d80212c4f6b3c..59dc4e873fd92fcaa5a0723351b6fda862ff51ad 100644 (file)
 */
 
 
+#include "exceptions.h"
+#include "ffmpeg_image_proxy.h"
+#include "film.h"
+#include "frame_interval_checker.h"
+#include "image.h"
 #include "image_content.h"
 #include "image_decoder.h"
-#include "video_decoder.h"
-#include "image.h"
-#include "ffmpeg_image_proxy.h"
 #include "j2k_image_proxy.h"
-#include "film.h"
-#include "exceptions.h"
 #include "video_content.h"
-#include "frame_interval_checker.h"
+#include "video_decoder.h"
 #include <boost/filesystem.hpp>
 #include <iostream>
 
index ae12d7adb3570363304326250fe55474b3827039..2235c2e6994003e1c6deba869966d80647dc99e0 100644 (file)
 */
 
 
-#include "image_content.h"
-#include "image_examiner.h"
-#include "film.h"
-#include "job.h"
-#include "exceptions.h"
+#include "compose.hpp"
 #include "config.h"
 #include "cross.h"
-#include "compose.hpp"
+#include "exceptions.h"
 #include "ffmpeg_image_proxy.h"
+#include "film.h"
 #include "image.h"
+#include "image_content.h"
+#include "image_examiner.h"
+#include "job.h"
 #include <dcp/openjpeg_image.h>
 #include <dcp/exceptions.h>
 #include <dcp/j2k_transcode.h>
@@ -39,8 +39,8 @@
 
 using std::cout;
 using std::list;
-using std::sort;
 using std::shared_ptr;
+using std::sort;
 using boost::optional;
 
 
index ea5f46da64401e5c92596201e3011a119a319b74..ab0d298fc1bd0f9bcceb881a83744d9157681433 100644 (file)
 
 */
 
+
 #include "image_filename_sorter.h"
 #include <dcp/locale_convert.h>
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
 #include <iostream>
 
+
 using std::list;
 using std::string;
 using dcp::locale_convert;
 using boost::optional;
 
+
 bool
 ImageFilenameSorter::operator() (boost::filesystem::path a, boost::filesystem::path b)
 {
-       string an = extract_numbers (a);
-       string bn = extract_numbers (b);
+       auto an = extract_numbers (a);
+       auto bn = extract_numbers (b);
 
        int const anl = an.length ();
        int const bnl = bn.length ();
@@ -51,7 +54,7 @@ string
 ImageFilenameSorter::extract_numbers (boost::filesystem::path p)
 {
        string numbers;
-       string const ps = p.leaf().string();
+       auto const ps = p.leaf().string();
        for (size_t i = 0; i < ps.size(); ++i) {
                if (isdigit (ps[i])) {
                        numbers += ps[i];
index 9e456c941b9d768dc711ca8625d0edb6be1de02b..c426e796fba8d05819ac9d9133f03415dadba4db 100644 (file)
 */
 
 
-#include "image_proxy.h"
-#include "raw_image_proxy.h"
+#include "cross.h"
+#include "exceptions.h"
 #include "ffmpeg_image_proxy.h"
-#include "j2k_image_proxy.h"
 #include "image.h"
-#include "exceptions.h"
-#include "cross.h"
+#include "image_proxy.h"
+#include "j2k_image_proxy.h"
+#include "raw_image_proxy.h"
 #include <dcp/util.h>
 #include <libcxml/cxml.h>
 #include <iostream>
index 121d3524c7f4f83acbddd1df6d7cb3a8c6aba94a..c0c8232eef6b13e3c3f843f0c28e451dcf6ff1cf 100644 (file)
 */
 
 
-#include "scoped_temporary.h"
 #include "compose.hpp"
-#include "exceptions.h"
 #include "cross.h"
+#include "exceptions.h"
+#include "scoped_temporary.h"
 #include "util.h"
 #include <curl/curl.h>
 #include <zip.h>
@@ -37,8 +37,8 @@
 using std::function;
 using std::list;
 using std::string;
-using boost::optional;
 using boost::algorithm::trim;
+using boost::optional;
 
 
 static size_t
@@ -66,7 +66,7 @@ ls_url (string url)
        auto const cr = curl_easy_perform (curl);
 
        if (cr != CURLE_OK) {
-               return list<string>();
+               return {};
        }
 
        list<string> result;
index 5dee5ca35af998c07ed1ebcc76684b25c946563c..55961fc6be9683861922253953f2774443b2d474 100644 (file)
  */
 
 
-#include "j2k_encoder.h"
-#include "util.h"
-#include "film.h"
-#include "log.h"
-#include "dcpomatic_log.h"
+#include "compose.hpp"
 #include "config.h"
-#include "dcp_video.h"
 #include "cross.h"
-#include "writer.h"
+#include "dcp_video.h"
+#include "dcpomatic_log.h"
+#include "encode_server_description.h"
 #include "encode_server_finder.h"
+#include "film.h"
+#include "j2k_encoder.h"
+#include "log.h"
 #include "player.h"
 #include "player_video.h"
-#include "encode_server_description.h"
-#include "compose.hpp"
+#include "util.h"
+#include "writer.h"
 #include <libcxml/cxml.h>
 #include <iostream>
 
 #include "i18n.h"
 
 
-using std::list;
 using std::cout;
 using std::exception;
+using std::list;
+using std::make_shared;
 using std::shared_ptr;
 using std::weak_ptr;
-using std::make_shared;
 using boost::optional;
 using dcp::Data;
 using namespace dcpomatic;
index 00d3cf2ef20b4edfb473dbcaa442e73bdff9a9b5..67083e6550cb314b7e9a13f166ea1486ffb26bec 100644 (file)
 */
 
 
-#include "j2k_image_proxy.h"
+#include "dcpomatic_assert.h"
 #include "dcpomatic_socket.h"
 #include "image.h"
-#include "dcpomatic_assert.h"
+#include "j2k_image_proxy.h"
 #include "warnings.h"
-#include <dcp/raw_convert.h>
-#include <dcp/openjpeg_image.h>
-#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_frame.h>
 #include <dcp/colour_conversion.h>
-#include <dcp/rgb_xyz.h>
 #include <dcp/j2k_transcode.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/openjpeg_image.h>
+#include <dcp/raw_convert.h>
+#include <dcp/rgb_xyz.h>
+#include <dcp/stereo_picture_frame.h>
 #include <libcxml/cxml.h>
 DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
index 4c8199bdcc1b52294368b305f101238dd222f0c9..50dcc336e2fd9029b3d659246165e06d3e303f10 100644 (file)
 
 */
 
+
 /** @file  src/job.cc
  *  @brief A parent class to represent long-running tasks which are run in their own thread.
  */
 
-#include "job.h"
-#include "util.h"
+
+#include "compose.hpp"
 #include "cross.h"
+#include "dcpomatic_log.h"
 #include "exceptions.h"
 #include "film.h"
+#include "job.h"
 #include "log.h"
-#include "dcpomatic_log.h"
-#include "compose.hpp"
+#include "util.h"
 #include <dcp/exceptions.h>
 #include <sub/exceptions.h>
-#include <boost/thread.hpp>
-#include <boost/filesystem.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/thread.hpp>
 #include <iostream>
 
 #include "i18n.h"
 
-using std::string;
-using std::list;
+
 using std::cout;
+using std::function;
+using std::list;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
-using std::function;
 using namespace dcpomatic;
 
+
 /** @param film Associated film, or 0 */
 Job::Job (shared_ptr<const Film> film)
        : _film (film)
@@ -59,6 +63,7 @@ Job::Job (shared_ptr<const Film> film)
 
 }
 
+
 Job::~Job ()
 {
 #ifdef DCPOMATIC_DEBUG
@@ -67,6 +72,7 @@ Job::~Job ()
 #endif
 }
 
+
 void
 Job::stop_thread ()
 {
@@ -78,6 +84,7 @@ Job::stop_thread ()
        } catch (...) {}
 }
 
+
 /** Start the job in a separate thread, returning immediately */
 void
 Job::start ()
@@ -91,6 +98,7 @@ Job::start ()
 #endif
 }
 
+
 /** A wrapper for the ::run() method to catch exceptions */
 void
 Job::run_wrapper ()
@@ -251,6 +259,7 @@ Job::run_wrapper ()
        }
 }
 
+
 /** @return true if this job is new (ie has not started running) */
 bool
 Job::is_new () const
@@ -259,6 +268,7 @@ Job::is_new () const
        return _state == NEW;
 }
 
+
 /** @return true if the job is running */
 bool
 Job::running () const
@@ -267,6 +277,7 @@ Job::running () const
        return _state == RUNNING;
 }
 
+
 /** @return true if the job has finished (either successfully or unsuccessfully) */
 bool
 Job::finished () const
@@ -275,6 +286,7 @@ Job::finished () const
        return _state == FINISHED_OK || _state == FINISHED_ERROR || _state == FINISHED_CANCELLED;
 }
 
+
 /** @return true if the job has finished successfully */
 bool
 Job::finished_ok () const
@@ -283,6 +295,7 @@ Job::finished_ok () const
        return _state == FINISHED_OK;
 }
 
+
 /** @return true if the job has finished unsuccessfully */
 bool
 Job::finished_in_error () const
@@ -291,6 +304,7 @@ Job::finished_in_error () const
        return _state == FINISHED_ERROR;
 }
 
+
 bool
 Job::finished_cancelled () const
 {
@@ -298,6 +312,7 @@ Job::finished_cancelled () const
        return _state == FINISHED_CANCELLED;
 }
 
+
 bool
 Job::paused_by_user () const
 {
@@ -305,6 +320,7 @@ Job::paused_by_user () const
        return _state == PAUSED_BY_USER;
 }
 
+
 bool
 Job::paused_by_priority () const
 {
@@ -312,6 +328,7 @@ Job::paused_by_priority () const
        return _state == PAUSED_BY_PRIORITY;
 }
 
+
 /** Set the state of this job.
  *  @param s New state.
  */
@@ -337,6 +354,7 @@ Job::set_state (State s)
        }
 }
 
+
 /** @return DCPTime (in seconds) that this sub-job has been running */
 int
 Job::elapsed_sub_time () const
@@ -348,6 +366,7 @@ Job::elapsed_sub_time () const
        return time (0) - _sub_start_time;
 }
 
+
 /** Check to see if this job has been interrupted or paused */
 void
 Job::check_for_interruption_or_pause ()
@@ -403,6 +422,7 @@ Job::set_progress (float p, bool force)
        set_progress_common (p);
 }
 
+
 void
 Job::set_progress_common (optional<float> p)
 {
@@ -414,6 +434,7 @@ Job::set_progress_common (optional<float> p)
        emit (boost::bind (boost::ref (Progress)));
 }
 
+
 /** @return fractional progress of the current sub-job, if known */
 optional<float>
 Job::progress () const
@@ -422,6 +443,7 @@ Job::progress () const
        return _progress;
 }
 
+
 void
 Job::sub (string n)
 {
@@ -435,6 +457,7 @@ Job::sub (string n)
        _sub_start_time = time (0);
 }
 
+
 string
 Job::error_details () const
 {
@@ -442,6 +465,7 @@ Job::error_details () const
        return _error_details;
 }
 
+
 /** @return A summary of any error that the job has generated */
 string
 Job::error_summary () const
@@ -450,6 +474,7 @@ Job::error_summary () const
        return _error_summary;
 }
 
+
 /** Set the current error string.
  *  @param s New error string.
  *  @param d New error detail string.
@@ -466,6 +491,7 @@ Job::set_error (string s, string d)
        _error_details = d;
 }
 
+
 /** Say that this job's progress will be unknown until further notice */
 void
 Job::set_progress_unknown ()
@@ -474,6 +500,7 @@ Job::set_progress_unknown ()
        set_progress_common (optional<float> ());
 }
 
+
 /** @return Human-readable status of this job */
 string
 Job::status () const
@@ -523,6 +550,7 @@ Job::status () const
        return s;
 }
 
+
 string
 Job::json_status () const
 {
@@ -547,6 +575,7 @@ Job::json_status () const
        return "";
 }
 
+
 /** @return An estimate of the remaining time for this sub-job, in seconds */
 int
 Job::remaining_time () const
@@ -558,6 +587,7 @@ Job::remaining_time () const
        return elapsed_sub_time() / progress().get() - elapsed_sub_time();
 }
 
+
 void
 Job::cancel ()
 {
@@ -573,6 +603,7 @@ Job::cancel ()
        _thread.join ();
 }
 
+
 /** @return true if the job was paused, false if it was not running */
 bool
 Job::pause_by_user ()
@@ -596,6 +627,7 @@ Job::pause_by_user ()
        return paused;
 }
 
+
 void
 Job::pause_by_priority ()
 {
@@ -605,6 +637,7 @@ Job::pause_by_priority ()
        }
 }
 
+
 void
 Job::resume ()
 {
@@ -614,6 +647,7 @@ Job::resume ()
        }
 }
 
+
 void
 Job::when_finished (boost::signals2::connection& connection, function<void()> finished)
 {
@@ -625,6 +659,7 @@ Job::when_finished (boost::signals2::connection& connection, function<void()> fi
        }
 }
 
+
 optional<string>
 Job::message () const
 {
@@ -632,6 +667,7 @@ Job::message () const
        return _message;
 }
 
+
 void
 Job::set_message (string m)
 {
index dd56b3124fea46550a2921ea96e813dd4a71f213..8c626ad1f0e2186d48d205f050dfececbf6de0bc 100644 (file)
 */
 
 
-#include "json_server.h"
-#include "job_manager.h"
-#include "job.h"
-#include "util.h"
 #include "film.h"
+#include "job.h"
+#include "job_manager.h"
+#include "json_server.h"
 #include "transcode_job.h"
+#include "util.h"
 #include <dcp/raw_convert.h>
 #include <boost/asio.hpp>
 #include <boost/bind/bind.hpp>
 #include <iostream>
 
 
-using std::string;
 using std::cout;
-using std::map;
+using std::dynamic_pointer_cast;
 using std::list;
-using boost::thread;
+using std::make_shared;
+using std::map;
 using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
 using boost::asio::ip::tcp;
+using boost::thread;
 using dcp::raw_convert;
 
 
@@ -74,7 +75,7 @@ try
        tcp::acceptor a (io_service, tcp::endpoint (tcp::v4 (), port));
        while (true) {
                try {
-                       shared_ptr<tcp::socket> s (new tcp::socket (io_service));
+                       auto s = make_shared<tcp::socket>(io_service);
                        a.accept (*s);
                        handle (s);
                }
index 97b6498938cc1f0992c76829b3e4f1110b4a9f14..aae492faffd07826517d237150e48550dc0748c1 100644 (file)
@@ -24,9 +24,9 @@
  */
 
 
-#include "log.h"
-#include "cross.h"
 #include "config.h"
+#include "cross.h"
+#include "log.h"
 #include "string_log_entry.h"
 #include <time.h>
 #include <cstdio>
 #include "i18n.h"
 
 
-using std::string;
 using std::cout;
-using std::shared_ptr;
 using std::make_shared;
+using std::shared_ptr;
+using std::string;
 
 
 Log::Log ()
index 09b528c81676fa0e1c62c3b1d4755632a56a1eee..d3d85622c22f30b6cba0d17e372329ce0c563c85 100644 (file)
@@ -19,9 +19,9 @@
 */
 
 
-#include "mid_side_decoder.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
+#include "mid_side_decoder.h"
 
 #include "i18n.h"
 
index 61e6c08ce9e66fa738300b9a417267356f71a8b6..8061e2f8462c2b101f01e9ea71e48ca5724c71a1 100644 (file)
 */
 
 
-#include "nanomsg.h"
 #include "dcpomatic_log.h"
 #include "exceptions.h"
+#include "nanomsg.h"
 #include <nanomsg/nn.h>
 #include <nanomsg/pair.h>
-#include <stdexcept>
 #include <cerrno>
+#include <stdexcept>
 
 
-using std::string;
 using std::runtime_error;
+using std::string;
 using boost::optional;
 
 
index 536629b336804b0675fe37b0682f65d8da8dd9fc..7a541a7c292ec6b8c271b5f7604826de03b66365 100644 (file)
@@ -19,9 +19,9 @@
 */
 
 
+#include "content.h"
 #include "overlaps.h"
 #include "types.h"
-#include "content.h"
 
 
 using std::function;
index 42c22ab7d890db6eab8d80272fec54174cb524e7..6853048de02d31ef865c759df8ef99526328a041 100644 (file)
 
 
 #include "atmos_decoder.h"
-#include "player.h"
-#include "film.h"
 #include "audio_buffers.h"
+#include "audio_content.h"
+#include "audio_decoder.h"
+#include "audio_processor.h"
+#include "compose.hpp"
+#include "config.h"
 #include "content_audio.h"
+#include "content_video.h"
 #include "dcp_content.h"
+#include "dcp_decoder.h"
 #include "dcpomatic_log.h"
-#include "job.h"
+#include "decoder.h"
+#include "decoder_factory.h"
+#include "ffmpeg_content.h"
+#include "film.h"
+#include "frame_rate_change.h"
 #include "image.h"
-#include "raw_image_proxy.h"
-#include "ratio.h"
+#include "image_decoder.h"
+#include "job.h"
 #include "log.h"
-#include "render_text.h"
-#include "config.h"
-#include "content_video.h"
+#include "piece.h"
+#include "player.h"
 #include "player_video.h"
-#include "frame_rate_change.h"
-#include "audio_processor.h"
 #include "playlist.h"
+#include "ratio.h"
+#include "raw_image_proxy.h"
 #include "referenced_reel_asset.h"
-#include "decoder_factory.h"
-#include "decoder.h"
-#include "video_decoder.h"
-#include "audio_decoder.h"
+#include "render_text.h"
+#include "shuffler.h"
 #include "text_content.h"
 #include "text_decoder.h"
-#include "ffmpeg_content.h"
-#include "audio_content.h"
-#include "dcp_decoder.h"
-#include "image_decoder.h"
-#include "compose.hpp"
-#include "shuffler.h"
 #include "timer.h"
+#include "video_decoder.h"
 #include <dcp/reel.h>
+#include <dcp/reel_closed_caption_asset.h>
+#include <dcp/reel_picture_asset.h>
 #include <dcp/reel_sound_asset.h>
 #include <dcp/reel_subtitle_asset.h>
-#include <dcp/reel_picture_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
-#include <stdint.h>
 #include <algorithm>
 #include <iostream>
+#include <stdint.h>
 
 #include "i18n.h"
 
@@ -70,6 +71,7 @@ using std::dynamic_pointer_cast;
 using std::list;
 using std::make_pair;
 using std::make_shared;
+using std::make_shared;
 using std::max;
 using std::min;
 using std::min;
@@ -77,7 +79,6 @@ using std::pair;
 using std::shared_ptr;
 using std::vector;
 using std::weak_ptr;
-using std::make_shared;
 using boost::optional;
 using boost::scoped_ptr;
 #if BOOST_VERSION >= 106100
@@ -278,9 +279,9 @@ Player::setup_pieces_unlocked ()
        _black = Empty (_film, playlist(), bind(&have_video, _1), _playback_length);
        _silent = Empty (_film, playlist(), bind(&have_audio, _1), _playback_length);
 
-       _next_video_time = boost::optional<dcpomatic::DCPTime>();
+       _next_video_time = boost::none;
        _next_video_eyes = Eyes::BOTH;
-       _next_audio_time = boost::optional<dcpomatic::DCPTime>();
+       _next_audio_time = boost::none;
 }
 
 
@@ -1251,9 +1252,9 @@ Player::seek (DCPTime time, bool accurate)
                _next_video_eyes = Eyes::LEFT;
                _next_audio_time = time;
        } else {
-               _next_video_time = optional<DCPTime>();
-               _next_video_eyes = optional<Eyes>();
-               _next_audio_time = optional<DCPTime>();
+               _next_video_time = boost::none;
+               _next_video_eyes = boost::none;
+               _next_audio_time = boost::none;
        }
 
        _black.set_position (time);
@@ -1396,7 +1397,7 @@ Player::set_dcp_decode_reduction (optional<int> reduction)
 
 
 optional<DCPTime>
-Player::content_time_to_dcp (shared_ptr<Content> content, ContentTime t)
+Player::content_time_to_dcp (shared_ptr<const Content> content, ContentTime t)
 {
        boost::mutex::scoped_lock lm (_mutex);
 
index bedf51d8e26fb976e0661a608f61f7cfd1c0ba5b..b70ea05ddeb972322a9dd0e4237d6cbd64891945 100644 (file)
@@ -27,7 +27,6 @@
 #include "atmos_metadata.h"
 #include "audio_merger.h"
 #include "audio_stream.h"
-#include "content.h"
 #include "content_atmos.h"
 #include "content_audio.h"
 #include "content_text.h"
@@ -35,7 +34,6 @@
 #include "empty.h"
 #include "film.h"
 #include "image.h"
-#include "piece.h"
 #include "player_text.h"
 #include "position_image.h"
 #include "shuffler.h"
@@ -52,11 +50,11 @@ namespace dcpomatic {
 }
 
 class AtmosContent;
+class AudioBuffers;
+class Content;
 class PlayerVideo;
 class Playlist;
-class AudioBuffers;
 class ReferencedReelAsset;
-class Shuffler;
 
 
 class PlayerProperty
@@ -102,7 +100,7 @@ public:
        void set_play_referenced ();
        void set_dcp_decode_reduction (boost::optional<int> reduction);
 
-       boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<Content> content, dcpomatic::ContentTime t);
+       boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<const Content> content, dcpomatic::ContentTime t);
 
        boost::signals2::signal<void (ChangeType, int, bool)> Change;
 
@@ -133,7 +131,6 @@ private:
        void construct ();
        void setup_pieces ();
        void setup_pieces_unlocked ();
-       void flush ();
        void film_change (ChangeType, Film::Property);
        void playlist_change (ChangeType);
        void playlist_content_change (ChangeType, int, bool);
@@ -175,7 +172,7 @@ private:
 
        /** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
        boost::atomic<int> _suspended;
-       std::list<std::shared_ptr<Piece> > _pieces;
+       std::list<std::shared_ptr<Piece>> _pieces;
 
        /** Size of the image we are rendering to; this may be the DCP frame size, or
         *  the size of preview in a window.
@@ -210,7 +207,7 @@ private:
 
        AudioMerger _audio_merger;
        std::unique_ptr<Shuffler> _shuffler;
-       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _delay;
+       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime>> _delay;
 
        class StreamState
        {
index a3b7ec89ff84e28f46e8a667b6b75cde14a1e850..626f8fac3a641b7fdfc041bb97946be88f270d2c 100644 (file)
@@ -19,8 +19,8 @@
 */
 
 
-#include "player_text.h"
 #include "font.h"
+#include "player_text.h"
 
 
 using std::list;
index 4cc536bb7530583639e14e3ff7c6270549daf947..081147434ad4846bf751cf9340ff7859da8587ce 100644 (file)
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "content.h"
 #include "film.h"
 #include "image.h"
@@ -33,17 +34,19 @@ extern "C" {
 #include <libxml++/libxml++.h>
 #include <iostream>
 
+
 using std::cout;
 using std::dynamic_pointer_cast;
+using std::function;
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
 using std::weak_ptr;
 using boost::optional;
-using std::function;
 using dcp::Data;
 using dcp::raw_convert;
 
+
 PlayerVideo::PlayerVideo (
        shared_ptr<const ImageProxy> in,
        Crop crop,
@@ -74,6 +77,7 @@ PlayerVideo::PlayerVideo (
 
 }
 
+
 PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket)
 {
        _crop = Crop (node);
@@ -103,12 +107,14 @@ PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket
        }
 }
 
+
 void
 PlayerVideo::set_text (PositionImage image)
 {
        _text = image;
 }
 
+
 shared_ptr<Image>
 PlayerVideo::image (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool fast) const
 {
@@ -191,6 +197,7 @@ PlayerVideo::make_image (function<AVPixelFormat (AVPixelFormat)> pixel_format, V
        }
 }
 
+
 void
 PlayerVideo::add_metadata (xmlpp::Node* node) const
 {
@@ -218,6 +225,7 @@ PlayerVideo::add_metadata (xmlpp::Node* node) const
        }
 }
 
+
 void
 PlayerVideo::write_to_socket (shared_ptr<Socket> socket) const
 {
@@ -227,6 +235,7 @@ PlayerVideo::write_to_socket (shared_ptr<Socket> socket) const
        }
 }
 
+
 bool
 PlayerVideo::has_j2k () const
 {
@@ -240,6 +249,7 @@ PlayerVideo::has_j2k () const
        return _crop == Crop() && _out_size == j2k->size() && _inter_size == j2k->size() && !_text && !_fade && !_colour_conversion;
 }
 
+
 shared_ptr<const dcp::Data>
 PlayerVideo::j2k () const
 {
@@ -248,12 +258,14 @@ PlayerVideo::j2k () const
        return j2k->j2k ();
 }
 
+
 Position<int>
 PlayerVideo::inter_position () const
 {
        return Position<int> ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.height) / 2);
 }
 
+
 /** @return true if this PlayerVideo is definitely the same as another, false if it is probably not */
 bool
 PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
@@ -284,6 +296,7 @@ PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
        return _in->same (other->_in);
 }
 
+
 AVPixelFormat
 PlayerVideo::force (AVPixelFormat, AVPixelFormat force_to)
 {
@@ -296,6 +309,7 @@ PlayerVideo::keep_xyz_or_rgb (AVPixelFormat p)
        return p == AV_PIX_FMT_XYZ12LE ? AV_PIX_FMT_XYZ12LE : AV_PIX_FMT_RGB48LE;
 }
 
+
 void
 PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, Image::Alignment alignment, bool fast, bool proxy_only)
 {
@@ -306,12 +320,14 @@ PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, Vide
        }
 }
 
+
 size_t
 PlayerVideo::memory_used () const
 {
        return _in->memory_used();
 }
 
+
 /** @return Shallow copy of this; _in and _text are shared between the original and the copy */
 shared_ptr<PlayerVideo>
 PlayerVideo::shallow_copy () const
@@ -332,6 +348,7 @@ PlayerVideo::shallow_copy () const
                );
 }
 
+
 /** Re-read crop, fade, inter/out size, colour conversion and video range from our content.
  *  @return true if this was possible, false if not.
  */
index e8714e9d6d4ffedac4ab9dd6fc6ae83ee1efe66b..c18a438821b9a91fd0e4e23b7d629363e81216f0 100644 (file)
 */
 
 
-#include "playlist.h"
-#include "video_content.h"
-#include "text_content.h"
-#include "ffmpeg_decoder.h"
-#include "ffmpeg_content.h"
-#include "image_decoder.h"
 #include "audio_content.h"
+#include "compose.hpp"
+#include "config.h"
 #include "content_factory.h"
 #include "dcp_content.h"
+#include "digester.h"
+#include "ffmpeg_content.h"
+#include "ffmpeg_decoder.h"
+#include "image_decoder.h"
 #include "job.h"
-#include "config.h"
+#include "playlist.h"
+#include "text_content.h"
 #include "util.h"
-#include "digester.h"
-#include "compose.hpp"
+#include "video_content.h"
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/bind/placeholders.hpp>
 #include "i18n.h"
 
 
-using std::list;
 using std::cout;
-using std::vector;
-using std::min;
+using std::dynamic_pointer_cast;
+using std::list;
 using std::max;
-using std::string;
+using std::min;
 using std::pair;
-using boost::optional;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using std::weak_ptr;
-using std::dynamic_pointer_cast;
+using boost::optional;
 using namespace dcpomatic;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
index eecb7c04085cc3d41298d120ededf4ca2f58186e..e833f2e36362dd80ec3aca030380cbd45cc6e94a 100644 (file)
@@ -61,7 +61,7 @@ RecipientDialog::RecipientDialog (
        : wxDialog (parent, wxID_ANY, title)
        , _recipient (recipient)
 {
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       auto overall_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (overall_sizer);
 
        _sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
@@ -97,14 +97,14 @@ RecipientDialog::RecipientDialog (
        ++r;
 
         wxClientDC dc (this);
-       wxFont font = _name->GetFont ();
+       auto font = _name->GetFont ();
        font.SetFamily (wxFONTFAMILY_TELETYPE);
        dc.SetFont (font);
-        wxSize size = dc.GetTextExtent (wxT ("1234567890123456789012345678"));
-        size.SetHeight (-1);
+       auto size = dc.GetTextExtent(wxT("1234567890123456789012345678"));
+       size.SetHeight (-1);
 
        add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition (r, 0));
-       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+       auto s = new wxBoxSizer (wxHORIZONTAL);
        _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
        _recipient_thumbprint->SetFont (font);
        set_recipient (recipient);
@@ -122,7 +122,7 @@ RecipientDialog::RecipientDialog (
 
        overall_sizer->Add (_sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+       auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -186,7 +186,7 @@ RecipientDialog::load_recipient (boost::filesystem::path file)
 void
 RecipientDialog::get_recipient_from_file ()
 {
-       wxFileDialog* d = new wxFileDialog (this, _("Select Certificate File"));
+       auto d = new wxFileDialog (this, _("Select Certificate File"));
        if (d->ShowModal () == wxID_OK) {
                load_recipient (boost::filesystem::path (wx_to_std (d->GetPath ())));
        }
@@ -199,7 +199,7 @@ RecipientDialog::get_recipient_from_file ()
 void
 RecipientDialog::setup_sensitivity ()
 {
-       wxButton* ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
+       auto ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
        if (ok) {
                ok->Enable (static_cast<bool>(_recipient) && !_name->GetValue().IsEmpty());
        }
index b5ab8c2db79777f9ab8bee2230782917c104442d..5ae9f5da4d8d66c3cf444f98096313ecec6007a3 100644 (file)
@@ -39,11 +39,12 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 
 
+using std::dynamic_pointer_cast;
 using std::map;
-using std::string;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
 using boost::bind;
-using std::dynamic_pointer_cast;
 using boost::optional;
 using namespace dcpomatic;
 #if BOOST_VERSION >= 106100
@@ -68,7 +69,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                /* XXX: assuming that all FFmpeg streams have bitmap subs */
                if (_stream->colours().empty()) {
                        _job_manager_connection = JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&SubtitleAppearanceDialog::active_jobs_changed, this, _1));
-                       _job = JobManager::instance()->add(shared_ptr<Job>(new ExamineFFmpegSubtitlesJob(film, ff)));
+                       _job = JobManager::instance()->add(make_shared<ExamineFFmpegSubtitlesJob>(film, ff));
                }
        }
 
index c31a6740c5ea86c86e1fb9a2763dba874a23e85d..84ef5cc1ba2bdae4da4af268d4728617d652eee6 100644 (file)
 
 */
 
+
 #ifndef DCPOMATIC_WX_TIMECODE_H
 #define DCPOMATIC_WX_TIMECODE_H
 
+
 #include "wx_util.h"
 #include "lib/dcpomatic_time.h"
 #include "lib/types.h"
@@ -28,6 +30,7 @@
 #include <wx/wx.h>
 #include <boost/signals2.hpp>
 
+
 class TimecodeBase : public wxPanel
 {
 public:
@@ -58,6 +61,7 @@ protected:
        bool _ignore_changed = false;
 };
 
+
 template <class T>
 class Timecode : public TimecodeBase
 {
index 677b83bdde27a4dc7cd5176cb92cfcbf2fdc5fa9..481e8100d2b77037c6e854b181a1ccaef0069a7b 100644 (file)
@@ -95,7 +95,7 @@ TimelineContentView::track () const
 }
 
 void
-TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> > overlaps)
+TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>> overlaps)
 {
        DCPOMATIC_ASSERT (_track);
 
@@ -105,8 +105,8 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
                return;
        }
 
-       DCPTime const position = cont->position ();
-       DCPTime const len = cont->length_after_trim (film);
+       auto const position = cont->position ();
+       auto const len = cont->length_after_trim (film);
 
        wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2);
 
index 5477e61f13cfaf660f5c95af1ab480e0383a0d32..100228ae8b634f124a9d16ca2ca8d5950fa9dea2 100644 (file)
@@ -29,7 +29,7 @@ public:
        void set_y (int y);
 
 private:
-       void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
+       void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int>> overlaps);
 
        int _y; ///< y position in tracks (not pixels)
 };
index fad3779bd07ed5339ff96b7915a897ba3ae12307..493743d4afebb92eb7d64e8b562fa60f0ed4795d 100644 (file)
@@ -297,7 +297,7 @@ checked_set (wxChoice* widget, string value)
 
 
 void
-checked_set (wxChoice* widget, vector<pair<string, string> > items)
+checked_set (wxChoice* widget, vector<pair<string, string>> items)
 {
        vector<pair<string, string>> current;
        for (unsigned int i = 0; i < widget->GetCount(); ++i) {
index 66cd402c487e415d1a167532048621b40ab3e8e3..5d4d1e0cacbb2a2648513c56fac28352e747fe2d 100644 (file)
  */
 
 
-#include "lib/film.h"
+#include "lib/config.h"
+#include "lib/content_factory.h"
 #include "lib/dcp_content.h"
 #include "lib/dcp_decoder.h"
-#include "lib/content_factory.h"
-#include "lib/player.h"
 #include "lib/examine_content_job.h"
+#include "lib/film.h"
 #include "lib/job_manager.h"
-#include "lib/config.h"
+#include "lib/piece.h"
+#include "lib/player.h"
 #include "test.h"
 #include <dcp/cpl.h>
 #include <dcp/dcp.h>
index 3c969921d8045dc956cc2e25369e28d2f89e181b..c23444c4abe6756f92299b3cacb4eea6a37f2587 100644 (file)
@@ -23,6 +23,7 @@
 #include "lib/content_factory.h"
 #include "lib/dcpomatic_time.h"
 #include "lib/film.h"
+#include "lib/piece.h"
 #include "lib/player.h"
 #include "lib/video_content.h"
 #include "test.h"
index db974d38463cb452148416fb81b6063b341e409e..618a5b29b6276fd93247de5322c36b9ce7b15d66 100644 (file)
  */
 
 
-#include "lib/film.h"
-#include "lib/ratio.h"
+#include "lib/content_factory.h"
+#include "lib/dcp_content.h"
+#include "lib/dcp_content_type.h"
 #include "lib/ffmpeg_content.h"
+#include "lib/film.h"
 #include "lib/image_content.h"
-#include "lib/dcp_content_type.h"
-#include "lib/dcp_content.h"
-#include "lib/video_content.h"
+#include "lib/ratio.h"
 #include "lib/string_text_file_content.h"
-#include "lib/content_factory.h"
+#include "lib/video_content.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
 
-using std::list;
 using std::cout;
-using std::vector;
-using std::string;
-using std::shared_ptr;
-using std::make_shared;
 using std::function;
+using std::list;
+using std::make_shared;
+using std::shared_ptr;
+using std::string;
+using std::vector;
 using namespace dcpomatic;
 
 
index 4ea709c81912f08d7fdeb4311fc3609314c731a0..89ee7f619728f0391fa78f2fcbf716e2174b72d8 100644 (file)
@@ -369,7 +369,7 @@ rms_error (boost::filesystem::path ref, boost::filesystem::path check)
        auto check_image = check_proxy.image(Image::Alignment::COMPACT).image;
 
        BOOST_REQUIRE_EQUAL (ref_image->pixel_format(), check_image->pixel_format());
-       AVPixelFormat const format = ref_image->pixel_format();
+       auto const format = ref_image->pixel_format();
 
        BOOST_REQUIRE (ref_image->size() == check_image->size());
        int const width = ref_image->size().width;