Assorted C++11/formatting cleanups.
authorCarl Hetherington <cth@carlh.net>
Wed, 7 Apr 2021 20:15:01 +0000 (22:15 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 7 Apr 2021 20:15:01 +0000 (22:15 +0200)
31 files changed:
src/lib/audio_mapping.cc
src/lib/audio_mapping.h
src/lib/audio_merger.cc
src/lib/audio_merger.h
src/lib/content_factory.cc
src/lib/content_factory.h
src/lib/encode_server.cc
src/lib/encode_server.h
src/lib/environment_info.cc
src/lib/environment_info.h
src/lib/ffmpeg.cc
src/lib/ffmpeg.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/player_text.cc
src/lib/player_text.h
src/lib/upmixer_a.cc
src/lib/upmixer_a.h
src/lib/video_filter_graph.cc
src/lib/video_filter_graph.h
src/lib/video_ring_buffers.cc
src/lib/video_ring_buffers.h
src/tools/dcpomatic_kdm_cli.cc
src/wx/content_view.cc
src/wx/content_view.h
src/wx/job_manager_view.cc
src/wx/job_manager_view.h
src/wx/recipients_panel.cc
src/wx/recipients_panel.h
src/wx/timeline_labels_view.cc
src/wx/timeline_labels_view.h

index 7734d168afb3040a28b4cca27076e6f62e4ee94b..8b9f102a56fdae460987cac010ee87ab89098178 100644 (file)
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "audio_mapping.h"
 #include "audio_processor.h"
 #include "digester.h"
 #include "audio_mapping.h"
 #include "audio_processor.h"
 #include "digester.h"
@@ -31,6 +32,7 @@ DCPOMATIC_ENABLE_WARNINGS
 #include <boost/regex.hpp>
 #include <iostream>
 
 #include <boost/regex.hpp>
 #include <iostream>
 
+
 using std::list;
 using std::cout;
 using std::make_pair;
 using std::list;
 using std::cout;
 using std::make_pair;
@@ -44,12 +46,6 @@ using std::dynamic_pointer_cast;
 using boost::optional;
 using dcp::raw_convert;
 
 using boost::optional;
 using dcp::raw_convert;
 
-AudioMapping::AudioMapping ()
-       : _input_channels (0)
-       , _output_channels (0)
-{
-
-}
 
 /** Create an empty AudioMapping.
  *  @param input_channels Number of input channels.
 
 /** Create an empty AudioMapping.
  *  @param input_channels Number of input channels.
@@ -60,6 +56,7 @@ AudioMapping::AudioMapping (int input_channels, int output_channels)
        setup (input_channels, output_channels);
 }
 
        setup (input_channels, output_channels);
 }
 
+
 void
 AudioMapping::setup (int input_channels, int output_channels)
 {
 void
 AudioMapping::setup (int input_channels, int output_channels)
 {
@@ -74,6 +71,7 @@ AudioMapping::setup (int input_channels, int output_channels)
        make_zero ();
 }
 
        make_zero ();
 }
 
+
 void
 AudioMapping::make_zero ()
 {
 void
 AudioMapping::make_zero ()
 {
@@ -84,6 +82,7 @@ AudioMapping::make_zero ()
        }
 }
 
        }
 }
 
+
 struct ChannelRegex
 {
        ChannelRegex (string regex_, int channel_)
 struct ChannelRegex
 {
        ChannelRegex (string regex_, int channel_)
@@ -95,6 +94,7 @@ struct ChannelRegex
        int channel;
 };
 
        int channel;
 };
 
+
 void
 AudioMapping::make_default (AudioProcessor const * processor, optional<boost::filesystem::path> filename)
 {
 void
 AudioMapping::make_default (AudioProcessor const * processor, optional<boost::filesystem::path> filename)
 {
@@ -145,12 +145,13 @@ AudioMapping::make_default (AudioProcessor const * processor, optional<boost::fi
        }
 }
 
        }
 }
 
+
 AudioMapping::AudioMapping (cxml::ConstNodePtr node, int state_version)
 {
        if (state_version < 32) {
 AudioMapping::AudioMapping (cxml::ConstNodePtr node, int state_version)
 {
        if (state_version < 32) {
-               setup (node->number_child<int> ("ContentChannels"), MAX_DCP_AUDIO_CHANNELS);
+               setup (node->number_child<int>("ContentChannels"), MAX_DCP_AUDIO_CHANNELS);
        } else {
        } else {
-               setup (node->number_child<int> ("InputChannels"), node->number_child<int> ("OutputChannels"));
+               setup (node->number_child<int>("InputChannels"), node->number_child<int>("OutputChannels"));
        }
 
        if (state_version <= 5) {
        }
 
        if (state_version <= 5) {
@@ -216,6 +217,7 @@ AudioMapping::get (int input_channel, int output_channel) const
        return _gain[input_channel][output_channel];
 }
 
        return _gain[input_channel][output_channel];
 }
 
+
 void
 AudioMapping::as_xml (xmlpp::Node* node) const
 {
 void
 AudioMapping::as_xml (xmlpp::Node* node) const
 {
@@ -232,6 +234,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const
        }
 }
 
        }
 }
 
+
 /** @return a string which is unique for a given AudioMapping configuration, for
  *  differentiation between different AudioMappings.
  */
 /** @return a string which is unique for a given AudioMapping configuration, for
  *  differentiation between different AudioMappings.
  */
@@ -250,6 +253,7 @@ AudioMapping::digest () const
        return digester.get ();
 }
 
        return digester.get ();
 }
 
+
 list<int>
 AudioMapping::mapped_output_channels () const
 {
 list<int>
 AudioMapping::mapped_output_channels () const
 {
@@ -271,6 +275,7 @@ AudioMapping::mapped_output_channels () const
        return mapped;
 }
 
        return mapped;
 }
 
+
 void
 AudioMapping::unmap_all ()
 {
 void
 AudioMapping::unmap_all ()
 {
index 6bac0a7d8eb43fa2f8e5ea2f50091267a005ebec..4ef5aedb144b8c86a4eab6cd7ef5196b6728e569 100644 (file)
 
 */
 
 
 */
 
+
 /** @file  src/lib/audio_mapping.h
  *  @brief AudioMapping class.
  */
 
 /** @file  src/lib/audio_mapping.h
  *  @brief AudioMapping class.
  */
 
+
 #ifndef DCPOMATIC_AUDIO_MAPPING_H
 #define DCPOMATIC_AUDIO_MAPPING_H
 
 #ifndef DCPOMATIC_AUDIO_MAPPING_H
 #define DCPOMATIC_AUDIO_MAPPING_H
 
+
 #include <dcp/types.h>
 #include <libcxml/cxml.h>
 #include <vector>
 
 #include <dcp/types.h>
 #include <libcxml/cxml.h>
 #include <vector>
 
+
 namespace xmlpp {
        class Node;
 }
 
 class AudioProcessor;
 
 namespace xmlpp {
        class Node;
 }
 
 class AudioProcessor;
 
+
 /** @class AudioMapping.
  *  @brief A many-to-many mapping of audio channels.
  */
 class AudioMapping
 {
 public:
 /** @class AudioMapping.
  *  @brief A many-to-many mapping of audio channels.
  */
 class AudioMapping
 {
 public:
-       AudioMapping ();
+       AudioMapping () {}
        AudioMapping (int input_channels, int output_channels);
        AudioMapping (cxml::ConstNodePtr, int);
 
        AudioMapping (int input_channels, int output_channels);
        AudioMapping (cxml::ConstNodePtr, int);
 
@@ -74,9 +79,10 @@ public:
 private:
        void setup (int input_channels, int output_channels);
 
 private:
        void setup (int input_channels, int output_channels);
 
-       int _input_channels;
-       int _output_channels;
-       std::vector<std::vector<float> > _gain;
+       int _input_channels = 0;
+       int _output_channels = 0;
+       std::vector<std::vector<float>> _gain;
 };
 
 };
 
+
 #endif
 #endif
index 06eba098f4dd6424f5c096baa6a25cbcb9f18e30..0bc1ad008ef9339b95f28e799e6fe88677129427 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 program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
 
 */
 
+
 /** @file  src/audio_merger.cc
  *  @brief AudioMerger class.
  */
 
 /** @file  src/audio_merger.cc
  *  @brief AudioMerger class.
  */
 
+
 #include "audio_merger.h"
 #include "dcpomatic_time.h"
 #include <iostream>
 
 #include "audio_merger.h"
 #include "dcpomatic_time.h"
 #include <iostream>
 
-using std::pair;
-using std::min;
-using std::max;
-using std::list;
+
 using std::cout;
 using std::cout;
+using std::list;
 using std::make_pair;
 using std::make_pair;
+using std::make_shared;
+using std::max;
+using std::min;
+using std::pair;
 using std::shared_ptr;
 using boost::optional;
 using namespace dcpomatic;
 
 using std::shared_ptr;
 using boost::optional;
 using namespace dcpomatic;
 
+
 AudioMerger::AudioMerger (int frame_rate)
        : _frame_rate (frame_rate)
 {
 
 }
 
 AudioMerger::AudioMerger (int frame_rate)
        : _frame_rate (frame_rate)
 {
 
 }
 
+
 Frame
 AudioMerger::frames (DCPTime t) const
 {
        return t.frames_floor (_frame_rate);
 }
 
 Frame
 AudioMerger::frames (DCPTime t) const
 {
        return t.frames_floor (_frame_rate);
 }
 
+
 /** Pull audio up to a given time; after this call, no more data can be pushed
  *  before the specified time.
  *  @param time Time to pull up to.
  *  @return Blocks of merged audio up to `time'.
  */
 /** Pull audio up to a given time; after this call, no more data can be pushed
  *  before the specified time.
  *  @param time Time to pull up to.
  *  @return Blocks of merged audio up to `time'.
  */
-list<pair<shared_ptr<AudioBuffers>, DCPTime> >
+list<pair<shared_ptr<AudioBuffers>, DCPTime>>
 AudioMerger::pull (DCPTime time)
 {
 AudioMerger::pull (DCPTime time)
 {
-       list<pair<shared_ptr<AudioBuffers>, DCPTime> > out;
+       list<pair<shared_ptr<AudioBuffers>, DCPTime>> out;
 
        list<Buffer> new_buffers;
 
 
        list<Buffer> new_buffers;
 
-       _buffers.sort (AudioMerger::BufferComparator());
+       _buffers.sort ([](Buffer const& a, Buffer const& b) {
+               return a.time < b.time;
+       });
+
        for (auto i: _buffers) {
                if (i.period().to <= time) {
                        /* Completely within the pull period */
        for (auto i: _buffers) {
                if (i.period().to <= time) {
                        /* Completely within the pull period */
@@ -70,7 +80,7 @@ AudioMerger::pull (DCPTime time)
                        int32_t const overlap = frames(DCPTime(time - i.time));
                        /* Though time > i.time, overlap could be 0 if the difference in time is less than one frame */
                        if (overlap > 0) {
                        int32_t const overlap = frames(DCPTime(time - i.time));
                        /* Though time > i.time, overlap could be 0 if the difference in time is less than one frame */
                        if (overlap > 0) {
-                               shared_ptr<AudioBuffers> audio(new AudioBuffers(i.audio, overlap, 0));
+                               auto audio = make_shared<AudioBuffers>(i.audio, overlap, 0);
                                out.push_back (make_pair(audio, i.time));
                                i.audio->trim_start (overlap);
                                i.time += DCPTime::from_frames(overlap, _frame_rate);
                                out.push_back (make_pair(audio, i.time));
                                i.audio->trim_start (overlap);
                                i.time += DCPTime::from_frames(overlap, _frame_rate);
@@ -86,13 +96,14 @@ AudioMerger::pull (DCPTime time)
 
        _buffers = new_buffers;
 
 
        _buffers = new_buffers;
 
-       for (list<pair<shared_ptr<AudioBuffers>, DCPTime> >::const_iterator i = out.begin(); i != out.end(); ++i) {
-               DCPOMATIC_ASSERT (i->first->frames() > 0);
+       for (auto const& i: out) {
+               DCPOMATIC_ASSERT (i.first->frames() > 0);
        }
 
        return out;
 }
 
        }
 
        return out;
 }
 
+
 /** Push some data into the merger at a given time */
 void
 AudioMerger::push (std::shared_ptr<const AudioBuffers> audio, DCPTime time)
 /** Push some data into the merger at a given time */
 void
 AudioMerger::push (std::shared_ptr<const AudioBuffers> audio, DCPTime time)
@@ -103,7 +114,7 @@ AudioMerger::push (std::shared_ptr<const AudioBuffers> audio, DCPTime time)
 
        /* Mix any overlapping parts of this new block with existing ones */
        for (auto i: _buffers) {
 
        /* Mix any overlapping parts of this new block with existing ones */
        for (auto i: _buffers) {
-               optional<DCPTimePeriod> overlap = i.period().overlap (period);
+               auto overlap = i.period().overlap(period);
                if (overlap) {
                        int32_t const offset = frames(DCPTime(overlap->from - i.time));
                        int32_t const frames_to_mix = frames(overlap->duration());
                if (overlap) {
                        int32_t const offset = frames(DCPTime(overlap->from - i.time));
                        int32_t const frames_to_mix = frames(overlap->duration());
@@ -117,14 +128,14 @@ AudioMerger::push (std::shared_ptr<const AudioBuffers> audio, DCPTime time)
 
        list<DCPTimePeriod> periods;
        for (auto i: _buffers) {
 
        list<DCPTimePeriod> periods;
        for (auto i: _buffers) {
-               periods.push_back (i.period ());
+               periods.push_back (i.period());
        }
 
        /* Add the non-overlapping parts */
        for (auto i: subtract(period, periods)) {
        }
 
        /* Add the non-overlapping parts */
        for (auto i: subtract(period, periods)) {
-               list<Buffer>::iterator before = _buffers.end();
-               list<Buffer>::iterator after = _buffers.end();
-               for (list<Buffer>::iterator j = _buffers.begin(); j != _buffers.end(); ++j) {
+               auto before = _buffers.end();
+               auto after = _buffers.end();
+               for (auto j = _buffers.begin(); j != _buffers.end(); ++j) {
                        if (j->period().to == i.from) {
                                before = j;
                        }
                        if (j->period().to == i.from) {
                                before = j;
                        }
@@ -134,7 +145,7 @@ AudioMerger::push (std::shared_ptr<const AudioBuffers> audio, DCPTime time)
                }
 
                /* Get the part of audio that we want to use */
                }
 
                /* Get the part of audio that we want to use */
-               shared_ptr<AudioBuffers> part (new AudioBuffers(audio, frames(i.to) - frames(i.from), frames(DCPTime(i.from - time))));
+               auto part = make_shared<AudioBuffers>(audio, frames(i.to) - frames(i.from), frames(DCPTime(i.from - time)));
 
                if (before == _buffers.end() && after == _buffers.end()) {
                        if (part->frames() > 0) {
 
                if (before == _buffers.end() && after == _buffers.end()) {
                        if (part->frames() > 0) {
@@ -158,6 +169,7 @@ AudioMerger::push (std::shared_ptr<const AudioBuffers> audio, DCPTime time)
        }
 }
 
        }
 }
 
+
 void
 AudioMerger::clear ()
 {
 void
 AudioMerger::clear ()
 {
index adaf72f8189acd7cd22a228e8a0d8cb99f2878e5..07e730ce2048164fe658d8e1fa155462b9457d25 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 program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
 
 */
 
+
 /** @file  src/audio_merger.h
  *  @brief AudioMerger class.
  */
 
 /** @file  src/audio_merger.h
  *  @brief AudioMerger class.
  */
 
+
 #include "audio_buffers.h"
 #include "dcpomatic_time.h"
 #include "util.h"
 
 #include "audio_buffers.h"
 #include "dcpomatic_time.h"
 #include "util.h"
 
+
 /** @class AudioMerger.
  *  @brief A class that can merge audio data from many sources.
  */
 /** @class AudioMerger.
  *  @brief A class that can merge audio data from many sources.
  */
@@ -33,7 +36,7 @@ class AudioMerger
 public:
        explicit AudioMerger (int frame_rate);
 
 public:
        explicit AudioMerger (int frame_rate);
 
-       std::list<std::pair<std::shared_ptr<AudioBuffers>, dcpomatic::DCPTime> > pull (dcpomatic::DCPTime time);
+       std::list<std::pair<std::shared_ptr<AudioBuffers>, dcpomatic::DCPTime>> pull (dcpomatic::DCPTime time);
        void push (std::shared_ptr<const AudioBuffers> audio, dcpomatic::DCPTime time);
        void clear ();
 
        void push (std::shared_ptr<const AudioBuffers> audio, dcpomatic::DCPTime time);
        void clear ();
 
@@ -69,15 +72,6 @@ private:
                }
        };
 
                }
        };
 
-       class BufferComparator
-       {
-       public:
-               bool operator() (AudioMerger::Buffer const & a, AudioMerger::Buffer const & b)
-               {
-                       return a.time < b.time;
-               }
-       };
-
        std::list<Buffer> _buffers;
        int _frame_rate;
 };
        std::list<Buffer> _buffers;
        int _frame_rate;
 };
index c4e389c7cd794c95b7ac23dd09470e01750027e1..e912589fcb9e89e51603dde5ec666423cfbcf407 100644 (file)
 
 */
 
 
 */
 
+
 /** @file  src/lib/content_factory.cc
  *  @brief Methods to create content objects.
  */
 
 /** @file  src/lib/content_factory.cc
  *  @brief Methods to create content objects.
  */
 
+
 #include "ffmpeg_content.h"
 #include "audio_content.h"
 #include "image_content.h"
 #include "ffmpeg_content.h"
 #include "audio_content.h"
 #include "image_content.h"
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
+
 using std::list;
 using std::list;
+using std::make_shared;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
 
 using boost::optional;
 
+
 /** Create a Content object from an XML node.
  *  @param node XML description.
  *  @param version XML state version.
 /** Create a Content object from an XML node.
  *  @param node XML description.
  *  @param version XML state version.
@@ -57,7 +62,7 @@ using boost::optional;
 shared_ptr<Content>
 content_factory (cxml::ConstNodePtr node, int version, list<string>& notes)
 {
 shared_ptr<Content>
 content_factory (cxml::ConstNodePtr node, int version, list<string>& notes)
 {
-       string const type = node->string_child ("Type");
+       auto const type = node->string_child ("Type");
 
        std::shared_ptr<Content> content;
 
 
        std::shared_ptr<Content> content;
 
@@ -65,49 +70,48 @@ content_factory (cxml::ConstNodePtr node, int version, list<string>& notes)
                /* SndfileContent is now handled by the FFmpeg code rather than by
                   separate libsndfile-based code.
                */
                /* SndfileContent is now handled by the FFmpeg code rather than by
                   separate libsndfile-based code.
                */
-               content.reset (new FFmpegContent (node, version, notes));
+               content.reset (new FFmpegContent(node, version, notes));
        } else if (type == "Image") {
        } else if (type == "Image") {
-               content.reset (new ImageContent (node, version));
+               content.reset (new ImageContent(node, version));
        } else if (type == "Sndfile") {
                /* SndfileContent is now handled by the FFmpeg code rather than by
                   separate libsndfile-based code.
                */
        } else if (type == "Sndfile") {
                /* SndfileContent is now handled by the FFmpeg code rather than by
                   separate libsndfile-based code.
                */
-               content.reset (new FFmpegContent (node, version, notes));
+               content.reset (new FFmpegContent(node, version, notes));
 
                content->audio->set_stream (
 
                content->audio->set_stream (
-                       AudioStreamPtr (
-                               new FFmpegAudioStream (
-                                       "Stream", 0,
-                                       node->number_child<int> ("AudioFrameRate"),
-                                       node->number_child<Frame> ("AudioLength"),
-                                       AudioMapping (node->node_child ("AudioMapping"), version)
-                                       )
+                       make_shared<FFmpegAudioStream>(
+                               "Stream", 0,
+                               node->number_child<int> ("AudioFrameRate"),
+                               node->number_child<Frame> ("AudioLength"),
+                               AudioMapping (node->node_child ("AudioMapping"), version)
                                )
                        );
 
        } else if (type == "SubRip" || type == "TextSubtitle") {
                                )
                        );
 
        } else if (type == "SubRip" || type == "TextSubtitle") {
-               content.reset (new StringTextFileContent (node, version));
+               content.reset (new StringTextFileContent(node, version));
        } else if (type == "DCP") {
        } else if (type == "DCP") {
-               content.reset (new DCPContent (node, version));
+               content.reset (new DCPContent(node, version));
        } else if (type == "DCPSubtitle") {
        } else if (type == "DCPSubtitle") {
-               content.reset (new DCPSubtitleContent (node, version));
+               content.reset (new DCPSubtitleContent(node, version));
        } else if (type == "VideoMXF") {
        } else if (type == "VideoMXF") {
-               content.reset (new VideoMXFContent (node, version));
+               content.reset (new VideoMXFContent(node, version));
        } else if (type == "AtmosMXF") {
        } else if (type == "AtmosMXF") {
-               content.reset (new AtmosMXFContent (node, version));
+               content.reset (new AtmosMXFContent(node, version));
        }
 
        return content;
 }
 
        }
 
        return content;
 }
 
+
 /** Create some Content objects from a file or directory.
  *  @param path File or directory.
  *  @return Content objects.
  */
 /** Create some Content objects from a file or directory.
  *  @param path File or directory.
  *  @return Content objects.
  */
-list<shared_ptr<Content> >
+list<shared_ptr<Content>>
 content_factory (boost::filesystem::path path)
 {
 content_factory (boost::filesystem::path path)
 {
-       list<shared_ptr<Content> > content;
+       list<shared_ptr<Content>> content;
 
        if (boost::filesystem::is_directory (path)) {
 
 
        if (boost::filesystem::is_directory (path)) {
 
@@ -138,11 +142,11 @@ content_factory (boost::filesystem::path path)
                                continue;
                        }
 
                                continue;
                        }
 
-                       if (valid_image_file (i->path ())) {
+                       if (valid_image_file(i->path())) {
                                ++image_files;
                        }
 
                                ++image_files;
                        }
 
-                       if (valid_sound_file (i->path ())) {
+                       if (valid_sound_file(i->path())) {
                                ++sound_files;
                        }
 
                                ++sound_files;
                        }
 
@@ -150,10 +154,10 @@ content_factory (boost::filesystem::path path)
                }
 
                if (image_files > 0 && sound_files == 0)  {
                }
 
                if (image_files > 0 && sound_files == 0)  {
-                       content.push_back (shared_ptr<Content> (new ImageContent(path)));
+                       content.push_back (make_shared<ImageContent>(path));
                } else if (image_files == 0 && sound_files > 0) {
                } else if (image_files == 0 && sound_files > 0) {
-                       for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator(); ++i) {
-                               content.push_back (shared_ptr<FFmpegContent> (new FFmpegContent(i->path())));
+                       for (auto i: boost::filesystem::directory_iterator(path)) {
+                               content.push_back (make_shared<FFmpegContent>(i.path()));
                        }
                }
 
                        }
                }
 
@@ -161,7 +165,7 @@ content_factory (boost::filesystem::path path)
 
                shared_ptr<Content> single;
 
 
                shared_ptr<Content> single;
 
-               string ext = path.extension().string ();
+               auto ext = path.extension().string();
                transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
 
                if (valid_image_file (path)) {
                transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
 
                if (valid_image_file (path)) {
@@ -175,11 +179,11 @@ content_factory (boost::filesystem::path path)
                                throw KDMAsContentError ();
                        }
                        single.reset (new DCPSubtitleContent(path));
                                throw KDMAsContentError ();
                        }
                        single.reset (new DCPSubtitleContent(path));
-               } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) {
+               } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf(path)) {
                        single.reset (new DCPSubtitleContent(path));
                        single.reset (new DCPSubtitleContent(path));
-               } else if (ext == ".mxf" && VideoMXFContent::valid_mxf (path)) {
+               } else if (ext == ".mxf" && VideoMXFContent::valid_mxf(path)) {
                        single.reset (new VideoMXFContent(path));
                        single.reset (new VideoMXFContent(path));
-               } else if (ext == ".mxf" && AtmosMXFContent::valid_mxf (path)) {
+               } else if (ext == ".mxf" && AtmosMXFContent::valid_mxf(path)) {
                        single.reset (new AtmosMXFContent(path));
                }
 
                        single.reset (new AtmosMXFContent(path));
                }
 
index ab76a29dc6367c9b6ee96d58fa2095bed8e8d90c..7da5435d5f531c2ff4ebba39615c25c167a13ad2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/lib/content_factory.h
  *  @brief Methods to create content objects.
  */
 
 /** @file  src/lib/content_factory.h
  *  @brief Methods to create content objects.
  */
 
+
 #include <libcxml/cxml.h>
 
 #include <libcxml/cxml.h>
 
+
 class Film;
 class Content;
 
 class Film;
 class Content;
 
+
 extern std::shared_ptr<Content> content_factory (cxml::ConstNodePtr, int, std::list<std::string> &);
 extern std::shared_ptr<Content> content_factory (cxml::ConstNodePtr, int, std::list<std::string> &);
-extern std::list<std::shared_ptr<Content> > content_factory (boost::filesystem::path);
+extern std::list<std::shared_ptr<Content>> content_factory (boost::filesystem::path);
index 891b8caacae2d375f36f7a3e61499a5676a4f3c9..24ba5bc451449bc59ab63d2c71d8ed182eb56a13 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file src/encode_server.cc
  *  @brief Class to describe a server to which we can send
  *  encoding work, and a class to implement such a server.
  */
 
 /** @file src/encode_server.cc
  *  @brief Class to describe a server to which we can send
  *  encoding work, and a class to implement such a server.
  */
 
+
 #include "encode_server.h"
 #include "util.h"
 #include "dcpomatic_socket.h"
 #include "encode_server.h"
 #include "util.h"
 #include "dcpomatic_socket.h"
@@ -53,6 +55,7 @@ DCPOMATIC_ENABLE_WARNINGS
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::string;
 using std::vector;
 using std::list;
 using std::string;
 using std::vector;
 using std::list;
@@ -69,6 +72,7 @@ using dcp::ArrayData;
 using dcp::Size;
 using dcp::raw_convert;
 
 using dcp::Size;
 using dcp::raw_convert;
 
+
 EncodeServer::EncodeServer (bool verbose, int num_threads)
 #if !defined(RUNNING_ON_VALGRIND) || RUNNING_ON_VALGRIND == 0
        : Server (ENCODE_FRAME_PORT)
 EncodeServer::EncodeServer (bool verbose, int num_threads)
 #if !defined(RUNNING_ON_VALGRIND) || RUNNING_ON_VALGRIND == 0
        : Server (ENCODE_FRAME_PORT)
@@ -81,6 +85,7 @@ EncodeServer::EncodeServer (bool verbose, int num_threads)
 
 }
 
 
 }
 
+
 EncodeServer::~EncodeServer ()
 {
        boost::this_thread::disable_interruption dis;
 EncodeServer::~EncodeServer ()
 {
        boost::this_thread::disable_interruption dis;
@@ -111,6 +116,7 @@ EncodeServer::~EncodeServer ()
        } catch (...) {}
 }
 
        } catch (...) {}
 }
 
+
 /** @param after_read Filled in with gettimeofday() after reading the input from the network.
  *  @param after_encode Filled in with gettimeofday() after encoding the image.
  */
 /** @param after_read Filled in with gettimeofday() after reading the input from the network.
  *  @param after_encode Filled in with gettimeofday() after encoding the image.
  */
@@ -119,9 +125,9 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
 {
        Socket::ReadDigestScope ds (socket);
 
 {
        Socket::ReadDigestScope ds (socket);
 
-       uint32_t length = socket->read_uint32 ();
+       auto length = socket->read_uint32 ();
        scoped_array<char> buffer (new char[length]);
        scoped_array<char> buffer (new char[length]);
-       socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length);
+       socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);
 
        string s (buffer.get());
        auto xml = make_shared<cxml::Document>("EncodingRequest");
 
        string s (buffer.get());
        auto xml = make_shared<cxml::Document>("EncodingRequest");
@@ -162,6 +168,7 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
        return dcp_video_frame.index ();
 }
 
        return dcp_video_frame.index ();
 }
 
+
 void
 EncodeServer::worker_thread ()
 {
 void
 EncodeServer::worker_thread ()
 {
@@ -226,6 +233,7 @@ EncodeServer::worker_thread ()
        }
 }
 
        }
 }
 
+
 void
 EncodeServer::run ()
 {
 void
 EncodeServer::run ()
 {
@@ -251,6 +259,7 @@ EncodeServer::run ()
        Server::run ();
 }
 
        Server::run ();
 }
 
+
 void
 EncodeServer::broadcast_thread ()
 try
 void
 EncodeServer::broadcast_thread ()
 try
@@ -275,6 +284,7 @@ catch (...)
        store_current ();
 }
 
        store_current ();
 }
 
+
 void
 EncodeServer::broadcast_received ()
 {
 void
 EncodeServer::broadcast_received ()
 {
@@ -320,6 +330,7 @@ EncodeServer::broadcast_received ()
        }
 }
 
        }
 }
 
+
 void
 EncodeServer::handle (shared_ptr<Socket> socket)
 {
 void
 EncodeServer::handle (shared_ptr<Socket> socket)
 {
index d313a851d3f942eb3bbe6a372b1a4075dece47a2..6e24a19849827cdde20c276e79d331b8a2cd1ab5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_ENCODE_SERVER_H
 #define DCPOMATIC_ENCODE_SERVER_H
 
 #ifndef DCPOMATIC_ENCODE_SERVER_H
 #define DCPOMATIC_ENCODE_SERVER_H
 
+
 /** @file src/encode_server.h
  *  @brief EncodeServer class.
  */
 
 /** @file src/encode_server.h
  *  @brief EncodeServer class.
  */
 
+
 #include "server.h"
 #include "exception_store.h"
 #include <boost/thread.hpp>
 #include "server.h"
 #include "exception_store.h"
 #include <boost/thread.hpp>
 #include <boost/thread/condition.hpp>
 #include <string>
 
 #include <boost/thread/condition.hpp>
 #include <string>
 
+
 class Socket;
 class Log;
 
 class Socket;
 class Log;
 
+
 /** @class EncodeServer
  *  @brief A class to run a server which can accept requests to perform JPEG2000
  *  encoding work.
 /** @class EncodeServer
  *  @brief A class to run a server which can accept requests to perform JPEG2000
  *  encoding work.
@@ -55,7 +60,7 @@ private:
        void broadcast_received ();
 
        boost::thread_group _worker_threads;
        void broadcast_received ();
 
        boost::thread_group _worker_threads;
-       std::list<std::shared_ptr<Socket> > _queue;
+       std::list<std::shared_ptr<Socket>> _queue;
        boost::condition _full_condition;
        boost::condition _empty_condition;
        bool _verbose;
        boost::condition _full_condition;
        boost::condition _empty_condition;
        bool _verbose;
@@ -77,4 +82,5 @@ private:
        } _broadcast;
 };
 
        } _broadcast;
 };
 
+
 #endif
 #endif
index 5b1f56f727e279122211616742cb4598ad0cce32..7a8fe68bc0c88c350835859b8c87b55bffbd42e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "log.h"
 #include "compose.hpp"
 #include "version.h"
 #include "log.h"
 #include "compose.hpp"
 #include "version.h"
@@ -35,10 +36,12 @@ extern "C" {
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
-using std::string;
+
 using std::list;
 using std::pair;
 using std::shared_ptr;
 using std::list;
 using std::pair;
 using std::shared_ptr;
+using std::string;
+
 
 /** @param v Version as used by FFmpeg.
  *  @return A string representation of v.
 
 /** @param v Version as used by FFmpeg.
  *  @return A string representation of v.
@@ -52,6 +55,7 @@ ffmpeg_version_to_string (int v)
        return buffer;
 }
 
        return buffer;
 }
 
+
 /** Return a user-readable string summarising the versions of our dependencies */
 static
 string
 /** Return a user-readable string summarising the versions of our dependencies */
 static
 string
@@ -72,6 +76,7 @@ dependency_version_summary ()
        return buffer;
 }
 
        return buffer;
 }
 
+
 list<string>
 environment_info ()
 {
 list<string>
 environment_info ()
 {
@@ -133,10 +138,9 @@ environment_info ()
 #endif
 #endif
 
 #endif
 #endif
 
-       info.push_back (String::compose ("CPU: %1, %2 processors", cpu_info(), boost::thread::hardware_concurrency ()));
-       list<pair<string, string> > const m = mount_info ();
-       for (list<pair<string, string> >::const_iterator i = m.begin(); i != m.end(); ++i) {
-               info.push_back (String::compose ("Mount: %1 %2", i->first, i->second));
+       info.push_back (String::compose ("CPU: %1, %2 processors", cpu_info(), boost::thread::hardware_concurrency()));
+       for (auto const& i: mount_info()) {
+               info.push_back (String::compose("Mount: %1 %2", i.first, i.second));
        }
 
        return info;
        }
 
        return info;
index 1f4c9aba09fffb9a30e4bb079e68bed6e6866359..7e85f8df6116dd62c5e93395fb320f17269a180b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,4 +18,5 @@
 
 */
 
 
 */
 
+
 extern std::list<std::string> environment_info ();
 extern std::list<std::string> environment_info ();
index f8398763e8185c59b096a7c9484844dedc5400a0..eb131d434b24572c423cd6ada89bb5759b0d6b0f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "ffmpeg.h"
 #include "ffmpeg_content.h"
 #include "film.h"
 #include "ffmpeg.h"
 #include "ffmpeg_content.h"
 #include "film.h"
@@ -41,6 +42,7 @@ extern "C" {
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::string;
 using std::cout;
 using std::cerr;
 using std::string;
 using std::cout;
 using std::cerr;
@@ -50,20 +52,18 @@ using boost::optional;
 using dcp::raw_convert;
 using namespace dcpomatic;
 
 using dcp::raw_convert;
 using namespace dcpomatic;
 
+
 boost::mutex FFmpeg::_mutex;
 
 boost::mutex FFmpeg::_mutex;
 
+
 FFmpeg::FFmpeg (std::shared_ptr<const FFmpegContent> c)
        : _ffmpeg_content (c)
 FFmpeg::FFmpeg (std::shared_ptr<const FFmpegContent> c)
        : _ffmpeg_content (c)
-       , _avio_buffer (0)
-       , _avio_buffer_size (4096)
-       , _avio_context (0)
-       , _format_context (0)
-       , _frame (0)
 {
        setup_general ();
        setup_decoders ();
 }
 
 {
        setup_general ();
        setup_decoders ();
 }
 
+
 FFmpeg::~FFmpeg ()
 {
        boost::mutex::scoped_lock lm (_mutex);
 FFmpeg::~FFmpeg ()
 {
        boost::mutex::scoped_lock lm (_mutex);
@@ -78,18 +78,21 @@ DCPOMATIC_ENABLE_WARNINGS
        avformat_close_input (&_format_context);
 }
 
        avformat_close_input (&_format_context);
 }
 
+
 static int
 avio_read_wrapper (void* data, uint8_t* buffer, int amount)
 {
        return reinterpret_cast<FFmpeg*>(data)->avio_read (buffer, amount);
 }
 
 static int
 avio_read_wrapper (void* data, uint8_t* buffer, int amount)
 {
        return reinterpret_cast<FFmpeg*>(data)->avio_read (buffer, amount);
 }
 
+
 static int64_t
 avio_seek_wrapper (void* data, int64_t offset, int whence)
 {
        return reinterpret_cast<FFmpeg*>(data)->avio_seek (offset, whence);
 }
 
 static int64_t
 avio_seek_wrapper (void* data, int64_t offset, int whence)
 {
        return reinterpret_cast<FFmpeg*>(data)->avio_seek (offset, whence);
 }
 
+
 void
 FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl)
 {
 void
 FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl)
 {
@@ -105,6 +108,7 @@ FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl)
        dcpomatic_log->log (String::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL);
 }
 
        dcpomatic_log->log (String::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL);
 }
 
+
 void
 FFmpeg::setup_general ()
 {
 void
 FFmpeg::setup_general ()
 {
@@ -114,7 +118,7 @@ FFmpeg::setup_general ()
        av_log_set_callback (FFmpeg::ffmpeg_log_callback);
 
        _file_group.set_paths (_ffmpeg_content->paths ());
        av_log_set_callback (FFmpeg::ffmpeg_log_callback);
 
        _file_group.set_paths (_ffmpeg_content->paths ());
-       _avio_buffer = static_cast<uint8_t*> (wrapped_av_malloc (_avio_buffer_size));
+       _avio_buffer = static_cast<uint8_t*> (wrapped_av_malloc(_avio_buffer_size));
        _avio_context = avio_alloc_context (_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper);
        if (!_avio_context) {
                throw std::bad_alloc ();
        _avio_context = avio_alloc_context (_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper);
        if (!_avio_context) {
                throw std::bad_alloc ();
@@ -194,6 +198,7 @@ DCPOMATIC_ENABLE_WARNINGS
        }
 }
 
        }
 }
 
+
 void
 FFmpeg::setup_decoders ()
 {
 void
 FFmpeg::setup_decoders ()
 {
@@ -232,6 +237,7 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 }
 
 DCPOMATIC_ENABLE_WARNINGS
 }
 
+
 DCPOMATIC_DISABLE_WARNINGS
 AVCodecContext *
 FFmpeg::video_codec_context () const
 DCPOMATIC_DISABLE_WARNINGS
 AVCodecContext *
 FFmpeg::video_codec_context () const
@@ -243,10 +249,11 @@ FFmpeg::video_codec_context () const
        return _format_context->streams[_video_stream.get()]->codec;
 }
 
        return _format_context->streams[_video_stream.get()]->codec;
 }
 
+
 AVCodecContext *
 FFmpeg::subtitle_codec_context () const
 {
 AVCodecContext *
 FFmpeg::subtitle_codec_context () const
 {
-       if (!_ffmpeg_content->subtitle_stream ()) {
+       if (!_ffmpeg_content->subtitle_stream()) {
                return nullptr;
        }
 
                return nullptr;
        }
 
@@ -254,12 +261,14 @@ FFmpeg::subtitle_codec_context () const
 }
 DCPOMATIC_ENABLE_WARNINGS
 
 }
 DCPOMATIC_ENABLE_WARNINGS
 
+
 int
 FFmpeg::avio_read (uint8_t* buffer, int const amount)
 {
        return _file_group.read (buffer, amount);
 }
 
 int
 FFmpeg::avio_read (uint8_t* buffer, int const amount)
 {
        return _file_group.read (buffer, amount);
 }
 
+
 int64_t
 FFmpeg::avio_seek (int64_t const pos, int whence)
 {
 int64_t
 FFmpeg::avio_seek (int64_t const pos, int whence)
 {
@@ -270,6 +279,7 @@ FFmpeg::avio_seek (int64_t const pos, int whence)
        return _file_group.seek (pos, whence);
 }
 
        return _file_group.seek (pos, whence);
 }
 
+
 FFmpegSubtitlePeriod
 FFmpeg::subtitle_period (AVSubtitle const & sub)
 {
 FFmpegSubtitlePeriod
 FFmpeg::subtitle_period (AVSubtitle const & sub)
 {
@@ -286,6 +296,7 @@ FFmpeg::subtitle_period (AVSubtitle const & sub)
                );
 }
 
                );
 }
 
+
 /** Compute the pts offset to use given a set of audio streams and some video details.
  *  Sometimes these parameters will have just been determined by an Examiner, sometimes
  *  they will have been retrieved from a piece of Content, hence the need for this method
 /** Compute the pts offset to use given a set of audio streams and some video details.
  *  Sometimes these parameters will have just been determined by an Examiner, sometimes
  *  they will have been retrieved from a piece of Content, hence the need for this method
index fac8a2d840b3960e8290e6ddec8448dd318e1721..5e1d0842ec771e6cccd803f4acf31442ae508006 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_FFMPEG_H
 #define DCPOMATIC_FFMPEG_H
 
 #ifndef DCPOMATIC_FFMPEG_H
 #define DCPOMATIC_FFMPEG_H
 
+
 #include "file_group.h"
 #include "ffmpeg_subtitle_period.h"
 #include "warnings.h"
 #include "file_group.h"
 #include "ffmpeg_subtitle_period.h"
 #include "warnings.h"
@@ -31,6 +33,7 @@ extern "C" {
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/thread/mutex.hpp>
 
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/thread/mutex.hpp>
 
+
 struct AVFormatContext;
 struct AVFrame;
 struct AVIOContext;
 struct AVFormatContext;
 struct AVFrame;
 struct AVIOContext;
@@ -39,6 +42,7 @@ class FFmpegContent;
 class FFmpegAudioStream;
 class Log;
 
 class FFmpegAudioStream;
 class Log;
 
+
 class FFmpeg
 {
 public:
 class FFmpeg
 {
 public:
@@ -56,20 +60,20 @@ protected:
        AVCodecContext* video_codec_context () const;
        AVCodecContext* subtitle_codec_context () const;
        dcpomatic::ContentTime pts_offset (
        AVCodecContext* video_codec_context () const;
        AVCodecContext* subtitle_codec_context () const;
        dcpomatic::ContentTime pts_offset (
-               std::vector<std::shared_ptr<FFmpegAudioStream> > audio_streams, boost::optional<dcpomatic::ContentTime> first_video, double video_frame_rate
+               std::vector<std::shared_ptr<FFmpegAudioStream>> audio_streams, boost::optional<dcpomatic::ContentTime> first_video, double video_frame_rate
                ) const;
 
        static FFmpegSubtitlePeriod subtitle_period (AVSubtitle const & sub);
 
        std::shared_ptr<const FFmpegContent> _ffmpeg_content;
 
                ) const;
 
        static FFmpegSubtitlePeriod subtitle_period (AVSubtitle const & sub);
 
        std::shared_ptr<const FFmpegContent> _ffmpeg_content;
 
-       uint8_t* _avio_buffer;
-       int _avio_buffer_size;
-       AVIOContext* _avio_context;
+       uint8_t* _avio_buffer = nullptr;
+       int _avio_buffer_size = 4096;
+       AVIOContext* _avio_context = nullptr;
        FileGroup _file_group;
 
        FileGroup _file_group;
 
-       AVFormatContext* _format_context;
-       AVFrame* _frame;
+       AVFormatContext* _format_context = nullptr;
+       AVFrame* _frame = nullptr;
 
        /** Index of video stream within AVFormatContext */
        boost::optional<int> _video_stream;
 
        /** Index of video stream within AVFormatContext */
        boost::optional<int> _video_stream;
@@ -88,4 +92,5 @@ private:
        static std::weak_ptr<Log> _ffmpeg_log;
 };
 
        static std::weak_ptr<Log> _ffmpeg_log;
 };
 
+
 #endif
 #endif
index b1bb632b1496536da2f6f3a1ff96b6b5655e0561..516962936238824775970f5796dc97c10ca6f62e 100644 (file)
@@ -16,6 +16,7 @@
     You should have received a copy of the GNU General Public License
     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
     You should have received a copy of the GNU General Public License
     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
+
 */
 
 #include "ffmpeg_content.h"
 */
 
 #include "ffmpeg_content.h"
@@ -45,6 +46,7 @@ extern "C" {
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::string;
 using std::vector;
 using std::list;
 using std::string;
 using std::vector;
 using std::list;
@@ -59,17 +61,20 @@ using boost::optional;
 using dcp::raw_convert;
 using namespace dcpomatic;
 
 using dcp::raw_convert;
 using namespace dcpomatic;
 
+
 int const FFmpegContentProperty::SUBTITLE_STREAMS = 100;
 int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
 int const FFmpegContentProperty::FILTERS = 102;
 int const FFmpegContentProperty::KDM = 103;
 
 int const FFmpegContentProperty::SUBTITLE_STREAMS = 100;
 int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
 int const FFmpegContentProperty::FILTERS = 102;
 int const FFmpegContentProperty::KDM = 103;
 
+
 FFmpegContent::FFmpegContent (boost::filesystem::path p)
        : Content (p)
 {
 
 }
 
 FFmpegContent::FFmpegContent (boost::filesystem::path p)
        : Content (p)
 {
 
 }
 
+
 template <class T>
 optional<T>
 get_optional_enum (cxml::ConstNodePtr node, string name)
 template <class T>
 optional<T>
 get_optional_enum (cxml::ConstNodePtr node, string name)
@@ -81,6 +86,7 @@ get_optional_enum (cxml::ConstNodePtr node, string name)
        return static_cast<T>(*v);
 }
 
        return static_cast<T>(*v);
 }
 
+
 FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list<string>& notes)
        : Content (node)
 {
 FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list<string>& notes)
        : Content (node)
 {
@@ -125,7 +131,8 @@ FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list<string>
        _bits_per_pixel = node->optional_number_child<int> ("BitsPerPixel");
 }
 
        _bits_per_pixel = node->optional_number_child<int> ("BitsPerPixel");
 }
 
-FFmpegContent::FFmpegContent (vector<shared_ptr<Content> > c)
+
+FFmpegContent::FFmpegContent (vector<shared_ptr<Content>> c)
        : Content (c)
 {
        auto i = c.begin ();
        : Content (c)
 {
        auto i = c.begin ();
@@ -186,10 +193,11 @@ FFmpegContent::FFmpegContent (vector<shared_ptr<Content> > c)
        _bits_per_pixel = ref->_bits_per_pixel;
 }
 
        _bits_per_pixel = ref->_bits_per_pixel;
 }
 
+
 void
 FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
 void
 FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
-       node->add_child("Type")->add_child_text ("FFmpeg");
+       node->add_child("Type")->add_child_text("FFmpeg");
        Content::as_xml (node, with_paths);
 
        if (video) {
        Content::as_xml (node, with_paths);
 
        if (video) {
@@ -199,7 +207,7 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
        if (audio) {
                audio->as_xml (node);
 
        if (audio) {
                audio->as_xml (node);
 
-               for (auto i: audio->streams ()) {
+               for (auto i: audio->streams()) {
                        auto f = dynamic_pointer_cast<FFmpegAudioStream> (i);
                        DCPOMATIC_ASSERT (f);
                        f->as_xml (node->add_child("AudioStream"));
                        auto f = dynamic_pointer_cast<FFmpegAudioStream> (i);
                        DCPOMATIC_ASSERT (f);
                        f->as_xml (node->add_child("AudioStream"));
@@ -225,26 +233,27 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
        }
 
        if (_first_video) {
        }
 
        if (_first_video) {
-               node->add_child("FirstVideo")->add_child_text (raw_convert<string> (_first_video.get().get()));
+               node->add_child("FirstVideo")->add_child_text(raw_convert<string>(_first_video.get().get()));
        }
 
        if (_color_range) {
        }
 
        if (_color_range) {
-               node->add_child("ColorRange")->add_child_text (raw_convert<string> (static_cast<int> (*_color_range)));
+               node->add_child("ColorRange")->add_child_text(raw_convert<string>(static_cast<int>(*_color_range)));
        }
        if (_color_primaries) {
        }
        if (_color_primaries) {
-               node->add_child("ColorPrimaries")->add_child_text (raw_convert<string> (static_cast<int> (*_color_primaries)));
+               node->add_child("ColorPrimaries")->add_child_text(raw_convert<string>(static_cast<int>(*_color_primaries)));
        }
        if (_color_trc) {
        }
        if (_color_trc) {
-               node->add_child("ColorTransferCharacteristic")->add_child_text (raw_convert<string> (static_cast<int> (*_color_trc)));
+               node->add_child("ColorTransferCharacteristic")->add_child_text(raw_convert<string>(static_cast<int>(*_color_trc)));
        }
        if (_colorspace) {
        }
        if (_colorspace) {
-               node->add_child("Colorspace")->add_child_text (raw_convert<string> (static_cast<int> (*_colorspace)));
+               node->add_child("Colorspace")->add_child_text(raw_convert<string>(static_cast<int>(*_colorspace)));
        }
        if (_bits_per_pixel) {
        }
        if (_bits_per_pixel) {
-               node->add_child("BitsPerPixel")->add_child_text (raw_convert<string> (*_bits_per_pixel));
+               node->add_child("BitsPerPixel")->add_child_text(raw_convert<string>(*_bits_per_pixel));
        }
 }
 
        }
 }
 
+
 void
 FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
 void
 FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
@@ -290,7 +299,7 @@ FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                        }
                }
 
                        }
                }
 
-               if (!examiner->audio_streams().empty ()) {
+               if (!examiner->audio_streams().empty()) {
                        audio = make_shared<AudioContent>(this);
 
                        for (auto i: examiner->audio_streams()) {
                        audio = make_shared<AudioContent>(this);
 
                        for (auto i: examiner->audio_streams()) {
@@ -324,20 +333,22 @@ FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        }
 }
 
        }
 }
 
+
 string
 FFmpegContent::summary () const
 {
        if (video && audio) {
 string
 FFmpegContent::summary () const
 {
        if (video && audio) {
-               return String::compose (_("%1 [movie]"), path_summary ());
+               return String::compose (_("%1 [movie]"), path_summary());
        } else if (video) {
        } else if (video) {
-               return String::compose (_("%1 [video]"), path_summary ());
+               return String::compose (_("%1 [video]"), path_summary());
        } else if (audio) {
        } else if (audio) {
-               return String::compose (_("%1 [audio]"), path_summary ());
+               return String::compose (_("%1 [audio]"), path_summary());
        }
 
        return path_summary ();
 }
 
        }
 
        return path_summary ();
 }
 
+
 string
 FFmpegContent::technical_summary () const
 {
 string
 FFmpegContent::technical_summary () const
 {
@@ -372,6 +383,7 @@ FFmpegContent::technical_summary () const
                );
 }
 
                );
 }
 
+
 void
 FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
 {
 void
 FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
 {
@@ -383,18 +395,21 @@ FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
        }
 }
 
        }
 }
 
+
 bool
 operator== (FFmpegStream const & a, FFmpegStream const & b)
 {
        return a._id == b._id;
 }
 
 bool
 operator== (FFmpegStream const & a, FFmpegStream const & b)
 {
        return a._id == b._id;
 }
 
+
 bool
 operator!= (FFmpegStream const & a, FFmpegStream const & b)
 {
        return a._id != b._id;
 }
 
 bool
 operator!= (FFmpegStream const & a, FFmpegStream const & b)
 {
        return a._id != b._id;
 }
 
+
 DCPTime
 FFmpegContent::full_length (shared_ptr<const Film> film) const
 {
 DCPTime
 FFmpegContent::full_length (shared_ptr<const Film> film) const
 {
@@ -413,9 +428,10 @@ FFmpegContent::full_length (shared_ptr<const Film> film) const
 
        /* XXX: subtitle content? */
 
 
        /* XXX: subtitle content? */
 
-       return DCPTime();
+       return {};
 }
 
 }
 
+
 DCPTime
 FFmpegContent::approximate_length () const
 {
 DCPTime
 FFmpegContent::approximate_length () const
 {
@@ -433,6 +449,7 @@ FFmpegContent::approximate_length () const
        return DCPTime::from_frames (longest, 24);
 }
 
        return DCPTime::from_frames (longest, 24);
 }
 
+
 void
 FFmpegContent::set_filters (vector<Filter const *> const & filters)
 {
 void
 FFmpegContent::set_filters (vector<Filter const *> const & filters)
 {
@@ -444,6 +461,7 @@ FFmpegContent::set_filters (vector<Filter const *> const & filters)
        }
 }
 
        }
 }
 
+
 string
 FFmpegContent::identifier () const
 {
 string
 FFmpegContent::identifier () const
 {
@@ -470,6 +488,7 @@ FFmpegContent::identifier () const
        return s;
 }
 
        return s;
 }
 
+
 void
 FFmpegContent::set_default_colour_conversion ()
 {
 void
 FFmpegContent::set_default_colour_conversion ()
 {
@@ -505,6 +524,7 @@ FFmpegContent::set_default_colour_conversion ()
        }
 }
 
        }
 }
 
+
 void
 FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
 {
 void
 FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
 {
@@ -649,6 +669,7 @@ FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>&
        }
 }
 
        }
 }
 
+
 /** Our subtitle streams have colour maps, which can be changed, but
  *  they have no way of signalling that change.  As a hack, we have this
  *  method which callers can use when they've modified one of our subtitle
 /** Our subtitle streams have colour maps, which can be changed, but
  *  they have no way of signalling that change.  As a hack, we have this
  *  method which callers can use when they've modified one of our subtitle
@@ -661,20 +682,22 @@ FFmpegContent::signal_subtitle_stream_changed ()
        ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
 }
 
        ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
 }
 
-vector<shared_ptr<FFmpegAudioStream> >
+
+vector<shared_ptr<FFmpegAudioStream>>
 FFmpegContent::ffmpeg_audio_streams () const
 {
 FFmpegContent::ffmpeg_audio_streams () const
 {
-       vector<shared_ptr<FFmpegAudioStream> > fa;
+       vector<shared_ptr<FFmpegAudioStream>> fa;
 
        if (audio) {
                for (auto i: audio->streams()) {
 
        if (audio) {
                for (auto i: audio->streams()) {
-                       fa.push_back (dynamic_pointer_cast<FFmpegAudioStream> (i));
+                       fa.push_back (dynamic_pointer_cast<FFmpegAudioStream>(i));
                }
        }
 
        return fa;
 }
 
                }
        }
 
        return fa;
 }
 
+
 void
 FFmpegContent::take_settings_from (shared_ptr<const Content> c)
 {
 void
 FFmpegContent::take_settings_from (shared_ptr<const Content> c)
 {
index fccc7ad9973f10a5afe4f505e8be1039e99dff36..df7b56edca41e9ecd5475c2f0a9658f1a1b855e5 100644 (file)
@@ -49,7 +49,7 @@ class FFmpegContent : public Content
 public:
        FFmpegContent (boost::filesystem::path);
        FFmpegContent (cxml::ConstNodePtr, int version, std::list<std::string> &);
 public:
        FFmpegContent (boost::filesystem::path);
        FFmpegContent (cxml::ConstNodePtr, int version, std::list<std::string> &);
-       FFmpegContent (std::vector<std::shared_ptr<Content> >);
+       FFmpegContent (std::vector<std::shared_ptr<Content>>);
 
        std::shared_ptr<FFmpegContent> shared_from_this () {
                return std::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
 
        std::shared_ptr<FFmpegContent> shared_from_this () {
                return std::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
@@ -73,7 +73,7 @@ public:
 
        void set_filters (std::vector<Filter const *> const &);
 
 
        void set_filters (std::vector<Filter const *> const &);
 
-       std::vector<std::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
+       std::vector<std::shared_ptr<FFmpegSubtitleStream>> subtitle_streams () const {
                boost::mutex::scoped_lock lm (_mutex);
                return _subtitle_streams;
        }
                boost::mutex::scoped_lock lm (_mutex);
                return _subtitle_streams;
        }
@@ -83,7 +83,7 @@ public:
                return _subtitle_stream;
        }
 
                return _subtitle_stream;
        }
 
-       std::vector<std::shared_ptr<FFmpegAudioStream> > ffmpeg_audio_streams () const;
+       std::vector<std::shared_ptr<FFmpegAudioStream>> ffmpeg_audio_streams () const;
 
        std::vector<Filter const *> filters () const {
                boost::mutex::scoped_lock lm (_mutex);
 
        std::vector<Filter const *> filters () const {
                boost::mutex::scoped_lock lm (_mutex);
@@ -105,7 +105,7 @@ private:
        friend struct ffmpeg_pts_offset_test;
        friend struct audio_sampling_rate_test;
 
        friend struct ffmpeg_pts_offset_test;
        friend struct audio_sampling_rate_test;
 
-       std::vector<std::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
+       std::vector<std::shared_ptr<FFmpegSubtitleStream>> _subtitle_streams;
        std::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
        boost::optional<dcpomatic::ContentTime> _first_video;
        /** Video filters that should be used when generating DCPs */
        std::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
        boost::optional<dcpomatic::ContentTime> _first_video;
        /** Video filters that should be used when generating DCPs */
index 5456b06c4aca6890cba4beced686688811400ce3..a3b7ec89ff84e28f46e8a667b6b75cde14a1e850 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "player_text.h"
 #include "font.h"
 
 #include "player_text.h"
 #include "font.h"
 
+
 using std::list;
 using std::shared_ptr;
 using namespace dcpomatic;
 
 using std::list;
 using std::shared_ptr;
 using namespace dcpomatic;
 
+
 void
 void
-PlayerText::add_fonts (list<shared_ptr<Font> > fonts_)
+PlayerText::add_fonts (list<shared_ptr<Font>> fonts_)
 {
        for (auto i: fonts_) {
                bool got = false;
 {
        for (auto i: fonts_) {
                bool got = false;
index 232ba65166f97b9f30d6eec9a4e0ff8c829139f0..cd4be984c9551e5f1d8eeabbb86255155a0c04d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #ifndef DCPOMATIC_PLAYER_CAPTION_H
 #define DCPOMATIC_PLAYER_CAPTION_H
 
 #ifndef DCPOMATIC_PLAYER_CAPTION_H
 #define DCPOMATIC_PLAYER_CAPTION_H
 
+
 #include "bitmap_text.h"
 #include "dcpomatic_time.h"
 #include "string_text.h"
 
 #include "bitmap_text.h"
 #include "dcpomatic_time.h"
 #include "string_text.h"
 
+
 namespace dcpomatic {
        class Font;
 }
 
 namespace dcpomatic {
        class Font;
 }
 
+
 /** A set of text (subtitle/CCAP) which span the same time period */
 class PlayerText
 {
 public:
 /** A set of text (subtitle/CCAP) which span the same time period */
 class PlayerText
 {
 public:
-       void add_fonts (std::list<std::shared_ptr<dcpomatic::Font> > fonts_);
+       void add_fonts (std::list<std::shared_ptr<dcpomatic::Font>> fonts_);
        std::list<std::shared_ptr<dcpomatic::Font> > fonts;
 
        /** BitmapTexts, with their rectangles transformed as specified by their content */
        std::list<std::shared_ptr<dcpomatic::Font> > fonts;
 
        /** BitmapTexts, with their rectangles transformed as specified by their content */
@@ -41,4 +45,5 @@ public:
        std::list<StringText> string;
 };
 
        std::list<StringText> string;
 };
 
+
 #endif
 #endif
index d8cfb4fff67bb9138861c7fce6cd31cd056034f7..f402b6691fc982fc180302d9792c9f8d395559b6 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "upmixer_a.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
 
 #include "i18n.h"
 
 #include "upmixer_a.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
 
 #include "i18n.h"
 
-using std::string;
+
+using std::make_shared;
 using std::min;
 using std::min;
-using std::vector;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
+using std::vector;
+
 
 UpmixerA::UpmixerA (int sampling_rate)
        : _left (0.02, 1900.0 / sampling_rate, 4800.0 / sampling_rate)
 
 UpmixerA::UpmixerA (int sampling_rate)
        : _left (0.02, 1900.0 / sampling_rate, 4800.0 / sampling_rate)
@@ -40,52 +44,57 @@ UpmixerA::UpmixerA (int sampling_rate)
 
 }
 
 
 }
 
+
 string
 UpmixerA::name () const
 {
        return _("Stereo to 5.1 up-mixer A");
 }
 
 string
 UpmixerA::name () const
 {
        return _("Stereo to 5.1 up-mixer A");
 }
 
+
 string
 UpmixerA::id () const
 {
        return N_("stereo-5.1-upmix-a");
 }
 
 string
 UpmixerA::id () const
 {
        return N_("stereo-5.1-upmix-a");
 }
 
+
 int
 UpmixerA::out_channels () const
 {
        return 6;
 }
 
 int
 UpmixerA::out_channels () const
 {
        return 6;
 }
 
+
 shared_ptr<AudioProcessor>
 UpmixerA::clone (int sampling_rate) const
 {
 shared_ptr<AudioProcessor>
 UpmixerA::clone (int sampling_rate) const
 {
-       return shared_ptr<AudioProcessor> (new UpmixerA (sampling_rate));
+       return make_shared<UpmixerA>(sampling_rate);
 }
 
 }
 
+
 shared_ptr<AudioBuffers>
 UpmixerA::run (shared_ptr<const AudioBuffers> in, int channels)
 {
        /* Input L and R */
 shared_ptr<AudioBuffers>
 UpmixerA::run (shared_ptr<const AudioBuffers> in, int channels)
 {
        /* Input L and R */
-       shared_ptr<AudioBuffers> in_L = in->channel (0);
-       shared_ptr<AudioBuffers> in_R = in->channel (1);
+       auto in_L = in->channel (0);
+       auto in_R = in->channel (1);
 
        /* Mix of L and R; -6dB down in amplitude (3dB in terms of power) */
 
        /* Mix of L and R; -6dB down in amplitude (3dB in terms of power) */
-       shared_ptr<AudioBuffers> in_LR = in_L->clone ();
+       auto in_LR = in_L->clone ();
        in_LR->accumulate_frames (in_R.get(), in_R->frames(), 0, 0);
        in_LR->apply_gain (-6);
 
        /* Run filters */
        in_LR->accumulate_frames (in_R.get(), in_R->frames(), 0, 0);
        in_LR->apply_gain (-6);
 
        /* Run filters */
-       vector<shared_ptr<AudioBuffers> > all_out;
-       all_out.push_back (_left.run (in_L));
-       all_out.push_back (_right.run (in_R));
-       all_out.push_back (_centre.run (in_LR));
-       all_out.push_back (_lfe.run (in_LR));
-       all_out.push_back (_ls.run (in_L));
-       all_out.push_back (_rs.run (in_R));
-
-       shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames ()));
+       vector<shared_ptr<AudioBuffers>> all_out;
+       all_out.push_back (_left.run(in_L));
+       all_out.push_back (_right.run(in_R));
+       all_out.push_back (_centre.run(in_LR));
+       all_out.push_back (_lfe.run(in_LR));
+       all_out.push_back (_ls.run(in_L));
+       all_out.push_back (_rs.run(in_R));
+
+       auto out = make_shared<AudioBuffers>(channels, in->frames());
        int const N = min (channels, 6);
 
        for (int i = 0; i < N; ++i) {
        int const N = min (channels, 6);
 
        for (int i = 0; i < N; ++i) {
@@ -110,6 +119,7 @@ UpmixerA::flush ()
        _rs.flush ();
 }
 
        _rs.flush ();
 }
 
+
 void
 UpmixerA::make_audio_mapping_default (AudioMapping& mapping) const
 {
 void
 UpmixerA::make_audio_mapping_default (AudioMapping& mapping) const
 {
@@ -120,11 +130,12 @@ UpmixerA::make_audio_mapping_default (AudioMapping& mapping) const
        }
 }
 
        }
 }
 
+
 vector<NamedChannel>
 UpmixerA::input_names () const
 {
 vector<NamedChannel>
 UpmixerA::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 984b0809591cc0ebb980d1fa5292ae327d3dffe7..b357616ef0038e758b8ac0d6a17fccb1e4fe0c75 100644 (file)
 
 */
 
 
 */
 
+
 /** @file  src/lib/upmixer_a.h
  *  @brief UpmixerA class.
  */
 
 /** @file  src/lib/upmixer_a.h
  *  @brief UpmixerA class.
  */
 
+
 #include "audio_processor.h"
 #include "audio_filter.h"
 
 #include "audio_processor.h"
 #include "audio_filter.h"
 
+
 /** @class UpmixerA
  *  @brief Stereo to 5.1 upmixer algorithm by Gérald Maruccia.
  */
 /** @class UpmixerA
  *  @brief Stereo to 5.1 upmixer algorithm by Gérald Maruccia.
  */
index b35fc14c11897b9edcde688859f15df37a482054..f1141150b6c9ce042b6b15e837c4f5baceb887fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "compose.hpp"
 #include "image.h"
 #include "video_filter_graph.h"
 #include "compose.hpp"
 #include "image.h"
 #include "video_filter_graph.h"
@@ -29,12 +30,15 @@ extern "C" {
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
+
 using std::list;
 using std::list;
-using std::pair;
-using std::vector;
-using std::string;
 using std::make_pair;
 using std::make_pair;
+using std::make_shared;
+using std::pair;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
+using std::vector;
+
 
 VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r)
        : _size (s)
 
 VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r)
        : _size (s)
@@ -44,21 +48,22 @@ VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction
 
 }
 
 
 }
 
+
 /** Take an AVFrame and process it using our configured filters, returning a
  *  set of Images.  Caller handles memory management of the input frame.
  */
 /** Take an AVFrame and process it using our configured filters, returning a
  *  set of Images.  Caller handles memory management of the input frame.
  */
-list<pair<shared_ptr<Image>, int64_t> >
+list<pair<shared_ptr<Image>, int64_t>>
 VideoFilterGraph::process (AVFrame* frame)
 {
 VideoFilterGraph::process (AVFrame* frame)
 {
-       list<pair<shared_ptr<Image>, int64_t> > images;
+       list<pair<shared_ptr<Image>, int64_t>> images;
 
 DCPOMATIC_DISABLE_WARNINGS
        if (_copy) {
 
 DCPOMATIC_DISABLE_WARNINGS
        if (_copy) {
-               images.push_back (make_pair (shared_ptr<Image> (new Image (frame)), av_frame_get_best_effort_timestamp (frame)));
+               images.push_back (make_pair(make_shared<Image>(frame), av_frame_get_best_effort_timestamp (frame)));
        } else {
                int r = av_buffersrc_write_frame (_buffer_src_context, frame);
                if (r < 0) {
        } else {
                int r = av_buffersrc_write_frame (_buffer_src_context, frame);
                if (r < 0) {
-                       throw DecodeError (String::compose (N_("could not push buffer into filter chain (%1)."), r));
+                       throw DecodeError (String::compose(N_("could not push buffer into filter chain (%1)."), r));
                }
 
                while (true) {
                }
 
                while (true) {
@@ -66,7 +71,7 @@ DCPOMATIC_DISABLE_WARNINGS
                                break;
                        }
 
                                break;
                        }
 
-                       images.push_back (make_pair (shared_ptr<Image> (new Image (_frame)), av_frame_get_best_effort_timestamp (_frame)));
+                       images.push_back (make_pair(make_shared<Image>(_frame), av_frame_get_best_effort_timestamp (_frame)));
                        av_frame_unref (_frame);
                }
        }
                        av_frame_unref (_frame);
                }
        }
@@ -75,6 +80,7 @@ DCPOMATIC_ENABLE_WARNINGS
        return images;
 }
 
        return images;
 }
 
+
 /** @param s Image size.
  *  @param p Pixel format.
  *  @return true if this chain can process images with `s' and `p', otherwise false.
 /** @param s Image size.
  *  @param p Pixel format.
  *  @return true if this chain can process images with `s' and `p', otherwise false.
@@ -85,6 +91,7 @@ VideoFilterGraph::can_process (dcp::Size s, AVPixelFormat p) const
        return (_size == s && _pixel_format == p);
 }
 
        return (_size == s && _pixel_format == p);
 }
 
+
 string
 VideoFilterGraph::src_parameters () const
 {
 string
 VideoFilterGraph::src_parameters () const
 {
@@ -99,23 +106,26 @@ VideoFilterGraph::src_parameters () const
        return buffer;
 }
 
        return buffer;
 }
 
+
 void *
 VideoFilterGraph::sink_parameters () const
 {
 void *
 VideoFilterGraph::sink_parameters () const
 {
-       AVBufferSinkParams* sink_params = av_buffersink_params_alloc ();
-       AVPixelFormat* pixel_fmts = new AVPixelFormat[2];
+       auto sink_params = av_buffersink_params_alloc ();
+       auto pixel_fmts = new AVPixelFormat[2];
        pixel_fmts[0] = _pixel_format;
        pixel_fmts[1] = AV_PIX_FMT_NONE;
        sink_params->pixel_fmts = pixel_fmts;
        return sink_params;
 }
 
        pixel_fmts[0] = _pixel_format;
        pixel_fmts[1] = AV_PIX_FMT_NONE;
        sink_params->pixel_fmts = pixel_fmts;
        return sink_params;
 }
 
+
 string
 VideoFilterGraph::src_name () const
 {
        return "buffer";
 }
 
 string
 VideoFilterGraph::src_name () const
 {
        return "buffer";
 }
 
+
 string
 VideoFilterGraph::sink_name () const
 {
 string
 VideoFilterGraph::sink_name () const
 {
index ba0284fb83e7233143e08306030c14e486fedda5..fb6c7eba1162ef6b597d287843a6af880e596526 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "filter_graph.h"
 
 #include "filter_graph.h"
 
+
 class VideoFilterGraph : public FilterGraph
 {
 public:
        VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r);
 
        bool can_process (dcp::Size s, AVPixelFormat p) const;
 class VideoFilterGraph : public FilterGraph
 {
 public:
        VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r);
 
        bool can_process (dcp::Size s, AVPixelFormat p) const;
-       std::list<std::pair<std::shared_ptr<Image>, int64_t> > process (AVFrame * frame);
+       std::list<std::pair<std::shared_ptr<Image>, int64_t>> process (AVFrame * frame);
 
 protected:
        std::string src_parameters () const;
 
 protected:
        std::string src_parameters () const;
index 8c73aba25d636d67b621f582be6440d9c2c5b3e8..63c52ee068879c0b262268ca94589b8c80928781 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "video_ring_buffers.h"
 #include "player_video.h"
 #include "compose.hpp"
 #include <list>
 #include <iostream>
 
 #include "video_ring_buffers.h"
 #include "player_video.h"
 #include "compose.hpp"
 #include <list>
 #include <iostream>
 
+
 using std::list;
 using std::make_pair;
 using std::cout;
 using std::list;
 using std::make_pair;
 using std::cout;
@@ -33,25 +35,28 @@ using std::shared_ptr;
 using boost::optional;
 using namespace dcpomatic;
 
 using boost::optional;
 using namespace dcpomatic;
 
+
 void
 VideoRingBuffers::put (shared_ptr<PlayerVideo> frame, DCPTime time)
 {
        boost::mutex::scoped_lock lm (_mutex);
 void
 VideoRingBuffers::put (shared_ptr<PlayerVideo> frame, DCPTime time)
 {
        boost::mutex::scoped_lock lm (_mutex);
-       _data.push_back (make_pair (frame, time));
+       _data.push_back (make_pair(frame, time));
 }
 
 }
 
+
 pair<shared_ptr<PlayerVideo>, DCPTime>
 VideoRingBuffers::get ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        if (_data.empty ()) {
 pair<shared_ptr<PlayerVideo>, DCPTime>
 VideoRingBuffers::get ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        if (_data.empty ()) {
-               return make_pair(shared_ptr<PlayerVideo>(), DCPTime());
+               return {};
        }
        }
-       pair<shared_ptr<PlayerVideo>, DCPTime> const r = _data.front ();
+       auto const r = _data.front();
        _data.pop_front ();
        return r;
 }
 
        _data.pop_front ();
        return r;
 }
 
+
 Frame
 VideoRingBuffers::size () const
 {
 Frame
 VideoRingBuffers::size () const
 {
@@ -59,6 +64,7 @@ VideoRingBuffers::size () const
        return _data.size ();
 }
 
        return _data.size ();
 }
 
+
 bool
 VideoRingBuffers::empty () const
 {
 bool
 VideoRingBuffers::empty () const
 {
@@ -66,6 +72,7 @@ VideoRingBuffers::empty () const
        return _data.empty ();
 }
 
        return _data.empty ();
 }
 
+
 void
 VideoRingBuffers::clear ()
 {
 void
 VideoRingBuffers::clear ()
 {
@@ -73,13 +80,14 @@ VideoRingBuffers::clear ()
        _data.clear ();
 }
 
        _data.clear ();
 }
 
+
 pair<size_t, string>
 VideoRingBuffers::memory_used () const
 {
        boost::mutex::scoped_lock lm (_mutex);
        size_t m = 0;
 pair<size_t, string>
 VideoRingBuffers::memory_used () const
 {
        boost::mutex::scoped_lock lm (_mutex);
        size_t m = 0;
-       for (list<pair<shared_ptr<PlayerVideo>, DCPTime> >::const_iterator i = _data.begin(); i != _data.end(); ++i) {
-               m += i->first->memory_used();
+       for (auto const& i: _data) {
+               m += i.first->memory_used();
        }
        return make_pair(m, String::compose("%1 frames", _data.size()));
 }
        }
        return make_pair(m, String::compose("%1 frames", _data.size()));
 }
@@ -89,8 +97,8 @@ void
 VideoRingBuffers::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
 {
        boost::mutex::scoped_lock lm (_mutex);
 VideoRingBuffers::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
 {
        boost::mutex::scoped_lock lm (_mutex);
-       for (list<pair<shared_ptr<PlayerVideo>, DCPTime> >::const_iterator i = _data.begin(); i != _data.end(); ++i) {
-               i->first->reset_metadata (film, player_video_container_size);
+       for (auto const& i: _data) {
+               i.first->reset_metadata (film, player_video_container_size);
        }
 }
 
        }
 }
 
index 832837d9422a59fe1a2cbd063f953ab740dd4a30..444a49ea771e489c3d5cb7bf60ba919b17466cc3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "dcpomatic_time.h"
 #include "player_video.h"
 #include "types.h"
 #include "dcpomatic_time.h"
 #include "player_video.h"
 #include "types.h"
@@ -46,5 +47,5 @@ public:
 
 private:
        mutable boost::mutex _mutex;
 
 private:
        mutable boost::mutex _mutex;
-       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _data;
+       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime>> _data;
 };
 };
index f21772a4d2d65d0fd8b10f6f300af51b28c463dd..bd4c4e62324fd54b8e6e0ef053220b45e31d8989 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 /** @file  src/tools/dcpomatic_kdm_cli.cc
  *  @brief Command-line program to generate KDMs.
  */
 
 /** @file  src/tools/dcpomatic_kdm_cli.cc
  *  @brief Command-line program to generate KDMs.
  */
 
-#include "lib/film.h"
+
 #include "lib/cinema.h"
 #include "lib/cinema.h"
-#include "lib/kdm_with_metadata.h"
 #include "lib/config.h"
 #include "lib/config.h"
-#include "lib/exceptions.h"
-#include "lib/emailer.h"
 #include "lib/dkdm_wrapper.h"
 #include "lib/dkdm_wrapper.h"
+#include "lib/emailer.h"
+#include "lib/exceptions.h"
+#include "lib/film.h"
+#include "lib/kdm_with_metadata.h"
 #include "lib/screen.h"
 #include <dcp/certificate.h>
 #include <dcp/decrypted_kdm.h>
 #include "lib/screen.h"
 #include <dcp/certificate.h>
 #include <dcp/decrypted_kdm.h>
 #include <getopt.h>
 #include <iostream>
 
 #include <getopt.h>
 #include <iostream>
 
-using std::string;
-using std::cout;
+
 using std::cerr;
 using std::cerr;
+using std::cout;
+using std::dynamic_pointer_cast;
 using std::list;
 using std::list;
-using std::vector;
+using std::make_shared;
 using std::runtime_error;
 using std::shared_ptr;
 using std::runtime_error;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using boost::optional;
 using boost::bind;
 using boost::optional;
 using boost::bind;
-using std::dynamic_pointer_cast;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
@@ -81,6 +85,7 @@ help ()
                "\t" << program_name << " -c \"Fred's Cinema\" -f now -d \"2 weeks\" -z my_great_movie\n\n";
 }
 
                "\t" << program_name << " -c \"Fred's Cinema\" -f now -d \"2 weeks\" -z my_great_movie\n\n";
 }
 
+
 static void
 error (string m)
 {
 static void
 error (string m)
 {
@@ -88,6 +93,7 @@ error (string m)
        exit (EXIT_FAILURE);
 }
 
        exit (EXIT_FAILURE);
 }
 
+
 static boost::posix_time::ptime
 time_from_string (string t)
 {
 static boost::posix_time::ptime
 time_from_string (string t)
 {
@@ -98,6 +104,7 @@ time_from_string (string t)
        return boost::posix_time::time_from_string (t);
 }
 
        return boost::posix_time::time_from_string (t);
 }
 
+
 static boost::posix_time::time_duration
 duration_from_string (string d)
 {
 static boost::posix_time::time_duration
 duration_from_string (string d)
 {
@@ -125,12 +132,14 @@ duration_from_string (string d)
        exit (EXIT_FAILURE);
 }
 
        exit (EXIT_FAILURE);
 }
 
+
 static bool
 always_overwrite ()
 {
        return true;
 }
 
 static bool
 always_overwrite ()
 {
        return true;
 }
 
+
 void
 write_files (
        list<KDMWithMetadataPtr> kdms,
 void
 write_files (
        list<KDMWithMetadataPtr> kdms,
@@ -165,11 +174,12 @@ write_files (
        }
 }
 
        }
 }
 
+
 shared_ptr<Cinema>
 find_cinema (string cinema_name)
 {
 shared_ptr<Cinema>
 find_cinema (string cinema_name)
 {
-       list<shared_ptr<Cinema> > cinemas = Config::instance()->cinemas ();
-       list<shared_ptr<Cinema> >::const_iterator i = cinemas.begin();
+       auto cinemas = Config::instance()->cinemas ();
+       auto i = cinemas.begin();
        while (
                i != cinemas.end() &&
                (*i)->name != cinema_name &&
        while (
                i != cinemas.end() &&
                (*i)->name != cinema_name &&
@@ -186,9 +196,10 @@ find_cinema (string cinema_name)
        return *i;
 }
 
        return *i;
 }
 
+
 void
 from_film (
 void
 from_film (
-       list<shared_ptr<Screen> > screens,
+       list<shared_ptr<Screen>> screens,
        boost::filesystem::path film_dir,
        bool verbose,
        boost::filesystem::path output,
        boost::filesystem::path film_dir,
        bool verbose,
        boost::filesystem::path output,
@@ -204,7 +215,7 @@ from_film (
 {
        shared_ptr<Film> film;
        try {
 {
        shared_ptr<Film> film;
        try {
-               film.reset (new Film (film_dir));
+               film = make_shared<Film>(film_dir);
                film->read_metadata ();
                if (verbose) {
                        cout << "Read film " << film->name () << "\n";
                film->read_metadata ();
                if (verbose) {
                        cout << "Read film " << film->name () << "\n";
@@ -222,12 +233,12 @@ from_film (
                error ("more than one CPL found in film");
        }
 
                error ("more than one CPL found in film");
        }
 
-       boost::filesystem::path cpl = cpls.front().cpl_file;
+       auto cpl = cpls.front().cpl_file;
 
        try {
                list<KDMWithMetadataPtr> kdms;
                for (auto i: screens) {
 
        try {
                list<KDMWithMetadataPtr> kdms;
                for (auto i: screens) {
-                       KDMWithMetadataPtr p = kdm_for_screen (film, cpl, i, valid_from, valid_to, formulation, disable_forensic_marking_picture, disable_forensic_marking_audio);
+                       auto p = kdm_for_screen (film, cpl, i, valid_from, valid_to, formulation, disable_forensic_marking_picture, disable_forensic_marking_audio);
                        if (p) {
                                kdms.push_back (p);
                        }
                        if (p) {
                                kdms.push_back (p);
                        }
@@ -245,18 +256,19 @@ from_film (
        }
 }
 
        }
 }
 
+
 optional<dcp::EncryptedKDM>
 sub_find_dkdm (shared_ptr<DKDMGroup> group, string cpl_id)
 {
        for (auto i: group->children()) {
 optional<dcp::EncryptedKDM>
 sub_find_dkdm (shared_ptr<DKDMGroup> group, string cpl_id)
 {
        for (auto i: group->children()) {
-               shared_ptr<DKDMGroup> g = dynamic_pointer_cast<DKDMGroup>(i);
+               auto g = dynamic_pointer_cast<DKDMGroup>(i);
                if (g) {
                if (g) {
-                       optional<dcp::EncryptedKDM> dkdm = sub_find_dkdm (g, cpl_id);
+                       auto dkdm = sub_find_dkdm (g, cpl_id);
                        if (dkdm) {
                                return dkdm;
                        }
                } else {
                        if (dkdm) {
                                return dkdm;
                        }
                } else {
-                       shared_ptr<DKDM> d = dynamic_pointer_cast<DKDM>(i);
+                       auto d = dynamic_pointer_cast<DKDM>(i);
                        assert (d);
                        if (d->dkdm().cpl_id() == cpl_id) {
                                return d->dkdm();
                        assert (d);
                        if (d->dkdm().cpl_id() == cpl_id) {
                                return d->dkdm();
@@ -267,12 +279,14 @@ sub_find_dkdm (shared_ptr<DKDMGroup> group, string cpl_id)
        return optional<dcp::EncryptedKDM>();
 }
 
        return optional<dcp::EncryptedKDM>();
 }
 
+
 optional<dcp::EncryptedKDM>
 find_dkdm (string cpl_id)
 {
        return sub_find_dkdm (Config::instance()->dkdms(), cpl_id);
 }
 
 optional<dcp::EncryptedKDM>
 find_dkdm (string cpl_id)
 {
        return sub_find_dkdm (Config::instance()->dkdms(), cpl_id);
 }
 
+
 dcp::EncryptedKDM
 kdm_from_dkdm (
        dcp::DecryptedKDM dkdm,
 dcp::EncryptedKDM
 kdm_from_dkdm (
        dcp::DecryptedKDM dkdm,
@@ -286,7 +300,7 @@ kdm_from_dkdm (
        )
 {
        /* Signer for new KDM */
        )
 {
        /* Signer for new KDM */
-       shared_ptr<const dcp::CertificateChain> signer = Config::instance()->signer_chain ();
+       auto signer = Config::instance()->signer_chain ();
        if (!signer->valid ()) {
                error ("signing certificate chain is invalid.");
        }
        if (!signer->valid ()) {
                error ("signing certificate chain is invalid.");
        }
@@ -307,9 +321,10 @@ kdm_from_dkdm (
        return kdm.encrypt (signer, target, trusted_devices, formulation, disable_forensic_marking_picture, disable_forensic_marking_audio);
 }
 
        return kdm.encrypt (signer, target, trusted_devices, formulation, disable_forensic_marking_picture, disable_forensic_marking_audio);
 }
 
+
 void
 from_dkdm (
 void
 from_dkdm (
-       list<shared_ptr<Screen> > screens,
+       list<shared_ptr<Screen>> screens,
        dcp::DecryptedKDM dkdm,
        bool verbose,
        boost::filesystem::path output,
        dcp::DecryptedKDM dkdm,
        bool verbose,
        boost::filesystem::path output,
@@ -335,7 +350,7 @@ from_dkdm (
                        dcp::LocalTime begin(valid_from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute());
                        dcp::LocalTime end(valid_to, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute());
 
                        dcp::LocalTime begin(valid_from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute());
                        dcp::LocalTime end(valid_to, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute());
 
-                       dcp::EncryptedKDM const kdm = kdm_from_dkdm(
+                       auto const kdm = kdm_from_dkdm(
                                                        dkdm,
                                                        i->recipient.get(),
                                                        i->trusted_device_thumbprints(),
                                                        dkdm,
                                                        i->recipient.get(),
                                                        i->trusted_device_thumbprints(),
@@ -354,7 +369,7 @@ from_dkdm (
                        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
                        name_values['i'] = kdm.cpl_id();
 
                        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
                        name_values['i'] = kdm.cpl_id();
 
-                       kdms.push_back (KDMWithMetadataPtr(new KDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, kdm)));
+                       kdms.push_back (make_shared<KDMWithMetadata>(name_values, i->cinema.get(), i->cinema->emails, kdm));
                }
                write_files (kdms, zip, output, container_name_format, filename_format, verbose);
        } catch (FileError& e) {
                }
                write_files (kdms, zip, output, container_name_format, filename_format, verbose);
        } catch (FileError& e) {
@@ -366,6 +381,7 @@ from_dkdm (
        }
 }
 
        }
 }
 
+
 void
 dump_dkdm_group (shared_ptr<DKDMGroup> group, int indent)
 {
 void
 dump_dkdm_group (shared_ptr<DKDMGroup> group, int indent)
 {
@@ -376,29 +392,30 @@ dump_dkdm_group (shared_ptr<DKDMGroup> group, int indent)
                cout << group->name() << "\n";
        }
        for (auto i: group->children()) {
                cout << group->name() << "\n";
        }
        for (auto i: group->children()) {
-               shared_ptr<DKDMGroup> g = dynamic_pointer_cast<DKDMGroup>(i);
+               auto g = dynamic_pointer_cast<DKDMGroup>(i);
                if (g) {
                        dump_dkdm_group (g, indent + 2);
                } else {
                        for (int j = 0; j < indent; ++j) {
                                cout << " ";
                        }
                if (g) {
                        dump_dkdm_group (g, indent + 2);
                } else {
                        for (int j = 0; j < indent; ++j) {
                                cout << " ";
                        }
-                       shared_ptr<DKDM> d = dynamic_pointer_cast<DKDM>(i);
+                       auto d = dynamic_pointer_cast<DKDM>(i);
                        assert(d);
                        cout << d->dkdm().cpl_id() << "\n";
                }
        }
 }
 
                        assert(d);
                        cout << d->dkdm().cpl_id() << "\n";
                }
        }
 }
 
+
 int main (int argc, char* argv[])
 {
        boost::filesystem::path output = ".";
 int main (int argc, char* argv[])
 {
        boost::filesystem::path output = ".";
-       dcp::NameFormat container_name_format = Config::instance()->kdm_container_name_format();
-       dcp::NameFormat filename_format = Config::instance()->kdm_filename_format();
+       auto container_name_format = Config::instance()->kdm_container_name_format();
+       auto filename_format = Config::instance()->kdm_filename_format();
        optional<string> cinema_name;
        shared_ptr<Cinema> cinema;
        optional<string> cinema_name;
        shared_ptr<Cinema> cinema;
-       string screen_description = "";
-       list<shared_ptr<Screen> > screens;
+       string screen_description;
+       list<shared_ptr<Screen>> screens;
        optional<dcp::EncryptedKDM> dkdm;
        optional<boost::posix_time::ptime> valid_from;
        optional<boost::posix_time::ptime> valid_to;
        optional<dcp::EncryptedKDM> dkdm;
        optional<boost::posix_time::ptime> valid_from;
        optional<boost::posix_time::ptime> valid_to;
@@ -466,13 +483,13 @@ int main (int argc, char* argv[])
                        duration_string = optarg;
                        break;
                case 'F':
                        duration_string = optarg;
                        break;
                case 'F':
-                       if (string (optarg) == "modified-transitional-1") {
+                       if (string(optarg) == "modified-transitional-1") {
                                formulation = dcp::Formulation::MODIFIED_TRANSITIONAL_1;
                                formulation = dcp::Formulation::MODIFIED_TRANSITIONAL_1;
-                       } else if (string (optarg) == "multiple-modified-transitional-1") {
+                       } else if (string(optarg) == "multiple-modified-transitional-1") {
                                formulation = dcp::Formulation::MULTIPLE_MODIFIED_TRANSITIONAL_1;
                                formulation = dcp::Formulation::MULTIPLE_MODIFIED_TRANSITIONAL_1;
-                       } else if (string (optarg) == "dci-any") {
+                       } else if (string(optarg) == "dci-any") {
                                formulation = dcp::Formulation::DCI_ANY;
                                formulation = dcp::Formulation::DCI_ANY;
-                       } else if (string (optarg) == "dci-specific") {
+                       } else if (string(optarg) == "dci-specific") {
                                formulation = dcp::Formulation::DCI_SPECIFIC;
                        } else {
                                error ("unrecognised KDM formulation " + string (optarg));
                                formulation = dcp::Formulation::DCI_SPECIFIC;
                        } else {
                                error ("unrecognised KDM formulation " + string (optarg));
@@ -501,7 +518,7 @@ int main (int argc, char* argv[])
                           (for lookup) and by creating a Cinema which the next Screen will be added to.
                        */
                        cinema_name = optarg;
                           (for lookup) and by creating a Cinema which the next Screen will be added to.
                        */
                        cinema_name = optarg;
-                       cinema = shared_ptr<Cinema> (new Cinema (optarg, list<string>(), "", 0, 0));
+                       cinema = make_shared<Cinema>(optarg, list<string>(), "", 0, 0);
                        break;
                case 'S':
                        screen_description = optarg;
                        break;
                case 'S':
                        screen_description = optarg;
@@ -510,7 +527,7 @@ int main (int argc, char* argv[])
                {
                        /* Make a new screen and add it to the current cinema */
                        dcp::CertificateChain chain (dcp::file_to_string(optarg));
                {
                        /* Make a new screen and add it to the current cinema */
                        dcp::CertificateChain chain (dcp::file_to_string(optarg));
-                       shared_ptr<Screen> screen (new Screen (screen_description, "", chain.leaf(), vector<TrustedDevice>()));
+                       auto screen = make_shared<Screen>(screen_description, "", chain.leaf(), vector<TrustedDevice>());
                        if (cinema) {
                                cinema->add_screen (screen);
                        }
                        if (cinema) {
                                cinema->add_screen (screen);
                        }
@@ -533,9 +550,9 @@ int main (int argc, char* argv[])
        }
 
        if (list_cinemas) {
        }
 
        if (list_cinemas) {
-               list<std::shared_ptr<Cinema> > cinemas = Config::instance()->cinemas ();
-               for (list<std::shared_ptr<Cinema> >::const_iterator i = cinemas.begin(); i != cinemas.end(); ++i) {
-                       cout << (*i)->name << " (" << Emailer::address_list ((*i)->emails) << ")\n";
+               auto cinemas = Config::instance()->cinemas ();
+               for (auto i: cinemas) {
+                       cout << i->name << " (" << Emailer::address_list (i->emails) << ")\n";
                }
                exit (EXIT_SUCCESS);
        }
                }
                exit (EXIT_SUCCESS);
        }
index b3a66a7bee500393c43dd535d302dd8c87a13eeb..8055e2f2d2fb2f043c147984bf30ecd99dd542ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "content_view.h"
 #include "wx_util.h"
 #include "lib/dcpomatic_assert.h"
 #include "content_view.h"
 #include "wx_util.h"
 #include "lib/dcpomatic_assert.h"
 #include <boost/optional.hpp>
 #include <wx/progdlg.h>
 
 #include <boost/optional.hpp>
 #include <wx/progdlg.h>
 
-using std::string;
+
 using std::cout;
 using std::cout;
+using std::dynamic_pointer_cast;
 using std::list;
 using std::list;
+using std::make_shared;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
 using std::weak_ptr;
 using boost::optional;
 using std::weak_ptr;
 using boost::optional;
-using std::dynamic_pointer_cast;
 using namespace dcpomatic;
 
 using namespace dcpomatic;
 
+
 ContentView::ContentView (wxWindow* parent)
        : wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER)
 {
 ContentView::ContentView (wxWindow* parent)
        : wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER)
 {
@@ -51,18 +55,20 @@ ContentView::ContentView (wxWindow* parent)
        AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
 }
 
        AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
 }
 
+
 shared_ptr<Content>
 ContentView::selected () const
 {
        long int s = GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if (s == -1) {
 shared_ptr<Content>
 ContentView::selected () const
 {
        long int s = GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if (s == -1) {
-               return shared_ptr<Content>();
+               return {};
        }
 
        DCPOMATIC_ASSERT (s < int(_content.size()));
        return _content[s];
 }
 
        }
 
        DCPOMATIC_ASSERT (s < int(_content.size()));
        return _content[s];
 }
 
+
 void
 ContentView::update ()
 {
 void
 ContentView::update ()
 {
@@ -70,29 +76,29 @@ ContentView::update ()
 
        DeleteAllItems ();
        _content.clear ();
 
        DeleteAllItems ();
        _content.clear ();
-       optional<path> dir = Config::instance()->player_content_directory();
+       auto dir = Config::instance()->player_content_directory();
        if (!dir || !boost::filesystem::is_directory(*dir)) {
                dir = home_directory ();
        }
 
        wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory"));
        if (!dir || !boost::filesystem::is_directory(*dir)) {
                dir = home_directory ();
        }
 
        wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory"));
-       JobManager* jm = JobManager::instance ();
+       auto jm = JobManager::instance ();
 
 
-       list<shared_ptr<ExamineContentJob> > jobs;
+       list<shared_ptr<ExamineContentJob>> jobs;
 
 
-       for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
+       for (auto i: directory_iterator(*dir)) {
                try {
                        progress.Pulse ();
 
                        shared_ptr<Content> content;
                try {
                        progress.Pulse ();
 
                        shared_ptr<Content> content;
-                       if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
-                               content.reset (new DCPContent(*i));
-                       } else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
-                               content = content_factory(*i).front();
+                       if (is_directory(i) && (is_regular_file(i / "ASSETMAP") || is_regular_file(i / "ASSETMAP.xml"))) {
+                               content.reset (new DCPContent(i));
+                       } else if (i.path().extension() == ".mp4" || i.path().extension() == ".ecinema") {
+                               content = content_factory(i).front();
                        }
 
                        if (content) {
                        }
 
                        if (content) {
-                               shared_ptr<ExamineContentJob> job(new ExamineContentJob(shared_ptr<Film>(), content));
+                               auto job = make_shared<ExamineContentJob>(shared_ptr<Film>(), content);
                                jm->add (job);
                                jobs.push_back (job);
                        }
                                jm->add (job);
                                jobs.push_back (job);
                        }
@@ -125,6 +131,7 @@ ContentView::update ()
        }
 }
 
        }
 }
 
+
 void
 ContentView::add (shared_ptr<Content> content)
 {
 void
 ContentView::add (shared_ptr<Content> content)
 {
@@ -152,6 +159,7 @@ ContentView::add (shared_ptr<Content> content)
        SetItem(it);
 }
 
        SetItem(it);
 }
 
+
 shared_ptr<Content>
 ContentView::get (string digest) const
 {
 shared_ptr<Content>
 ContentView::get (string digest) const
 {
@@ -161,5 +169,5 @@ ContentView::get (string digest) const
                }
        }
 
                }
        }
 
-       return shared_ptr<Content>();
+       return {};
 }
 }
index 0bbfffaa76418f331f1ee699d7d6afb3d21fe508..1ad7c541ae9645ae8b9109e586be401437967631 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "lib/content_store.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include "lib/content_store.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
@@ -25,9 +26,11 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <vector>
 
 DCPOMATIC_ENABLE_WARNINGS
 #include <vector>
 
+
 class Content;
 class Film;
 
 class Content;
 class Film;
 
+
 class ContentView : public wxListCtrl, public ContentStore
 {
 public:
 class ContentView : public wxListCtrl, public ContentStore
 {
 public:
@@ -42,5 +45,5 @@ private:
        void add (std::shared_ptr<Content> content);
 
        std::weak_ptr<Film> _film;
        void add (std::shared_ptr<Content> content);
 
        std::weak_ptr<Film> _film;
-       std::vector<std::shared_ptr<Content> > _content;
+       std::vector<std::shared_ptr<Content>> _content;
 };
 };
index 6b341307d9e2fee6c8d928c9439569b2ec6f3e55..19243393c308dc174e7ee7bda14c1699f183df8d 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.
 
 
     This file is part of DCP-o-matic.
 
     You should have received a copy of the GNU General Public License
     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
     You should have received a copy of the GNU General Public License
     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
+
 */
 
 */
 
+
 /** @file src/job_manager_view.cc
  *  @brief Class generating a GTK widget to show the progress of jobs.
  */
 
 /** @file src/job_manager_view.cc
  *  @brief Class generating a GTK widget to show the progress of jobs.
  */
 
+
 #include "job_manager_view.h"
 #include "batch_job_view.h"
 #include "normal_job_view.h"
 #include "job_manager_view.h"
 #include "batch_job_view.h"
 #include "normal_job_view.h"
@@ -33,6 +36,7 @@
 #include "lib/compose.hpp"
 #include <iostream>
 
 #include "lib/compose.hpp"
 #include <iostream>
 
+
 using std::string;
 using std::list;
 using std::map;
 using std::string;
 using std::list;
 using std::map;
@@ -45,6 +49,7 @@ using boost::bind;
 using namespace boost::placeholders;
 #endif
 
 using namespace boost::placeholders;
 #endif
 
+
 /** @param parent Parent window.
  *  @param batch true to use BatchJobView, false to use NormalJobView.
  *
 /** @param parent Parent window.
  *  @param batch true to use BatchJobView, false to use NormalJobView.
  *
@@ -55,7 +60,7 @@ JobManagerView::JobManagerView (wxWindow* parent, bool batch)
        , _batch (batch)
 {
        _panel = new wxPanel (this);
        , _batch (batch)
 {
        _panel = new wxPanel (this);
-       wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       auto sizer = new wxBoxSizer (wxVERTICAL);
        sizer->Add (_panel, 1, wxEXPAND);
        SetSizer (sizer);
 
        sizer->Add (_panel, 1, wxEXPAND);
        SetSizer (sizer);
 
@@ -66,24 +71,25 @@ JobManagerView::JobManagerView (wxWindow* parent, bool batch)
        SetScrollRate (0, 32);
        EnableScrolling (false, true);
 
        SetScrollRate (0, 32);
        EnableScrolling (false, true);
 
-       Bind (wxEVT_TIMER, boost::bind (&JobManagerView::periodic, this));
+       Bind (wxEVT_TIMER, boost::bind(&JobManagerView::periodic, this));
        _timer.reset (new wxTimer (this));
        _timer->Start (1000);
 
        _timer.reset (new wxTimer (this));
        _timer->Start (1000);
 
-       JobManager::instance()->JobAdded.connect (bind (&JobManagerView::job_added, this, _1));
-       JobManager::instance()->JobsReordered.connect (bind (&JobManagerView::replace, this));
+       JobManager::instance()->JobAdded.connect (bind(&JobManagerView::job_added, this, _1));
+       JobManager::instance()->JobsReordered.connect (bind(&JobManagerView::replace, this));
 }
 
 }
 
+
 void
 JobManagerView::job_added (weak_ptr<Job> j)
 {
 void
 JobManagerView::job_added (weak_ptr<Job> j)
 {
-       shared_ptr<Job> job = j.lock ();
+       auto job = j.lock ();
        if (job) {
                shared_ptr<JobView> v;
                if (_batch) {
        if (job) {
                shared_ptr<JobView> v;
                if (_batch) {
-                       v.reset (new BatchJobView (job, this, _panel, _table));
+                       v.reset (new BatchJobView(job, this, _panel, _table));
                } else {
                } else {
-                       v.reset (new NormalJobView (job, this, _panel, _table));
+                       v.reset (new NormalJobView(job, this, _panel, _table));
                }
                v->setup ();
                _job_records.push_back (v);
                }
                v->setup ();
                _job_records.push_back (v);
@@ -93,20 +99,22 @@ JobManagerView::job_added (weak_ptr<Job> j)
        job_list_changed ();
 }
 
        job_list_changed ();
 }
 
+
 void
 JobManagerView::periodic ()
 {
 void
 JobManagerView::periodic ()
 {
-       for (list<shared_ptr<JobView> >::iterator i = _job_records.begin(); i != _job_records.end(); ++i) {
-               (*i)->maybe_pulse ();
+       for (auto i: _job_records) {
+               i->maybe_pulse ();
        }
 }
 
        }
 }
 
+
 void
 JobManagerView::replace ()
 {
        /* Make a new version of _job_records which reflects the order in JobManager's job list */
 
 void
 JobManagerView::replace ()
 {
        /* Make a new version of _job_records which reflects the order in JobManager's job list */
 
-       list<shared_ptr<JobView> > new_job_records;
+       list<shared_ptr<JobView>> new_job_records;
 
        for (auto i: JobManager::instance()->get()) {
                /* Find this job's JobView */
 
        for (auto i: JobManager::instance()->get()) {
                /* Find this job's JobView */
@@ -131,6 +139,7 @@ JobManagerView::replace ()
        job_list_changed ();
 }
 
        job_list_changed ();
 }
 
+
 void
 JobManagerView::job_list_changed ()
 {
 void
 JobManagerView::job_list_changed ()
 {
index 392d7504ce2878b2bca4773102aebb77bb993785..e960bc2f667a33e2c291fd79dffb3fbe9ac0ce18 100644 (file)
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 /** @file src/job_manager_view.h
  *  @brief Class which is a wxPanel for showing the progress of jobs.
  */
 /** @file src/job_manager_view.h
  *  @brief Class which is a wxPanel for showing the progress of jobs.
  */
@@ -54,5 +55,5 @@ private:
        std::shared_ptr<wxTimer> _timer;
        bool _batch;
 
        std::shared_ptr<wxTimer> _timer;
        bool _batch;
 
-       std::list<std::shared_ptr<JobView> > _job_records;
+       std::list<std::shared_ptr<JobView>> _job_records;
 };
 };
index e59293fe782a92e634a98ad7af92317e9652e717..58a986ca4aef2614e47f872546b2b542e4f64034 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "recipients_panel.h"
 #include "wx_util.h"
 #include "recipient_dialog.h"
 #include "recipients_panel.h"
 #include "wx_util.h"
 #include "recipient_dialog.h"
 #include <list>
 #include <iostream>
 
 #include <list>
 #include <iostream>
 
-using std::list;
-using std::pair;
+
 using std::cout;
 using std::cout;
-using std::map;
-using std::string;
+using std::list;
 using std::make_pair;
 using std::make_pair;
+using std::map;
+using std::pair;
 using std::shared_ptr;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
 using namespace dcpomatic;
 
 using boost::optional;
 using namespace dcpomatic;
 
+
 RecipientsPanel::RecipientsPanel (wxWindow* parent)
        : wxPanel (parent, wxID_ANY)
        , _ignore_selection_change (false)
 {
 RecipientsPanel::RecipientsPanel (wxWindow* parent)
        : wxPanel (parent, wxID_ANY)
        , _ignore_selection_change (false)
 {
-       wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       auto sizer = new wxBoxSizer (wxVERTICAL);
 
 #ifdef __WXGTK3__
        int const height = 30;
 
 #ifdef __WXGTK3__
        int const height = 30;
@@ -55,13 +58,13 @@ RecipientsPanel::RecipientsPanel (wxWindow* parent)
 #endif
        sizer->Add (_search, 0, wxBOTTOM, DCPOMATIC_SIZER_GAP);
 
 #endif
        sizer->Add (_search, 0, wxBOTTOM, DCPOMATIC_SIZER_GAP);
 
-       wxBoxSizer* targets = new wxBoxSizer (wxHORIZONTAL);
+       auto targets = new wxBoxSizer (wxHORIZONTAL);
        _targets = new wxTreeCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT);
        targets->Add (_targets, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP);
 
        add_recipients ();
 
        _targets = new wxTreeCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT);
        targets->Add (_targets, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP);
 
        add_recipients ();
 
-       wxBoxSizer* target_buttons = new wxBoxSizer (wxVERTICAL);
+       auto target_buttons = new wxBoxSizer (wxVERTICAL);
 
        _add_recipient = new Button (this, _("Add..."));
        target_buttons->Add (_add_recipient, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
 
        _add_recipient = new Button (this, _("Add..."));
        target_buttons->Add (_add_recipient, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
@@ -122,9 +125,9 @@ RecipientsPanel::add_recipient (shared_ptr<DKDMRecipient> r)
 void
 RecipientsPanel::add_recipient_clicked ()
 {
 void
 RecipientsPanel::add_recipient_clicked ()
 {
-       RecipientDialog* d = new RecipientDialog (GetParent(), _("Add recipient"));
+       auto d = new RecipientDialog (GetParent(), _("Add recipient"));
        if (d->ShowModal() == wxID_OK) {
        if (d->ShowModal() == wxID_OK) {
-               shared_ptr<DKDMRecipient> r (new DKDMRecipient(d->name(), d->notes(), d->recipient(), d->emails(), d->utc_offset_hour(), d->utc_offset_minute()));
+               auto r = std::make_shared<DKDMRecipient>(d->name(), d->notes(), d->recipient(), d->emails(), d->utc_offset_hour(), d->utc_offset_minute());
                Config::instance()->add_dkdm_recipient (r);
                add_recipient (r);
        }
                Config::instance()->add_dkdm_recipient (r);
                add_recipient (r);
        }
@@ -140,9 +143,9 @@ RecipientsPanel::edit_recipient_clicked ()
                return;
        }
 
                return;
        }
 
-       pair<wxTreeItemId, shared_ptr<DKDMRecipient> > c = *_selected.begin();
+       auto c = *_selected.begin();
 
 
-       RecipientDialog* d = new RecipientDialog (
+       auto d = new RecipientDialog (
                GetParent(), _("Edit recipient"), c.second->name, c.second->notes, c.second->emails, c.second->utc_offset_hour, c.second->utc_offset_minute, c.second->recipient
                );
 
                GetParent(), _("Edit recipient"), c.second->name, c.second->notes, c.second->emails, c.second->utc_offset_hour, c.second->utc_offset_minute, c.second->recipient
                );
 
@@ -163,22 +166,22 @@ RecipientsPanel::edit_recipient_clicked ()
 void
 RecipientsPanel::remove_recipient_clicked ()
 {
 void
 RecipientsPanel::remove_recipient_clicked ()
 {
-       for (RecipientMap::iterator i = _selected.begin(); i != _selected.end(); ++i) {
-               Config::instance()->remove_dkdm_recipient (i->second);
-               _targets->Delete (i->first);
+       for (auto const& i: _selected) {
+               Config::instance()->remove_dkdm_recipient (i.second);
+               _targets->Delete (i.first);
        }
 
        selection_changed ();
 }
 
 
        }
 
        selection_changed ();
 }
 
 
-list<shared_ptr<DKDMRecipient> >
+list<shared_ptr<DKDMRecipient>>
 RecipientsPanel::recipients () const
 {
 RecipientsPanel::recipients () const
 {
-       list<shared_ptr<DKDMRecipient> > r;
+       list<shared_ptr<DKDMRecipient>> r;
 
 
-       for (RecipientMap::const_iterator i = _selected.begin(); i != _selected.end(); ++i) {
-               r.push_back (i->second);
+       for (auto const& i: _selected) {
+               r.push_back (i.second);
        }
 
        r.sort ();
        }
 
        r.sort ();
@@ -240,10 +243,10 @@ RecipientsPanel::search_changed ()
 
        _ignore_selection_change = true;
 
 
        _ignore_selection_change = true;
 
-       for (RecipientMap::const_iterator i = _selected.begin(); i != _selected.end(); ++i) {
+       for (auto const& i: _selected) {
                /* The wxTreeItemIds will now be different, so we must search by recipient */
                /* The wxTreeItemIds will now be different, so we must search by recipient */
-               RecipientMap::const_iterator j = _recipients.begin ();
-               while (j != _recipients.end() && j->second != i->second) {
+               auto j = _recipients.begin ();
+               while (j != _recipients.end() && j->second != i.second) {
                        ++j;
                }
 
                        ++j;
                }
 
index d224eed1b98251c71c2ae9c8f668ae73118fbcad..aacfccd9a90b96cc2695f3326b85c8a0390f8935 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
 
 */
 
+
 #include "lib/dkdm_recipient.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include "lib/dkdm_recipient.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
@@ -29,8 +30,10 @@ DCPOMATIC_ENABLE_WARNINGS
 #include <list>
 #include <map>
 
 #include <list>
 #include <map>
 
+
 class DKDMRecipient;
 
 class DKDMRecipient;
 
+
 class RecipientsPanel : public wxPanel
 {
 public:
 class RecipientsPanel : public wxPanel
 {
 public:
@@ -39,7 +42,7 @@ public:
 
        void setup_sensitivity ();
 
 
        void setup_sensitivity ();
 
-       std::list<std::shared_ptr<DKDMRecipient> > recipients () const;
+       std::list<std::shared_ptr<DKDMRecipient>> recipients () const;
        boost::signals2::signal<void ()> RecipientsChanged;
 
 private:
        boost::signals2::signal<void ()> RecipientsChanged;
 
 private:
@@ -59,7 +62,7 @@ private:
        wxButton* _remove_recipient;
        wxTreeItemId _root;
 
        wxButton* _remove_recipient;
        wxTreeItemId _root;
 
-       typedef std::map<wxTreeItemId, std::shared_ptr<DKDMRecipient> > RecipientMap;
+       typedef std::map<wxTreeItemId, std::shared_ptr<DKDMRecipient>> RecipientMap;
        RecipientMap _recipients;
        RecipientMap _selected;
 
        RecipientMap _recipients;
        RecipientMap _selected;
 
index b0bd8acbb48eeaedf1ea619e8b2b866498831910..4450fef0552ec2dd4f60e4ef59f24370655b09df 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2016-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 #include <wx/wx.h>
 #include <wx/graphics.h>
 
 #include <wx/wx.h>
 #include <wx/graphics.h>
 
+
 using std::list;
 using std::list;
-using std::min;
 using std::max;
 using std::max;
+using std::min;
+
 
 TimelineLabelsView::TimelineLabelsView (Timeline& tl)
        : TimelineView (tl)
 
 TimelineLabelsView::TimelineLabelsView (Timeline& tl)
        : TimelineView (tl)
@@ -47,17 +49,19 @@ TimelineLabelsView::TimelineLabelsView (Timeline& tl)
        _width += 24;
 }
 
        _width += 24;
 }
 
+
 dcpomatic::Rect<int>
 TimelineLabelsView::bbox () const
 {
        return dcpomatic::Rect<int> (0, 0, _width, _timeline.tracks() * _timeline.pixels_per_track());
 }
 
 dcpomatic::Rect<int>
 TimelineLabelsView::bbox () const
 {
        return dcpomatic::Rect<int> (0, 0, _width, _timeline.tracks() * _timeline.pixels_per_track());
 }
 
+
 void
 void
-TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> >)
+TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>>)
 {
        int const h = _timeline.pixels_per_track ();
 {
        int const h = _timeline.pixels_per_track ();
-       gc->SetFont (gc->CreateFont(wxNORMAL_FONT->Bold(), wxColour (0, 0, 0)));
+       gc->SetFont (gc->CreateFont(wxNORMAL_FONT->Bold(), wxColour(0, 0, 0)));
 
        int fy = 0;
        if (_video_tracks) {
 
        int fy = 0;
        if (_video_tracks) {
@@ -84,24 +88,28 @@ TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> >
        }
 }
 
        }
 }
 
+
 void
 TimelineLabelsView::set_video_tracks (int n)
 {
        _video_tracks = n;
 }
 
 void
 TimelineLabelsView::set_video_tracks (int n)
 {
        _video_tracks = n;
 }
 
+
 void
 TimelineLabelsView::set_audio_tracks (int n)
 {
        _audio_tracks = n;
 }
 
 void
 TimelineLabelsView::set_audio_tracks (int n)
 {
        _audio_tracks = n;
 }
 
+
 void
 TimelineLabelsView::set_text_tracks (int n)
 {
        _text_tracks = n;
 }
 
 void
 TimelineLabelsView::set_text_tracks (int n)
 {
        _text_tracks = n;
 }
 
+
 void
 TimelineLabelsView::set_atmos (bool s)
 {
 void
 TimelineLabelsView::set_atmos (bool s)
 {
index 88094f2c4068cd64cc4110eb165dc80d24a582ac..2ff1fa6a8daf6c2e7a1638a4da1f648868e37e59 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2016-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 */
 
 
 */
 
+
 #include "timeline_view.h"
 
 #include "timeline_view.h"
 
+
 class wxWindow;
 
 class wxWindow;
 
+
 class TimelineLabelsView : public TimelineView
 {
 public:
 class TimelineLabelsView : public TimelineView
 {
 public:
@@ -35,7 +38,7 @@ public:
        void set_atmos (bool s);
 
 private:
        void set_atmos (bool s);
 
 private:
-       void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
+       void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int>> overlaps);
 
        int _width = 0;
        int _video_tracks = 0;
 
        int _width = 0;
        int _video_tracks = 0;