More enum class additions.
authorCarl Hetherington <cth@carlh.net>
Sun, 31 Jan 2021 02:14:24 +0000 (03:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 31 Jan 2021 02:14:24 +0000 (03:14 +0100)
92 files changed:
src/lib/analyse_subtitles_job.cc
src/lib/butler.cc
src/lib/change_signaller.h
src/lib/config.cc
src/lib/content.cc
src/lib/content_video.h
src/lib/copy_dcp_details_to_film.cc
src/lib/create_cli.cc
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/lib/dcp_decoder.cc
src/lib/dcp_encoder.cc
src/lib/dcp_examiner.cc
src/lib/dcp_examiner.h
src/lib/dcp_subtitle_content.cc
src/lib/dcp_video.cc
src/lib/emailer.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_encoder.cc
src/lib/ffmpeg_file_encoder.cc
src/lib/film.cc
src/lib/hints.cc
src/lib/j2k_encoder.cc
src/lib/j2k_encoder.h
src/lib/j2k_image_proxy.h
src/lib/player.cc
src/lib/player.h
src/lib/player_video.cc
src/lib/playlist.cc
src/lib/reel_writer.cc
src/lib/reel_writer.h
src/lib/send_problem_report_job.cc
src/lib/shuffler.cc
src/lib/string_text_file_content.cc
src/lib/subtitle_encoder.cc
src/lib/text_content.cc
src/lib/types.cc
src/lib/types.h
src/lib/upload_job.cc
src/lib/util.cc
src/lib/video_content.cc
src/lib/video_content.h
src/lib/video_decoder.cc
src/lib/writer.cc
src/lib/writer.h
src/tools/dcpomatic.cc
src/tools/dcpomatic_cli.cc
src/tools/dcpomatic_create.cc
src/tools/dcpomatic_player.cc
src/tools/server_test.cc
src/wx/audio_dialog.cc
src/wx/closed_captions_dialog.cc
src/wx/content_panel.cc
src/wx/content_panel.h
src/wx/content_widget.h
src/wx/controls.cc
src/wx/dcp_panel.cc
src/wx/export_video_file_dialog.cc
src/wx/film_editor.cc
src/wx/film_viewer.cc
src/wx/full_config_dialog.cc
src/wx/hints_dialog.cc
src/wx/smpte_metadata_dialog.cc
src/wx/subtitle_appearance_dialog.cc
src/wx/text_panel.cc
src/wx/timeline.cc
src/wx/timeline_content_view.cc
src/wx/timeline_dialog.cc
src/wx/video_view.cc
test/4k_test.cc
test/client_server_test.cc
test/closed_caption_test.cc
test/create_cli_test.cc
test/digest_test.cc
test/ffmpeg_encoder_test.cc
test/file_naming_test.cc
test/hints_test.cc
test/isdcf_name_test.cc
test/optimise_stills_test.cc
test/player_test.cc
test/recover_test.cc
test/reel_writer_test.cc
test/reels_test.cc
test/required_disk_space_test.cc
test/shuffler_test.cc
test/subtitle_reel_number_test.cc
test/subtitle_reel_test.cc
test/test.cc
test/test.h
test/threed_test.cc
test/vf_test.cc
test/video_level_test.cc

index b941824d6382fa0744c8b9e826f3e7ea45777893..d95e859db8b44aedebb8de4668e1d9eb1c8c6361 100644 (file)
@@ -30,8 +30,9 @@
 
 #include "i18n.h"
 
-using std::string;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
 using std::weak_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -62,12 +63,12 @@ AnalyseSubtitlesJob::json_name () const
 void
 AnalyseSubtitlesJob::run ()
 {
-       shared_ptr<Playlist> playlist (new Playlist());
-       shared_ptr<Content> content = _content.lock ();
+       auto playlist = make_shared<Playlist>();
+       auto content = _content.lock ();
        DCPOMATIC_ASSERT (content);
        playlist->add (_film, content);
 
-       shared_ptr<Player> player (new Player(_film, playlist));
+       auto player = make_shared<Player>(_film, playlist);
        player->set_ignore_audio ();
        player->set_fast ();
        player->set_play_referenced ();
@@ -90,7 +91,7 @@ AnalyseSubtitlesJob::run ()
 void
 AnalyseSubtitlesJob::analyse (PlayerText text, TextType type)
 {
-       if (type != TEXT_OPEN_SUBTITLE) {
+       if (type != TextType::OPEN_SUBTITLE) {
                return;
        }
 
index d09b0356a7829e8afa5be0714d8c8d585e1296f2..56acbd8a0817aa4809741aea234a3589a9d9162c 100644 (file)
@@ -384,8 +384,8 @@ void
 Butler::player_change (ChangeType type, int property)
 {
        if (property == VideoContentProperty::CROP) {
-               if (type == CHANGE_TYPE_DONE) {
-                       shared_ptr<const Film> film = _film.lock();
+               if (type == ChangeType::DONE) {
+                       auto film = _film.lock();
                        if (film) {
                                _video.reset_metadata (film, _player->video_container_size());
                        }
@@ -395,9 +395,9 @@ Butler::player_change (ChangeType type, int property)
 
        boost::mutex::scoped_lock lm (_mutex);
 
-       if (type == CHANGE_TYPE_PENDING) {
+       if (type == ChangeType::PENDING) {
                ++_suspended;
-       } else if (type == CHANGE_TYPE_DONE) {
+       } else if (type == ChangeType::DONE) {
                --_suspended;
                if (_died || _pending_seek_position) {
                        lm.unlock ();
@@ -406,7 +406,7 @@ Butler::player_change (ChangeType type, int property)
                }
 
                DCPTime seek_to;
-               DCPTime next = _video.get().second;
+               auto next = _video.get().second;
                if (_awaiting && _awaiting > next) {
                        /* We have recently done a player_changed seek and our buffers haven't been refilled yet,
                           so assume that we're seeking to the same place as last time.
@@ -418,7 +418,7 @@ Butler::player_change (ChangeType type, int property)
 
                seek_unlocked (seek_to, true);
                _awaiting = seek_to;
-       } else if (type == CHANGE_TYPE_CANCELLED) {
+       } else if (type == ChangeType::CANCELLED) {
                --_suspended;
        }
 
@@ -429,7 +429,7 @@ Butler::player_change (ChangeType type, int property)
 void
 Butler::text (PlayerText pt, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
 {
-       if (type != TEXT_CLOSED_CAPTION) {
+       if (type != TextType::CLOSED_CAPTION) {
                return;
        }
 
index 6c4c150f2cf468616776e576ecfbed5e95666aa9..55a5f2dc57f90b5d8307fbd882db9894d02714ae 100644 (file)
@@ -32,15 +32,15 @@ public:
                , _property (p)
                , _done (true)
        {
-               _thing->signal_change (CHANGE_TYPE_PENDING, _property);
+               _thing->signal_change (ChangeType::PENDING, _property);
        }
 
        ~ChangeSignaller ()
        {
                if (_done) {
-                       _thing->signal_change (CHANGE_TYPE_DONE, _property);
+                       _thing->signal_change (ChangeType::DONE, _property);
                } else {
-                       _thing->signal_change (CHANGE_TYPE_CANCELLED, _property);
+                       _thing->signal_change (ChangeType::CANCELLED, _property);
                }
        }
 
index 7040c5127e1d071fd5e3c0e4cc6d0a5c37e08aa4..c0750bb4eeb3d35d61db716135444c90be85fb20 100644 (file)
@@ -88,7 +88,7 @@ Config::set_defaults ()
        _use_any_servers = true;
        _servers.clear ();
        _only_servers_encode = false;
-       _tms_protocol = FILE_TRANSFER_PROTOCOL_SCP;
+       _tms_protocol = FileTransferProtocol::SCP;
        _tms_ip = "";
        _tms_path = ".";
        _tms_user = "";
@@ -107,7 +107,7 @@ Config::set_defaults ()
        _upload_after_make_dcp = false;
        _mail_server = "";
        _mail_port = 25;
-       _mail_protocol = EMAIL_PROTOCOL_AUTO;
+       _mail_protocol = EmailProtocol::AUTO;
        _mail_user = "";
        _mail_password = "";
        _kdm_from = "";
@@ -269,7 +269,7 @@ try
        }
 
        _only_servers_encode = f.optional_bool_child ("OnlyServersEncode").get_value_or (false);
-       _tms_protocol = static_cast<FileTransferProtocol>(f.optional_number_child<int>("TMSProtocol").get_value_or(static_cast<int>(FILE_TRANSFER_PROTOCOL_SCP)));
+       _tms_protocol = static_cast<FileTransferProtocol>(f.optional_number_child<int>("TMSProtocol").get_value_or(static_cast<int>(FileTransferProtocol::SCP)));
        _tms_ip = f.string_child ("TMSIP");
        _tms_path = f.string_child ("TMSPath");
        _tms_user = f.string_child ("TMSUser");
@@ -331,13 +331,13 @@ try
                /* Make sure this matches the code in write_config */
                string const protocol = f.optional_string_child("MailProtocol").get_value_or("Auto");
                if (protocol == "Auto") {
-                       _mail_protocol = EMAIL_PROTOCOL_AUTO;
+                       _mail_protocol = EmailProtocol::AUTO;
                } else if (protocol == "Plain") {
-                       _mail_protocol = EMAIL_PROTOCOL_PLAIN;
+                       _mail_protocol = EmailProtocol::PLAIN;
                } else if (protocol == "STARTTLS") {
-                       _mail_protocol = EMAIL_PROTOCOL_STARTTLS;
+                       _mail_protocol = EmailProtocol::STARTTLS;
                } else if (protocol == "SSL") {
-                       _mail_protocol = EMAIL_PROTOCOL_SSL;
+                       _mail_protocol = EmailProtocol::SSL;
                }
        }
 
@@ -701,16 +701,16 @@ Config::write_config () const
        root->add_child("MailPort")->add_child_text (raw_convert<string> (_mail_port));
        /* [XML] MailProtocol Protocol to use on SMTP server (Auto, Plain, STARTTLS or SSL) */
        switch (_mail_protocol) {
-       case EMAIL_PROTOCOL_AUTO:
+       case EmailProtocol::AUTO:
                root->add_child("MailProtocol")->add_child_text("Auto");
                break;
-       case EMAIL_PROTOCOL_PLAIN:
+       case EmailProtocol::PLAIN:
                root->add_child("MailProtocol")->add_child_text("Plain");
                break;
-       case EMAIL_PROTOCOL_STARTTLS:
+       case EmailProtocol::STARTTLS:
                root->add_child("MailProtocol")->add_child_text("STARTTLS");
                break;
-       case EMAIL_PROTOCOL_SSL:
+       case EmailProtocol::SSL:
                root->add_child("MailProtocol")->add_child_text("SSL");
                break;
        }
index d4dffe7775978e5ff267ed18dd67e3eb99e9189c..40790bdc09ca84a82d97614c38e056c5a0f4daa2 100644 (file)
@@ -200,7 +200,7 @@ void
 Content::signal_change (ChangeType c, int p)
 {
        try {
-               if (c == CHANGE_TYPE_PENDING || c == CHANGE_TYPE_CANCELLED) {
+               if (c == ChangeType::PENDING || c == ChangeType::CANCELLED) {
                        Change (c, shared_from_this(), p, _change_signals_frequent);
                } else {
                        emit (boost::bind (boost::ref(Change), c, shared_from_this(), p, _change_signals_frequent));
index ee169b6c556c93b93a7636f183314e56830ed17d..8ca18576e4e939f9c7b469924b6f5e63e89a8d10 100644 (file)
@@ -33,8 +33,8 @@ class ContentVideo
 public:
        ContentVideo ()
                : frame (0)
-               , eyes (EYES_LEFT)
-               , part (PART_WHOLE)
+               , eyes (Eyes::LEFT)
+               , part (Part::WHOLE)
        {}
 
        ContentVideo (std::shared_ptr<const ImageProxy> i, Frame f, Eyes e, Part p)
index 64a38c3353832e81538c67917b3ad3d0cdeb219a..3e62c96a3b9ac4750d34c26600819bc7c050d125 100644 (file)
@@ -38,7 +38,7 @@ using std::shared_ptr;
 void
 copy_dcp_details_to_film (shared_ptr<const DCPContent> dcp, shared_ptr<Film> film)
 {
-       string name = dcp->name ();
+       auto name = dcp->name ();
        name = name.substr (0, name.find("_"));
        film->set_name (name);
        film->set_use_isdcf_name (true);
@@ -46,7 +46,7 @@ copy_dcp_details_to_film (shared_ptr<const DCPContent> dcp, shared_ptr<Film> fil
                film->set_dcp_content_type (DCPContentType::from_libdcp_kind(dcp->content_kind().get()));
        }
        film->set_encrypted (dcp->encrypted());
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->set_interop (dcp->standard() == dcp::Standard::INTEROP);
        film->set_three_d (dcp->three_d());
 
@@ -61,11 +61,9 @@ copy_dcp_details_to_film (shared_ptr<const DCPContent> dcp, shared_ptr<Film> fil
                film->set_audio_channels (dcp->audio->stream()->channels());
        }
 
-       map<dcp::Marker, dcpomatic::ContentTime> dcp_markers;
-       map<dcp::Marker, dcpomatic::DCPTime> film_markers;
        film->clear_markers ();
-       for (map<dcp::Marker, dcpomatic::ContentTime>::const_iterator i = dcp_markers.begin(); i != dcp_markers.end(); ++i) {
-               film->set_marker (i->first, dcpomatic::DCPTime(i->second.get()));
+       for (auto const& i: dcp->markers()) {
+               film->set_marker (i.first, dcpomatic::DCPTime(i.second.get()));
        }
 
        film->set_ratings (dcp->ratings());
index de26a7412355919b1f97c6085f3a44b51f8e2a74..819f17f6ea87b43966be130c851388e71354e350 100644 (file)
@@ -91,7 +91,7 @@ CreateCLI::CreateCLI (int argc, char* argv[])
        string config_dir_string;
        string output_dir_string;
        int j2k_bandwidth_int = 0;
-       VideoFrameType next_frame_type = VIDEO_FRAME_TYPE_2D;
+       auto next_frame_type = VideoFrameType::TWO_D;
 
        int i = 1;
        while (i < argc) {
@@ -115,10 +115,10 @@ CreateCLI::CreateCLI (int argc, char* argv[])
                } else if (a == "--threed") {
                        threed = claimed = true;
                } else if (a == "--left-eye") {
-                       next_frame_type = VIDEO_FRAME_TYPE_3D_LEFT;
+                       next_frame_type = VideoFrameType::THREE_D_LEFT;
                        claimed = true;
                } else if (a == "--right-eye") {
-                       next_frame_type = VIDEO_FRAME_TYPE_3D_RIGHT;
+                       next_frame_type = VideoFrameType::THREE_D_RIGHT;
                        claimed = true;
                } else if (a == "--fourk") {
                        fourk = true;
@@ -145,7 +145,7 @@ CreateCLI::CreateCLI (int argc, char* argv[])
                                c.path = a;
                                c.frame_type = next_frame_type;
                                content.push_back (c);
-                               next_frame_type = VIDEO_FRAME_TYPE_2D;
+                               next_frame_type = VideoFrameType::TWO_D;
                        }
                }
 
index 022fd223cbfbb2d25a3d7f696fd20109fed243ca..4bd718e96207212eeb1860672514ccac27b1f214 100644 (file)
 
 #include "i18n.h"
 
-using std::string;
 using std::cout;
 using std::distance;
-using std::pair;
-using std::vector;
 using std::list;
+using std::make_shared;
 using std::map;
+using std::pair;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using boost::scoped_ptr;
 using boost::optional;
 using boost::function;
@@ -85,7 +86,7 @@ DCPContent::DCPContent (boost::filesystem::path p)
        read_directory (p);
        set_default_colour_conversion ();
 
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                _reference_text[i] = false;
        }
 }
@@ -98,21 +99,19 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
        text = TextContent::from_xml (this, node, version);
        atmos = AtmosContent::from_xml (this, node);
 
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                _reference_text[i] = false;
        }
 
        if (video && audio) {
                audio->set_stream (
-                       AudioStreamPtr (
-                               new AudioStream (
-                                       node->number_child<int> ("AudioFrameRate"),
-                                       /* AudioLength was not present in some old metadata versions */
-                                       node->optional_number_child<Frame>("AudioLength").get_value_or (
-                                               video->length() * node->number_child<int>("AudioFrameRate") / video_frame_rate().get()
-                                               ),
-                                       AudioMapping (node->node_child ("AudioMapping"), version)
-                                       )
+                       make_shared<AudioStream> (
+                               node->number_child<int> ("AudioFrameRate"),
+                               /* AudioLength was not present in some old metadata versions */
+                               node->optional_number_child<Frame>("AudioLength").get_value_or (
+                                       video->length() * node->number_child<int>("AudioFrameRate") / video_frame_rate().get()
+                                       ),
+                               AudioMapping (node->node_child ("AudioMapping"), version)
                                )
                        );
        }
@@ -127,14 +126,14 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
        _reference_video = node->optional_bool_child ("ReferenceVideo").get_value_or (false);
        _reference_audio = node->optional_bool_child ("ReferenceAudio").get_value_or (false);
        if (version >= 37) {
-               _reference_text[TEXT_OPEN_SUBTITLE] = node->optional_bool_child("ReferenceOpenSubtitle").get_value_or(false);
-               _reference_text[TEXT_CLOSED_CAPTION] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false);
+               _reference_text[static_cast<int>(TextType::OPEN_SUBTITLE)] = node->optional_bool_child("ReferenceOpenSubtitle").get_value_or(false);
+               _reference_text[static_cast<int>(TextType::CLOSED_CAPTION)] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false);
        } else {
-               _reference_text[TEXT_OPEN_SUBTITLE] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false);
-               _reference_text[TEXT_CLOSED_CAPTION] = false;
+               _reference_text[static_cast<int>(TextType::OPEN_SUBTITLE)] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false);
+               _reference_text[static_cast<int>(TextType::CLOSED_CAPTION)] = false;
        }
        if (node->optional_string_child("Standard")) {
-               string const s = node->optional_string_child("Standard").get();
+               auto const s = node->optional_string_child("Standard").get();
                if (s == "Interop") {
                        _standard = dcp::Standard::INTEROP;
                } else if (s == "SMPTE") {
@@ -145,7 +144,7 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
        }
        _three_d = node->optional_bool_child("ThreeD").get_value_or (false);
 
-       optional<string> ck = node->optional_string_child("ContentKind");
+       auto ck = node->optional_string_child("ContentKind");
        if (ck) {
                _content_kind = dcp::content_kind_from_string (*ck);
        }
@@ -201,13 +200,13 @@ void
 DCPContent::read_sub_directory (boost::filesystem::path p)
 {
        LOG_GENERAL ("DCPContent::read_sub_directory reads %1", p.string());
-       for (boost::filesystem::directory_iterator i(p); i != boost::filesystem::directory_iterator(); ++i) {
-               if (boost::filesystem::is_regular_file (i->path())) {
-                       LOG_GENERAL ("Inside there's regular file %1", i->path().string());
-                       add_path (i->path());
-               } else if (boost::filesystem::is_directory (i->path ())) {
-                       LOG_GENERAL ("Inside there's directory %1", i->path().string());
-                       read_sub_directory (i->path());
+       for (auto i: boost::filesystem::directory_iterator(p)) {
+               if (boost::filesystem::is_regular_file(i.path())) {
+                       LOG_GENERAL ("Inside there's regular file %1", i.path().string());
+                       add_path (i.path());
+               } else if (boost::filesystem::is_directory (i.path())) {
+                       LOG_GENERAL ("Inside there's directory %1", i.path().string());
+                       read_sub_directory (i.path());
                }
        }
 }
@@ -230,12 +229,12 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        }
        Content::examine (film, job);
 
-       shared_ptr<DCPExaminer> examiner (new DCPExaminer(shared_from_this(), film ? film->tolerant() : true));
+       auto examiner = make_shared<DCPExaminer>(shared_from_this(), film ? film->tolerant() : true);
 
        if (examiner->has_video()) {
                {
                        boost::mutex::scoped_lock lm (_mutex);
-                       video.reset (new VideoContent (this));
+                       video = make_shared<VideoContent>(this);
                }
                video->take_from_examiner (examiner);
                set_default_colour_conversion ();
@@ -244,11 +243,11 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        if (examiner->has_audio()) {
                {
                        boost::mutex::scoped_lock lm (_mutex);
-                       audio.reset (new AudioContent (this));
+                       audio = make_shared<AudioContent>(this);
                }
-               AudioStreamPtr as (new AudioStream (examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels()));
+               auto as = make_shared<AudioStream>(examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels());
                audio->set_stream (as);
-               AudioMapping m = as->mapping ();
+               auto m = as->mapping ();
                m.make_default (film ? film->audio_processor() : 0);
                as->set_mapping (m);
        }
@@ -256,7 +255,7 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        if (examiner->has_atmos()) {
                {
                        boost::mutex::scoped_lock lm (_mutex);
-                       atmos.reset (new AtmosContent(this));
+                       atmos = make_shared<AtmosContent>(this);
                }
                /* Setting length will cause calculations to be made based on edit rate, so that must
                 * be set up first otherwise hard-to-spot exceptions will be thrown.
@@ -266,10 +265,10 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        }
 
        list<shared_ptr<TextContent> > new_text;
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                for (int j = 0; j < examiner->text_count(static_cast<TextType>(i)); ++j) {
-                       shared_ptr<TextContent> c(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i)));
-                       if (i == TEXT_CLOSED_CAPTION) {
+                       auto c = make_shared<TextContent>(this, static_cast<TextType>(i), static_cast<TextType>(i));
+                       if (i == static_cast<int>(TextType::CLOSED_CAPTION)) {
                                c->set_dcp_track (examiner->dcp_text_track(j));
                        }
                        new_text.push_back (c);
@@ -288,9 +287,8 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                _content_kind = examiner->content_kind ();
                _cpl = examiner->cpl ();
                _reel_lengths = examiner->reel_lengths ();
-               map<dcp::Marker, dcp::Time> markers = examiner->markers();
-               for (map<dcp::Marker, dcp::Time>::const_iterator i = markers.begin(); i != markers.end(); ++i) {
-                       _markers[i->first] = ContentTime(i->second.as_editable_units(DCPTime::HZ));
+               for (auto const& i: examiner->markers()) {
+                       _markers[i.first] = ContentTime(i.second.as_editable_units(DCPTime::HZ));
                }
                _ratings = examiner->ratings ();
                _content_versions = examiner->content_versions ();
@@ -309,7 +307,7 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        }
 
        if (video) {
-               video->set_frame_type (_three_d ? VIDEO_FRAME_TYPE_3D : VIDEO_FRAME_TYPE_2D);
+               video->set_frame_type (_three_d ? VideoFrameType::THREE_D : VideoFrameType::TWO_D);
        }
 }
 
@@ -369,8 +367,8 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const
        node->add_child("KDMValid")->add_child_text (_kdm_valid ? "1" : "0");
        node->add_child("ReferenceVideo")->add_child_text (_reference_video ? "1" : "0");
        node->add_child("ReferenceAudio")->add_child_text (_reference_audio ? "1" : "0");
-       node->add_child("ReferenceOpenSubtitle")->add_child_text(_reference_text[TEXT_OPEN_SUBTITLE] ? "1" : "0");
-       node->add_child("ReferenceClosedCaption")->add_child_text(_reference_text[TEXT_CLOSED_CAPTION] ? "1" : "0");
+       node->add_child("ReferenceOpenSubtitle")->add_child_text(_reference_text[static_cast<int>(TextType::OPEN_SUBTITLE)] ? "1" : "0");
+       node->add_child("ReferenceClosedCaption")->add_child_text(_reference_text[static_cast<int>(TextType::CLOSED_CAPTION)] ? "1" : "0");
        if (_standard) {
                switch (_standard.get ()) {
                case dcp::Standard::INTEROP:
@@ -394,14 +392,14 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const
                node->add_child("ReelLength")->add_child_text (raw_convert<string> (i));
        }
 
-       for (map<dcp::Marker, ContentTime>::const_iterator i = _markers.begin(); i != _markers.end(); ++i) {
-               xmlpp::Element* marker = node->add_child("Marker");
-               marker->set_attribute("type", dcp::marker_to_string(i->first));
-               marker->add_child_text(raw_convert<string>(i->second.get()));
+       for (auto const& i: _markers) {
+               auto marker = node->add_child("Marker");
+               marker->set_attribute("type", dcp::marker_to_string(i.first));
+               marker->add_child_text(raw_convert<string>(i.second.get()));
        }
 
        for (auto i: _ratings) {
-               xmlpp::Element* rating = node->add_child("Rating");
+               auto rating = node->add_child("Rating");
                i.as_xml (rating);
        }
 
@@ -414,7 +412,7 @@ DCPTime
 DCPContent::full_length (shared_ptr<const Film> film) const
 {
        if (!video) {
-               return DCPTime();
+               return {};
        }
        FrameRateChange const frc (film, shared_from_this());
        return DCPTime::from_frames (llrint(video->length() * frc.factor()), film->video_frame_rate());
@@ -424,7 +422,7 @@ DCPTime
 DCPContent::approximate_length () const
 {
        if (!video) {
-               return DCPTime();
+               return {};
        }
        return DCPTime::from_frames (video->length(), 24);
 }
@@ -443,7 +441,7 @@ DCPContent::identifier () const
        }
 
        s += string (_reference_video ? "1" : "0");
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                s += string (_reference_text[i] ? "1" : "0");
        }
        return s;
@@ -537,15 +535,15 @@ DCPContent::set_reference_text (TextType type, bool r)
 
        {
                boost::mutex::scoped_lock lm (_mutex);
-               _reference_text[type] = r;
+               _reference_text[static_cast<int>(type)] = r;
        }
 }
 
 list<DCPTimePeriod>
 DCPContent::reels (shared_ptr<const Film> film) const
 {
-       list<int64_t> reel_lengths = _reel_lengths;
-       if (reel_lengths.empty ()) {
+       auto reel_lengths = _reel_lengths;
+       if (reel_lengths.empty()) {
                /* Old metadata with no reel lengths; get them here instead */
                try {
                        scoped_ptr<DCPExaminer> examiner (new DCPExaminer(shared_from_this(), film->tolerant()));
@@ -563,13 +561,13 @@ DCPContent::reels (shared_ptr<const Film> film) const
        */
 
        /* The starting point of this content on the timeline */
-       DCPTime pos = position() - DCPTime (trim_start().get());
+       auto pos = position() - DCPTime (trim_start().get());
 
        for (auto i: reel_lengths) {
                /* This reel runs from `pos' to `to' */
                DCPTime const to = pos + DCPTime::from_frames (i, film->video_frame_rate());
                if (to > position()) {
-                       p.push_back (DCPTimePeriod (max(position(), pos), min(end(film), to)));
+                       p.push_back (DCPTimePeriod(max(position(), pos), min(end(film), to)));
                        if (to > end(film)) {
                                break;
                        }
@@ -613,7 +611,7 @@ DCPContent::can_reference (shared_ptr<const Film> film, function<bool (shared_pt
                return false;
        }
 
-       list<DCPTimePeriod> const fr = film->reels ();
+       auto const fr = film->reels ();
 
        list<DCPTimePeriod> reel_list;
        try {
@@ -637,7 +635,7 @@ DCPContent::can_reference (shared_ptr<const Film> film, function<bool (shared_pt
                }
        }
 
-       ContentList a = overlaps (film, film->content(), part, position(), end(film));
+       auto a = overlaps (film, film->content(), part, position(), end(film));
        if (a.size() != 1 || a.front().get() != this) {
                why_not = overlapping;
                return false;
@@ -661,7 +659,7 @@ DCPContent::can_reference_video (shared_ptr<const Film> film, string& why_not) c
        }
 
        if (film->resolution() != resolution()) {
-               if (resolution() == RESOLUTION_4K) {
+               if (resolution() == Resolution::FOUR_K) {
                        /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
                        why_not = _("it is 4K and the film is 2K.");
                } else {
@@ -735,7 +733,7 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri
        }
 
         for (auto i: decoder->reels()) {
-                if (type == TEXT_OPEN_SUBTITLE) {
+                if (type == TextType::OPEN_SUBTITLE) {
                        if (!i->main_subtitle()) {
                                /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
                                why_not = _("it does not have open subtitles in all its reels.");
@@ -746,7 +744,7 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri
                                return false;
                        }
                 }
-               if (type == TEXT_CLOSED_CAPTION) {
+               if (type == TextType::CLOSED_CAPTION) {
                        if (i->closed_captions().empty()) {
                                /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
                                why_not = _("it does not have closed captions in all its reels.");
@@ -775,14 +773,14 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri
 void
 DCPContent::take_settings_from (shared_ptr<const Content> c)
 {
-       shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (c);
+       auto dc = dynamic_pointer_cast<const DCPContent>(c);
        if (!dc) {
                return;
        }
 
        _reference_video = dc->_reference_video;
        _reference_audio = dc->_reference_audio;
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                _reference_text[i] = dc->_reference_text[i];
        }
 }
@@ -814,9 +812,9 @@ Resolution
 DCPContent::resolution () const
 {
        if (video->size().width > 2048 || video->size().height > 1080) {
-               return RESOLUTION_4K;
+               return Resolution::FOUR_K;
        }
 
-       return RESOLUTION_2K;
+       return Resolution::TWO_K;
 }
 
index c235dd823c975df375042a30d8dd4f61c8df5503..136c527a5c3d7bf84931ca3b2c3fc4b34483684d 100644 (file)
@@ -117,7 +117,7 @@ public:
         */
        bool reference_text (TextType type) const {
                boost::mutex::scoped_lock lm (_mutex);
-               return _reference_text[type];
+               return _reference_text[static_cast<int>(type)];
        }
 
        bool can_reference_text (std::shared_ptr<const Film> film, TextType type, std::string &) const;
@@ -201,7 +201,7 @@ private:
         *  rather than by rewrapping.  The types here are the original text types,
         *  not what they are being used for.
         */
-       bool _reference_text[TEXT_COUNT];
+       bool _reference_text[static_cast<int>(TextType::COUNT)];
 
        boost::optional<dcp::Standard> _standard;
        boost::optional<dcp::ContentKind> _content_kind;
index 0491f5af7cf6d8d3fca7ebcaa87bf654e08d61d9..4076936ddca2460898d06f4aae30046fbc3ef9ba 100644 (file)
@@ -254,7 +254,7 @@ DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
                pass_texts (
                        next,
                        (*_reel)->main_subtitle()->asset(),
-                       _dcp_content->reference_text(TEXT_OPEN_SUBTITLE),
+                       _dcp_content->reference_text(TextType::OPEN_SUBTITLE),
                        (*_reel)->main_subtitle()->entry_point().get_value_or(0),
                        *decoder,
                        size
@@ -264,7 +264,7 @@ DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
 
        for (auto i: (*_reel)->closed_captions()) {
                pass_texts (
-                       next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point().get_value_or(0), *decoder, size
+                       next, i->asset(), _dcp_content->reference_text(TextType::CLOSED_CAPTION), i->entry_point().get_value_or(0), *decoder, size
                        );
                ++decoder;
        }
index 4b4785cc6e362021cab8c4ba6c8cada370810c23..c5bcf31f2c207ce25d65ab97ea577f719681bed7 100644 (file)
@@ -133,10 +133,10 @@ void
 DCPEncoder::video (shared_ptr<PlayerVideo> data, DCPTime time)
 {
        if (!_film->three_d()) {
-               if (data->eyes() == EYES_LEFT) {
+               if (data->eyes() == Eyes::LEFT) {
                        /* Use left-eye images for both eyes... */
-                       data->set_eyes (EYES_BOTH);
-               } else if (data->eyes() == EYES_RIGHT) {
+                       data->set_eyes (Eyes::BOTH);
+               } else if (data->eyes() == Eyes::RIGHT) {
                        /* ...and discard the right */
                        return;
                }
@@ -158,7 +158,7 @@ DCPEncoder::audio (shared_ptr<AudioBuffers> data, DCPTime time)
 void
 DCPEncoder::text (PlayerText data, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
 {
-       if (type == TEXT_CLOSED_CAPTION || _non_burnt_subtitles) {
+       if (type == TextType::CLOSED_CAPTION || _non_burnt_subtitles) {
                _writer->write (data, type, track, period);
        }
 }
index 5ea56835926c1b17b073666142732a559e4b212e..89ddfd6eae907b49c3d1d46237275eea6a280ef6 100644 (file)
@@ -57,20 +57,10 @@ using std::dynamic_pointer_cast;
 
 DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
        : DCP (content, tolerant)
-       , _video_length (0)
-       , _audio_length (0)
-       , _has_video (false)
-       , _has_audio (false)
-       , _encrypted (false)
-       , _needs_assets (false)
-       , _kdm_valid (false)
-       , _three_d (false)
-       , _has_atmos (false)
-       , _atmos_length (0)
 {
        shared_ptr<dcp::CPL> cpl;
 
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                _text_count[i] = 0;
        }
 
@@ -127,7 +117,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                return;
                        }
 
-                       dcp::Fraction const frac = i->main_picture()->edit_rate ();
+                       auto const frac = i->main_picture()->edit_rate ();
                        float const fr = float(frac.numerator) / frac.denominator;
                        if (!_video_frame_rate) {
                                _video_frame_rate = fr;
@@ -136,7 +126,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                        }
 
                        _has_video = true;
-                       shared_ptr<dcp::PictureAsset> asset = i->main_picture()->asset ();
+                       auto asset = i->main_picture()->asset();
                        if (!_video_size) {
                                _video_size = asset->size ();
                        } else if (_video_size.get() != asset->size ()) {
@@ -154,7 +144,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                        }
 
                        _has_audio = true;
-                       shared_ptr<dcp::SoundAsset> asset = i->main_sound()->asset ();
+                       auto asset = i->main_sound()->asset();
 
                        if (!_audio_channels) {
                                _audio_channels = asset->channels ();
@@ -178,7 +168,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                return;
                        }
 
-                       _text_count[TEXT_OPEN_SUBTITLE] = 1;
+                       _text_count[static_cast<int>(TextType::OPEN_SUBTITLE)] = 1;
                }
 
                for (auto j: i->closed_captions()) {
@@ -188,7 +178,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                return;
                        }
 
-                       _text_count[TEXT_CLOSED_CAPTION]++;
+                       _text_count[static_cast<int>(TextType::CLOSED_CAPTION)]++;
                        _dcp_text_tracks.push_back (DCPTextTrack(j->annotation_text(), j->language().get_value_or(_("Unknown"))));
                }
 
index b61dd94a5535a78a25e817e487df00085907dbe4..3fedaca06aded36f75f4beacd85de8ef2fd954ee 100644 (file)
@@ -94,7 +94,7 @@ public:
         *  @return Number of assets of this type in this DCP.
         */
        int text_count (TextType type) const {
-               return _text_count[type];
+               return _text_count[static_cast<int>(type)];
        }
 
        DCPTextTrack dcp_text_track (int i) const {
@@ -153,31 +153,31 @@ public:
 private:
        boost::optional<double> _video_frame_rate;
        boost::optional<dcp::Size> _video_size;
-       Frame _video_length;
+       Frame _video_length = 0;
        boost::optional<int> _audio_channels;
        boost::optional<int> _audio_frame_rate;
-       Frame _audio_length;
+       Frame _audio_length = 0;
        std::string _name;
        /** true if this DCP has video content (but false if it has unresolved references to video content) */
-       bool _has_video;
+       bool _has_video = false;
        /** true if this DCP has audio content (but false if it has unresolved references to audio content) */
-       bool _has_audio;
+       bool _has_audio = false;
        /** number of different assets of each type (OCAP/CCAP) */
-       int _text_count[TEXT_COUNT];
+       int _text_count[static_cast<int>(TextType::COUNT)];
        /** the DCPTextTracks for each of our CCAPs */
        std::vector<DCPTextTrack> _dcp_text_tracks;
-       bool _encrypted;
-       bool _needs_assets;
-       bool _kdm_valid;
+       bool _encrypted = false;
+       bool _needs_assets = false;
+       bool _kdm_valid = false;
        boost::optional<dcp::Standard> _standard;
-       bool _three_d;
+       bool _three_d = false;
        dcp::ContentKind _content_kind;
        std::string _cpl;
        std::list<int64_t> _reel_lengths;
        std::map<dcp::Marker, dcp::Time> _markers;
        std::vector<dcp::Rating> _ratings;
        std::vector<std::string> _content_versions;
-       bool _has_atmos;
-       Frame _atmos_length;
+       bool _has_atmos = false;
+       Frame _atmos_length = 0;
        dcp::Fraction _atmos_edit_rate;
 };
index 2c5d98e498387b285bf4286720395a1e6d17d382..858849ca3134f003803abbfcad881dcb890c1d8e 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.
 
 
 #include "i18n.h"
 
-using std::string;
+using std::dynamic_pointer_cast;
 using std::list;
+using std::make_shared;
 using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
 using dcp::raw_convert;
 using namespace dcpomatic;
 
 DCPSubtitleContent::DCPSubtitleContent (boost::filesystem::path path)
        : Content (path)
 {
-       text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_OPEN_SUBTITLE)));
+       text.push_back (make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE));
 }
 
 DCPSubtitleContent::DCPSubtitleContent (cxml::ConstNodePtr node, int version)
@@ -55,10 +56,10 @@ DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
        Content::examine (film, job);
 
-       shared_ptr<dcp::SubtitleAsset> sc = load (path (0));
+       auto sc = load (path(0));
 
-       shared_ptr<dcp::InteropSubtitleAsset> iop = dynamic_pointer_cast<dcp::InteropSubtitleAsset> (sc);
-       shared_ptr<dcp::SMPTESubtitleAsset> smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset> (sc);
+       auto iop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(sc);
+       auto smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(sc);
        if (smpte) {
                set_video_frame_rate (smpte->edit_rate().numerator);
        }
@@ -68,12 +69,12 @@ DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        /* Default to turning these subtitles on */
        only_text()->set_use (true);
 
-       _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ());
+       _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds());
 
        sc->fix_empty_font_ids ();
 
        for (auto i: sc->load_font_nodes()) {
-               only_text()->add_font (shared_ptr<Font> (new Font (i->id)));
+               only_text()->add_font(make_shared<Font>(i->id));
        }
 }
 
index 67baa121570c0f95016bb89449e44618d11f4910..58e10f0ed69f349b65d5c51b92b89f59a872205d 100644 (file)
@@ -56,9 +56,10 @@ DCPOMATIC_ENABLE_WARNINGS
 
 #include "i18n.h"
 
-using std::string;
 using std::cout;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
 using dcp::Size;
 using dcp::ArrayData;
 using dcp::raw_convert;
@@ -91,7 +92,7 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::
        _index = node->number_child<int> ("Index");
        _frames_per_second = node->number_child<int> ("FramesPerSecond");
        _j2k_bandwidth = node->number_child<int> ("J2KBandwidth");
-       _resolution = Resolution (node->optional_number_child<int>("Resolution").get_value_or (RESOLUTION_2K));
+       _resolution = Resolution (node->optional_number_child<int>("Resolution").get_value_or(static_cast<int>(Resolution::TWO_K)));
 }
 
 shared_ptr<dcp::OpenJPEGImage>
@@ -99,7 +100,7 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
 {
        shared_ptr<dcp::OpenJPEGImage> xyz;
 
-       shared_ptr<Image> image = frame->image (bind (&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, true, false);
+       auto image = frame->image (bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, true, false);
        if (frame->colour_conversion()) {
                xyz = dcp::rgb_to_xyz (
                        image->data()[0],
@@ -109,7 +110,7 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
                        note
                        );
        } else {
-               xyz.reset (new dcp::OpenJPEGImage (image->data()[0], image->size(), image->stride()[0]));
+               xyz = make_shared<dcp::OpenJPEGImage>(image->data()[0], image->size(), image->stride()[0]);
        }
 
        return xyz;
@@ -121,25 +122,25 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
 ArrayData
 DCPVideo::encode_locally ()
 {
-       string const comment = Config::instance()->dcp_j2k_comment();
+       auto const comment = Config::instance()->dcp_j2k_comment();
 
-       ArrayData enc = dcp::compress_j2k (
+       auto enc = dcp::compress_j2k (
                convert_to_xyz (_frame, boost::bind(&Log::dcp_log, dcpomatic_log.get(), _1, _2)),
                _j2k_bandwidth,
                _frames_per_second,
-               _frame->eyes() == EYES_LEFT || _frame->eyes() == EYES_RIGHT,
-               _resolution == RESOLUTION_4K,
+               _frame->eyes() == Eyes::LEFT || _frame->eyes() == Eyes::RIGHT,
+               _resolution == Resolution::FOUR_K,
                comment.empty() ? "libdcp" : comment
                );
 
        switch (_frame->eyes()) {
-       case EYES_BOTH:
+       case Eyes::BOTH:
                LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for mono"), _index);
                break;
-       case EYES_LEFT:
+       case Eyes::LEFT:
                LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for L"), _index);
                break;
-       case EYES_RIGHT:
+       case Eyes::RIGHT:
                LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for R"), _index);
                break;
        default:
@@ -162,13 +163,13 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
        boost::asio::ip::tcp::resolver::query query (serv.host_name(), raw_convert<string> (ENCODE_FRAME_PORT));
        boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
 
-       shared_ptr<Socket> socket (new Socket (timeout));
+       auto socket = make_shared<Socket>(timeout);
 
        socket->connect (*endpoint_iterator);
 
        /* Collect all XML metadata */
        xmlpp::Document doc;
-       xmlpp::Element* root = doc.create_root_node ("EncodingRequest");
+       auto root = doc.create_root_node ("EncodingRequest");
        root->add_child("Version")->add_child_text (raw_convert<string> (SERVER_LINK_VERSION));
        add_metadata (root);
 
@@ -178,7 +179,7 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
                Socket::WriteDigestScope ds (socket);
 
                /* Send XML metadata */
-               string xml = doc.write_to_string ("UTF-8");
+               auto xml = doc.write_to_string ("UTF-8");
                socket->write (xml.length() + 1);
                socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
 
index c4637ff0da387747d39ea49af604e8e85a8355e1..8a061738bd14c86bfd6658bc5b194def845c94b0 100644 (file)
@@ -176,7 +176,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
                throw NetworkError ("Could not initialise libcurl");
        }
 
-       if ((protocol == EMAIL_PROTOCOL_AUTO && port == 465) || protocol == EMAIL_PROTOCOL_SSL) {
+       if ((protocol == EmailProtocol::AUTO && port == 465) || protocol == EmailProtocol::SSL) {
                /* "SSL" or "Implicit TLS"; I think curl wants us to use smtps here */
                curl_easy_setopt (curl, CURLOPT_URL, String::compose("smtps://%1:%2", server, port).c_str());
        } else {
@@ -209,7 +209,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
        curl_easy_setopt (curl, CURLOPT_READDATA, this);
        curl_easy_setopt (curl, CURLOPT_UPLOAD, 1L);
 
-       if (protocol == EMAIL_PROTOCOL_AUTO || protocol == EMAIL_PROTOCOL_STARTTLS) {
+       if (protocol == EmailProtocol::AUTO || protocol == EmailProtocol::STARTTLS) {
                curl_easy_setopt (curl, CURLOPT_USE_SSL, (long) CURLUSESSL_TRY);
        }
        curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
index 2c42cf579cbbb1a11b2a8916531d050010f9e5ca..7f1c75a936915d3ea440cd24ccb4b6c2ffde2e75 100644 (file)
@@ -306,7 +306,7 @@ FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                _subtitle_streams = examiner->subtitle_streams ();
                if (!_subtitle_streams.empty ()) {
                        text.clear ();
-                       text.push_back (make_shared<TextContent>(this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN));
+                       text.push_back (make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::UNKNOWN));
                        _subtitle_stream = _subtitle_streams.front ();
                }
        }
index 059742025a7349985991a91948386ca39e192f6f..5f29b64da51b498e8a656bc56cce9933f365ef70 100644 (file)
 
 #include "i18n.h"
 
-using std::string;
-using std::runtime_error;
 using std::cout;
-using std::pair;
 using std::list;
+using std::make_shared;
 using std::map;
+using std::pair;
+using std::runtime_error;
 using std::shared_ptr;
-using boost::bind;
+using std::string;
 using std::weak_ptr;
+using boost::bind;
 using boost::optional;
 using namespace dcpomatic;
 #if BOOST_VERSION >= 106100
@@ -106,8 +107,8 @@ FFmpegEncoder::FFmpegEncoder (
                }
        }
 
-       _butler.reset (
-               new Butler(_film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VideoRange::VIDEO, true, false)
+       _butler = std::make_shared<Butler>(
+               _film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VideoRange::VIDEO, true, false
                );
 }
 
@@ -116,7 +117,7 @@ void
 FFmpegEncoder::go ()
 {
        {
-               shared_ptr<Job> job = _job.lock ();
+               auto job = _job.lock ();
                DCPOMATIC_ASSERT (job);
                job->sub (_("Encoding"));
        }
@@ -154,14 +155,14 @@ FFmpegEncoder::go ()
                        );
        }
 
-       list<DCPTimePeriod> reel_periods = _film->reels ();
-       list<DCPTimePeriod>::const_iterator reel = reel_periods.begin ();
-       list<FileEncoderSet>::iterator encoder = file_encoders.begin ();
+       auto reel_periods = _film->reels ();
+       auto reel = reel_periods.begin ();
+       auto encoder = file_encoders.begin ();
 
-       DCPTime const video_frame = DCPTime::from_frames (1, _film->video_frame_rate ());
+       auto const video_frame = DCPTime::from_frames (1, _film->video_frame_rate ());
        int const audio_frames = video_frame.frames_round(_film->audio_frame_rate());
        float* interleaved = new float[_output_audio_channels * audio_frames];
-       shared_ptr<AudioBuffers> deinterleaved (new AudioBuffers (_output_audio_channels, audio_frames));
+       auto deinterleaved = make_shared<AudioBuffers>(_output_audio_channels, audio_frames);
        int const gets_per_frame = _film->three_d() ? 2 : 1;
        for (DCPTime i; i < _film->length(); i += video_frame) {
 
@@ -175,7 +176,7 @@ FFmpegEncoder::go ()
 
                for (int j = 0; j < gets_per_frame; ++j) {
                        Butler::Error e;
-                       pair<shared_ptr<PlayerVideo>, DCPTime> v = _butler->get_video (true, &e);
+                       auto v = _butler->get_video (true, &e);
                        _butler->rethrow ();
                        if (!v.first) {
                                throw DecodeError(String::compose("Error during decoding: %1", e.summary()));
@@ -245,22 +246,19 @@ FFmpegEncoder::FileEncoderSet::FileEncoderSet (
 {
        if (three_d) {
                /// TRANSLATORS: L here is an abbreviation for "left", to indicate the left-eye part of a 3D export
-               _encoders[EYES_LEFT] = shared_ptr<FFmpegFileEncoder>(
-                       new FFmpegFileEncoder(
-                               video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
-                               audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension))
+               _encoders[Eyes::LEFT] = make_shared<FFmpegFileEncoder>(
+                       video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
+                       audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension)
                        );
                /// TRANSLATORS: R here is an abbreviation for "right", to indicate the right-eye part of a 3D export
-               _encoders[EYES_RIGHT] = shared_ptr<FFmpegFileEncoder>(
-                       new FFmpegFileEncoder(
-                               video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
-                               audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension))
+               _encoders[Eyes::RIGHT] = make_shared<FFmpegFileEncoder>(
+                       video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
+                       audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension)
                        );
        } else {
-               _encoders[EYES_BOTH]  = shared_ptr<FFmpegFileEncoder>(
-                       new FFmpegFileEncoder(
-                               video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
-                               audio_stream_per_channel, x264_crf, String::compose("%1%2", output.string(), extension))
+               _encoders[Eyes::BOTH] = make_shared<FFmpegFileEncoder>(
+                       video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
+                       audio_stream_per_channel, x264_crf, String::compose("%1%2", output.string(), extension)
                        );
        }
 }
@@ -270,10 +268,10 @@ FFmpegEncoder::FileEncoderSet::get (Eyes eyes) const
 {
        if (_encoders.size() == 1) {
                /* We are doing a 2D export... */
-               if (eyes == EYES_LEFT) {
+               if (eyes == Eyes::LEFT) {
                        /* ...but we got some 3D data; put the left eye into the output... */
-                       eyes = EYES_BOTH;
-               } else if (eyes == EYES_RIGHT) {
+                       eyes = Eyes::BOTH;
+               } else if (eyes == Eyes::RIGHT) {
                        /* ...and ignore the right eye.*/
                        return shared_ptr<FFmpegFileEncoder>();
                }
@@ -287,15 +285,15 @@ FFmpegEncoder::FileEncoderSet::get (Eyes eyes) const
 void
 FFmpegEncoder::FileEncoderSet::flush ()
 {
-       for (map<Eyes, std::shared_ptr<FFmpegFileEncoder> >::iterator i = _encoders.begin(); i != _encoders.end(); ++i) {
-               i->second->flush ();
+       for (auto& i: _encoders) {
+               i.second->flush ();
        }
 }
 
 void
 FFmpegEncoder::FileEncoderSet::audio (shared_ptr<AudioBuffers> a)
 {
-       for (map<Eyes, std::shared_ptr<FFmpegFileEncoder> >::iterator i = _encoders.begin(); i != _encoders.end(); ++i) {
-               i->second->audio (a);
+       for (auto& i: _encoders) {
+               i.second->audio (a);
        }
 }
index 0aa976c3fcf0187b35c901039f1d527596c2c61b..0378f5156b78afb0b99f72e08dabf1899a77a1cd 100644 (file)
@@ -231,20 +231,20 @@ FFmpegFileEncoder::FFmpegFileEncoder (
        _pixel_format = pixel_format (format);
 
        switch (format) {
-       case EXPORT_FORMAT_PRORES:
+       case ExportFormat::PRORES:
                _sample_format = AV_SAMPLE_FMT_S16;
                _video_codec_name = "prores_ks";
                _audio_codec_name = "pcm_s16le";
                av_dict_set (&_video_options, "profile", "3", 0);
                av_dict_set (&_video_options, "threads", "auto", 0);
                break;
-       case EXPORT_FORMAT_H264_AAC:
+       case ExportFormat::H264_AAC:
                _sample_format = AV_SAMPLE_FMT_FLTP;
                _video_codec_name = "libx264";
                _audio_codec_name = "aac";
                av_dict_set_int (&_video_options, "crf", x264_crf, 0);
                break;
-       case EXPORT_FORMAT_H264_PCM:
+       case ExportFormat::H264_PCM:
                _sample_format = AV_SAMPLE_FMT_S32;
                _video_codec_name = "libx264";
                _audio_codec_name = "pcm_s24le";
@@ -289,10 +289,10 @@ AVPixelFormat
 FFmpegFileEncoder::pixel_format (ExportFormat format)
 {
        switch (format) {
-       case EXPORT_FORMAT_PRORES:
+       case ExportFormat::PRORES:
                return AV_PIX_FMT_YUV422P10;
-       case EXPORT_FORMAT_H264_AAC:
-       case EXPORT_FORMAT_H264_PCM:
+       case ExportFormat::H264_AAC:
+       case ExportFormat::H264_PCM:
                return AV_PIX_FMT_YUV420P;
        default:
                DCPOMATIC_ASSERT (false);
@@ -399,14 +399,14 @@ void
 FFmpegFileEncoder::video (shared_ptr<PlayerVideo> video, DCPTime time)
 {
        /* All our output formats are video range at the moment */
-       shared_ptr<Image> image = video->image (
+       auto image = video->image (
                bind (&PlayerVideo::force, _1, _pixel_format),
                VideoRange::VIDEO,
                true,
                false
                );
 
-       AVFrame* frame = av_frame_alloc ();
+       auto frame = av_frame_alloc ();
        DCPOMATIC_ASSERT (frame);
 
        {
index dacde49d4964283bfa1ea6e182e333a606c34af1..193dedf4cd3bc1980dfababef1def911074c6c3c 100644 (file)
@@ -151,7 +151,7 @@ Film::Film (optional<boost::filesystem::path> dir)
        , _use_isdcf_name (true)
        , _dcp_content_type (Config::instance()->default_dcp_content_type ())
        , _container (Config::instance()->default_container ())
-       , _resolution (RESOLUTION_2K)
+       , _resolution (Resolution::TWO_K)
        , _encrypted (false)
        , _context_id (dcp::make_uuid ())
        , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
@@ -162,7 +162,7 @@ Film::Film (optional<boost::filesystem::path> dir)
        , _sequence (true)
        , _interop (Config::instance()->default_interop ())
        , _audio_processor (0)
-       , _reel_type (REELTYPE_SINGLE)
+       , _reel_type (ReelType::SINGLE)
        , _reel_length (2000000000)
        , _reencode_j2k (false)
        , _user_explicit_video_frame_rate (false)
@@ -620,7 +620,7 @@ Film::read_metadata (optional<boost::filesystem::path> path)
                }
        }
 
-       _reel_type = static_cast<ReelType> (f.optional_number_child<int>("ReelType").get_value_or (static_cast<int>(REELTYPE_SINGLE)));
+       _reel_type = static_cast<ReelType> (f.optional_number_child<int>("ReelType").get_value_or (static_cast<int>(ReelType::SINGLE)));
        _reel_length = f.optional_number_child<int64_t>("ReelLength").get_value_or (2000000000);
        _reencode_j2k = f.optional_bool_child("ReencodeJ2K").get_value_or(false);
        _user_explicit_video_frame_rate = f.optional_bool_child("UserExplicitVideoFrameRate").get_value_or(false);
@@ -906,9 +906,9 @@ Film::isdcf_name (bool if_created_now) const
                auto ccap = false;
                for (auto i: content()) {
                        for (auto j: i->text) {
-                               if (j->type() == TEXT_OPEN_SUBTITLE && j->use() && !j->burn()) {
+                               if (j->type() == TextType::OPEN_SUBTITLE && j->use() && !j->burn()) {
                                        burnt_in = false;
-                               } else if (j->type() == TEXT_CLOSED_CAPTION && j->use()) {
+                               } else if (j->type() == TextType::CLOSED_CAPTION && j->use()) {
                                        ccap = true;
                                }
                        }
@@ -993,7 +993,7 @@ Film::isdcf_name (bool if_created_now) const
                }
 
                bool any_text = false;
-               for (int i = 0; i < TEXT_COUNT; ++i) {
+               for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                        if (dc->reference_text(static_cast<TextType>(i))) {
                                any_text = true;
                        }
@@ -1178,7 +1178,7 @@ Film::signal_change (ChangeType type, int p)
 void
 Film::signal_change (ChangeType type, Property p)
 {
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                _dirty = true;
 
                if (p == Film::CONTENT) {
@@ -1217,9 +1217,9 @@ Film::j2c_path (int reel, Frame frame, Eyes eyes, bool tmp) const
        snprintf(buffer, sizeof(buffer), "%08d_%08" PRId64, reel, frame);
        string s (buffer);
 
-       if (eyes == EYES_LEFT) {
+       if (eyes == Eyes::LEFT) {
                s += ".L";
-       } else if (eyes == EYES_RIGHT) {
+       } else if (eyes == Eyes::RIGHT) {
                s += ".R";
        }
 
@@ -1387,9 +1387,9 @@ Film::maybe_set_container_and_resolution ()
 
                if (!_user_explicit_resolution) {
                        if (video->size_after_crop().width > 2048 || video->size_after_crop().height > 1080) {
-                               set_resolution (RESOLUTION_4K, false);
+                               set_resolution (Resolution::FOUR_K, false);
                        } else {
-                               set_resolution (RESOLUTION_2K, false);
+                               set_resolution (Resolution::TWO_K, false);
                        }
                }
        }
@@ -1449,7 +1449,7 @@ Film::playlist_content_change (ChangeType type, weak_ptr<Content> c, int p, bool
                signal_change (type, Film::NAME);
        }
 
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                emit (boost::bind (boost::ref (ContentChange), type, c, p, frequent));
                if (!frequent) {
                        check_settings_consistency ();
@@ -1473,7 +1473,7 @@ Film::playlist_change (ChangeType type)
        signal_change (type, CONTENT);
        signal_change (type, NAME);
 
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                check_settings_consistency ();
        }
 
@@ -1517,12 +1517,12 @@ Film::check_settings_consistency ()
                        d->set_reference_audio(false);
                        change_made = true;
                }
-               if (d->reference_text(TEXT_OPEN_SUBTITLE) && !d->can_reference_text(shared_from_this(), TEXT_OPEN_SUBTITLE, why_not)) {
-                       d->set_reference_text(TEXT_OPEN_SUBTITLE, false);
+               if (d->reference_text(TextType::OPEN_SUBTITLE) && !d->can_reference_text(shared_from_this(), TextType::OPEN_SUBTITLE, why_not)) {
+                       d->set_reference_text(TextType::OPEN_SUBTITLE, false);
                        change_made = true;
                }
-               if (d->reference_text(TEXT_CLOSED_CAPTION) && !d->can_reference_text(shared_from_this(), TEXT_CLOSED_CAPTION, why_not)) {
-                       d->set_reference_text(TEXT_CLOSED_CAPTION, false);
+               if (d->reference_text(TextType::CLOSED_CAPTION) && !d->can_reference_text(shared_from_this(), TextType::CLOSED_CAPTION, why_not)) {
+                       d->set_reference_text(TextType::CLOSED_CAPTION, false);
                        change_made = true;
                }
        }
@@ -1536,7 +1536,7 @@ void
 Film::playlist_order_changed ()
 {
        /* XXX: missing PENDING */
-       signal_change (CHANGE_TYPE_DONE, CONTENT_ORDER);
+       signal_change (ChangeType::DONE, CONTENT_ORDER);
 }
 
 int
@@ -1565,9 +1565,9 @@ dcp::Size
 Film::full_frame () const
 {
        switch (_resolution) {
-       case RESOLUTION_2K:
+       case Resolution::TWO_K:
                return dcp::Size (2048, 1080);
-       case RESOLUTION_4K:
+       case Resolution::FOUR_K:
                return dcp::Size (4096, 2160);
        }
 
@@ -1767,10 +1767,10 @@ Film::reels () const
        auto const len = length();
 
        switch (reel_type ()) {
-       case REELTYPE_SINGLE:
+       case ReelType::SINGLE:
                p.push_back (DCPTimePeriod (DCPTime (), len));
                break;
-       case REELTYPE_BY_VIDEO_CONTENT:
+       case ReelType::BY_VIDEO_CONTENT:
        {
                /* Collect all reel boundaries */
                list<DCPTime> split_points;
@@ -1802,7 +1802,7 @@ Film::reels () const
                }
                break;
        }
-       case REELTYPE_BY_LENGTH:
+       case ReelType::BY_LENGTH:
        {
                DCPTime current;
                /* Integer-divide reel length by the size of one frame to give the number of frames per reel,
@@ -1912,7 +1912,7 @@ Film::closed_caption_tracks () const
                for (auto j: i->text) {
                        /* XXX: Empty DCPTextTrack ends up being a magic value here - the "unknown" or "not specified" track */
                        auto dtt = j->dcp_track().get_value_or(DCPTextTrack());
-                       if (j->type() == TEXT_CLOSED_CAPTION && find(tt.begin(), tt.end(), dtt) == tt.end()) {
+                       if (j->type() == TextType::CLOSED_CAPTION && find(tt.begin(), tt.end(), dtt) == tt.end()) {
                                tt.push_back (dtt);
                        }
                }
index ebc42bc918f092a76c881c73df49e665c8c54934..32accdd02c611ea5d46a8291ff9745151114520d 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.
 
 
 #include "i18n.h"
 
-using std::vector;
-using std::string;
-using std::pair;
-using std::min;
-using std::max;
 using std::cout;
+using std::make_shared;
+using std::max;
+using std::min;
+using std::pair;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using std::weak_ptr;
 using boost::optional;
 using boost::bind;
@@ -113,7 +114,7 @@ Hints::check_few_audio_channels ()
 void
 Hints::check_upmixers ()
 {
-       AudioProcessor const * ap = film()->audio_processor();
+       auto ap = film()->audio_processor();
        if (ap && (ap->id() == "stereo-5.1-upmix-a" || ap->id() == "stereo-5.1-upmix-b")) {
                hint (_("You are using DCP-o-matic's stereo-to-5.1 upmixer.  This is experimental and may result in poor-quality audio.  If you continue, you should listen to the resulting DCP in a cinema to make sure that it sounds good."));
        }
@@ -151,7 +152,7 @@ Hints::check_incorrect_container ()
 void
 Hints::check_unusual_container ()
 {
-       string const film_container = film()->container()->id();
+       auto const film_container = film()->container()->id();
        if (film_container != "185" && film_container != "239" && film_container != "190") {
                hint (_("Your DCP uses an unusual container ratio.  This may cause problems on some projectors.  If possible, use Flat or Scope for the DCP container ratio"));
        }
@@ -170,7 +171,7 @@ Hints::check_high_j2k_bandwidth ()
 void
 Hints::check_frame_rate ()
 {
-       shared_ptr<const Film> f = film ();
+       auto f = film ();
        switch (f->video_frame_rate()) {
        case 24:
                /* Fine */
@@ -274,7 +275,7 @@ Hints::check_3d_in_2d ()
 {
        int three_d = 0;
        for (auto i: film()->content()) {
-               if (i->video && i->video->frame_type() != VIDEO_FRAME_TYPE_2D) {
+               if (i->video && i->video->frame_type() != VideoFrameType::TWO_D) {
                        ++three_d;
                }
        }
@@ -288,15 +289,15 @@ Hints::check_3d_in_2d ()
 void
 Hints::check_loudness ()
 {
-       boost::filesystem::path path = film()->audio_analysis_path(film()->playlist());
+       auto path = film()->audio_analysis_path(film()->playlist());
        if (boost::filesystem::exists (path)) {
                try {
-                       shared_ptr<AudioAnalysis> an (new AudioAnalysis (path));
+                       auto an = make_shared<AudioAnalysis>(path);
 
                        string ch;
 
-                       vector<AudioAnalysis::PeakTime> sample_peak = an->sample_peak ();
-                       vector<float> true_peak = an->true_peak ();
+                       auto sample_peak = an->sample_peak ();
+                       auto true_peak = an->true_peak ();
 
                        for (size_t i = 0; i < sample_peak.size(); ++i) {
                                float const peak = max (sample_peak[i].peak, true_peak.empty() ? 0 : true_peak[i]);
@@ -335,12 +336,12 @@ subtitle_mxf_too_big (shared_ptr<dcp::SubtitleAsset> asset)
 void
 Hints::thread ()
 {
-       shared_ptr<const Film> film = _film.lock ();
+       auto film = _film.lock ();
        if (!film) {
                return;
        }
 
-       ContentList content = film->content ();
+       auto content = film->content ();
 
        check_big_font_files ();
        check_few_audio_channels ();
@@ -357,7 +358,7 @@ Hints::thread ()
 
        emit (bind(boost::ref(Progress), _("Examining closed captions")));
 
-       shared_ptr<Player> player (new Player(film));
+       auto player = make_shared<Player>(film);
        player->set_ignore_video ();
        player->set_ignore_audio ();
        player->Text.connect (bind(&Hints::text, this, _1, _2, _3, _4));
@@ -402,7 +403,7 @@ Hints::thread ()
        dcp::DCP dcp (dcp_dir);
        dcp.read ();
        DCPOMATIC_ASSERT (dcp.cpls().size() == 1);
-       for (auto reel: dcp.cpls().front()->reels()) {
+       for (auto reel: dcp.cpls()[0]->reels()) {
                for (auto ccap: reel->closed_captions()) {
                        if (ccap->asset() && ccap->asset()->xml_as_string().length() > static_cast<size_t>(MAX_CLOSED_CAPTION_XML_SIZE - SIZE_SLACK) && !ccap_xml_too_big) {
                                hint (_(
@@ -444,10 +445,10 @@ Hints::text (PlayerText text, TextType type, optional<DCPTextTrack> track, DCPTi
        _writer->write (text, type, track, period);
 
        switch (type) {
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                closed_caption (text, period);
                break;
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                open_subtitle (text, period);
                break;
        default:
@@ -533,7 +534,7 @@ Hints::open_subtitle (PlayerText text, DCPTimePeriod period)
 void
 Hints::check_ffec_and_ffmc_in_smpte_feature ()
 {
-       shared_ptr<const Film> f = film();
+       auto f = film();
        if (!f->interop() && f->dcp_content_type()->libdcp_kind() == dcp::ContentKind::FEATURE && (!f->marker(dcp::Marker::FFEC) || !f->marker(dcp::Marker::FFMC))) {
                hint (_("SMPTE DCPs with the type FTR (feature) should have markers for the first frame of end credits (FFEC) and the first frame of moving credits (FFMC).  You should add these markers using the 'Markers' button in the DCP tab."));
        }
index 7c6e2347733f361c7054f3bd862b7bf1e2d19357..a7fa657f84172fe398c3f8d0a170aa1a572ceedb 100644 (file)
@@ -218,7 +218,7 @@ J2KEncoder::encode (shared_ptr<PlayerVideo> pv, DCPTime time)
                /* This frame already has J2K data, so just write it */
                _writer->write (pv->j2k(), position, pv->eyes ());
                frame_done ();
-       } else if (_last_player_video[pv->eyes()] && _writer->can_repeat(position) && pv->same (_last_player_video[pv->eyes()])) {
+       } else if (_last_player_video[static_cast<int>(pv->eyes())] && _writer->can_repeat(position) && pv->same (_last_player_video[static_cast<int>(pv->eyes())])) {
                LOG_DEBUG_ENCODE("Frame @ %1 REPEAT", to_string(time));
                _writer->repeat (position, pv->eyes ());
        } else {
@@ -239,7 +239,7 @@ J2KEncoder::encode (shared_ptr<PlayerVideo> pv, DCPTime time)
                _empty_condition.notify_all ();
        }
 
-       _last_player_video[pv->eyes()] = pv;
+       _last_player_video[static_cast<int>(pv->eyes())] = pv;
        _last_player_video_time = time;
 }
 
index afa010ace01cb71c38398e6a03cb1931fc1a7330..98cca6ba2b5f38c9ea5726f009a145dc01ddefb9 100644 (file)
@@ -98,7 +98,7 @@ private:
        std::shared_ptr<Writer> _writer;
        Waker _waker;
 
-       std::shared_ptr<PlayerVideo> _last_player_video[EYES_COUNT];
+       std::shared_ptr<PlayerVideo> _last_player_video[static_cast<int>(Eyes::COUNT)];
        boost::optional<dcpomatic::DCPTime> _last_player_video_time;
 
        boost::signals2::scoped_connection _server_found_connection;
index 91c90dba71bad6cd95cdfe6e095a1ebab1439804..06de576f362d93f3d36c09c14bf5a14f129871f2 100644 (file)
@@ -50,6 +50,9 @@ public:
 
        J2KImageProxy (std::shared_ptr<cxml::Node> xml, std::shared_ptr<Socket> socket);
 
+       /* For tests */
+       J2KImageProxy (dcp::ArrayData data, dcp::Size size, AVPixelFormat pixel_format);
+
        Result image (
                boost::optional<dcp::Size> size = boost::optional<dcp::Size> ()
                ) const;
@@ -71,11 +74,6 @@ public:
        size_t memory_used () const;
 
 private:
-       friend struct client_server_test_j2k;
-
-       /* For tests */
-       J2KImageProxy (dcp::ArrayData data, dcp::Size size, AVPixelFormat pixel_format);
-
        std::shared_ptr<const dcp::Data> _data;
        dcp::Size _size;
        boost::optional<dcp::Eye> _eye;
index cbfea55b6d5a9cf8e153d84ac73fd076d55e0ade..74e7480f518166a96666d62b8c40f7a7e21714c6 100644 (file)
 
 #include "i18n.h"
 
-using std::list;
+using std::copy;
 using std::cout;
-using std::min;
+using std::dynamic_pointer_cast;
+using std::list;
+using std::make_pair;
+using std::make_shared;
+using std::map;
 using std::max;
 using std::min;
-using std::vector;
+using std::min;
 using std::pair;
-using std::map;
-using std::make_pair;
-using std::copy;
 using std::shared_ptr;
+using std::vector;
 using std::weak_ptr;
-using std::dynamic_pointer_cast;
 using boost::optional;
 using boost::scoped_ptr;
 #if BOOST_VERSION >= 106100
@@ -92,15 +93,8 @@ int const PlayerProperty::PLAYBACK_LENGTH = 705;
 Player::Player (shared_ptr<const Film> film)
        : _film (film)
        , _suspended (0)
-       , _ignore_video (false)
-       , _ignore_audio (false)
-       , _ignore_text (false)
-       , _always_burn_open_subtitles (false)
-       , _fast (false)
        , _tolerant (film->tolerant())
-       , _play_referenced (false)
        , _audio_merger (_film->audio_frame_rate())
-       , _shuffler (0)
 {
        construct ();
 }
@@ -109,15 +103,8 @@ Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist
        : _film (film)
        , _playlist (playlist_)
        , _suspended (0)
-       , _ignore_video (false)
-       , _ignore_audio (false)
-       , _ignore_text (false)
-       , _always_burn_open_subtitles (false)
-       , _fast (false)
        , _tolerant (film->tolerant())
-       , _play_referenced (false)
        , _audio_merger (_film->audio_frame_rate())
-       , _shuffler (0)
 {
        construct ();
 }
@@ -133,7 +120,7 @@ Player::construct ()
        _playlist_content_change_connection = playlist()->ContentChange.connect (bind(&Player::playlist_content_change, this, _1, _3, _4));
        set_video_container_size (_film->frame_size ());
 
-       film_change (CHANGE_TYPE_DONE, Film::AUDIO_PROCESSOR);
+       film_change (ChangeType::DONE, Film::AUDIO_PROCESSOR);
 
        setup_pieces ();
        seek (DCPTime (), true);
@@ -169,7 +156,7 @@ Player::setup_pieces_unlocked ()
 {
        _playback_length = _playlist ? _playlist->length(_film) : _film->length();
 
-       list<shared_ptr<Piece> > old_pieces = _pieces;
+       auto old_pieces = _pieces;
        _pieces.clear ();
 
        delete _shuffler;
@@ -195,7 +182,7 @@ Player::setup_pieces_unlocked ()
                        }
                }
 
-               shared_ptr<Decoder> decoder = decoder_factory (_film, i, _fast, _tolerant, old_decoder);
+               auto decoder = decoder_factory (_film, i, _fast, _tolerant, old_decoder);
                DCPOMATIC_ASSERT (decoder);
 
                FrameRateChange frc (_film, i);
@@ -214,7 +201,7 @@ Player::setup_pieces_unlocked ()
                        }
                }
 
-               shared_ptr<DCPDecoder> dcp = dynamic_pointer_cast<DCPDecoder> (decoder);
+               auto dcp = dynamic_pointer_cast<DCPDecoder> (decoder);
                if (dcp) {
                        dcp->set_decode_referenced (_play_referenced);
                        if (_play_referenced) {
@@ -222,15 +209,15 @@ Player::setup_pieces_unlocked ()
                        }
                }
 
-               shared_ptr<Piece> piece (new Piece (i, decoder, frc));
+               auto piece = make_shared<Piece>(i, decoder, frc);
                _pieces.push_back (piece);
 
                if (decoder->video) {
-                       if (i->video->frame_type() == VIDEO_FRAME_TYPE_3D_LEFT || i->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
+                       if (i->video->frame_type() == VideoFrameType::THREE_D_LEFT || i->video->frame_type() == VideoFrameType::THREE_D_RIGHT) {
                                /* We need a Shuffler to cope with 3D L/R video data arriving out of sequence */
-                               decoder->video->Data.connect (bind (&Shuffler::video, _shuffler, weak_ptr<Piece>(piece), _1));
+                               decoder->video->Data.connect (bind(&Shuffler::video, _shuffler, weak_ptr<Piece>(piece), _1));
                        } else {
-                               decoder->video->Data.connect (bind (&Player::video, this, weak_ptr<Piece>(piece), _1));
+                               decoder->video->Data.connect (bind(&Player::video, this, weak_ptr<Piece>(piece), _1));
                        }
                }
 
@@ -238,7 +225,7 @@ Player::setup_pieces_unlocked ()
                        decoder->audio->Data.connect (bind (&Player::audio, this, weak_ptr<Piece> (piece), _1, _2));
                }
 
-               list<shared_ptr<TextDecoder> >::const_iterator j = decoder->text.begin();
+               auto j = decoder->text.begin();
 
                while (j != decoder->text.end()) {
                        (*j)->BitmapStart.connect (
@@ -272,7 +259,7 @@ Player::setup_pieces_unlocked ()
        _silent = Empty (_film, playlist(), bind(&have_audio, _1), _playback_length);
 
        _last_video_time = DCPTime ();
-       _last_video_eyes = EYES_BOTH;
+       _last_video_eyes = Eyes::BOTH;
        _last_audio_time = DCPTime ();
 }
 
@@ -280,7 +267,7 @@ void
 Player::playlist_content_change (ChangeType type, int property, bool frequent)
 {
        if (property == VideoContentProperty::CROP) {
-               if (type == CHANGE_TYPE_DONE) {
+               if (type == ChangeType::DONE) {
                        dcp::Size const vcs = video_container_size();
                        boost::mutex::scoped_lock lm (_mutex);
                        for (list<pair<shared_ptr<PlayerVideo>, DCPTime> >::const_iterator i = _delay.begin(); i != _delay.end(); ++i) {
@@ -288,17 +275,17 @@ Player::playlist_content_change (ChangeType type, int property, bool frequent)
                        }
                }
        } else {
-               if (type == CHANGE_TYPE_PENDING) {
+               if (type == ChangeType::PENDING) {
                        /* The player content is probably about to change, so we can't carry on
                           until that has happened and we've rebuilt our pieces.  Stop pass()
                           and seek() from working until then.
                        */
                        ++_suspended;
-               } else if (type == CHANGE_TYPE_DONE) {
+               } else if (type == ChangeType::DONE) {
                        /* A change in our content has gone through.  Re-build our pieces. */
                        setup_pieces ();
                        --_suspended;
-               } else if (type == CHANGE_TYPE_CANCELLED) {
+               } else if (type == ChangeType::CANCELLED) {
                        --_suspended;
                }
        }
@@ -309,14 +296,14 @@ Player::playlist_content_change (ChangeType type, int property, bool frequent)
 void
 Player::set_video_container_size (dcp::Size s)
 {
-       Change (CHANGE_TYPE_PENDING, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
+       Change (ChangeType::PENDING, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
 
                if (s == _video_container_size) {
                        lm.unlock ();
-                       Change (CHANGE_TYPE_CANCELLED, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
+                       Change (ChangeType::CANCELLED, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
                        return;
                }
 
@@ -326,13 +313,13 @@ Player::set_video_container_size (dcp::Size s)
                _black_image->make_black ();
        }
 
-       Change (CHANGE_TYPE_DONE, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
+       Change (ChangeType::DONE, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
 }
 
 void
 Player::playlist_change (ChangeType type)
 {
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                setup_pieces ();
        }
        Change (type, PlayerProperty::PLAYLIST, false);
@@ -352,17 +339,17 @@ Player::film_change (ChangeType type, Film::Property p)
                /* Pieces contain a FrameRateChange which contains the DCP frame rate,
                   so we need new pieces here.
                */
-               if (type == CHANGE_TYPE_DONE) {
+               if (type == ChangeType::DONE) {
                        setup_pieces ();
                }
                Change (type, PlayerProperty::FILM_VIDEO_FRAME_RATE, false);
        } else if (p == Film::AUDIO_PROCESSOR) {
-               if (type == CHANGE_TYPE_DONE && _film->audio_processor ()) {
+               if (type == ChangeType::DONE && _film->audio_processor ()) {
                        boost::mutex::scoped_lock lm (_mutex);
                        _audio_processor = _film->audio_processor()->clone (_film->audio_frame_rate ());
                }
        } else if (p == Film::AUDIO_CHANNELS) {
-               if (type == CHANGE_TYPE_DONE) {
+               if (type == ChangeType::DONE) {
                        boost::mutex::scoped_lock lm (_mutex);
                        _audio_merger.clear ();
                }
@@ -372,21 +359,19 @@ Player::film_change (ChangeType type, Film::Property p)
 shared_ptr<PlayerVideo>
 Player::black_player_video_frame (Eyes eyes) const
 {
-       return shared_ptr<PlayerVideo> (
-               new PlayerVideo (
-                       shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)),
-                       Crop (),
-                       optional<double> (),
-                       _video_container_size,
-                       _video_container_size,
-                       eyes,
-                       PART_WHOLE,
-                       PresetColourConversion::all().front().conversion,
-                       VideoRange::FULL,
-                       std::weak_ptr<Content>(),
-                       boost::optional<Frame>(),
-                       false
-               )
+       return std::make_shared<PlayerVideo> (
+               std::make_shared<const RawImageProxy>(_black_image),
+               Crop(),
+               optional<double>(),
+               _video_container_size,
+               _video_container_size,
+               eyes,
+               Part::WHOLE,
+               PresetColourConversion::all().front().conversion,
+               VideoRange::FULL,
+               std::weak_ptr<Content>(),
+               boost::optional<Frame>(),
+               false
        );
 }
 
@@ -411,14 +396,14 @@ DCPTime
 Player::content_video_to_dcp (shared_ptr<const Piece> piece, Frame f) const
 {
        /* See comment in dcp_to_content_video */
-       DCPTime const d = DCPTime::from_frames (f * piece->frc.factor(), piece->frc.dcp) - DCPTime(piece->content->trim_start(), piece->frc);
+       auto const d = DCPTime::from_frames (f * piece->frc.factor(), piece->frc.dcp) - DCPTime(piece->content->trim_start(), piece->frc);
        return d + piece->content->position();
 }
 
 Frame
 Player::dcp_to_resampled_audio (shared_ptr<const Piece> piece, DCPTime t) const
 {
-       DCPTime s = t - piece->content->position ();
+       auto s = t - piece->content->position ();
        s = min (piece->content->length_after_trim(_film), s);
        /* See notes in dcp_to_content_video */
        return max (DCPTime (), DCPTime (piece->content->trim_start (), piece->frc) + s).frames_floor (_film->audio_frame_rate ());
@@ -436,7 +421,7 @@ Player::resampled_audio_to_dcp (shared_ptr<const Piece> piece, Frame f) const
 ContentTime
 Player::dcp_to_content_time (shared_ptr<const Piece> piece, DCPTime t) const
 {
-       DCPTime s = t - piece->content->position ();
+       auto s = t - piece->content->position ();
        s = min (piece->content->length_after_trim(_film), s);
        return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start());
 }
@@ -444,7 +429,7 @@ Player::dcp_to_content_time (shared_ptr<const Piece> piece, DCPTime t) const
 DCPTime
 Player::content_time_to_dcp (shared_ptr<const Piece> piece, ContentTime t) const
 {
-       return max (DCPTime (), DCPTime (t - piece->content->trim_start(), piece->frc) + piece->content->position());
+       return max (DCPTime(), DCPTime(t - piece->content->trim_start(), piece->frc) + piece->content->position());
 }
 
 vector<FontData>
@@ -457,7 +442,7 @@ Player::get_subtitle_fonts ()
                /* XXX: things may go wrong if there are duplicate font IDs
                   with different font files.
                */
-               vector<FontData> f = i->decoder->fonts ();
+               auto f = i->decoder->fonts ();
                copy (f.begin(), f.end(), back_inserter(fonts));
        }
 
@@ -580,11 +565,11 @@ Player::get_reel_assets ()
                                maybe_add_asset (a, k->main_sound(), reel_trim_start, reel_trim_end, from, ffr);
                        }
 
-                       if (j->reference_text (TEXT_OPEN_SUBTITLE)) {
+                       if (j->reference_text (TextType::OPEN_SUBTITLE)) {
                                maybe_add_asset (a, k->main_subtitle(), reel_trim_start, reel_trim_end, from, ffr);
                        }
 
-                       if (j->reference_text (TEXT_CLOSED_CAPTION)) {
+                       if (j->reference_text (TextType::CLOSED_CAPTION)) {
                                for (auto l: k->closed_captions()) {
                                        maybe_add_asset (a, l, reel_trim_start, reel_trim_end, from, ffr);
                                }
@@ -611,7 +596,7 @@ Player::pass ()
 
        if (_playback_length == DCPTime()) {
                /* Special; just give one black frame */
-               emit_video (black_player_video_frame(EYES_BOTH), DCPTime());
+               emit_video (black_player_video_frame(Eyes::BOTH), DCPTime());
                return true;
        }
 
@@ -680,7 +665,7 @@ Player::pass ()
        }
        case BLACK:
                LOG_DEBUG_PLAYER ("Emit black for gap at %1", to_string(_black.position()));
-               emit_video (black_player_video_frame(EYES_BOTH), _black.position());
+               emit_video (black_player_video_frame(Eyes::BOTH), _black.position());
                _black.set_position (_black.position() + one_video_frame());
                break;
        case SILENT:
@@ -766,7 +751,7 @@ Player::open_subtitles_for_frame (DCPTime time) const
 
        for (
                auto j:
-               _active_texts[TEXT_OPEN_SUBTITLE].get_burnt(DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_open_subtitles)
+               _active_texts[static_cast<int>(TextType::OPEN_SUBTITLE)].get_burnt(DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_open_subtitles)
                ) {
 
                /* Bitmap subtitles */
@@ -845,17 +830,17 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                        LastVideoMap::const_iterator last = _last_video.find (wp);
                        if (_film->three_d()) {
                                Eyes fill_to_eyes = video.eyes;
-                               if (fill_to_eyes == EYES_BOTH) {
-                                       fill_to_eyes = EYES_LEFT;
+                               if (fill_to_eyes == Eyes::BOTH) {
+                                       fill_to_eyes = Eyes::LEFT;
                                }
                                if (fill_to == piece->content->end(_film)) {
                                        /* Don't fill after the end of the content */
-                                       fill_to_eyes = EYES_LEFT;
+                                       fill_to_eyes = Eyes::LEFT;
                                }
                                DCPTime j = fill_from;
-                               Eyes eyes = _last_video_eyes.get_value_or(EYES_LEFT);
-                               if (eyes == EYES_BOTH) {
-                                       eyes = EYES_LEFT;
+                               Eyes eyes = _last_video_eyes.get_value_or(Eyes::LEFT);
+                               if (eyes == Eyes::BOTH) {
+                                       eyes = Eyes::LEFT;
                                }
                                while (j < fill_to || eyes != fill_to_eyes) {
                                        if (last != _last_video.end()) {
@@ -867,7 +852,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                                                LOG_DEBUG_PLAYER("Fill using black at %1 in 3D mode", to_string(j));
                                                emit_video (black_player_video_frame(eyes), j);
                                        }
-                                       if (eyes == EYES_RIGHT) {
+                                       if (eyes == Eyes::RIGHT) {
                                                j += one_video_frame();
                                        }
                                        eyes = increment_eyes (eyes);
@@ -877,7 +862,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                                        if (last != _last_video.end()) {
                                                emit_video (last->second, j);
                                        } else {
-                                               emit_video (black_player_video_frame(EYES_BOTH), j);
+                                               emit_video (black_player_video_frame(Eyes::BOTH), j);
                                        }
                                }
                        }
@@ -1014,7 +999,7 @@ Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, C
        ps.bitmap.push_back (BitmapText(image->scale(scaled_size, dcp::YUVToRGB::REC601, image->pixel_format(), true, _fast), subtitle.sub.rectangle));
        DCPTime from (content_time_to_dcp (piece, subtitle.from()));
 
-       _active_texts[text->type()].add_from (wc, ps, from);
+       _active_texts[static_cast<int>(text->type())].add_from (wc, ps, from);
 }
 
 void
@@ -1058,7 +1043,7 @@ Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Co
                ps.add_fonts (text->fonts ());
        }
 
-       _active_texts[text->type()].add_from (wc, ps, from);
+       _active_texts[static_cast<int>(text->type())].add_from (wc, ps, from);
 }
 
 void
@@ -1069,7 +1054,7 @@ Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Conte
                return;
        }
 
-       if (!_active_texts[text->type()].have(wc)) {
+       if (!_active_texts[static_cast<int>(text->type())].have(wc)) {
                return;
        }
 
@@ -1084,9 +1069,9 @@ Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Conte
                return;
        }
 
-       pair<PlayerText, DCPTime> from = _active_texts[text->type()].add_to (wc, dcp_to);
+       pair<PlayerText, DCPTime> from = _active_texts[static_cast<int>(text->type())].add_to (wc, dcp_to);
 
-       bool const always = (text->type() == TEXT_OPEN_SUBTITLE && _always_burn_open_subtitles);
+       bool const always = (text->type() == TextType::OPEN_SUBTITLE && _always_burn_open_subtitles);
        if (text->use() && !always && !text->burn()) {
                Text (from.first, text->type(), text->dcp_track().get_value_or(DCPTextTrack()), DCPTimePeriod (from.second, dcp_to));
        }
@@ -1114,7 +1099,7 @@ Player::seek (DCPTime time, bool accurate)
        }
 
        _audio_merger.clear ();
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                _active_texts[i].clear ();
        }
 
@@ -1139,7 +1124,7 @@ Player::seek (DCPTime time, bool accurate)
 
        if (accurate) {
                _last_video_time = time;
-               _last_video_eyes = EYES_LEFT;
+               _last_video_eyes = Eyes::LEFT;
                _last_audio_time = time;
        } else {
                _last_video_time = optional<DCPTime>();
@@ -1161,7 +1146,7 @@ Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
        */
        _delay.push_back (make_pair (pv, time));
 
-       if (pv->eyes() == EYES_BOTH || pv->eyes() == EYES_RIGHT) {
+       if (pv->eyes() == Eyes::BOTH || pv->eyes() == Eyes::RIGHT) {
                _last_video_time = time + one_video_frame();
        }
        _last_video_eyes = increment_eyes (pv->eyes());
@@ -1178,13 +1163,13 @@ Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
 void
 Player::do_emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
 {
-       if (pv->eyes() == EYES_BOTH || pv->eyes() == EYES_RIGHT) {
-               for (int i = 0; i < TEXT_COUNT; ++i) {
+       if (pv->eyes() == Eyes::BOTH || pv->eyes() == Eyes::RIGHT) {
+               for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                        _active_texts[i].clear_before (time);
                }
        }
 
-       optional<PositionImage> subtitles = open_subtitles_for_frame (time);
+       auto subtitles = open_subtitles_for_frame (time);
        if (subtitles) {
                pv->set_text (subtitles.get ());
        }
@@ -1250,14 +1235,14 @@ Player::discard_audio (shared_ptr<const AudioBuffers> audio, DCPTime time, DCPTi
 void
 Player::set_dcp_decode_reduction (optional<int> reduction)
 {
-       Change (CHANGE_TYPE_PENDING, PlayerProperty::DCP_DECODE_REDUCTION, false);
+       Change (ChangeType::PENDING, PlayerProperty::DCP_DECODE_REDUCTION, false);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
 
                if (reduction == _dcp_decode_reduction) {
                        lm.unlock ();
-                       Change (CHANGE_TYPE_CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
+                       Change (ChangeType::CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
                        return;
                }
 
@@ -1265,7 +1250,7 @@ Player::set_dcp_decode_reduction (optional<int> reduction)
                setup_pieces_unlocked ();
        }
 
-       Change (CHANGE_TYPE_DONE, PlayerProperty::DCP_DECODE_REDUCTION, false);
+       Change (ChangeType::DONE, PlayerProperty::DCP_DECODE_REDUCTION, false);
 }
 
 optional<DCPTime>
@@ -1280,7 +1265,7 @@ Player::content_time_to_dcp (shared_ptr<Content> content, ContentTime t)
        }
 
        /* We couldn't find this content; perhaps things are being changed over */
-       return optional<DCPTime>();
+       return {};
 }
 
 
index 48ed568dad99d445b8e871837489eedabdf50347..0b0c9facdf4eeaa2184034f18196d54f9d074565 100644 (file)
@@ -171,17 +171,17 @@ private:
        std::shared_ptr<Image> _black_image;
 
        /** true if the player should ignore all video; i.e. never produce any */
-       bool _ignore_video;
-       bool _ignore_audio;
+       bool _ignore_video = false;
+       bool _ignore_audio = false;
        /** true if the player should ignore all text; i.e. never produce any */
-       bool _ignore_text;
-       bool _always_burn_open_subtitles;
+       bool _ignore_text = false;
+       bool _always_burn_open_subtitles = false;
        /** true if we should try to be fast rather than high quality */
-       bool _fast;
+       bool _fast = false;
        /** true if we should keep going in the face of `survivable' errors */
-       bool _tolerant;
+       bool _tolerant = false;
        /** true if we should `play' (i.e output) referenced DCP data (e.g. for preview) */
-       bool _play_referenced;
+       bool _play_referenced = false;
 
        /** Time just after the last video frame we emitted, or the time of the last accurate seek */
        boost::optional<dcpomatic::DCPTime> _last_video_time;
@@ -195,7 +195,7 @@ private:
        LastVideoMap _last_video;
 
        AudioMerger _audio_merger;
-       Shuffler* _shuffler;
+       Shuffler* _shuffler = nullptr;
        std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _delay;
 
        class StreamState
@@ -216,7 +216,7 @@ private:
        Empty _black;
        Empty _silent;
 
-       ActiveText _active_texts[TEXT_COUNT];
+       ActiveText _active_texts[static_cast<int>(TextType::COUNT)];
        std::shared_ptr<AudioProcessor> _audio_processor;
 
        dcpomatic::DCPTime _playback_length;
index ce552f20fb78a780a820f47acad2b3f66d60b760..f91b990c8b1d32c8df8ac723ddc820dac71da0c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
-#include "player_video.h"
 #include "content.h"
-#include "video_content.h"
+#include "film.h"
 #include "image.h"
 #include "image_proxy.h"
 #include "j2k_image_proxy.h"
-#include "film.h"
 #include "player.h"
+#include "player_video.h"
+#include "video_content.h"
 #include <dcp/raw_convert.h>
 extern "C" {
 #include <libavutil/pixfmt.h>
@@ -33,12 +33,13 @@ extern "C" {
 #include <libxml++/libxml++.h>
 #include <iostream>
 
-using std::string;
 using std::cout;
+using std::dynamic_pointer_cast;
+using std::make_shared;
 using std::pair;
 using std::shared_ptr;
+using std::string;
 using std::weak_ptr;
-using std::dynamic_pointer_cast;
 using boost::optional;
 using boost::function;
 using dcp::Data;
@@ -81,25 +82,25 @@ PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket
 
        _inter_size = dcp::Size (node->number_child<int> ("InterWidth"), node->number_child<int> ("InterHeight"));
        _out_size = dcp::Size (node->number_child<int> ("OutWidth"), node->number_child<int> ("OutHeight"));
-       _eyes = (Eyes) node->number_child<int> ("Eyes");
-       _part = (Part) node->number_child<int> ("Part");
-       _video_range = (VideoRange) node->number_child<int>("VideoRange");
+       _eyes = static_cast<Eyes>(node->number_child<int>("Eyes"));
+       _part = static_cast<Part>(node->number_child<int>("Part"));
+       _video_range = static_cast<VideoRange>(node->number_child<int>("VideoRange"));
        _error = node->optional_bool_child("Error").get_value_or (false);
 
        /* Assume that the ColourConversion uses the current state version */
        _colour_conversion = ColourConversion::from_xml (node, Film::current_state_version);
 
-       _in = image_proxy_factory (node->node_child ("In"), socket);
+       _in = image_proxy_factory (node->node_child("In"), socket);
 
-       if (node->optional_number_child<int> ("SubtitleX")) {
+       if (node->optional_number_child<int>("SubtitleX")) {
 
-               shared_ptr<Image> image (
-                       new Image (AV_PIX_FMT_BGRA, dcp::Size (node->number_child<int> ("SubtitleWidth"), node->number_child<int> ("SubtitleHeight")), true)
+               auto image = make_shared<Image> (
+                       AV_PIX_FMT_BGRA, dcp::Size(node->number_child<int>("SubtitleWidth"), node->number_child<int>("SubtitleHeight")), true
                        );
 
                image->read_from_socket (socket);
 
-               _text = PositionImage (image, Position<int> (node->number_child<int> ("SubtitleX"), node->number_child<int> ("SubtitleY")));
+               _text = PositionImage (image, Position<int>(node->number_child<int>("SubtitleX"), node->number_child<int>("SubtitleY")));
        }
 }
 
@@ -136,21 +137,21 @@ PlayerVideo::make_image (function<AVPixelFormat (AVPixelFormat)> pixel_format, V
        _image_out_size = _out_size;
        _image_fade = _fade;
 
-       ImageProxy::Result prox = _in->image (_inter_size);
+       auto prox = _in->image (_inter_size);
        _error = prox.error;
 
-       Crop total_crop = _crop;
+       auto total_crop = _crop;
        switch (_part) {
-       case PART_LEFT_HALF:
+       case Part::LEFT_HALF:
                total_crop.right += prox.image->size().width / 2;
                break;
-       case PART_RIGHT_HALF:
+       case Part::RIGHT_HALF:
                total_crop.left += prox.image->size().width / 2;
                break;
-       case PART_TOP_HALF:
+       case Part::TOP_HALF:
                total_crop.bottom += prox.image->size().height / 2;
                break;
-       case PART_BOTTOM_HALF:
+       case Part::BOTTOM_HALF:
                total_crop.top += prox.image->size().height / 2;
                break;
        default:
@@ -225,18 +226,18 @@ PlayerVideo::has_j2k () const
 {
        /* XXX: maybe other things */
 
-       shared_ptr<const J2KImageProxy> j2k = dynamic_pointer_cast<const J2KImageProxy> (_in);
+       auto j2k = dynamic_pointer_cast<const J2KImageProxy> (_in);
        if (!j2k) {
                return false;
        }
 
-       return _crop == Crop () && _out_size == j2k->size() && !_text && !_fade && !_colour_conversion;
+       return _crop == Crop() && _out_size == j2k->size() && !_text && !_fade && !_colour_conversion;
 }
 
 shared_ptr<const dcp::Data>
 PlayerVideo::j2k () const
 {
-       shared_ptr<const J2KImageProxy> j2k = dynamic_pointer_cast<const J2KImageProxy> (_in);
+       auto j2k = dynamic_pointer_cast<const J2KImageProxy> (_in);
        DCPOMATIC_ASSERT (j2k);
        return j2k->j2k ();
 }
@@ -309,21 +310,19 @@ PlayerVideo::memory_used () const
 shared_ptr<PlayerVideo>
 PlayerVideo::shallow_copy () const
 {
-       return shared_ptr<PlayerVideo>(
-               new PlayerVideo(
-                       _in,
-                       _crop,
-                       _fade,
-                       _inter_size,
-                       _out_size,
-                       _eyes,
-                       _part,
-                       _colour_conversion,
-                       _video_range,
-                       _content,
-                       _video_frame,
-                       _error
-                       )
+       return std::make_shared<PlayerVideo>(
+               _in,
+               _crop,
+               _fade,
+               _inter_size,
+               _out_size,
+               _eyes,
+               _part,
+               _colour_conversion,
+               _video_range,
+               _content,
+               _video_frame,
+               _error
                );
 }
 
@@ -333,7 +332,7 @@ PlayerVideo::shallow_copy () const
 bool
 PlayerVideo::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
 {
-       shared_ptr<Content> content = _content.lock();
+       auto content = _content.lock();
        if (!content || !_video_frame) {
                return false;
        }
index ab7649be151f5e3dd1834bf6b3c84c61712d9ae1..20534e467778b58246e87cb0ec5ab12033cfc09a 100644 (file)
@@ -72,10 +72,10 @@ Playlist::~Playlist ()
 void
 Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ptr<Content> content, int property, bool frequent)
 {
-       shared_ptr<const Film> film = weak_film.lock ();
+       auto film = weak_film.lock ();
        DCPOMATIC_ASSERT (film);
 
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                if (
                        property == ContentProperty::TRIM_START ||
                        property == ContentProperty::TRIM_END ||
@@ -142,7 +142,7 @@ Playlist::maybe_sequence (shared_ptr<const Film> film)
                        continue;
                }
 
-               if (i->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
+               if (i->video->frame_type() == VideoFrameType::THREE_D_RIGHT) {
                        i->set_position (film, next_right);
                        next_right = i->end(film);
                } else {
@@ -204,10 +204,10 @@ Playlist::set_from_xml (shared_ptr<const Film> film, cxml::ConstNodePtr node, in
        boost::mutex::scoped_lock lm (_mutex);
 
        for (auto i: node->node_children ("Content")) {
-               shared_ptr<Content> content = content_factory (i, version, notes);
+               auto content = content_factory (i, version, notes);
 
                /* See if this content should be nudged to start on a video frame */
-               DCPTime const old_pos = content->position();
+               auto const old_pos = content->position();
                content->set_position(film, old_pos);
                if (old_pos != content->position()) {
                        string note = _("Your project contains video content that was not aligned to a frame boundary.");
@@ -269,7 +269,7 @@ Playlist::as_xml (xmlpp::Node* node, bool with_content_paths)
 void
 Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c)
 {
-       Change (CHANGE_TYPE_PENDING);
+       Change (ChangeType::PENDING);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -278,7 +278,7 @@ Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c)
                reconnect (film);
        }
 
-       Change (CHANGE_TYPE_DONE);
+       Change (ChangeType::DONE);
 
        LengthChange ();
 }
@@ -286,14 +286,14 @@ Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c)
 void
 Playlist::remove (shared_ptr<Content> c)
 {
-       Change (CHANGE_TYPE_PENDING);
+       Change (ChangeType::PENDING);
 
        bool cancelled = false;
 
        {
                boost::mutex::scoped_lock lm (_mutex);
 
-               ContentList::iterator i = _content.begin ();
+               auto i = _content.begin ();
                while (i != _content.end() && *i != c) {
                        ++i;
                }
@@ -306,9 +306,9 @@ Playlist::remove (shared_ptr<Content> c)
        }
 
        if (cancelled) {
-               Change (CHANGE_TYPE_CANCELLED);
+               Change (ChangeType::CANCELLED);
        } else {
-               Change (CHANGE_TYPE_DONE);
+               Change (ChangeType::DONE);
        }
 
        /* This won't change order, so it does not need a sort */
@@ -319,7 +319,7 @@ Playlist::remove (shared_ptr<Content> c)
 void
 Playlist::remove (ContentList c)
 {
-       Change (CHANGE_TYPE_PENDING);
+       Change (ChangeType::PENDING);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -336,7 +336,7 @@ Playlist::remove (ContentList c)
                }
        }
 
-       Change (CHANGE_TYPE_DONE);
+       Change (ChangeType::DONE);
 
        /* This won't change order, so it does not need a sort */
 
@@ -359,7 +359,7 @@ public:
 int
 Playlist::best_video_frame_rate () const
 {
-       list<int> const allowed_dcp_frame_rates = Config::instance()->allowed_dcp_frame_rates ();
+       auto const allowed_dcp_frame_rates = Config::instance()->allowed_dcp_frame_rates ();
 
        /* Work out what rates we could manage, including those achieved by using skip / repeat */
        list<FrameRateCandidate> candidates;
@@ -378,7 +378,7 @@ Playlist::best_video_frame_rate () const
        /* Pick the best one */
        float error = std::numeric_limits<float>::max ();
        optional<FrameRateCandidate> best;
-       list<FrameRateCandidate>::iterator i = candidates.begin();
+       auto i = candidates.begin();
        while (i != candidates.end()) {
 
                float this_error = 0;
@@ -428,12 +428,12 @@ Playlist::length (shared_ptr<const Film> film) const
 optional<DCPTime>
 Playlist::start () const
 {
-       ContentList cont = content ();
+       auto cont = content ();
        if (cont.empty()) {
-               return optional<DCPTime> ();
+               return {};
        }
 
-       DCPTime start = DCPTime::max ();
+       auto start = DCPTime::max ();
        for (auto i: cont) {
                start = min (start, i->position ());
        }
@@ -558,7 +558,7 @@ Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n)
                range.second = max (range.second, i->end(film));
        }
 
-       Change (CHANGE_TYPE_PENDING);
+       Change (ChangeType::PENDING);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -566,7 +566,7 @@ Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n)
                DCPTime pos = range.second;
                for (int i = 0; i < n; ++i) {
                        for (auto j: c) {
-                               shared_ptr<Content> copy = j->clone ();
+                               auto copy = j->clone ();
                                copy->set_position (film, pos + copy->position() - range.first);
                                _content.push_back (copy);
                        }
@@ -577,15 +577,15 @@ Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n)
                reconnect (film);
        }
 
-       Change (CHANGE_TYPE_DONE);
+       Change (ChangeType::DONE);
 }
 
 void
 Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c)
 {
-       ContentList cont = content ();
-       ContentList::iterator previous = cont.end();
-       ContentList::iterator i = cont.begin();
+       auto cont = content ();
+       auto previous = cont.end();
+       auto i = cont.begin();
        while (i != cont.end() && *i != c) {
                previous = i;
                ++i;
@@ -596,9 +596,9 @@ Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c)
                return;
        }
 
-       shared_ptr<Content> previous_c = *previous;
+       auto previous_c = *previous;
 
-       DCPTime const p = previous_c->position ();
+       auto const p = previous_c->position ();
        previous_c->set_position (film, p + c->length_after_trim(film));
        c->set_position (film, p);
 }
@@ -606,8 +606,8 @@ Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c)
 void
 Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c)
 {
-       ContentList cont = content ();
-       ContentList::iterator i = cont.begin();
+       auto cont = content ();
+       auto i = cont.begin();
        while (i != cont.end() && *i != c) {
                ++i;
        }
@@ -621,7 +621,7 @@ Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c)
                return;
        }
 
-       shared_ptr<Content> next_c = *next;
+       auto next_c = *next;
 
        next_c->set_position (film, c->position());
        c->set_position (film, c->position() + next_c->length_after_trim(film));
@@ -634,7 +634,7 @@ Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, i
        int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length(film).seconds();
 
        for (auto i: content()) {
-               shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (i);
+               auto d = dynamic_pointer_cast<DCPContent> (i);
                if (d) {
                        if (d->reference_video()) {
                                video -= uint64_t (j2k_bandwidth / 8) * d->length_after_trim(film).seconds();
@@ -656,7 +656,7 @@ Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) co
        int best_score = -1;
        for (auto i: content()) {
                int score = 0;
-               optional<DCPTimePeriod> const o = DCPTimePeriod(i->position(), i->end(film)).overlap (period);
+               auto const o = DCPTimePeriod(i->position(), i->end(film)).overlap (period);
                if (o) {
                        score += 100 * o.get().duration().get() / period.duration().get();
                }
index 1d2ec557fd15907f86016b46578885246657e7cc..4888a1567d5150b145c235c90dd6024c6094410c 100644 (file)
@@ -80,7 +80,7 @@ static dcp::MXFMetadata
 mxf_metadata ()
 {
        dcp::MXFMetadata meta;
-       Config* config = Config::instance();
+       auto config = Config::instance();
        if (!config->dcp_company_name().empty()) {
                meta.company_name = config->dcp_company_name ();
        }
@@ -114,7 +114,7 @@ ReelWriter::ReelWriter (
           output.  We will hard-link it into the DCP later.
        */
 
-       dcp::Standard const standard = film()->interop() ? dcp::Standard::INTEROP : dcp::Standard::SMPTE;
+       auto const standard = film()->interop() ? dcp::Standard::INTEROP : dcp::Standard::SMPTE;
 
        boost::filesystem::path const asset =
                film()->internal_video_asset_dir() / film()->internal_video_asset_filename(_period);
@@ -159,15 +159,15 @@ ReelWriter::ReelWriter (
                /* We already have a complete picture asset that we can just re-use */
                /* XXX: what about if the encryption key changes? */
                if (film()->three_d()) {
-                       _picture_asset.reset (new dcp::StereoPictureAsset(asset));
+                       _picture_asset = make_shared<dcp::StereoPictureAsset>(asset);
                } else {
-                       _picture_asset.reset (new dcp::MonoPictureAsset(asset));
+                       _picture_asset = make_shared<dcp::MonoPictureAsset>(asset);
                }
        }
 
        if (film()->audio_channels()) {
-               _sound_asset.reset (
-                       new dcp::SoundAsset (dcp::Fraction(film()->video_frame_rate(), 1), film()->audio_frame_rate(), film()->audio_channels(), film()->audio_language(), standard)
+               _sound_asset = make_shared<dcp::SoundAsset> (
+                       dcp::Fraction(film()->video_frame_rate(), 1), film()->audio_frame_rate(), film()->audio_channels(), film()->audio_language(), standard
                        );
 
                _sound_asset->set_metadata (mxf_metadata());
@@ -200,7 +200,7 @@ ReelWriter::ReelWriter (
 void
 ReelWriter::write_frame_info (Frame frame, Eyes eyes, dcp::FrameInfo info) const
 {
-       shared_ptr<InfoFileHandle> handle = film()->info_file_handle(_period, false);
+       auto handle = film()->info_file_handle(_period, false);
        dcpomatic_fseek (handle->get(), frame_info_position(frame, eyes), SEEK_SET);
        checked_fwrite (&info.offset, sizeof(info.offset), handle->get(), handle->file());
        checked_fwrite (&info.size, sizeof (info.size), handle->get(), handle->file());
@@ -227,11 +227,11 @@ long
 ReelWriter::frame_info_position (Frame frame, Eyes eyes) const
 {
        switch (eyes) {
-       case EYES_BOTH:
+       case Eyes::BOTH:
                return frame * _info_size;
-       case EYES_LEFT:
+       case Eyes::LEFT:
                return frame * _info_size * 2;
-       case EYES_RIGHT:
+       case Eyes::RIGHT:
                return frame * _info_size * 2 + _info_size;
        default:
                DCPOMATIC_ASSERT (false);
@@ -243,14 +243,14 @@ ReelWriter::frame_info_position (Frame frame, Eyes eyes) const
 Frame
 ReelWriter::check_existing_picture_asset (boost::filesystem::path asset)
 {
-       shared_ptr<Job> job = _job.lock ();
+       auto job = _job.lock ();
 
        if (job) {
                job->sub (_("Checking existing image data"));
        }
 
        /* Try to open the existing asset */
-       FILE* asset_file = fopen_boost (asset, "rb");
+       auto asset_file = fopen_boost (asset, "rb");
        if (!asset_file) {
                LOG_GENERAL ("Could not open existing asset at %1 (errno=%2)", asset.string(), errno);
                return 0;
@@ -306,9 +306,9 @@ ReelWriter::write (shared_ptr<const Data> encoded, Frame frame, Eyes eyes)
                return;
        }
 
-       dcp::FrameInfo fin = _picture_asset_writer->write (encoded->data(), encoded->size());
+       auto fin = _picture_asset_writer->write (encoded->data(), encoded->size());
        write_frame_info (frame, eyes, fin);
-       _last_written[eyes] = encoded;
+       _last_written[static_cast<int>(eyes)] = encoded;
 }
 
 
@@ -347,9 +347,9 @@ ReelWriter::repeat_write (Frame frame, Eyes eyes)
                return;
        }
 
-       dcp::FrameInfo fin = _picture_asset_writer->write (
-               _last_written[eyes]->data(),
-               _last_written[eyes]->size()
+       auto fin = _picture_asset_writer->write (
+               _last_written[static_cast<int>(eyes)]->data(),
+               _last_written[static_cast<int>(eyes)]->size()
                );
        write_frame_info (frame, eyes, fin);
 }
@@ -383,7 +383,7 @@ ReelWriter::finish (boost::filesystem::path output_dcp)
                boost::filesystem::create_hard_link (video_from, video_to, ec);
                if (ec) {
                        LOG_WARNING_NC ("Hard-link failed; copying instead");
-                       shared_ptr<Job> job = _job.lock ();
+                       auto job = _job.lock ();
                        if (job) {
                                job->sub (_("Copying video file into DCP"));
                                try {
@@ -407,7 +407,7 @@ ReelWriter::finish (boost::filesystem::path output_dcp)
        /* Move the audio asset into the DCP */
        if (_sound_asset) {
                boost::filesystem::path audio_to = output_dcp;
-               string const aaf = audio_asset_filename (_sound_asset, _reel_index, _reel_count, _content_summary);
+               auto const aaf = audio_asset_filename (_sound_asset, _reel_index, _reel_count, _content_summary);
                audio_to /= aaf;
 
                boost::system::error_code ec;
@@ -424,7 +424,7 @@ ReelWriter::finish (boost::filesystem::path output_dcp)
        if (_atmos_asset) {
                _atmos_asset_writer->finalize ();
                boost::filesystem::path atmos_to = output_dcp;
-               string const aaf = atmos_asset_filename (_atmos_asset, _reel_index, _reel_count, _content_summary);
+               auto const aaf = atmos_asset_filename (_atmos_asset, _reel_index, _reel_count, _content_summary);
                atmos_to /= aaf;
 
                boost::system::error_code ec;
@@ -465,7 +465,7 @@ maybe_add_text (
                }
 
                if (dynamic_pointer_cast<dcp::InteropSubtitleAsset> (asset)) {
-                       boost::filesystem::path directory = output_dcp / asset->id ();
+                       auto directory = output_dcp / asset->id ();
                        boost::filesystem::create_directories (directory);
                        asset->write (directory / ("sub_" + asset->id() + ".xml"));
                } else {
@@ -481,18 +481,16 @@ maybe_add_text (
                                );
                }
 
-               reel_asset.reset (
-                       new T (
-                               asset,
-                               dcp::Fraction (film->video_frame_rate(), 1),
-                               picture_duration,
-                               0
-                               )
+               reel_asset = make_shared<T> (
+                       asset,
+                       dcp::Fraction(film->video_frame_rate(), 1),
+                       picture_duration,
+                       0
                        );
        } else {
                /* We don't have a subtitle asset of our own; hopefully we have one to reference */
                for (auto j: refs) {
-                       shared_ptr<T> k = dynamic_pointer_cast<T> (j.asset);
+                       auto k = dynamic_pointer_cast<T> (j.asset);
                        if (k && j.period == period) {
                                reel_asset = k;
                                /* If we have a hash for this asset in the CPL, assume that it is correct */
@@ -524,20 +522,20 @@ ReelWriter::create_reel_picture (shared_ptr<dcp::Reel> reel, list<ReferencedReel
 
        if (_picture_asset) {
                /* We have made a picture asset of our own.  Put it into the reel */
-               shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (_picture_asset);
+               auto mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (_picture_asset);
                if (mono) {
-                       reel_asset.reset (new dcp::ReelMonoPictureAsset (mono, 0));
+                       reel_asset = make_shared<dcp::ReelMonoPictureAsset>(mono, 0);
                }
 
-               shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (_picture_asset);
+               auto stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (_picture_asset);
                if (stereo) {
-                       reel_asset.reset (new dcp::ReelStereoPictureAsset (stereo, 0));
+                       reel_asset = make_shared<dcp::ReelStereoPictureAsset>(stereo, 0);
                }
        } else {
                LOG_GENERAL ("no picture asset of our own; look through %1", refs.size());
                /* We don't have a picture asset of our own; hopefully we have one to reference */
                for (auto j: refs) {
-                       shared_ptr<dcp::ReelPictureAsset> k = dynamic_pointer_cast<dcp::ReelPictureAsset> (j.asset);
+                       auto k = dynamic_pointer_cast<dcp::ReelPictureAsset> (j.asset);
                        if (k) {
                                LOG_GENERAL ("candidate picture asset period is %1-%2", j.period.from.get(), j.period.to.get());
                        }
@@ -574,12 +572,12 @@ ReelWriter::create_reel_sound (shared_ptr<dcp::Reel> reel, list<ReferencedReelAs
 
        if (_sound_asset) {
                /* We have made a sound asset of our own.  Put it into the reel */
-               reel_asset.reset (new dcp::ReelSoundAsset(_sound_asset, 0));
+               reel_asset = make_shared<dcp::ReelSoundAsset>(_sound_asset, 0);
        } else {
                LOG_GENERAL ("no sound asset of our own; look through %1", refs.size());
                /* We don't have a sound asset of our own; hopefully we have one to reference */
                for (auto j: refs) {
-                       shared_ptr<dcp::ReelSoundAsset> k = dynamic_pointer_cast<dcp::ReelSoundAsset> (j.asset);
+                       auto k = dynamic_pointer_cast<dcp::ReelSoundAsset> (j.asset);
                        if (k) {
                                LOG_GENERAL ("candidate sound asset period is %1-%2", j.period.from.get(), j.period.to.get());
                        }
@@ -593,7 +591,7 @@ ReelWriter::create_reel_sound (shared_ptr<dcp::Reel> reel, list<ReferencedReelAs
                }
        }
 
-       Frame const period_duration = _period.duration().frames_round(film()->video_frame_rate());
+       auto const period_duration = _period.duration().frames_round(film()->video_frame_rate());
 
        DCPOMATIC_ASSERT (reel_asset);
        if (reel_asset->actual_duration() != period_duration) {
@@ -625,7 +623,7 @@ ReelWriter::create_reel_text (
        set<DCPTextTrack> ensure_closed_captions
        ) const
 {
-       shared_ptr<dcp::ReelSubtitleAsset> subtitle = maybe_add_text<dcp::ReelSubtitleAsset> (
+       auto subtitle = maybe_add_text<dcp::ReelSubtitleAsset> (
                _subtitle_asset, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
                );
 
@@ -637,7 +635,7 @@ ReelWriter::create_reel_text (
        } else if (ensure_subtitles) {
                /* We had no subtitle asset, but we've been asked to make sure there is one */
                subtitle = maybe_add_text<dcp::ReelSubtitleAsset>(
-                       empty_text_asset(TEXT_OPEN_SUBTITLE, optional<DCPTextTrack>()),
+                       empty_text_asset(TextType::OPEN_SUBTITLE, optional<DCPTextTrack>()),
                        duration,
                        reel,
                        refs,
@@ -650,23 +648,23 @@ ReelWriter::create_reel_text (
                        );
        }
 
-       for (map<DCPTextTrack, shared_ptr<dcp::SubtitleAsset> >::const_iterator i = _closed_caption_assets.begin(); i != _closed_caption_assets.end(); ++i) {
-               shared_ptr<dcp::ReelClosedCaptionAsset> a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
-                       i->second, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
+       for (auto const& i: _closed_caption_assets) {
+               auto a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
+                       i.second, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
                        );
                DCPOMATIC_ASSERT (a);
-               a->set_annotation_text (i->first.name);
-               if (!i->first.language.empty()) {
-                       a->set_language (dcp::LanguageTag(i->first.language));
+               a->set_annotation_text (i.first.name);
+               if (!i.first.language.empty()) {
+                       a->set_language (dcp::LanguageTag(i.first.language));
                }
 
-               ensure_closed_captions.erase (i->first);
+               ensure_closed_captions.erase (i.first);
        }
 
        /* Make empty tracks for anything we've been asked to ensure but that we haven't added */
        for (auto i: ensure_closed_captions) {
-               shared_ptr<dcp::ReelClosedCaptionAsset> a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
-                       empty_text_asset(TEXT_CLOSED_CAPTION, i), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
+               auto a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
+                       empty_text_asset(TextType::CLOSED_CAPTION, i), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
                        );
                DCPOMATIC_ASSERT (a);
                a->set_annotation_text (i.name);
@@ -681,22 +679,22 @@ ReelWriter::create_reel_text (
 void
 ReelWriter::create_reel_markers (shared_ptr<dcp::Reel> reel) const
 {
-       Film::Markers markers = film()->markers();
+       auto markers = film()->markers();
        film()->add_ffoc_lfoc(markers);
        Film::Markers reel_markers;
-       for (Film::Markers::const_iterator i = markers.begin(); i != markers.end(); ++i) {
-               if (_period.contains(i->second)) {
-                       reel_markers[i->first] = i->second;
+       for (auto const& i: markers) {
+               if (_period.contains(i.second)) {
+                       reel_markers[i.first] = i.second;
                }
        }
 
        if (!reel_markers.empty ()) {
                auto ma = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration(), 0);
-               for (map<dcp::Marker, DCPTime>::const_iterator i = reel_markers.begin(); i != reel_markers.end(); ++i) {
+               for (auto const& i: reel_markers) {
                        int h, m, s, f;
-                       DCPTime relative = i->second - _period.from;
+                       DCPTime relative = i.second - _period.from;
                        relative.split (film()->video_frame_rate(), h, m, s, f);
-                       ma->set (i->first, dcp::Time(h, m, s, f, film()->video_frame_rate()));
+                       ma->set (i.first, dcp::Time(h, m, s, f, film()->video_frame_rate()));
                }
                reel->add (ma);
        }
@@ -717,7 +715,7 @@ ReelWriter::create_reel (
 {
        LOG_GENERAL ("create_reel for %1-%2; %3 of %4", _period.from.get(), _period.to.get(), _reel_index, _reel_count);
 
-       shared_ptr<dcp::Reel> reel (new dcp::Reel());
+       auto reel = make_shared<dcp::Reel>();
 
        /* This is a bit of a hack; in the strange `_text_only' mode we have no picture, so we don't know
         * how long the subtitle / CCAP assets should be.  However, since we're only writing them to see
@@ -725,7 +723,7 @@ ReelWriter::create_reel (
         */
        int64_t duration = 0;
        if (!_text_only) {
-               shared_ptr<dcp::ReelPictureAsset> reel_picture_asset = create_reel_picture (reel, refs);
+               auto reel_picture_asset = create_reel_picture (reel, refs);
                duration = reel_picture_asset->actual_duration ();
                create_reel_sound (reel, refs);
                create_reel_markers (reel);
@@ -734,7 +732,7 @@ ReelWriter::create_reel (
        create_reel_text (reel, refs, fonts, duration, output_dcp, ensure_subtitles, ensure_closed_captions);
 
        if (_atmos_asset) {
-               reel->add (shared_ptr<dcp::ReelAtmosAsset>(new dcp::ReelAtmosAsset(_atmos_asset, 0)));
+               reel->add (make_shared<dcp::ReelAtmosAsset>(_atmos_asset, 0));
        }
 
        return reel;
@@ -780,11 +778,11 @@ ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track) const
 {
        shared_ptr<dcp::SubtitleAsset> asset;
 
-       vector<dcp::LanguageTag> lang = film()->subtitle_languages();
+       auto lang = film()->subtitle_languages();
        if (film()->interop()) {
-               shared_ptr<dcp::InteropSubtitleAsset> s (new dcp::InteropSubtitleAsset ());
+               auto s = make_shared<dcp::InteropSubtitleAsset>();
                s->set_movie_title (film()->name());
-               if (type == TEXT_OPEN_SUBTITLE) {
+               if (type == TextType::OPEN_SUBTITLE) {
                        s->set_language (lang.empty() ? "Unknown" : lang.front().to_string());
                } else if (!track->language.empty()) {
                        s->set_language (track->language);
@@ -795,7 +793,7 @@ ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track) const
                shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset ());
                s->set_content_title_text (film()->name());
                s->set_metadata (mxf_metadata());
-               if (type == TEXT_OPEN_SUBTITLE && !lang.empty()) {
+               if (type == TextType::OPEN_SUBTITLE && !lang.empty()) {
                        s->set_language (lang.front());
                } else if (track && !track->language.empty()) {
                        s->set_language (dcp::LanguageTag(track->language));
@@ -820,10 +818,10 @@ ReelWriter::write (PlayerText subs, TextType type, optional<DCPTextTrack> track,
        shared_ptr<dcp::SubtitleAsset> asset;
 
        switch (type) {
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                asset = _subtitle_asset;
                break;
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                DCPOMATIC_ASSERT (track);
                asset = _closed_caption_assets[*track];
                break;
@@ -836,10 +834,10 @@ ReelWriter::write (PlayerText subs, TextType type, optional<DCPTextTrack> track,
        }
 
        switch (type) {
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                _subtitle_asset = asset;
                break;
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                DCPOMATIC_ASSERT (track);
                _closed_caption_assets[*track] = asset;
                break;
@@ -856,14 +854,12 @@ ReelWriter::write (PlayerText subs, TextType type, optional<DCPTextTrack> track,
 
        for (auto i: subs.bitmap) {
                asset->add (
-                       shared_ptr<dcp::Subtitle>(
-                               new dcp::SubtitleImage(
-                                       i.image->as_png(),
-                                       dcp::Time(period.from.seconds() - _period.from.seconds(), film()->video_frame_rate()),
-                                       dcp::Time(period.to.seconds() - _period.from.seconds(), film()->video_frame_rate()),
-                                       i.rectangle.x, dcp::HAlign::LEFT, i.rectangle.y, dcp::VAlign::TOP,
-                                       dcp::Time(), dcp::Time()
-                                       )
+                       make_shared<dcp::SubtitleImage>(
+                               i.image->as_png(),
+                               dcp::Time(period.from.seconds() - _period.from.seconds(), film()->video_frame_rate()),
+                               dcp::Time(period.to.seconds() - _period.from.seconds(), film()->video_frame_rate()),
+                               i.rectangle.x, dcp::HAlign::LEFT, i.rectangle.y, dcp::VAlign::TOP,
+                               dcp::Time(), dcp::Time()
                                )
                        );
        }
@@ -877,7 +873,7 @@ ReelWriter::existing_picture_frame_ok (FILE* asset_file, shared_ptr<InfoFileHand
        /* Read the data from the info file; for 3D we just check the left
           frames until we find a good one.
        */
-       dcp::FrameInfo const info = read_frame_info (info_file, frame, film()->three_d() ? EYES_LEFT : EYES_BOTH);
+       auto const info = read_frame_info (info_file, frame, film()->three_d() ? Eyes::LEFT : Eyes::BOTH);
 
        bool ok = true;
 
index 019917abc9a3f3a8095975e6e61528bf082cb33f..5eb0e1b08215c1e2aa87358bd67e6b9ee0ee99a5 100644 (file)
@@ -122,7 +122,7 @@ private:
        /** the first picture frame index that does not already exist in our MXF */
        int _first_nonexistant_frame;
        /** the data of the last written frame, if there is one */
-       std::shared_ptr<const dcp::Data> _last_written[EYES_COUNT];
+       std::shared_ptr<const dcp::Data> _last_written[static_cast<int>(Eyes::COUNT)];
        /** index of this reel within the DCP (starting from 0) */
        int _reel_index;
        /** number of reels in the DCP */
index cff1c8e9f873ad179816a31d013c116b1a9b4135..7f60a3fdc2e8e91239a2ff92753a31e621af3ecd 100644 (file)
@@ -80,7 +80,7 @@ SendProblemReportJob::run ()
 
        string body = _summary + "\n\n";
 
-       body += "Version: " + string (dcpomatic_version) + " " + string (dcpomatic_git_commit) + "\n\n";
+       body += "Version: " + string(dcpomatic_version) + " " + string(dcpomatic_git_commit) + "\n\n";
 
        for (auto i: environment_info ()) {
                body += i + "\n";
@@ -101,11 +101,8 @@ SendProblemReportJob::run ()
                body += "---<8----\n";
        }
 
-       list<string> to;
-       to.push_back ("carl@dcpomatic.com");
-
-       Emailer emailer (_from, to, "DCP-o-matic problem report", body);
-       emailer.send ("main.carlh.net", 2525, EMAIL_PROTOCOL_STARTTLS);
+       Emailer emailer (_from, {"carl@dcpomatic.com"}, "DCP-o-matic problem report", body);
+       emailer.send ("main.carlh.net", 2525, EmailProtocol::STARTTLS);
 
        set_progress (1);
        set_state (FINISHED_OK);
index 2b3c5ba84c4c72da4a1687b3ec60201dece1c95c..a13e7f6de82c7f539f673f1e5dd9970a6a64141a 100644 (file)
@@ -48,7 +48,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
 {
        LOG_DEBUG_THREE_D ("Shuffler::video frame=%1 eyes=%2 part=%3", video.frame, static_cast<int>(video.eyes), static_cast<int>(video.part));
 
-       if (video.eyes != EYES_LEFT && video.eyes != EYES_RIGHT) {
+       if (video.eyes != Eyes::LEFT && video.eyes != Eyes::RIGHT) {
                /* Pass through anything that we don't care about */
                Video (weak_piece, video);
                return;
@@ -57,7 +57,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
        shared_ptr<Piece> piece = weak_piece.lock ();
        DCPOMATIC_ASSERT (piece);
 
-       if (!_last && video.eyes == EYES_LEFT) {
+       if (!_last && video.eyes == Eyes::LEFT) {
                LOG_DEBUG_THREE_D_NC ("Shuffler first after clear");
                /* We haven't seen anything since the last clear() and we have some eyes-left so assume everything is OK */
                Video (weak_piece, video);
@@ -74,8 +74,8 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
                        !_store.empty() &&
                        _last &&
                        (
-                               (_store.front().second.frame == _last->frame       && _store.front().second.eyes == EYES_RIGHT && _last->eyes == EYES_LEFT) ||
-                               (_store.front().second.frame >= (_last->frame + 1) && _store.front().second.eyes == EYES_LEFT  && _last->eyes == EYES_RIGHT)
+                               (_store.front().second.frame == _last->frame       && _store.front().second.eyes == Eyes::RIGHT && _last->eyes == Eyes::LEFT) ||
+                               (_store.front().second.frame >= (_last->frame + 1) && _store.front().second.eyes == Eyes::LEFT  && _last->eyes == Eyes::RIGHT)
                                );
 
                if (!store_front_in_sequence) {
index 2bf41611073025390db4f28ecc25d422cb68e396..01e0fe60ff490450b3e30a950f640020f4ce22dd 100644 (file)
@@ -33,6 +33,7 @@
 using std::string;
 using std::cout;
 using std::shared_ptr;
+using std::make_shared;
 using boost::optional;
 using dcp::raw_convert;
 using namespace dcpomatic;
@@ -40,7 +41,7 @@ using namespace dcpomatic;
 StringTextFileContent::StringTextFileContent (boost::filesystem::path path)
        : Content (path)
 {
-       text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
+       text.push_back (shared_ptr<TextContent> (new TextContent (this, TextType::OPEN_SUBTITLE, TextType::UNKNOWN)));
 }
 
 StringTextFileContent::StringTextFileContent (cxml::ConstNodePtr node, int version)
@@ -61,7 +62,7 @@ StringTextFileContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job
 
        boost::mutex::scoped_lock lm (_mutex);
        _length = s.length ();
-       only_text()->add_font (shared_ptr<Font> (new Font (TEXT_FONT_ID)));
+       only_text()->add_font (make_shared<Font>(TEXT_FONT_ID));
 }
 
 string
index cc42f1204e78c860b21e0ba623b494def2ed3124..3721ee02b5835c9d8021fbb5aa500dc48ddf821a 100644 (file)
 
 #include "i18n.h"
 
-using std::string;
 using std::make_pair;
+using std::make_shared;
 using std::pair;
-using std::vector;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -128,7 +129,7 @@ SubtitleEncoder::go ()
 void
 SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period)
 {
-       if (type != TEXT_OPEN_SUBTITLE) {
+       if (type != TextType::OPEN_SUBTITLE) {
                return;
        }
 
@@ -136,7 +137,7 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> tr
                shared_ptr<dcp::SubtitleAsset> asset;
                vector<dcp::LanguageTag> lang = _film->subtitle_languages ();
                if (_film->interop ()) {
-                       shared_ptr<dcp::InteropSubtitleAsset> s (new dcp::InteropSubtitleAsset());
+                       auto s = make_shared<dcp::InteropSubtitleAsset>();
                        s->set_movie_title (_film->name());
                        if (!lang.empty()) {
                                s->set_language (lang.front().to_string());
@@ -144,7 +145,7 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> tr
                        s->set_reel_number (raw_convert<string>(_reel_index + 1));
                        _assets[_reel_index].first = s;
                } else {
-                       shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset());
+                       auto s = make_shared<dcp::SMPTESubtitleAsset>();
                        s->set_content_title_text (_film->name());
                        if (!lang.empty()) {
                                s->set_language (lang.front());
index 86fd85b68b8da47e08c218f249c353665605ddda..79ac42f43b25f7eb732d1925b71f37a8a016e525 100644 (file)
@@ -120,10 +120,10 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version)
        , _y_offset (0)
        , _x_scale (1)
        , _y_scale (1)
-       , _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or (1))
-       , _outline_width (node->optional_number_child<int>("OutlineWidth").get_value_or (4))
-       , _type (TEXT_OPEN_SUBTITLE)
-       , _original_type (TEXT_OPEN_SUBTITLE)
+       , _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or(1))
+       , _outline_width (node->optional_number_child<int>("OutlineWidth").get_value_or(4))
+       , _type (TextType::OPEN_SUBTITLE)
+       , _original_type (TextType::OPEN_SUBTITLE)
 {
        if (version >= 37) {
                _use = node->bool_child ("Use");
index 840ee3aa8b5608fb9ff946f04efdffa22c4f6eb9..3586cdb935b67bc065a55a99592611967eb13706 100644 (file)
@@ -59,9 +59,9 @@ string
 resolution_to_string (Resolution r)
 {
        switch (r) {
-       case RESOLUTION_2K:
+       case Resolution::TWO_K:
                return "2K";
-       case RESOLUTION_4K:
+       case Resolution::FOUR_K:
                return "4K";
        }
 
@@ -74,15 +74,15 @@ Resolution
 string_to_resolution (string s)
 {
        if (s == "2K") {
-               return RESOLUTION_2K;
+               return Resolution::TWO_K;
        }
 
        if (s == "4K") {
-               return RESOLUTION_4K;
+               return Resolution::FOUR_K;
        }
 
        DCPOMATIC_ASSERT (false);
-       return RESOLUTION_2K;
+       return Resolution::TWO_K;
 }
 
 Crop::Crop (shared_ptr<cxml::Node> node)
@@ -106,11 +106,11 @@ TextType
 string_to_text_type (string s)
 {
        if (s == "unknown") {
-               return TEXT_UNKNOWN;
+               return TextType::UNKNOWN;
        } else if (s == "open-subtitle") {
-               return TEXT_OPEN_SUBTITLE;
+               return TextType::OPEN_SUBTITLE;
        } else if (s == "closed-caption") {
-               return TEXT_CLOSED_CAPTION;
+               return TextType::CLOSED_CAPTION;
        } else {
                throw MetadataError (String::compose ("Unknown text type %1", s));
        }
@@ -120,11 +120,11 @@ string
 text_type_to_string (TextType t)
 {
        switch (t) {
-       case TEXT_UNKNOWN:
+       case TextType::UNKNOWN:
                return "unknown";
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                return "open-subtitle";
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                return "closed-caption";
        default:
                DCPOMATIC_ASSERT (false);
@@ -135,11 +135,11 @@ string
 text_type_to_name (TextType t)
 {
        switch (t) {
-       case TEXT_UNKNOWN:
+       case TextType::UNKNOWN:
                return _("Timed text");
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                return _("Open subtitles");
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                return _("Closed captions");
        default:
                DCPOMATIC_ASSERT (false);
@@ -150,19 +150,19 @@ string
 video_frame_type_to_string (VideoFrameType t)
 {
        switch (t) {
-       case VIDEO_FRAME_TYPE_2D:
+       case VideoFrameType::TWO_D:
                return "2d";
-       case VIDEO_FRAME_TYPE_3D:
+       case VideoFrameType::THREE_D:
                return "3d";
-       case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+       case VideoFrameType::THREE_D_LEFT_RIGHT:
                return "3d-left-right";
-       case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
+       case VideoFrameType::THREE_D_TOP_BOTTOM:
                return "3d-top-bottom";
-       case VIDEO_FRAME_TYPE_3D_ALTERNATE:
+       case VideoFrameType::THREE_D_ALTERNATE:
                return "3d-alternate";
-       case VIDEO_FRAME_TYPE_3D_LEFT:
+       case VideoFrameType::THREE_D_LEFT:
                return "3d-left";
-       case VIDEO_FRAME_TYPE_3D_RIGHT:
+       case VideoFrameType::THREE_D_RIGHT:
                return "3d-right";
        default:
                DCPOMATIC_ASSERT (false);
@@ -175,19 +175,19 @@ VideoFrameType
 string_to_video_frame_type (string s)
 {
        if (s == "2d") {
-               return VIDEO_FRAME_TYPE_2D;
+               return VideoFrameType::TWO_D;
        } else if (s == "3d") {
-               return VIDEO_FRAME_TYPE_3D;
+               return VideoFrameType::THREE_D;
        } else if (s == "3d-left-right") {
-               return VIDEO_FRAME_TYPE_3D_LEFT_RIGHT;
+               return VideoFrameType::THREE_D_LEFT_RIGHT;
        } else if (s == "3d-top-bottom") {
-               return VIDEO_FRAME_TYPE_3D_TOP_BOTTOM;
+               return VideoFrameType::THREE_D_TOP_BOTTOM;
        } else if (s == "3d-alternate") {
-               return VIDEO_FRAME_TYPE_3D_ALTERNATE;
+               return VideoFrameType::THREE_D_ALTERNATE;
        } else if (s == "3d-left") {
-               return VIDEO_FRAME_TYPE_3D_LEFT;
+               return VideoFrameType::THREE_D_LEFT;
        } else if (s == "3d-right") {
-               return VIDEO_FRAME_TYPE_3D_RIGHT;
+               return VideoFrameType::THREE_D_RIGHT;
        }
 
        DCPOMATIC_ASSERT (false);
index 4569cfd9a6d25b58c6b55409bb6daeb5829119f8..3cd8768e80f180f50fbf5e06a91467fd195aed5a 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.
 
@@ -85,57 +85,57 @@ namespace xmlpp {
 /** Port on which player listens for play requests */
 #define PLAYER_PLAY_PORT (Config::instance()->server_port_base()+5)
 
-typedef std::vector<std::shared_ptr<Content> > ContentList;
-typedef std::vector<std::shared_ptr<FFmpegContent> > FFmpegContentList;
+typedef std::vector<std::shared_ptr<Content>> ContentList;
+typedef std::vector<std::shared_ptr<FFmpegContent>> FFmpegContentList;
 
 typedef int64_t Frame;
 
-enum VideoFrameType
+enum class VideoFrameType
 {
-       VIDEO_FRAME_TYPE_2D,
+       TWO_D,
        /** `True' 3D content, e.g. 3D DCPs */
-       VIDEO_FRAME_TYPE_3D,
-       VIDEO_FRAME_TYPE_3D_LEFT_RIGHT,
-       VIDEO_FRAME_TYPE_3D_TOP_BOTTOM,
-       VIDEO_FRAME_TYPE_3D_ALTERNATE,
+       THREE_D,
+       THREE_D_LEFT_RIGHT,
+       THREE_D_TOP_BOTTOM,
+       THREE_D_ALTERNATE,
        /** This content is all the left frames of some 3D */
-       VIDEO_FRAME_TYPE_3D_LEFT,
+       THREE_D_LEFT,
        /** This content is all the right frames of some 3D */
-       VIDEO_FRAME_TYPE_3D_RIGHT
+       THREE_D_RIGHT
 };
 
 std::string video_frame_type_to_string (VideoFrameType);
 VideoFrameType string_to_video_frame_type (std::string);
 
-enum Eyes
+enum class Eyes
 {
-       EYES_BOTH,
-       EYES_LEFT,
-       EYES_RIGHT,
-       EYES_COUNT
+       BOTH,
+       LEFT,
+       RIGHT,
+       COUNT
 };
 
-enum Part
+enum class Part
 {
-       PART_LEFT_HALF,
-       PART_RIGHT_HALF,
-       PART_TOP_HALF,
-       PART_BOTTOM_HALF,
-       PART_WHOLE
+       LEFT_HALF,
+       RIGHT_HALF,
+       TOP_HALF,
+       BOTTOM_HALF,
+       WHOLE
 };
 
-enum ReelType
+enum class ReelType
 {
-       REELTYPE_SINGLE,
-       REELTYPE_BY_VIDEO_CONTENT,
-       REELTYPE_BY_LENGTH
+       SINGLE,
+       BY_VIDEO_CONTENT,
+       BY_LENGTH
 };
 
-enum ChangeType
+enum class ChangeType
 {
-       CHANGE_TYPE_PENDING,
-       CHANGE_TYPE_DONE,
-       CHANGE_TYPE_CANCELLED
+       PENDING,
+       DONE,
+       CANCELLED
 };
 
 
@@ -162,24 +162,24 @@ extern VideoRange string_to_video_range (std::string s);
  *  There is some use of the word `subtitle' in the code which may mean
  *  caption in some contexts.
  */
-enum TextType
+enum class TextType
 {
-       TEXT_UNKNOWN,
-       TEXT_OPEN_SUBTITLE,
-       TEXT_CLOSED_CAPTION,
-       TEXT_COUNT
+       UNKNOWN,
+       OPEN_SUBTITLE,
+       CLOSED_CAPTION,
+       COUNT
 };
 
 extern std::string text_type_to_string (TextType t);
 extern std::string text_type_to_name (TextType t);
 extern TextType string_to_text_type (std::string s);
 
-enum ExportFormat
+enum class ExportFormat
 {
-       EXPORT_FORMAT_PRORES,
-       EXPORT_FORMAT_H264_AAC,
-       EXPORT_FORMAT_H264_PCM,
-       EXPORT_FORMAT_SUBTITLES_DCP
+       PRORES,
+       H264_AAC,
+       H264_PCM,
+       SUBTITLES_DCP
 };
 
 /** @struct Crop
@@ -243,24 +243,24 @@ struct CPLSummary
        time_t last_write_time;
 };
 
-enum Resolution {
-       RESOLUTION_2K,
-       RESOLUTION_4K
+enum class Resolution {
+       TWO_K,
+       FOUR_K
 };
 
 std::string resolution_to_string (Resolution);
 Resolution string_to_resolution (std::string);
 
-enum FileTransferProtocol {
-       FILE_TRANSFER_PROTOCOL_SCP,
-       FILE_TRANSFER_PROTOCOL_FTP
+enum class FileTransferProtocol {
+       SCP,
+       FTP
 };
 
-enum EmailProtocol {
-       EMAIL_PROTOCOL_AUTO,
-       EMAIL_PROTOCOL_PLAIN,
-       EMAIL_PROTOCOL_STARTTLS,
-       EMAIL_PROTOCOL_SSL
+enum class EmailProtocol {
+       AUTO,
+       PLAIN,
+       STARTTLS,
+       SSL
 };
 
 
index 67a0462510ee91fd9bb35a923b3cae71b3cce956..ec474abdfd49879517b92243ded556fbea60fa84 100644 (file)
@@ -72,16 +72,16 @@ UploadJob::run ()
        LOG_GENERAL_NC (N_("Upload job starting"));
 
        scoped_ptr<Uploader> uploader;
-       switch (Config::instance()->tms_protocol ()) {
-       case FILE_TRANSFER_PROTOCOL_SCP:
-               uploader.reset (new SCPUploader (bind (&UploadJob::set_status, this, _1), bind (&UploadJob::set_progress, this, _1, false)));
+       switch (Config::instance()->tms_protocol()) {
+       case FileTransferProtocol::SCP:
+               uploader.reset (new SCPUploader(bind (&UploadJob::set_status, this, _1), bind(&UploadJob::set_progress, this, _1, false)));
                break;
-       case FILE_TRANSFER_PROTOCOL_FTP:
-               uploader.reset (new CurlUploader (bind (&UploadJob::set_status, this, _1), bind (&UploadJob::set_progress, this, _1, false)));
+       case FileTransferProtocol::FTP:
+               uploader.reset (new CurlUploader(bind (&UploadJob::set_status, this, _1), bind(&UploadJob::set_progress, this, _1, false)));
                break;
        }
 
-       uploader->upload (_film->dir (_film->dcp_name ()));
+       uploader->upload (_film->dir(_film->dcp_name()));
 
        set_progress (1);
        set_status (N_(""));
index 67b6599ea44459dd78d32ecd0dbdd7fe427fb415..2a14f00c78aada548ac010dfb21a9197926de5e1 100644 (file)
@@ -870,11 +870,11 @@ remap (shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping m
 Eyes
 increment_eyes (Eyes e)
 {
-       if (e == EYES_LEFT) {
-               return EYES_RIGHT;
+       if (e == Eyes::LEFT) {
+               return Eyes::RIGHT;
        }
 
-       return EYES_LEFT;
+       return Eyes::LEFT;
 }
 
 void
index f5e5139122191337183735e764573480894688cf..216ad6784b22f1df56da7f2ebea36468f4fc7953 100644 (file)
@@ -62,6 +62,7 @@ using std::setprecision;
 using std::list;
 using std::pair;
 using std::shared_ptr;
+using std::make_shared;
 using boost::optional;
 using std::dynamic_pointer_cast;
 using dcp::raw_convert;
@@ -71,7 +72,7 @@ VideoContent::VideoContent (Content* parent)
        : ContentPart (parent)
        , _use (true)
        , _length (0)
-       , _frame_type (VIDEO_FRAME_TYPE_2D)
+       , _frame_type (VideoFrameType::TWO_D)
        , _yuv (true)
        , _fade_in (0)
        , _fade_out (0)
@@ -84,10 +85,10 @@ shared_ptr<VideoContent>
 VideoContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
 {
        if (!node->optional_number_child<int> ("VideoWidth")) {
-               return shared_ptr<VideoContent> ();
+               return {};
        }
 
-       return shared_ptr<VideoContent> (new VideoContent (parent, node, version));
+       return make_shared<VideoContent>(parent, node, version);
 }
 
 VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int version)
@@ -109,22 +110,22 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio
                /* Snapshot of the VideoFrameType enum at version 34 */
                switch (node->number_child<int> ("VideoFrameType")) {
                case 0:
-                       _frame_type = VIDEO_FRAME_TYPE_2D;
+                       _frame_type = VideoFrameType::TWO_D;
                        break;
                case 1:
-                       _frame_type = VIDEO_FRAME_TYPE_3D_LEFT_RIGHT;
+                       _frame_type = VideoFrameType::THREE_D_LEFT_RIGHT;
                        break;
                case 2:
-                       _frame_type = VIDEO_FRAME_TYPE_3D_TOP_BOTTOM;
+                       _frame_type = VideoFrameType::THREE_D_TOP_BOTTOM;
                        break;
                case 3:
-                       _frame_type = VIDEO_FRAME_TYPE_3D_ALTERNATE;
+                       _frame_type = VideoFrameType::THREE_D_ALTERNATE;
                        break;
                case 4:
-                       _frame_type = VIDEO_FRAME_TYPE_3D_LEFT;
+                       _frame_type = VideoFrameType::THREE_D_LEFT;
                        break;
                case 5:
-                       _frame_type = VIDEO_FRAME_TYPE_3D_RIGHT;
+                       _frame_type = VideoFrameType::THREE_D_RIGHT;
                        break;
                }
        } else {
@@ -138,7 +139,7 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio
        _crop.bottom = node->number_child<int> ("BottomCrop");
 
        if (version <= 7) {
-               optional<string> r = node->optional_string_child ("Ratio");
+               auto r = node->optional_string_child ("Ratio");
                if (r) {
                        _legacy_ratio = Ratio::from_id(r.get())->ratio();
                }
@@ -355,15 +356,15 @@ VideoContent::size_after_3d_split () const
 {
        auto const s = size ();
        switch (frame_type ()) {
-       case VIDEO_FRAME_TYPE_2D:
-       case VIDEO_FRAME_TYPE_3D:
-       case VIDEO_FRAME_TYPE_3D_ALTERNATE:
-       case VIDEO_FRAME_TYPE_3D_LEFT:
-       case VIDEO_FRAME_TYPE_3D_RIGHT:
+       case VideoFrameType::TWO_D:
+       case VideoFrameType::THREE_D:
+       case VideoFrameType::THREE_D_ALTERNATE:
+       case VideoFrameType::THREE_D_LEFT:
+       case VideoFrameType::THREE_D_RIGHT:
                return s;
-       case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+       case VideoFrameType::THREE_D_LEFT_RIGHT:
                return dcp::Size (s.width / 2, s.height);
-       case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
+       case VideoFrameType::THREE_D_TOP_BOTTOM:
                return dcp::Size (s.width, s.height / 2);
        }
 
index e5bbb5bab066bdcb495700c12aa4faf2cb90151f..22a6090e7a62454cac16ae25fe9be932b4c52df6 100644 (file)
@@ -53,6 +53,7 @@ class VideoContent : public ContentPart, public std::enable_shared_from_this<Vid
 {
 public:
        explicit VideoContent (Content* parent);
+       VideoContent (Content* parent, cxml::ConstNodePtr, int);
        VideoContent (Content* parent, std::vector<std::shared_ptr<Content> >);
 
        void as_xml (xmlpp::Node *) const;
@@ -67,7 +68,7 @@ public:
 
        Frame length_after_3d_combine () const {
                boost::mutex::scoped_lock lm (_mutex);
-               if (_frame_type == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
+               if (_frame_type == VideoFrameType::THREE_D_ALTERNATE) {
                        return _length / 2;
                }
 
@@ -205,7 +206,6 @@ private:
        friend struct scaled_size_test2;
        friend struct scaled_size_legacy_test;
 
-       VideoContent (Content* parent, cxml::ConstNodePtr, int);
        void setup_default_colour_conversion ();
 
        bool _use;
index cab8197cb75420eb2ba29e88ab51dfaaa7c68cdf..4b46b111f743922211fc42596120ebb56bd386ae 100644 (file)
@@ -72,7 +72,7 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
         */
        if (_frame_interval_checker) {
                _frame_interval_checker->feed (frame_time, afr);
-               if (_frame_interval_checker->guess() == FrameIntervalChecker::PROBABLY_NOT_3D && vft == VIDEO_FRAME_TYPE_3D) {
+               if (_frame_interval_checker->guess() == FrameIntervalChecker::PROBABLY_NOT_3D && vft == VideoFrameType::THREE_D) {
                        boost::throw_exception (
                                DecodeError(
                                        String::compose(
@@ -90,7 +90,7 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
        }
 
        Frame frame;
-       Eyes eyes = EYES_BOTH;
+       Eyes eyes = Eyes::BOTH;
        if (!_position) {
                /* This is the first data we have received since initialisation or seek.  Set
                   the position based on the frame that was given.  After this first time
@@ -101,21 +101,21 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
                   If we drop the frame with the duplicated timestamp we obviously lose sync.
                */
                _position = ContentTime::from_frames (decoder_frame, afr);
-               if (vft == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
+               if (vft == VideoFrameType::THREE_D_ALTERNATE) {
                        frame = decoder_frame / 2;
-                       _last_emitted_eyes = EYES_RIGHT;
+                       _last_emitted_eyes = Eyes::RIGHT;
                } else {
                        frame = decoder_frame;
                }
        } else {
-               if (vft == VIDEO_FRAME_TYPE_3D || vft == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
+               if (vft == VideoFrameType::THREE_D || vft == VideoFrameType::THREE_D_ALTERNATE) {
                        DCPOMATIC_ASSERT (_last_emitted_eyes);
-                       if (_last_emitted_eyes.get() == EYES_RIGHT) {
+                       if (_last_emitted_eyes.get() == Eyes::RIGHT) {
                                frame = _position->frames_round(afr) + 1;
-                               eyes = EYES_LEFT;
+                               eyes = Eyes::LEFT;
                        } else {
                                frame = _position->frames_round(afr);
-                               eyes = EYES_RIGHT;
+                               eyes = Eyes::RIGHT;
                        }
                } else {
                        frame = _position->frames_round(afr) + 1;
@@ -123,35 +123,35 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
        }
 
        switch (vft) {
-       case VIDEO_FRAME_TYPE_2D:
-               Data (ContentVideo (image, frame, EYES_BOTH, PART_WHOLE));
+       case VideoFrameType::TWO_D:
+               Data (ContentVideo (image, frame, Eyes::BOTH, Part::WHOLE));
                break;
-       case VIDEO_FRAME_TYPE_3D:
+       case VideoFrameType::THREE_D:
        {
-               Data (ContentVideo (image, frame, eyes, PART_WHOLE));
+               Data (ContentVideo (image, frame, eyes, Part::WHOLE));
                _last_emitted_frame = frame;
                _last_emitted_eyes = eyes;
                break;
        }
-       case VIDEO_FRAME_TYPE_3D_ALTERNATE:
+       case VideoFrameType::THREE_D_ALTERNATE:
        {
-               Data (ContentVideo (image, frame, eyes, PART_WHOLE));
+               Data (ContentVideo (image, frame, eyes, Part::WHOLE));
                _last_emitted_eyes = eyes;
                break;
        }
-       case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
-               Data (ContentVideo (image, frame, EYES_LEFT, PART_LEFT_HALF));
-               Data (ContentVideo (image, frame, EYES_RIGHT, PART_RIGHT_HALF));
+       case VideoFrameType::THREE_D_LEFT_RIGHT:
+               Data (ContentVideo (image, frame, Eyes::LEFT, Part::LEFT_HALF));
+               Data (ContentVideo (image, frame, Eyes::RIGHT, Part::RIGHT_HALF));
                break;
-       case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
-               Data (ContentVideo (image, frame, EYES_LEFT, PART_TOP_HALF));
-               Data (ContentVideo (image, frame, EYES_RIGHT, PART_BOTTOM_HALF));
+       case VideoFrameType::THREE_D_TOP_BOTTOM:
+               Data (ContentVideo (image, frame, Eyes::LEFT, Part::TOP_HALF));
+               Data (ContentVideo (image, frame, Eyes::RIGHT, Part::BOTTOM_HALF));
                break;
-       case VIDEO_FRAME_TYPE_3D_LEFT:
-               Data (ContentVideo (image, frame, EYES_LEFT, PART_WHOLE));
+       case VideoFrameType::THREE_D_LEFT:
+               Data (ContentVideo (image, frame, Eyes::LEFT, Part::WHOLE));
                break;
-       case VIDEO_FRAME_TYPE_3D_RIGHT:
-               Data (ContentVideo (image, frame, EYES_RIGHT, PART_WHOLE));
+       case VideoFrameType::THREE_D_RIGHT:
+               Data (ContentVideo (image, frame, Eyes::RIGHT, Part::WHOLE));
                break;
        default:
                DCPOMATIC_ASSERT (false);
index 6518caea915d369edae44f52a4682e42afbbdac6..e47fa973b8841b21c5cfdebdba8784f770b51123 100644 (file)
@@ -165,12 +165,12 @@ Writer::write (shared_ptr<const Data> encoded, Frame frame, Eyes eyes)
        qi.reel = video_reel (frame);
        qi.frame = frame - _reels[qi.reel].start ();
 
-       if (film()->three_d() && eyes == EYES_BOTH) {
+       if (film()->three_d() && eyes == Eyes::BOTH) {
                /* 2D material in a 3D DCP; fake the 3D */
-               qi.eyes = EYES_LEFT;
+               qi.eyes = Eyes::LEFT;
                _queue.push_back (qi);
                ++_queued_full_in_memory;
-               qi.eyes = EYES_RIGHT;
+               qi.eyes = Eyes::RIGHT;
                _queue.push_back (qi);
                ++_queued_full_in_memory;
        } else {
@@ -210,10 +210,10 @@ Writer::repeat (Frame frame, Eyes eyes)
        qi.type = QueueItem::REPEAT;
        qi.reel = video_reel (frame);
        qi.frame = frame - _reels[qi.reel].start ();
-       if (film()->three_d() && eyes == EYES_BOTH) {
-               qi.eyes = EYES_LEFT;
+       if (film()->three_d() && eyes == Eyes::BOTH) {
+               qi.eyes = Eyes::LEFT;
                _queue.push_back (qi);
-               qi.eyes = EYES_RIGHT;
+               qi.eyes = Eyes::RIGHT;
                _queue.push_back (qi);
        } else {
                qi.eyes = eyes;
@@ -250,10 +250,10 @@ Writer::fake_write (Frame frame, Eyes eyes)
 
        qi.reel = reel;
        qi.frame = frame_in_reel;
-       if (film()->three_d() && eyes == EYES_BOTH) {
-               qi.eyes = EYES_LEFT;
+       if (film()->three_d() && eyes == Eyes::BOTH) {
+               qi.eyes = Eyes::LEFT;
                _queue.push_back (qi);
-               qi.eyes = EYES_RIGHT;
+               qi.eyes = Eyes::RIGHT;
                _queue.push_back (qi);
        } else {
                qi.eyes = eyes;
@@ -355,18 +355,18 @@ Writer::have_sequenced_image_at_queue_head ()
 bool
 Writer::LastWritten::next (QueueItem qi) const
 {
-       if (qi.eyes == EYES_BOTH) {
+       if (qi.eyes == Eyes::BOTH) {
                /* 2D */
                return qi.frame == (_frame + 1);
        }
 
        /* 3D */
 
-       if (_eyes == EYES_LEFT && qi.frame == _frame && qi.eyes == EYES_RIGHT) {
+       if (_eyes == Eyes::LEFT && qi.frame == _frame && qi.eyes == Eyes::RIGHT) {
                return true;
        }
 
-       if (_eyes == EYES_RIGHT && qi.frame == (_frame + 1) && qi.eyes == EYES_LEFT) {
+       if (_eyes == Eyes::RIGHT && qi.frame == (_frame + 1) && qi.eyes == Eyes::LEFT) {
                return true;
        }
 
@@ -760,18 +760,18 @@ Writer::can_fake_write (Frame frame) const
        return (frame != 0 && frame < reel.first_nonexistant_frame());
 }
 
-/** @param track Closed caption track if type == TEXT_CLOSED_CAPTION */
+/** @param track Closed caption track if type == TextType::CLOSED_CAPTION */
 void
 Writer::write (PlayerText text, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
 {
-       vector<ReelWriter>::iterator* reel = 0;
+       vector<ReelWriter>::iterator* reel = nullptr;
 
        switch (type) {
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                reel = &_subtitle_reel;
                _have_subtitles = true;
                break;
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                DCPOMATIC_ASSERT (track);
                DCPOMATIC_ASSERT (_caption_reels.find(*track) != _caption_reels.end());
                reel = &_caption_reels[*track];
@@ -846,7 +846,7 @@ Writer::write (ReferencedReelAsset asset)
 size_t
 Writer::video_reel (int frame) const
 {
-       DCPTime t = DCPTime::from_frames (frame, film()->video_frame_rate());
+       auto t = DCPTime::from_frames (frame, film()->video_frame_rate());
        size_t i = 0;
        while (i < _reels.size() && !_reels[i].period().contains (t)) {
                ++i;
@@ -863,8 +863,8 @@ Writer::set_digest_progress (Job* job, float progress)
 
        _digest_progresses[boost::this_thread::get_id()] = progress;
        float min_progress = FLT_MAX;
-       for (map<boost::thread::id, float>::const_iterator i = _digest_progresses.begin(); i != _digest_progresses.end(); ++i) {
-               min_progress = min (min_progress, i->second);
+       for (auto const& i: _digest_progresses) {
+               min_progress = min (min_progress, i.second);
        }
 
        job->set_progress (min_progress);
index c8a007f78aa5aff7454686d1382c96134c9ede45..e7409de3117ebc362f4f0507c0e6b3186f362f97 100644 (file)
@@ -54,7 +54,7 @@ public:
                : size (0)
                , reel (0)
                , frame (0)
-               , eyes (EYES_BOTH)
+               , eyes (Eyes::BOTH)
        {}
 
        enum Type {
@@ -158,7 +158,7 @@ private:
        public:
                LastWritten()
                        : _frame(-1)
-                       , _eyes(EYES_RIGHT)
+                       , _eyes(Eyes::RIGHT)
                {}
 
                /** @return true if qi is the next item after this one */
index 78466d25baabbc4c112fe969ba3f726ac587fad0..a670af7dbb7b87396aaca76f9b69e32b3409524d 100644 (file)
@@ -512,7 +512,7 @@ private:
 
        void film_change (ChangeType type)
        {
-               if (type == CHANGE_TYPE_DONE) {
+               if (type == ChangeType::DONE) {
                        set_menu_sensitivity ();
                }
        }
@@ -1118,7 +1118,7 @@ private:
                        }
                        list<string> to = { "carl@dcpomatic.com" };
                        Emailer emailer (d->email(), to, "DCP-o-matic translations", body);
-                       emailer.send ("main.carlh.net", 2525, EMAIL_PROTOCOL_STARTTLS);
+                       emailer.send ("main.carlh.net", 2525, EmailProtocol::STARTTLS);
                }
 
                d->Destroy ();
index 46ae790cc76c389043bf70e13f207e1e4fc7de75..d1b8f4ef3ffcdfc258e09f2d89508bcd11a076b8 100644 (file)
@@ -76,7 +76,7 @@ static void
 print_dump (shared_ptr<Film> film)
 {
        cout << film->dcp_name (true) << "\n"
-            << film->container()->container_nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n"
+            << film->container()->container_nickname() << " at " << ((film->resolution() == Resolution::TWO_K) ? "2K" : "4K") << "\n"
             << (film->j2k_bandwidth() / 1000000) << "Mbit/s" << "\n"
             << "Output " << film->video_frame_rate() << "fps " << (film->three_d() ? "3D" : "2D") << " " << (film->audio_frame_rate() / 1000) << "kHz\n"
             << (film->interop() ? "Inter-Op" : "SMPTE") << " " << (film->encrypted() ? "encrypted" : "unencrypted") << "\n";
index a2d5c8e5d2a9f61cb316e6c2bb56de11c89d391a..14eae6b3ed643b547d8ee7f3c18754ca3db91e6f 100644 (file)
@@ -104,7 +104,7 @@ main (int argc, char* argv[])
                film->set_encrypted (cc.encrypt);
                film->set_three_d (cc.threed);
                if (cc.fourk) {
-                       film->set_resolution (RESOLUTION_4K);
+                       film->set_resolution (Resolution::FOUR_K);
                }
                if (cc.j2k_bandwidth) {
                        film->set_j2k_bandwidth (*cc.j2k_bandwidth);
index c6c4c0878b346a5edf7bea27d65426758d8add27..539b585042bcd3a258b0f890d3666aef4ac48825 100644 (file)
@@ -404,7 +404,7 @@ public:
 
        void film_changed (ChangeType type, Film::Property property)
        {
-               if (type != CHANGE_TYPE_DONE || property != Film::CONTENT) {
+               if (type != ChangeType::DONE || property != Film::CONTENT) {
                        return;
                }
 
@@ -416,14 +416,14 @@ public:
                _film->set_container (Ratio::from_id("185"));
 
                for (auto i: _film->content()) {
-                       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(i);
+                       auto dcp = dynamic_pointer_cast<DCPContent>(i);
 
                        for (auto j: i->text) {
                                j->set_use (true);
                        }
 
                        if (i->video) {
-                               Ratio const * r = Ratio::nearest_from_ratio(i->video->size().ratio());
+                               auto const r = Ratio::nearest_from_ratio(i->video->size().ratio());
                                if (r->id() == "239") {
                                        /* Any scope content means we use scope */
                                        _film->set_container(r);
@@ -431,7 +431,7 @@ public:
                        }
 
                        /* Any 3D content means we use 3D mode */
-                       if (i->video && i->video->frame_type() != VIDEO_FRAME_TYPE_2D) {
+                       if (i->video && i->video->frame_type() != VideoFrameType::TWO_D) {
                                _film->set_three_d (true);
                        }
                }
@@ -441,19 +441,19 @@ public:
 
                set_menu_sensitivity ();
 
-               wxMenuItemList old = _cpl_menu->GetMenuItems();
-               for (wxMenuItemList::iterator i = old.begin(); i != old.end(); ++i) {
-                       _cpl_menu->Remove (*i);
+               auto old = _cpl_menu->GetMenuItems();
+               for (auto const& i: old) {
+                       _cpl_menu->Remove (i);
                }
 
                if (_film->content().size() == 1) {
                        /* Offer a CPL menu */
-                       shared_ptr<DCPContent> first = dynamic_pointer_cast<DCPContent>(_film->content().front());
+                       auto first = dynamic_pointer_cast<DCPContent>(_film->content().front());
                        if (first) {
                                DCPExaminer ex (first, true);
                                int id = ID_view_cpl;
                                for (auto i: ex.cpls()) {
-                                       wxMenuItem* j = _cpl_menu->AppendRadioItem(
+                                       auto j = _cpl_menu->AppendRadioItem(
                                                id,
                                                wxString::Format("%s (%s)", std_to_wx(i->annotation_text().get_value_or("")).data(), std_to_wx(i->id()).data())
                                                );
@@ -473,11 +473,11 @@ private:
 
        bool report_errors_from_last_job (wxWindow* parent) const
        {
-               JobManager* jm = JobManager::instance ();
+               auto jm = JobManager::instance ();
 
                DCPOMATIC_ASSERT (!jm->get().empty());
 
-               shared_ptr<Job> last = jm->get().back();
+               auto last = jm->get().back();
                if (last->finished_in_error()) {
                        error_dialog(parent, wxString::Format(_("Could not load DCP.\n\n%s."), std_to_wx(last->error_summary()).data()), std_to_wx(last->error_details()));
                        return false;
index e3375b98839fc99cdd158ff3d96fa03bfc99518e..8e44967994cfc8614ac0e7a9be7731e1ab7fd167 100644 (file)
@@ -55,8 +55,8 @@ static int frame_count = 0;
 void
 process_video (shared_ptr<PlayerVideo> pvf)
 {
-       shared_ptr<DCPVideo> local  (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K));
-       shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K));
+       shared_ptr<DCPVideo> local  (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, Resolution::TWO_K));
+       shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, Resolution::TWO_K));
 
        cout << "Frame " << frame_count << ": ";
        cout.flush ();
index 41b2a9d396c4faea163c360cd1b9ac5fecebcd4d..b8c7f7b7343b23af4b08f62361d68dd6747606cd 100644 (file)
@@ -314,12 +314,12 @@ AudioDialog::channel_clicked (wxCommandEvent& ev)
 void
 AudioDialog::film_change (ChangeType type, int p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
        if (p == Film::AUDIO_CHANNELS) {
-               shared_ptr<Film> film = _film.lock ();
+               auto film = _film.lock ();
                if (film) {
                        _channels = film->audio_channels ();
                        try_to_load_analysis ();
@@ -330,7 +330,7 @@ AudioDialog::film_change (ChangeType type, int p)
 void
 AudioDialog::content_change (ChangeType type, int p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
@@ -375,12 +375,12 @@ AudioDialog::setup_statistics ()
                return;
        }
 
-       shared_ptr<Film> film = _film.lock ();
+       auto film = _film.lock ();
        if (!film) {
                return;
        }
 
-       pair<AudioAnalysis::PeakTime, int> const peak = _analysis->overall_sample_peak ();
+       auto const peak = _analysis->overall_sample_peak ();
        float const peak_dB = linear_to_db(peak.first.peak) + _analysis->gain_correction(_playlist);
        _sample_peak->SetLabel (
                wxString::Format (
@@ -412,7 +412,7 @@ AudioDialog::setup_statistics ()
 
        /* XXX: check whether it's ok to add dB gain to these quantities */
 
-       if (static_cast<bool>(_analysis->integrated_loudness ())) {
+       if (static_cast<bool>(_analysis->integrated_loudness())) {
                _integrated_loudness->SetLabel (
                        wxString::Format (
                                _("Integrated loudness %.2f LUFS"),
@@ -421,7 +421,7 @@ AudioDialog::setup_statistics ()
                        );
        }
 
-       if (static_cast<bool>(_analysis->loudness_range ())) {
+       if (static_cast<bool>(_analysis->loudness_range())) {
                _loudness_range->SetLabel (
                        wxString::Format (
                                _("Loudness range %.2f LU"),
@@ -455,7 +455,7 @@ AudioDialog::set_cursor (optional<DCPTime> time, optional<float> db)
                return;
        }
 
-       shared_ptr<Film> film = _film.lock();
+       auto film = _film.lock();
        DCPOMATIC_ASSERT (film);
        _cursor->SetLabel (wxString::Format (_("Cursor: %.1fdB at %s"), *db, time->timecode(film->video_frame_rate())));
 }
index c23c2902b017064fe7015be6d58aa591c35bba25..f2528a00f72eda67d8ee72a637384899c61b4861 100644 (file)
@@ -239,7 +239,7 @@ ClosedCaptionsDialog::update_tracks (shared_ptr<const Film> film)
 
        for (auto i: film->content()) {
                for (auto j: i->text) {
-                       if (j->use() && j->type() == TEXT_CLOSED_CAPTION && j->dcp_track()) {
+                       if (j->use() && j->type() == TextType::CLOSED_CAPTION && j->dcp_track()) {
                                if (find(_tracks.begin(), _tracks.end(), j->dcp_track()) == _tracks.end()) {
                                        _tracks.push_back (*j->dcp_track());
                                }
index 0530c9128453f85606d4032d73e8fa7b5bb6d73b..a06791d4d0766be5351a43a8f9ea4ae893a0a634 100644 (file)
@@ -78,7 +78,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV
        , _ignore_deselect (false)
        , _no_check_selection (false)
 {
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                _text_panel[i] = 0;
        }
 
@@ -331,7 +331,7 @@ ContentPanel::check_selection ()
 
        bool have_video = false;
        bool have_audio = false;
-       bool have_text[TEXT_COUNT] = { false, false };
+       bool have_text[static_cast<int>(TextType::COUNT)] = { false, false };
        for (auto i: selected()) {
                if (i->video) {
                        have_video = true;
@@ -340,7 +340,7 @@ ContentPanel::check_selection ()
                        have_audio = true;
                }
                for (auto j: i->text) {
-                       have_text[j->original_type()] = true;
+                       have_text[static_cast<int>(j->original_type())] = true;
                }
        }
 
@@ -370,7 +370,7 @@ ContentPanel::check_selection ()
                ++off;
        }
 
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                if (have_text[i] && !_text_panel[i]) {
                        _text_panel[i] = new TextPanel (this, static_cast<TextType>(i));
                        _notebook->InsertPage (off, _text_panel[i], _text_panel[i]->name());
@@ -570,7 +570,7 @@ ContentPanel::setup_sensitivity ()
        if (_audio_panel) {
                _audio_panel->Enable (_generally_sensitive && audio_selection.size() > 0);
        }
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                if (_text_panel[i]) {
                        _text_panel[i]->Enable (_generally_sensitive && selection.size() == 1 && !selection.front()->text.empty());
                }
@@ -790,7 +790,7 @@ ContentPanel::panels () const
        if (_audio_panel) {
                p.push_back (_audio_panel);
        }
-       for (int i = 0; i < TEXT_COUNT; ++i) {
+       for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
                if (_text_panel[i]) {
                        p.push_back (_text_panel[i]);
                }
index 6a9ef3f4a561724cc442b2931c4ceaaa7a12dcff..124fd6b94983d17a825073df7f339d93d8d46ffd 100644 (file)
@@ -136,7 +136,7 @@ private:
        wxButton* _timeline;
        VideoPanel* _video_panel;
        AudioPanel* _audio_panel;
-       TextPanel* _text_panel[TEXT_COUNT];
+       TextPanel* _text_panel[static_cast<int>(TextType::COUNT)];
        TimingPanel* _timing_panel;
        ContentMenu* _menu;
        TimelineDialog* _timeline_dialog;
index d38609cb4b8c1d0e408a00406bf34e705548eead..1a9c85dde762f9cec226714ea96a3f78156c4897 100644 (file)
@@ -195,14 +195,14 @@ private:
        void button_clicked ()
        {
                U const v = boost::bind (_model_getter, _part(_content.front().get()).get())();
-               for (typename List::iterator i = _content.begin (); i != _content.end(); ++i) {
-                       boost::bind (_model_setter, _part(i->get()).get(), v) ();
+               for (auto const& i: _content) {
+                       boost::bind (_model_setter, _part(i.get()).get(), v)();
                }
        }
 
        void model_changed (ChangeType type, int property)
        {
-               if (type == CHANGE_TYPE_DONE && property == _property && !_ignore_model_changes) {
+               if (type == ChangeType::DONE && property == _property && !_ignore_model_changes) {
                        update_from_model ();
                }
        }
index 5364e16148333364ecbc5851b2a16cc1fc165782..31134340054b2ed232548068ed4bcfad42caeea0 100644 (file)
@@ -190,7 +190,7 @@ Controls::update_position ()
 void
 Controls::eye_changed ()
 {
-       _viewer->set_eyes (_eye->GetSelection() == 0 ? EYES_LEFT : EYES_RIGHT);
+       _viewer->set_eyes (_eye->GetSelection() == 0 ? Eyes::LEFT : Eyes::RIGHT);
 }
 
 void
@@ -407,7 +407,7 @@ Controls::film () const
 void
 Controls::film_change (ChangeType type, Film::Property p)
 {
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                if (p == Film::CONTENT) {
                        setup_sensitivity ();
                        update_position_label ();
index 047768f56119c7e03f322e07393795145b62b577..cf4d5d3fe4a42c865d2b1675298d0425fb210fb4 100644 (file)
@@ -286,7 +286,7 @@ DCPPanel::resolution_changed ()
                return;
        }
 
-       _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
+       _film->set_resolution (_resolution->GetSelection() == 0 ? Resolution::TWO_K : Resolution::FOUR_K);
 }
 
 void
@@ -354,7 +354,7 @@ DCPPanel::film_changed (int p)
                checked_set (_encrypted, _film->encrypted ());
                break;
        case Film::RESOLUTION:
-               checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
+               checked_set (_resolution, _film->resolution() == Resolution::TWO_K ? 0 : 1);
                setup_container ();
                setup_dcp_name ();
                break;
@@ -433,8 +433,8 @@ DCPPanel::film_changed (int p)
                film_changed (Film::AUDIO_CHANNELS);
                break;
        case Film::REEL_TYPE:
-               checked_set (_reel_type, _film->reel_type ());
-               _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
+               checked_set (_reel_type, static_cast<int>(_film->reel_type()));
+               _reel_length->Enable (_film->reel_type() == ReelType::BY_LENGTH);
                break;
        case Film::REEL_LENGTH:
                checked_set (_reel_length, _film->reel_length() / 1000000000LL);
@@ -586,7 +586,7 @@ DCPPanel::setup_sensitivity ()
        _copy_isdcf_name_button->Enable (_generally_sensitive);
        _encrypted->Enable              (_generally_sensitive);
        _reel_type->Enable              (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
-       _reel_length->Enable            (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
+       _reel_length->Enable            (_generally_sensitive && _film && _film->reel_type() == ReelType::BY_LENGTH);
        _markers->Enable                (_generally_sensitive && _film && !_film->interop());
        _metadata->Enable               (_generally_sensitive);
        _frame_rate_choice->Enable      (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
index f1b2d2622e5e49322768a20d86e0ddbcada998a0..30ea6ef479c7607d0d64db65103e20c5ca51331c 100644 (file)
@@ -49,8 +49,8 @@ wxString format_extensions[] = {
 };
 
 ExportFormat formats[] = {
-       EXPORT_FORMAT_PRORES,
-       EXPORT_FORMAT_H264_AAC,
+       ExportFormat::PRORES,
+       ExportFormat::H264_AAC,
 };
 
 ExportVideoFileDialog::ExportVideoFileDialog (wxWindow* parent, string name)
index bb40dad9f3693eccf70a944bdcaba8dfc4d87853..47a6358cca9677e3f35d9cf3a48ac7caaef80b73 100644 (file)
@@ -73,7 +73,7 @@ FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer)
 void
 FilmEditor::film_change (ChangeType type, Film::Property p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
@@ -95,7 +95,7 @@ FilmEditor::film_change (ChangeType type, Film::Property p)
 void
 FilmEditor::film_content_change (ChangeType type, int property)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
index e8c3b8c71363292bccd5cbd8c1dea57bf26f0990..f3155323974bfd7ee9191caeeb3109f1fe0098bd 100644 (file)
@@ -184,8 +184,8 @@ FilmViewer::set_film (shared_ptr<Film> film)
        _film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
        _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
 
-       film_change (CHANGE_TYPE_DONE, Film::VIDEO_FRAME_RATE);
-       film_change (CHANGE_TYPE_DONE, Film::THREE_D);
+       film_change (ChangeType::DONE, Film::VIDEO_FRAME_RATE);
+       film_change (ChangeType::DONE, Film::THREE_D);
        film_length_change ();
 
        /* Keep about 1 second's worth of history samples */
@@ -376,7 +376,7 @@ FilmViewer::stop ()
 void
 FilmViewer::player_change (ChangeType type, int property, bool frequent)
 {
-       if (type != CHANGE_TYPE_DONE || frequent) {
+       if (type != ChangeType::DONE || frequent) {
                return;
        }
 
@@ -407,7 +407,7 @@ FilmViewer::player_change (ChangeType type, int property, bool frequent)
 void
 FilmViewer::film_change (ChangeType type, Film::Property p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
@@ -464,7 +464,7 @@ FilmViewer::set_coalesce_player_changes (bool c)
 
        if (!c) {
                for (auto i: _pending_player_changes) {
-                       player_change (CHANGE_TYPE_DONE, i, false);
+                       player_change (ChangeType::DONE, i, false);
                }
                _pending_player_changes.clear ();
        }
@@ -710,7 +710,7 @@ FilmViewer::gets () const
 void
 FilmViewer::content_change (ChangeType type, int property)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
index e17e0a57b1a3bad4a7915b1daf9c7588869f7d89..43c76fddb61d9696d63f33b4148999f9a6229c4a 100644 (file)
@@ -586,7 +586,7 @@ private:
                Config* config = Config::instance ();
 
                checked_set (_upload, config->upload_after_make_dcp());
-               checked_set (_tms_protocol, config->tms_protocol ());
+               checked_set (_tms_protocol, static_cast<int>(config->tms_protocol()));
                checked_set (_tms_ip, config->tms_ip ());
                checked_set (_tms_path, config->tms_path ());
                checked_set (_tms_user, config->tms_user ());
@@ -700,21 +700,21 @@ private:
 
        void config_changed ()
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
                checked_set (_server, config->mail_server ());
                checked_set (_port, config->mail_port ());
                switch (config->mail_protocol()) {
-               case EMAIL_PROTOCOL_AUTO:
+               case EmailProtocol::AUTO:
                        checked_set (_protocol, 0);
                        break;
-               case EMAIL_PROTOCOL_PLAIN:
+               case EmailProtocol::PLAIN:
                        checked_set (_protocol, 1);
                        break;
-               case EMAIL_PROTOCOL_STARTTLS:
+               case EmailProtocol::STARTTLS:
                        checked_set (_protocol, 2);
                        break;
-               case EMAIL_PROTOCOL_SSL:
+               case EmailProtocol::SSL:
                        checked_set (_protocol, 3);
                        break;
                }
@@ -736,16 +736,16 @@ private:
        {
                switch (_protocol->GetSelection()) {
                case 0:
-                       Config::instance()->set_mail_protocol(EMAIL_PROTOCOL_AUTO);
+                       Config::instance()->set_mail_protocol(EmailProtocol::AUTO);
                        break;
                case 1:
-                       Config::instance()->set_mail_protocol(EMAIL_PROTOCOL_PLAIN);
+                       Config::instance()->set_mail_protocol(EmailProtocol::PLAIN);
                        break;
                case 2:
-                       Config::instance()->set_mail_protocol(EMAIL_PROTOCOL_STARTTLS);
+                       Config::instance()->set_mail_protocol(EmailProtocol::STARTTLS);
                        break;
                case 3:
-                       Config::instance()->set_mail_protocol(EMAIL_PROTOCOL_SSL);
+                       Config::instance()->set_mail_protocol(EmailProtocol::SSL);
                        break;
                }
        }
index 2c6bac14a0ae0013525eda7c25187176c0c90bd0..2e53d8104f655cfc4a79d715826fa2e92859941b 100644 (file)
@@ -87,20 +87,20 @@ HintsDialog::HintsDialog (wxWindow* parent, std::weak_ptr<Film> film, bool ok)
                _film_content_change_connection = locked_film->ContentChange.connect (boost::bind (&HintsDialog::film_content_change, this, _1));
        }
 
-       film_change (CHANGE_TYPE_DONE);
+       film_change (ChangeType::DONE);
 }
 
 void
 HintsDialog::film_change (ChangeType type)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
        _text->Clear ();
        _current.clear ();
 
-       std::shared_ptr<Film> film = _film.lock ();
+       auto film = _film.lock ();
        if (!film) {
                return;
        }
index 772250701ebe062706223c35cb6dd0619ac97661..b8a1184e0839bca02df4b35342315a8bbc9168b4 100644 (file)
@@ -244,16 +244,16 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_
 
        _film_changed_connection = film()->Change.connect(boost::bind(&SMPTEMetadataDialog::film_changed, this, _1, _2));
 
-       film_changed (CHANGE_TYPE_DONE, Film::NAME_LANGUAGE);
-       film_changed (CHANGE_TYPE_DONE, Film::RELEASE_TERRITORY);
-       film_changed (CHANGE_TYPE_DONE, Film::VERSION_NUMBER);
-       film_changed (CHANGE_TYPE_DONE, Film::STATUS);
-       film_changed (CHANGE_TYPE_DONE, Film::CHAIN);
-       film_changed (CHANGE_TYPE_DONE, Film::DISTRIBUTOR);
-       film_changed (CHANGE_TYPE_DONE, Film::FACILITY);
-       film_changed (CHANGE_TYPE_DONE, Film::CONTENT_VERSIONS);
-       film_changed (CHANGE_TYPE_DONE, Film::LUMINANCE);
-       film_changed (CHANGE_TYPE_DONE, Film::SUBTITLE_LANGUAGES);
+       film_changed (ChangeType::DONE, Film::NAME_LANGUAGE);
+       film_changed (ChangeType::DONE, Film::RELEASE_TERRITORY);
+       film_changed (ChangeType::DONE, Film::VERSION_NUMBER);
+       film_changed (ChangeType::DONE, Film::STATUS);
+       film_changed (ChangeType::DONE, Film::CHAIN);
+       film_changed (ChangeType::DONE, Film::DISTRIBUTOR);
+       film_changed (ChangeType::DONE, Film::FACILITY);
+       film_changed (ChangeType::DONE, Film::CONTENT_VERSIONS);
+       film_changed (ChangeType::DONE, Film::LUMINANCE);
+       film_changed (ChangeType::DONE, Film::SUBTITLE_LANGUAGES);
 
        setup_sensitivity ();
 }
@@ -262,7 +262,7 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_
 void
 SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
 {
-       if (type != CHANGE_TYPE_DONE || film()->interop()) {
+       if (type != ChangeType::DONE || film()->interop()) {
                return;
        }
 
index e21093798646641ab390ddfeb43130f744996b19..ef3f20e7a8ab106c663b96726a8835041da7cd02 100644 (file)
@@ -59,7 +59,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
        , _content (content)
        , _caption (caption)
 {
-       shared_ptr<FFmpegContent> ff = dynamic_pointer_cast<FFmpegContent> (content);
+       auto ff = dynamic_pointer_cast<FFmpegContent> (content);
        if (ff) {
                _stream = ff->subtitle_stream ();
                /* XXX: assuming that all FFmpeg streams have bitmap subs */
@@ -135,7 +135,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                _overall_sizer->Add (restore, 0, wxALL, DCPOMATIC_SIZER_X_GAP);
        }
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+       auto buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
                _overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -174,7 +174,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                _effect->SetSelection (NONE);
        }
 
-       optional<dcp::Colour> effect_colour = _caption->effect_colour();
+       auto effect_colour = _caption->effect_colour();
        _force_effect_colour->SetValue (static_cast<bool>(effect_colour));
        if (effect_colour) {
                _effect_colour->SetColour (wxColour (effect_colour->r, effect_colour->g, effect_colour->b));
@@ -182,7 +182,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                _effect_colour->SetColour (wxColour (0, 0, 0));
        }
 
-       optional<ContentTime> fade_in = _caption->fade_in();
+       auto fade_in = _caption->fade_in();
        _force_fade_in->SetValue (static_cast<bool>(fade_in));
        if (fade_in) {
                _fade_in->set (*fade_in, _content->active_video_frame_rate(film));
@@ -190,7 +190,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                _fade_in->set (ContentTime(), _content->active_video_frame_rate(film));
        }
 
-       optional<ContentTime> fade_out = _caption->fade_out();
+       auto fade_out = _caption->fade_out();
        _force_fade_out->SetValue (static_cast<bool>(fade_out));
        if (fade_out) {
                _fade_out->set (*fade_out, _content->active_video_frame_rate(film));
@@ -214,7 +214,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
 void
 SubtitleAppearanceDialog::content_change (ChangeType type)
 {
-       if (type == CHANGE_TYPE_DONE) {
+       if (type == ChangeType::DONE) {
                setup_sensitivity ();
        }
 }
@@ -222,8 +222,8 @@ SubtitleAppearanceDialog::content_change (ChangeType type)
 wxCheckBox*
 SubtitleAppearanceDialog::set_to (wxWindow* w, int& r)
 {
-       wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-       wxCheckBox* set_to = new CheckBox (this, _("Set to"));
+       auto s = new wxBoxSizer (wxHORIZONTAL);
+       auto set_to = new CheckBox (this, _("Set to"));
        s->Add (set_to, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 8);
        s->Add (w, 0, wxALIGN_CENTER_VERTICAL);
        _table->Add (s, wxGBPosition (r, 1));
@@ -234,10 +234,10 @@ SubtitleAppearanceDialog::set_to (wxWindow* w, int& r)
 void
 SubtitleAppearanceDialog::apply ()
 {
-       shared_ptr<const Film> film = _film.lock ();
+       auto film = _film.lock ();
 
        if (_force_colour->GetValue ()) {
-               wxColour const c = _colour->GetColour ();
+               auto const c = _colour->GetColour ();
                _caption->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue()));
        } else {
                _caption->unset_colour ();
@@ -258,7 +258,7 @@ SubtitleAppearanceDialog::apply ()
                _caption->unset_effect ();
        }
        if (_force_effect_colour->GetValue ()) {
-               wxColour const ec = _effect_colour->GetColour ();
+               auto const ec = _effect_colour->GetColour ();
                _caption->set_effect_colour (dcp::Colour (ec.Red(), ec.Green(), ec.Blue()));
        } else {
                _caption->unset_effect_colour ();
@@ -276,12 +276,12 @@ SubtitleAppearanceDialog::apply ()
        _caption->set_outline_width (_outline_width->GetValue ());
 
        if (_stream) {
-               for (map<RGBA, RGBAColourPicker*>::const_iterator i = _pickers.begin(); i != _pickers.end(); ++i) {
-                       _stream->set_colour (i->first, i->second->colour ());
+               for (auto const& i: _pickers) {
+                       _stream->set_colour (i.first, i.second->colour());
                }
        }
 
-       shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (_content);
+       auto fc = dynamic_pointer_cast<FFmpegContent> (_content);
        if (fc) {
                fc->signal_subtitle_stream_changed ();
        }
@@ -290,8 +290,8 @@ SubtitleAppearanceDialog::apply ()
 void
 SubtitleAppearanceDialog::restore ()
 {
-       for (map<RGBA, RGBAColourPicker*>::const_iterator i = _pickers.begin(); i != _pickers.end(); ++i) {
-               i->second->set (i->first);
+       for (auto const& i: _pickers) {
+               i.second->set (i.first);
        }
 }
 
@@ -330,13 +330,13 @@ SubtitleAppearanceDialog::active_jobs_changed (optional<string> last)
 void
 SubtitleAppearanceDialog::add_colours ()
 {
-       map<RGBA, RGBA> colours = _stream->colours ();
-       for (map<RGBA, RGBA>::const_iterator i = colours.begin(); i != colours.end(); ++i) {
-               wxPanel* from = new wxPanel (_colours_panel, wxID_ANY);
-               from->SetBackgroundColour (wxColour (i->first.r, i->first.g, i->first.b, i->first.a));
+       auto colours = _stream->colours ();
+       for (auto const& i: _stream->colours()) {
+               auto from = new wxPanel(_colours_panel, wxID_ANY);
+               from->SetBackgroundColour(wxColour(i.first.r, i.first.g, i.first.b, i.first.a));
                _colour_table->Add (from, 1, wxEXPAND);
-               RGBAColourPicker* to = new RGBAColourPicker (_colours_panel, i->second);
+               auto to = new RGBAColourPicker(_colours_panel, i.second);
                _colour_table->Add (to, 1, wxEXPAND);
-               _pickers[i->first] = to;
+               _pickers[i.first] = to;
        }
 }
index 521e55fc50f4e9c604d851322e4de34a7590f237..dec58f0cd1fc87b3a5ba49b4bd9ce983864b7622 100644 (file)
@@ -65,7 +65,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
        , _loading_analysis (false)
 {
        wxString refer = _("Use this DCP's subtitle as OV and make VF");
-       if (t == TEXT_CLOSED_CAPTION) {
+       if (t == TextType::CLOSED_CAPTION) {
                refer = _("Use this DCP's closed caption as OV and make VF");
        }
 
@@ -145,7 +145,7 @@ void
 TextPanel::setup_visibility ()
 {
        switch (current_type()) {
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                if (_dcp_track_label) {
                        _dcp_track_label->Destroy ();
                        _dcp_track_label = 0;
@@ -161,7 +161,7 @@ TextPanel::setup_visibility ()
                }
 
                break;
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                if (!_dcp_track_label) {
                        _dcp_track_label = create_label (this, _("CCAP track"), true);
                        add_label_to_sizer (_grid, _dcp_track_label, true, wxGBPosition(_ccap_track_row, 0));
@@ -348,7 +348,7 @@ TextPanel::dcp_track_changed ()
        if (track) {
                for (auto i: _parent->selected_text()) {
                        shared_ptr<TextContent> t = i->text_of_original_type(_original_type);
-                       if (t && t->type() == TEXT_CLOSED_CAPTION) {
+                       if (t && t->type() == TextType::CLOSED_CAPTION) {
                                t->set_dcp_track(*track);
                        }
                }
@@ -409,10 +409,10 @@ TextPanel::film_content_changed (int property)
        } else if (property == TextContentProperty::TYPE) {
                if (text) {
                        switch (text->type()) {
-                       case TEXT_OPEN_SUBTITLE:
+                       case TextType::OPEN_SUBTITLE:
                                _type->SetSelection (0);
                                break;
-                       case TEXT_CLOSED_CAPTION:
+                       case TextType::CLOSED_CAPTION:
                                _type->SetSelection (1);
                                break;
                        default:
@@ -474,12 +474,12 @@ TextPanel::current_type () const
 {
        switch (_type->GetSelection()) {
        case 0:
-               return TEXT_OPEN_SUBTITLE;
+               return TextType::OPEN_SUBTITLE;
        case 1:
-               return TEXT_CLOSED_CAPTION;
+               return TextType::CLOSED_CAPTION;
        }
 
-       return TEXT_UNKNOWN;
+       return TextType::UNKNOWN;
 }
 
 void
@@ -558,10 +558,10 @@ TextPanel::setup_sensitivity ()
        }
 
        switch (type) {
-       case TEXT_OPEN_SUBTITLE:
+       case TextType::OPEN_SUBTITLE:
                _type->SetSelection (0);
                break;
-       case TEXT_CLOSED_CAPTION:
+       case TextType::CLOSED_CAPTION:
                if (_type->GetCount() > 1) {
                        _type->SetSelection (1);
                }
@@ -574,35 +574,35 @@ TextPanel::setup_sensitivity ()
        _use->Enable (!reference && any_subs > 0);
        bool const use = _use->GetValue ();
        if (_outline_subtitles) {
-               _outline_subtitles->Enable (!_loading_analysis && any_subs && use && type == TEXT_OPEN_SUBTITLE);
+               _outline_subtitles->Enable (!_loading_analysis && any_subs && use && type == TextType::OPEN_SUBTITLE);
        }
        _type->Enable (!reference && any_subs > 0 && use);
-       _burn->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
-       _x_offset->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
-       _y_offset->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
-       _x_scale->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
-       _y_scale->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
-       _line_spacing->Enable (!reference && use && type == TEXT_OPEN_SUBTITLE && dcp_subs < any_subs);
+       _burn->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
+       _x_offset->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
+       _y_offset->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
+       _x_scale->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
+       _y_scale->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
+       _line_spacing->Enable (!reference && use && type == TextType::OPEN_SUBTITLE && dcp_subs < any_subs);
        _stream->Enable (!reference && ffmpeg_subs == 1);
        /* Ideally we would check here to see if the FFmpeg content has "string" subs (i.e. not bitmaps) */
        _text_view_button->Enable (!reference && any_subs > 0 && ffmpeg_subs == 0);
-       _fonts_dialog_button->Enable (!reference && any_subs > 0 && ffmpeg_subs == 0 && type == TEXT_OPEN_SUBTITLE);
-       _appearance_dialog_button->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
+       _fonts_dialog_button->Enable (!reference && any_subs > 0 && ffmpeg_subs == 0 && type == TextType::OPEN_SUBTITLE);
+       _appearance_dialog_button->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
 }
 
 void
 TextPanel::stream_changed ()
 {
-       FFmpegContentList fc = _parent->selected_ffmpeg ();
+       auto fc = _parent->selected_ffmpeg ();
        if (fc.size() != 1) {
                return;
        }
 
-       shared_ptr<FFmpegContent> fcs = fc.front ();
+       auto fcs = fc.front ();
 
-       vector<shared_ptr<FFmpegSubtitleStream> > a = fcs->subtitle_streams ();
-       vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = a.begin ();
-       string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ()));
+       auto a = fcs->subtitle_streams ();
+       auto i = a.begin ();
+       auto const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ()));
        while (i != a.end() && (*i)->identifier () != s) {
                ++i;
        }
@@ -631,7 +631,7 @@ TextPanel::y_offset_changed ()
 void
 TextPanel::x_scale_changed ()
 {
-       ContentList c = _parent->selected_text ();
+       auto c = _parent->selected_text ();
        if (c.size() == 1) {
                c.front()->text_of_original_type(_original_type)->set_x_scale (_x_scale->GetValue() / 100.0);
        }
@@ -694,10 +694,10 @@ TextPanel::fonts_dialog_clicked ()
 {
        if (_fonts_dialog) {
                _fonts_dialog->Destroy ();
-               _fonts_dialog = 0;
+               _fonts_dialog = nullptr;
        }
 
-       ContentList c = _parent->selected_text ();
+       auto c = _parent->selected_text ();
        DCPOMATIC_ASSERT (c.size() == 1);
 
        _fonts_dialog = new FontsDialog (this, c.front(), c.front()->text_of_original_type(_original_type));
@@ -707,12 +707,12 @@ TextPanel::fonts_dialog_clicked ()
 void
 TextPanel::reference_clicked ()
 {
-       ContentList c = _parent->selected ();
+       auto c = _parent->selected ();
        if (c.size() != 1) {
                return;
        }
 
-       shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
+       auto d = dynamic_pointer_cast<DCPContent> (c.front ());
        if (!d) {
                return;
        }
@@ -723,10 +723,10 @@ TextPanel::reference_clicked ()
 void
 TextPanel::appearance_dialog_clicked ()
 {
-       ContentList c = _parent->selected_text ();
+       auto c = _parent->selected_text ();
        DCPOMATIC_ASSERT (c.size() == 1);
 
-       SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type));
+       auto d = new SubtitleAppearanceDialog (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type));
        if (d->ShowModal () == wxID_OK) {
                d->apply ();
        }
@@ -759,14 +759,14 @@ TextPanel::try_to_load_analysis ()
        setup_sensitivity ();
        _analysis.reset ();
 
-       shared_ptr<Content> content = _analysis_content.lock ();
+       auto content = _analysis_content.lock ();
        if (!content) {
                _loading_analysis = false;
                setup_sensitivity ();
                return;
        }
 
-       boost::filesystem::path const path = _parent->film()->subtitle_analysis_path(content);
+       auto const path = _parent->film()->subtitle_analysis_path(content);
 
        if (!boost::filesystem::exists(path)) {
                for (auto i: JobManager::instance()->get()) {
@@ -800,15 +800,15 @@ TextPanel::try_to_load_analysis ()
 void
 TextPanel::update_outline_subtitles_in_viewer ()
 {
-       shared_ptr<FilmViewer> fv = _parent->film_viewer().lock();
+       auto fv = _parent->film_viewer().lock();
        if (!fv) {
                return;
        }
 
        if (_analysis) {
-               optional<dcpomatic::Rect<double> > rect = _analysis->bounding_box ();
+               auto rect = _analysis->bounding_box ();
                if (rect) {
-                       shared_ptr<Content> content = _analysis_content.lock ();
+                       auto content = _analysis_content.lock ();
                        DCPOMATIC_ASSERT (content);
                        rect->x += content->text.front()->x_offset();
                        rect->y += content->text.front()->y_offset();
@@ -835,7 +835,7 @@ TextPanel::clear_outline_subtitles ()
 void
 TextPanel::analysis_finished ()
 {
-       shared_ptr<Content> content = _analysis_content.lock ();
+       auto content = _analysis_content.lock ();
        if (!content) {
                _loading_analysis = false;
                setup_sensitivity ();
index 3294676fc2f8daaf8d5e0b9ce0704f326b1917c0..89f2239569edea9cf9e8b79f325381e119ec460b 100644 (file)
@@ -112,7 +112,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film, w
        _main_canvas->Bind   (wxEVT_SCROLLWIN_PAGEDOWN,   boost::bind (&Timeline::scrolled,     this, _1));
        _main_canvas->Bind   (wxEVT_SCROLLWIN_THUMBTRACK, boost::bind (&Timeline::scrolled,     this, _1));
 
-       film_change (CHANGE_TYPE_DONE, Film::CONTENT);
+       film_change (ChangeType::DONE, Film::CONTENT);
 
        SetMinSize (wxSize (640, 4 * pixels_per_track() + 96));
 
@@ -227,7 +227,7 @@ Timeline::paint_main ()
 void
 Timeline::film_change (ChangeType type, Film::Property p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
@@ -277,7 +277,7 @@ Timeline::recreate_views ()
 void
 Timeline::film_content_change (ChangeType type, int property, bool frequent)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
@@ -403,7 +403,7 @@ Timeline::assign_tracks ()
                }
 
                /* Video on tracks 0 and maybe 1 (left and right eye) */
-               if (cv->content()->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
+               if (cv->content()->video->frame_type() == VideoFrameType::THREE_D_RIGHT) {
                        cv->set_track (1);
                        _tracks = max (_tracks, 2);
                        have_3d = true;
index 8258a81f97a5bfd6dd37e8485a3a5b2cef29ba71..bb84d6147fe50e1b22f4a74145e3eac80c73257a 100644 (file)
@@ -44,10 +44,10 @@ TimelineContentView::bbox () const
 {
        DCPOMATIC_ASSERT (_track);
 
-       shared_ptr<const Film> film = _timeline.film ();
-       shared_ptr<const Content> content = _content.lock ();
+       auto film = _timeline.film ();
+       auto content = _content.lock ();
        if (!film || !content) {
-               return dcpomatic::Rect<int> ();
+               return {};
        }
 
        return dcpomatic::Rect<int> (
@@ -86,7 +86,7 @@ TimelineContentView::set_track (int t)
 void
 TimelineContentView::unset_track ()
 {
-       _track = boost::optional<int> ();
+       _track = boost::optional<int>();
 }
 
 boost::optional<int>
@@ -100,8 +100,8 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
 {
        DCPOMATIC_ASSERT (_track);
 
-       shared_ptr<const Film> film = _timeline.film ();
-       shared_ptr<const Content> cont = content ();
+       auto film = _timeline.film ();
+       auto cont = content ();
        if (!film || !cont) {
                return;
        }
@@ -119,7 +119,7 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
        }
 
        /* Outline */
-       wxGraphicsPath path = gc->CreatePath ();
+       auto path = gc->CreatePath ();
        path.MoveToPoint    (time_x (position) + 2,           y_pos (_track.get()) + 4);
        path.AddLineToPoint (time_x (position + len) - 1,     y_pos (_track.get()) + 4);
        path.AddLineToPoint (time_x (position + len) - 1,     y_pos (_track.get() + 1) - 4);
@@ -139,12 +139,12 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
 
        /* Overlaps */
        gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (foreground_colour(), wxBRUSHSTYLE_CROSSDIAG_HATCH));
-       for (list<dcpomatic::Rect<int> >::const_iterator i = overlaps.begin(); i != overlaps.end(); ++i) {
-               gc->DrawRectangle (i->x, i->y + 4, i->width, i->height - 8);
+       for (auto const& i: overlaps) {
+               gc->DrawRectangle (i.x, i.y + 4, i.width, i.height - 8);
        }
 
        /* Label text */
-       wxString lab = label ();
+       auto lab = label ();
        wxDouble lab_width;
        wxDouble lab_height;
        wxDouble lab_descent;
@@ -166,7 +166,7 @@ TimelineContentView::y_pos (int t) const
 void
 TimelineContentView::content_change (ChangeType type, int p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
index 563c31f703264243946c05e785cec0c7031e26da..f15bf7bfc254f712d37968ce280f2b97f916edb5 100644 (file)
@@ -57,7 +57,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film, weak_pt
        , _film (film)
        , _timeline (this, cp, film, viewer)
 {
-       wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       auto sizer = new wxBoxSizer (wxVERTICAL);
 
        wxBitmap select (bitmap_path("select"), wxBITMAP_TYPE_PNG);
        wxBitmap zoom (bitmap_path("zoom"), wxBITMAP_TYPE_PNG);
@@ -91,7 +91,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film, weak_pt
        sizer->SetSizeHints (this);
 
         _toolbar->ToggleTool ((int) Timeline::SNAP, _timeline.snap ());
-       film_change (CHANGE_TYPE_DONE, Film::SEQUENCE);
+       film_change (ChangeType::DONE, Film::SEQUENCE);
 
        _film_changed_connection = film->Change.connect (bind (&TimelineDialog::film_change, this, _1, _2));
 }
@@ -99,11 +99,11 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film, weak_pt
 void
 TimelineDialog::film_change (ChangeType type, Film::Property p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
-       shared_ptr<Film> film = _film.lock ();
+       auto film = _film.lock ();
        if (!film) {
                return;
        }
@@ -127,7 +127,7 @@ TimelineDialog::tool_clicked (wxCommandEvent& ev)
        if (t == Timeline::SNAP) {
                _timeline.set_snap (_toolbar->GetToolState ((int) t));
        } else if (t == Timeline::SEQUENCE) {
-               shared_ptr<Film> film = _film.lock ();
+               auto film = _film.lock ();
                if (film) {
                        film->set_sequence (_toolbar->GetToolState ((int) t));
                }
index 42a7fe58b22c3a4d39ba98c26d9c171d13c4caed..3e21e709dd2b5fc1749540ed9c4087d5aeddb20c 100644 (file)
@@ -33,7 +33,7 @@ VideoView::VideoView (FilmViewer* viewer)
        : _viewer (viewer)
        , _state_timer ("viewer")
        , _video_frame_rate (0)
-       , _eyes (EYES_LEFT)
+       , _eyes (Eyes::LEFT)
        , _three_d (false)
        , _dropped (0)
        , _errored (0)
@@ -84,7 +84,7 @@ VideoView::get_next_frame (bool non_blocking)
                _player_video.first &&
                _three_d &&
                _eyes != _player_video.first->eyes() &&
-               _player_video.first->eyes() != EYES_BOTH
+               _player_video.first->eyes() != Eyes::BOTH
                );
 
        if (_player_video.first && _player_video.first->error()) {
@@ -109,8 +109,8 @@ VideoView::time_until_next_frame () const
                return optional<int>();
        }
 
-       dcpomatic::DCPTime const next = position() + one_video_frame();
-       dcpomatic::DCPTime const time = _viewer->audio_time().get_value_or(position());
+       auto const next = position() + one_video_frame();
+       auto const time = _viewer->audio_time().get_value_or(position());
        if (next < time) {
                return 0;
        }
@@ -128,7 +128,7 @@ VideoView::start ()
 bool
 VideoView::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video_container_size)
 {
-       pair<shared_ptr<PlayerVideo>, dcpomatic::DCPTime> pv = player_video ();
+       auto pv = player_video ();
        if (!pv.first) {
                return false;
        }
index 6c6dea82781cb7bf746d9d6ca308bd3c6e1c06a2..38b43e9cdbd2bc1f47fc591aee8eb2e12626f238 100644 (file)
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE (fourk_test)
        LogSwitcher ls (film->log());
        film->set_name ("4k_test");
        auto c = make_shared<FFmpegContent>("test/data/test.mp4");
-       film->set_resolution (RESOLUTION_4K);
+       film->set_resolution (Resolution::FOUR_K);
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
        film->examine_and_add_content (c);
index eb066ce0fd19edc588704f309cf2eea01ff40e46..3dceb31b0623a400c0cccde9b82c690d055e619c 100644 (file)
 
 using std::list;
 using std::shared_ptr;
+using std::weak_ptr;
+using std::make_shared;
 using boost::thread;
 using boost::optional;
-using std::weak_ptr;
 using dcp::ArrayData;
 
 void
@@ -60,7 +61,7 @@ do_remote_encode (shared_ptr<DCPVideo> frame, EncodeServerDescription descriptio
 
 BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 {
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), true));
+       auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), true);
        uint8_t* p = image->data()[0];
 
        for (int y = 0; y < 1080; ++y) {
@@ -73,7 +74,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                p += image->stride()[0];
        }
 
-       shared_ptr<Image> sub_image (new Image (AV_PIX_FMT_BGRA, dcp::Size (100, 200), true));
+       auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), true);
        p = sub_image->data()[0];
        for (int y = 0; y < 200; ++y) {
                uint8_t* q = p;
@@ -86,42 +87,38 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                p += sub_image->stride()[0];
        }
 
-       LogSwitcher ls (shared_ptr<Log>(new FileLog("build/test/client_server_test_rgb.log")));
-
-       shared_ptr<PlayerVideo> pvf (
-               new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
-                       Crop (),
-                       optional<double> (),
-                       dcp::Size (1998, 1080),
-                       dcp::Size (1998, 1080),
-                       EYES_BOTH,
-                       PART_WHOLE,
-                       ColourConversion(),
-                       VideoRange::FULL,
-                       weak_ptr<Content>(),
-                       optional<Frame>(),
-                       false
-                       )
+       LogSwitcher ls (make_shared<FileLog>("build/test/client_server_test_rgb.log"));
+
+       auto pvf = std::make_shared<PlayerVideo>(
+               make_shared<RawImageProxy>(image),
+               Crop (),
+               optional<double> (),
+               dcp::Size (1998, 1080),
+               dcp::Size (1998, 1080),
+               Eyes::BOTH,
+               Part::WHOLE,
+               ColourConversion(),
+               VideoRange::FULL,
+               weak_ptr<Content>(),
+               optional<Frame>(),
+               false
                );
 
-       pvf->set_text (PositionImage (sub_image, Position<int> (50, 60)));
+       pvf->set_text (PositionImage(sub_image, Position<int>(50, 60)));
 
-       shared_ptr<DCPVideo> frame (
-               new DCPVideo (
-                       pvf,
-                       0,
-                       24,
-                       200000000,
-                       RESOLUTION_2K
-                       )
+       auto frame = make_shared<DCPVideo> (
+               pvf,
+               0,
+               24,
+               200000000,
+               Resolution::TWO_K
                );
 
-       ArrayData locally_encoded = frame->encode_locally ();
+       auto locally_encoded = frame->encode_locally ();
 
-       EncodeServer* server = new EncodeServer (true, 2);
+       auto server = new EncodeServer (true, 2);
 
-       thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
+       auto server_thread = new thread (boost::bind(&EncodeServer::run, server));
 
        /* Let the server get itself ready */
        dcpomatic_sleep_seconds (1);
@@ -134,12 +131,12 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                threads.push_back (new thread (boost::bind (do_remote_encode, frame, description, locally_encoded)));
        }
 
-       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
-               (*i)->join ();
+       for (auto i: threads) {
+               i->join ();
        }
 
-       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
-               delete *i;
+       for (auto i: threads) {
+               delete i;
        }
 
        server->stop ();
@@ -150,7 +147,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 
 BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 {
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true));
+       auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true);
 
        for (int i = 0; i < image->planes(); ++i) {
                uint8_t* p = image->data()[i];
@@ -159,7 +156,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                }
        }
 
-       shared_ptr<Image> sub_image (new Image (AV_PIX_FMT_BGRA, dcp::Size (100, 200), true));
+       auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), true);
        uint8_t* p = sub_image->data()[0];
        for (int y = 0; y < 200; ++y) {
                uint8_t* q = p;
@@ -172,42 +169,38 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                p += sub_image->stride()[0];
        }
 
-       LogSwitcher ls (shared_ptr<Log>(new FileLog("build/test/client_server_test_yuv.log")));
-
-       shared_ptr<PlayerVideo> pvf (
-               new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
-                       Crop (),
-                       optional<double> (),
-                       dcp::Size (1998, 1080),
-                       dcp::Size (1998, 1080),
-                       EYES_BOTH,
-                       PART_WHOLE,
-                       ColourConversion(),
-                       VideoRange::FULL,
-                       weak_ptr<Content>(),
-                       optional<Frame>(),
-                       false
-                       )
+       LogSwitcher ls (make_shared<FileLog>("build/test/client_server_test_yuv.log"));
+
+       auto pvf = std::make_shared<PlayerVideo>(
+               std::make_shared<RawImageProxy>(image),
+               Crop(),
+               optional<double>(),
+               dcp::Size(1998, 1080),
+               dcp::Size(1998, 1080),
+               Eyes::BOTH,
+               Part::WHOLE,
+               ColourConversion(),
+               VideoRange::FULL,
+               weak_ptr<Content>(),
+               optional<Frame>(),
+               false
                );
 
-       pvf->set_text (PositionImage (sub_image, Position<int> (50, 60)));
+       pvf->set_text (PositionImage(sub_image, Position<int>(50, 60)));
 
-       shared_ptr<DCPVideo> frame (
-               new DCPVideo (
-                       pvf,
-                       0,
-                       24,
-                       200000000,
-                       RESOLUTION_2K
-                       )
+       auto frame = make_shared<DCPVideo>(
+               pvf,
+               0,
+               24,
+               200000000,
+               Resolution::TWO_K
                );
 
-       ArrayData locally_encoded = frame->encode_locally ();
+       auto locally_encoded = frame->encode_locally ();
 
-       EncodeServer* server = new EncodeServer (true, 2);
+       auto server = new EncodeServer (true, 2);
 
-       thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
+       auto server_thread = new thread(boost::bind(&EncodeServer::run, server));
 
        /* Let the server get itself ready */
        dcpomatic_sleep_seconds (1);
@@ -217,15 +210,15 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 
        list<thread*> threads;
        for (int i = 0; i < 8; ++i) {
-               threads.push_back (new thread (boost::bind (do_remote_encode, frame, description, locally_encoded)));
+               threads.push_back (new thread(boost::bind(do_remote_encode, frame, description, locally_encoded)));
        }
 
-       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
-               (*i)->join ();
+       for (auto i: threads) {
+               i->join ();
        }
 
-       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
-               delete *i;
+       for (auto i: threads) {
+               delete i;
        }
 
        server->stop ();
@@ -236,7 +229,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 
 BOOST_AUTO_TEST_CASE (client_server_test_j2k)
 {
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true));
+       auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true);
 
        for (int i = 0; i < image->planes(); ++i) {
                uint8_t* p = image->data()[i];
@@ -245,69 +238,61 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                }
        }
 
-       LogSwitcher ls (shared_ptr<Log>(new FileLog("build/test/client_server_test_j2k.log")));
-
-       shared_ptr<PlayerVideo> raw_pvf (
-               new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
-                       Crop (),
-                       optional<double> (),
-                       dcp::Size (1998, 1080),
-                       dcp::Size (1998, 1080),
-                       EYES_BOTH,
-                       PART_WHOLE,
-                       ColourConversion(),
-                       VideoRange::FULL,
-                       weak_ptr<Content>(),
-                       optional<Frame>(),
-                       false
-                       )
+       LogSwitcher ls (make_shared<FileLog>("build/test/client_server_test_j2k.log"));
+
+       auto raw_pvf = std::make_shared<PlayerVideo> (
+               std::make_shared<RawImageProxy>(image),
+               Crop(),
+               optional<double>(),
+               dcp::Size(1998, 1080),
+               dcp::Size(1998, 1080),
+               Eyes::BOTH,
+               Part::WHOLE,
+               ColourConversion(),
+               VideoRange::FULL,
+               weak_ptr<Content>(),
+               optional<Frame>(),
+               false
                );
 
-       shared_ptr<DCPVideo> raw_frame (
-               new DCPVideo (
-                       raw_pvf,
-                       0,
-                       24,
-                       200000000,
-                       RESOLUTION_2K
-                       )
+       auto raw_frame = make_shared<DCPVideo> (
+               raw_pvf,
+               0,
+               24,
+               200000000,
+               Resolution::TWO_K
                );
 
-       ArrayData raw_locally_encoded = raw_frame->encode_locally ();
-
-       shared_ptr<PlayerVideo> j2k_pvf (
-               new PlayerVideo (
-                       shared_ptr<ImageProxy> (new J2KImageProxy (raw_locally_encoded, dcp::Size (1998, 1080), AV_PIX_FMT_XYZ12LE)),
-                       Crop (),
-                       optional<double> (),
-                       dcp::Size (1998, 1080),
-                       dcp::Size (1998, 1080),
-                       EYES_BOTH,
-                       PART_WHOLE,
-                       PresetColourConversion::all().front().conversion,
-                       VideoRange::FULL,
-                       weak_ptr<Content>(),
-                       optional<Frame>(),
-                       false
-                       )
+       auto raw_locally_encoded = raw_frame->encode_locally ();
+
+       auto j2k_pvf = std::make_shared<PlayerVideo> (
+               std::make_shared<J2KImageProxy>(raw_locally_encoded, dcp::Size(1998, 1080), AV_PIX_FMT_XYZ12LE),
+               Crop(),
+               optional<double>(),
+               dcp::Size(1998, 1080),
+               dcp::Size(1998, 1080),
+               Eyes::BOTH,
+               Part::WHOLE,
+               PresetColourConversion::all().front().conversion,
+               VideoRange::FULL,
+               weak_ptr<Content>(),
+               optional<Frame>(),
+               false
                );
 
-       shared_ptr<DCPVideo> j2k_frame (
-               new DCPVideo (
-                       j2k_pvf,
-                       0,
-                       24,
-                       200000000,
-                       RESOLUTION_2K
-                       )
+       auto j2k_frame = make_shared<DCPVideo> (
+               j2k_pvf,
+               0,
+               24,
+               200000000,
+               Resolution::TWO_K
                );
 
-       ArrayData j2k_locally_encoded = j2k_frame->encode_locally ();
+       auto j2k_locally_encoded = j2k_frame->encode_locally ();
 
-       EncodeServer* server = new EncodeServer (true, 2);
+       auto server = new EncodeServer (true, 2);
 
-       thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
+       auto server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
        /* Let the server get itself ready */
        dcpomatic_sleep_seconds (1);
@@ -317,15 +302,15 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
 
        list<thread*> threads;
        for (int i = 0; i < 8; ++i) {
-               threads.push_back (new thread (boost::bind (do_remote_encode, j2k_frame, description, j2k_locally_encoded)));
+               threads.push_back (new thread(boost::bind(do_remote_encode, j2k_frame, description, j2k_locally_encoded)));
        }
 
-       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
-               (*i)->join ();
+       for (auto i: threads) {
+               i->join ();
        }
 
-       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
-               delete *i;
+       for (auto i: threads) {
+               delete i;
        }
 
        server->stop ();
index 48fc8e05c91a1a52893ade569dc9477d65bae3a2..31824b44393cf6d7f995db68da57e10bc28d722c 100644 (file)
@@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1)
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       content->only_text()->set_type (TEXT_CLOSED_CAPTION);
+       content->only_text()->set_type (TextType::CLOSED_CAPTION);
 
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs ());
@@ -68,11 +68,11 @@ BOOST_AUTO_TEST_CASE (closed_caption_test2)
        film->examine_and_add_content (content3);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       content1->only_text()->set_type (TEXT_CLOSED_CAPTION);
+       content1->only_text()->set_type (TextType::CLOSED_CAPTION);
        content1->only_text()->set_dcp_track (DCPTextTrack("First track", "fr-FR"));
-       content2->only_text()->set_type (TEXT_CLOSED_CAPTION);
+       content2->only_text()->set_type (TextType::CLOSED_CAPTION);
        content2->only_text()->set_dcp_track (DCPTextTrack("Second track", "de-DE"));
-       content3->only_text()->set_type (TEXT_CLOSED_CAPTION);
+       content3->only_text()->set_type (TextType::CLOSED_CAPTION);
        content3->only_text()->set_dcp_track (DCPTextTrack("Third track", "it-IT"));
 
        film->make_dcp ();
index 31c8ae877e8a8841ecbed7ac0f93c1a90b8cb21a..9010dae21e6b190ba44da41edddacb79d8b38229 100644 (file)
@@ -130,18 +130,18 @@ BOOST_AUTO_TEST_CASE (create_cli_test)
        BOOST_CHECK_EQUAL (*cc.output_dir, "flaps");
        BOOST_REQUIRE_EQUAL (cc.content.size(), 3U);
        BOOST_CHECK_EQUAL (cc.content[0].path, "fred");
-       BOOST_CHECK_EQUAL (cc.content[0].frame_type, VIDEO_FRAME_TYPE_2D);
+       BOOST_CHECK_EQUAL (cc.content[0].frame_type, VideoFrameType::TWO_D);
        BOOST_CHECK_EQUAL (cc.content[1].path, "jim");
-       BOOST_CHECK_EQUAL (cc.content[1].frame_type, VIDEO_FRAME_TYPE_2D);
+       BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::TWO_D);
        BOOST_CHECK_EQUAL (cc.content[2].path, "sheila");
-       BOOST_CHECK_EQUAL (cc.content[2].frame_type, VIDEO_FRAME_TYPE_2D);
+       BOOST_CHECK_EQUAL (cc.content[2].frame_type, VideoFrameType::TWO_D);
 
        cc = run ("dcpomatic2_create --left-eye left.mp4 --right-eye right.mp4");
        BOOST_REQUIRE_EQUAL (cc.content.size(), 2U);
        BOOST_CHECK_EQUAL (cc.content[0].path, "left.mp4");
-       BOOST_CHECK_EQUAL (cc.content[0].frame_type, VIDEO_FRAME_TYPE_3D_LEFT);
+       BOOST_CHECK_EQUAL (cc.content[0].frame_type, VideoFrameType::THREE_D_LEFT);
        BOOST_CHECK_EQUAL (cc.content[1].path, "right.mp4");
-       BOOST_CHECK_EQUAL (cc.content[1].frame_type, VIDEO_FRAME_TYPE_3D_RIGHT);
+       BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::THREE_D_RIGHT);
        BOOST_CHECK_EQUAL (cc.fourk, false);
 
        cc = run ("dcpomatic2_create --fourk foo.mp4");
index ba73461bf1b8d4719f5b8d28ea969767dfe18123..bfa8e62f65456f8b14f8fc00340f19b3480804c1 100644 (file)
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE (digest_test)
        film->examine_and_add_content (r);
        film->examine_and_add_content (g);
        film->examine_and_add_content (b);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        BOOST_REQUIRE (!wait_for_jobs());
 
        BOOST_CHECK (Config::instance()->master_encoding_threads() > 1);
index 1147b4d07dbbadb3608cc1bfb7852078eee32d2b..7a967b2009e06b4e7c2317029a253619c6fff27d 100644 (file)
@@ -45,16 +45,16 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f
        string name = "ffmpeg_encoder_";
        string extension;
        switch (format) {
-       case EXPORT_FORMAT_H264_AAC:
+       case ExportFormat::H264_AAC:
                name += "h264";
                extension = "mp4";
                break;
-       case EXPORT_FORMAT_PRORES:
+       case ExportFormat::PRORES:
                name += "prores";
                extension = "mov";
                break;
-       case EXPORT_FORMAT_H264_PCM:
-       case EXPORT_FORMAT_SUBTITLES_DCP:
+       case ExportFormat::H264_PCM:
+       case ExportFormat::SUBTITLES_DCP:
                BOOST_REQUIRE (false);
        }
 
@@ -78,25 +78,25 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f
 /** Red / green / blue MP4 -> Prores */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test1)
 {
-       ffmpeg_content_test (1, "test/data/test.mp4", EXPORT_FORMAT_PRORES);
+       ffmpeg_content_test (1, "test/data/test.mp4", ExportFormat::PRORES);
 }
 
 /** Dolby Aurora trailer VOB -> Prores */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test2)
 {
-       ffmpeg_content_test (2, TestPaths::private_data() / "dolby_aurora.vob", EXPORT_FORMAT_PRORES);
+       ffmpeg_content_test (2, TestPaths::private_data() / "dolby_aurora.vob", ExportFormat::PRORES);
 }
 
 /** Sintel trailer -> Prores */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test3)
 {
-       ffmpeg_content_test (3, TestPaths::private_data() / "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", EXPORT_FORMAT_PRORES);
+       ffmpeg_content_test (3, TestPaths::private_data() / "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", ExportFormat::PRORES);
 }
 
 /** Big Buck Bunny trailer -> Prores */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test4)
 {
-       ffmpeg_content_test (4, TestPaths::private_data() / "big_buck_bunny_trailer_480p.mov", EXPORT_FORMAT_PRORES);
+       ffmpeg_content_test (4, TestPaths::private_data() / "big_buck_bunny_trailer_480p.mov", ExportFormat::PRORES);
 }
 
 /** Still image -> Prores */
@@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test5)
 
        film->write_metadata ();
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", EXPORT_FORMAT_PRORES, false, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", ExportFormat::PRORES, false, false, false, 23);
        encoder.go ();
 }
 
@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6)
        film->write_metadata();
 
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", EXPORT_FORMAT_PRORES, false, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", ExportFormat::PRORES, false, false, false, 23);
        encoder.go ();
 }
 
@@ -160,14 +160,14 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7)
        s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
 
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", EXPORT_FORMAT_PRORES, false, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", ExportFormat::PRORES, false, false, false, 23);
        encoder.go ();
 }
 
 /** Red / green / blue MP4 -> H264 */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test1)
 {
-       ffmpeg_content_test(1, "test/data/test.mp4", EXPORT_FORMAT_H264_AAC);
+       ffmpeg_content_test(1, "test/data/test.mp4", ExportFormat::H264_AAC);
 }
 
 /** Just subtitles -> H264 */
@@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2)
        film->write_metadata();
 
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", ExportFormat::H264_AAC, false, false, false, 23);
        encoder.go ();
 }
 
@@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3)
        film->write_metadata();
 
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", ExportFormat::H264_AAC, false, false, false, 23);
        encoder.go ();
 }
 
@@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4)
        film->set_container(Ratio::from_id("185"));
 
        shared_ptr<Job> job(new TranscodeJob(film));
-       FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23);
+       FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", ExportFormat::H264_AAC, false, false, false, 23);
        encoder.go();
 }
 
@@ -280,7 +280,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5)
        Rs->audio->set_mapping (map);
 
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", ExportFormat::H264_AAC, true, false, false, 23);
        encoder.go ();
 
        check_ffmpeg ("build/test/ffmpeg_encoder_h264_test5.mp4", "test/data/ffmpeg_encoder_h264_test5.mp4", 1);
@@ -308,7 +308,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6)
        }
 
        shared_ptr<Job> job (new TranscodeJob (film2));
-       FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23);
+       FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", ExportFormat::H264_AAC, true, false, false, 23);
        encoder.go ();
 }
 
@@ -321,9 +321,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7)
        shared_ptr<Content> R (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data() / "bbc405.png")));
        film->examine_and_add_content (R);
        BOOST_REQUIRE (!wait_for_jobs());
-       L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+       L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
        L->set_position (film, DCPTime());
-       R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
        R->set_position (film, DCPTime());
        film->set_three_d (true);
        film->make_dcp ();
@@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7)
        BOOST_REQUIRE (!wait_for_jobs());
 
        shared_ptr<Job> job (new TranscodeJob (film2));
-       FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23);
+       FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", ExportFormat::H264_AAC, true, false, false, 23);
        encoder.go ();
 }
 
@@ -349,7 +349,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8)
        film->set_audio_channels (2);
 
        shared_ptr<Job> job(new TranscodeJob(film));
-       FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23);
+       FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", ExportFormat::H264_AAC, true, false, false, 23);
        encoder.go();
 }
 
@@ -370,6 +370,6 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9)
 
        film->write_metadata ();
        shared_ptr<Job> job (new TranscodeJob (film));
-       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", EXPORT_FORMAT_H264_AAC, false, false, false, 23);
+       FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", ExportFormat::H264_AAC, false, false, false, 23);
        encoder.go ();
 }
index 6fce510604ed27eb107819baecd712b00fa3be02..ef43316d26281e208b13d55f501b75b1d270cf36 100644 (file)
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (file_naming_test)
        b->set_video_frame_rate (24);
        b->video->set_length (24);
 
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->write_metadata ();
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE (file_naming_test2)
        b->set_video_frame_rate (24);
        b->video->set_length (24);
 
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
 
index 1be36193a96374fe6a7584d0e3abe476d515fddc..2aec8169330f8a20f614b16dcd2c9085dbc38f74 100644 (file)
@@ -85,7 +85,7 @@ check (TextType type, string name, optional<string> expected_hint = optional<str
 BOOST_AUTO_TEST_CASE (hint_closed_caption_too_long)
 {
        check (
-               TEXT_CLOSED_CAPTION,
+               TextType::CLOSED_CAPTION,
                "hint_closed_caption_too_long",
                String::compose("At least one of your closed caption lines has more than %1 characters.  It is advisable to make each line %1 characters at most in length.", MAX_CLOSED_CAPTION_LENGTH, MAX_CLOSED_CAPTION_LENGTH)
              );
@@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_too_long)
 BOOST_AUTO_TEST_CASE (hint_many_closed_caption_lines)
 {
        check (
-               TEXT_CLOSED_CAPTION,
+               TextType::CLOSED_CAPTION,
                "hint_many_closed_caption_lines",
                String::compose("Some of your closed captions span more than %1 lines, so they will be truncated.", MAX_CLOSED_CAPTION_LINES)
              );
@@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE (hint_many_closed_caption_lines)
 BOOST_AUTO_TEST_CASE (hint_subtitle_too_early)
 {
        check (
-               TEXT_OPEN_SUBTITLE,
+               TextType::OPEN_SUBTITLE,
                "hint_subtitle_too_early",
                string("It is advisable to put your first subtitle at least 4 seconds after the start of the DCP to make sure it is seen.")
                );
@@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_too_early)
 BOOST_AUTO_TEST_CASE (hint_short_subtitles)
 {
        check (
-               TEXT_OPEN_SUBTITLE,
+               TextType::OPEN_SUBTITLE,
                "hint_short_subtitles",
                string("At least one of your subtitles lasts less than 15 frames.  It is advisable to make each subtitle at least 15 frames long.")
                );
@@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (hint_short_subtitles)
 BOOST_AUTO_TEST_CASE (hint_subtitles_too_close)
 {
        check (
-               TEXT_OPEN_SUBTITLE,
+               TextType::OPEN_SUBTITLE,
                "hint_subtitles_too_close",
                string("At least one of your subtitles starts less than 2 frames after the previous one.  It is advisable to make the gap between subtitles at least 2 frames.")
              );
@@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE (hint_subtitles_too_close)
 BOOST_AUTO_TEST_CASE (hint_many_subtitle_lines)
 {
        check (
-               TEXT_OPEN_SUBTITLE,
+               TextType::OPEN_SUBTITLE,
                "hint_many_subtitle_lines",
                string("At least one of your subtitles has more than 3 lines.  It is advisable to use no more than 3 lines.")
              );
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE (hint_many_subtitle_lines)
 BOOST_AUTO_TEST_CASE (hint_subtitle_too_long)
 {
        check (
-               TEXT_OPEN_SUBTITLE,
+               TextType::OPEN_SUBTITLE,
                "hint_subtitle_too_long",
                string("At least one of your subtitle lines has more than 52 characters.  It is advisable to make each line 52 characters at most in length.")
              );
@@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_mxf_too_big)
 
        shared_ptr<Film> film = new_test_film2 (name);
        shared_ptr<Content> content = content_factory("test/data/" + name + ".srt").front();
-       content->text.front()->set_type (TEXT_OPEN_SUBTITLE);
+       content->text.front()->set_type (TextType::OPEN_SUBTITLE);
        for (int i = 1; i < 512; ++i) {
                shared_ptr<dcpomatic::Font> font(new dcpomatic::Font(String::compose("font_%1", i)));
                font->set_file ("test/data/LiberationSans-Regular.ttf");
@@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_xml_too_big)
        fclose (ccap);
 
        shared_ptr<Content> content = content_factory("build/test/" + name + ".srt").front();
-       content->text.front()->set_type (TEXT_CLOSED_CAPTION);
+       content->text.front()->set_type (TextType::CLOSED_CAPTION);
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
        vector<string> hints = get_hints (film);
index 3465db750336118e3297630d350975f24bde53d8..dc2263206963367ea389d163ffbc8fb5d9202912 100644 (file)
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        film->set_container (Ratio::from_id ("239"));
        film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
        film->set_audio_channels (1);
-       film->set_resolution (RESOLUTION_4K);
+       film->set_resolution (Resolution::FOUR_K);
        film->set_subtitle_language (dcp::LanguageTag("fr-FR"));
        shared_ptr<Content> text = content_factory("test/data/subrip.srt").front();
        BOOST_REQUIRE_EQUAL (text->text.size(), 1U);
index d0f2aaa6b51b52a764faed9e10cf1c235c1d4307..cec864e0fe4203579fd5b7a17694436e087005fe 100644 (file)
@@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE (optimise_stills_test2)
        shared_ptr<Content> content = content_factory("test/data/flat_red.png").front ();
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
-       content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
+       content->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT);
        film->set_three_d (true);
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs ());
index 96f75f098ff15273b16b768af2549524f07094c4..9194b84bbbf52f0e97e22eabf8f5263de6cb5f11 100644 (file)
@@ -312,7 +312,7 @@ BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test)
        shared_ptr<Content> text = content_factory("test/data/subrip.srt").front();
        film->examine_and_add_content (text);
        BOOST_REQUIRE (!wait_for_jobs());
-       text->only_text()->set_type (TEXT_CLOSED_CAPTION);
+       text->only_text()->set_type (TextType::CLOSED_CAPTION);
        text->only_text()->set_use (true);
 
        shared_ptr<Player> player (new Player(film));
@@ -375,9 +375,9 @@ BOOST_AUTO_TEST_CASE (player_3d_test_1)
        film->examine_and_add_content (right);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       left->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+       left->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
        left->set_position (film, DCPTime());
-       right->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       right->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
        right->set_position (film, DCPTime());
        film->set_three_d (true);
 
@@ -404,9 +404,9 @@ BOOST_AUTO_TEST_CASE (player_3d_test_2)
        film->examine_and_add_content (right);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       left->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+       left->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
        left->set_position (film, DCPTime());
-       right->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       right->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
        right->set_position (film, DCPTime());
        film->set_three_d (true);
 
index 13cb37a07c873c72fdfbb240b7f1bdccba3b8255..bdbd6f273de0409482c7335c48d7378a4b9b9d60 100644 (file)
@@ -36,8 +36,9 @@
 #include <iostream>
 
 using std::cout;
-using std::string;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
@@ -85,15 +86,15 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
 
 BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_test_2d"))
 {
-       shared_ptr<Film> film = new_test_film ("recover_test_3d");
+       auto film = new_test_film ("recover_test_3d");
        film->set_interop (false);
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("recover_test");
        film->set_three_d (true);
 
-       shared_ptr<ImageContent> content (new ImageContent("test/data/3d_test"));
-       content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
+       auto content = make_shared<ImageContent>("test/data/3d_test");
+       content->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT);
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
@@ -112,8 +113,8 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
 
-       shared_ptr<dcp::StereoPictureAsset> A (new dcp::StereoPictureAsset ("build/test/recover_test_3d/original.mxf"));
-       shared_ptr<dcp::StereoPictureAsset> B (new dcp::StereoPictureAsset (video));
+       auto A = make_shared<dcp::StereoPictureAsset>("build/test/recover_test_3d/original.mxf");
+       auto B = make_shared<dcp::StereoPictureAsset>(video);
 
        dcp::EqualityOptions eq;
        BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
@@ -122,7 +123,7 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t
 
 BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on("recover_test_3d"))
 {
-       shared_ptr<Film> film = new_test_film ("recover_test_2d_encrypted");
+       auto film = new_test_film ("recover_test_2d_encrypted");
        film->set_interop (false);
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
@@ -130,7 +131,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
        film->set_encrypted (true);
        film->_key = dcp::Key("eafcb91c9f5472edf01f3a2404c57258");
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/count300bd24.m2ts"));
+       auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
@@ -150,9 +151,9 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
 
-       shared_ptr<dcp::MonoPictureAsset> A (new dcp::MonoPictureAsset ("build/test/recover_test_2d_encrypted/original.mxf"));
+       auto A = make_shared<dcp::MonoPictureAsset>("build/test/recover_test_2d_encrypted/original.mxf");
        A->set_key (film->key ());
-       shared_ptr<dcp::MonoPictureAsset> B (new dcp::MonoPictureAsset (video));
+       auto B = make_shared<dcp::MonoPictureAsset>(video);
        B->set_key (film->key ());
 
        dcp::EqualityOptions eq;
index 1223a217aec9fcbaa67bd00a6a7c2209704b7da4..9e567fb2a2714663dcd8cc3334e5d80f4808000d 100644 (file)
@@ -50,50 +50,50 @@ static bool equal (dcp::FrameInfo a, ReelWriter const & writer, shared_ptr<InfoF
 
 BOOST_AUTO_TEST_CASE (write_frame_info_test)
 {
-       shared_ptr<Film> film = new_test_film2 ("write_frame_info_test");
+       auto film = new_test_film2 ("write_frame_info_test");
        dcpomatic::DCPTimePeriod const period (dcpomatic::DCPTime(0), dcpomatic::DCPTime(96000));
        ReelWriter writer (film, period, shared_ptr<Job>(), 0, 1, false);
 
        /* Write the first one */
 
        dcp::FrameInfo info1(0, 123, "12345678901234567890123456789012");
-       writer.write_frame_info (0, EYES_LEFT, info1);
+       writer.write_frame_info (0, Eyes::LEFT, info1);
        {
-               shared_ptr<InfoFileHandle> file = film->info_file_handle(period, true);
-               BOOST_CHECK (equal(info1, writer, file, 0, EYES_LEFT));
+               auto file = film->info_file_handle(period, true);
+               BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT));
        }
 
        /* Write some more */
 
        dcp::FrameInfo info2(596, 14921, "123acb789f1234ae782012n456339522");
-       writer.write_frame_info (5, EYES_RIGHT, info2);
+       writer.write_frame_info (5, Eyes::RIGHT, info2);
 
        {
-               shared_ptr<InfoFileHandle> file = film->info_file_handle(period, true);
-               BOOST_CHECK (equal(info1, writer, file, 0, EYES_LEFT));
-               BOOST_CHECK (equal(info2, writer, file, 5, EYES_RIGHT));
+               auto file = film->info_file_handle(period, true);
+               BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT));
+               BOOST_CHECK (equal(info2, writer, file, 5, Eyes::RIGHT));
        }
 
        dcp::FrameInfo info3(12494, 99157123, "xxxxyyyyabc12356ffsfdsf456339522");
-       writer.write_frame_info (10, EYES_LEFT, info3);
+       writer.write_frame_info (10, Eyes::LEFT, info3);
 
        {
-               shared_ptr<InfoFileHandle> file = film->info_file_handle(period, true);
-               BOOST_CHECK (equal(info1, writer, file, 0, EYES_LEFT));
-               BOOST_CHECK (equal(info2, writer, file, 5, EYES_RIGHT));
-               BOOST_CHECK (equal(info3, writer, file, 10, EYES_LEFT));
+               auto file = film->info_file_handle(period, true);
+               BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT));
+               BOOST_CHECK (equal(info2, writer, file, 5, Eyes::RIGHT));
+               BOOST_CHECK (equal(info3, writer, file, 10, Eyes::LEFT));
        }
 
        /* Overwrite one */
 
        dcp::FrameInfo info4(55512494, 123599157123, "ABCDEFGyabc12356ffsfdsf4563395ZZ");
-       writer.write_frame_info (5, EYES_RIGHT, info4);
+       writer.write_frame_info (5, Eyes::RIGHT, info4);
 
        {
-               shared_ptr<InfoFileHandle> file = film->info_file_handle(period, true);
-               BOOST_CHECK (equal(info1, writer, file, 0, EYES_LEFT));
-               BOOST_CHECK (equal(info4, writer, file, 5, EYES_RIGHT));
-               BOOST_CHECK (equal(info3, writer, file, 10, EYES_LEFT));
+               auto file = film->info_file_handle(period, true);
+               BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT));
+               BOOST_CHECK (equal(info4, writer, file, 5, Eyes::RIGHT));
+               BOOST_CHECK (equal(info3, writer, file, 10, Eyes::LEFT));
        }
 }
 
@@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE (write_frame_info_test)
 BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
 {
        /* Make a DCP */
-       shared_ptr<Film> film = new_test_film2 ("reel_reuse_video_test");
-       shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+       auto film = new_test_film2 ("reel_reuse_video_test");
+       auto video = content_factory("test/data/flat_red.png").front();
        film->examine_and_add_content (video);
        BOOST_REQUIRE (!wait_for_jobs());
-       shared_ptr<Content> audio = content_factory("test/data/white.wav").front();
+       auto audio = content_factory("test/data/white.wav").front();
        film->examine_and_add_content (audio);
        BOOST_REQUIRE (!wait_for_jobs());
        film->make_dcp ();
index cf8dc3e2ea5d8e3cdfe7c44e6eb35eb460f371a4..4020053395f6649aeb8337665383605b72e16aeb 100644 (file)
@@ -41,28 +41,29 @@ using std::cout;
 using std::vector;
 using std::string;
 using std::shared_ptr;
+using std::make_shared;
 using boost::function;
 using namespace dcpomatic;
 
 /** Test Film::reels() */
 BOOST_AUTO_TEST_CASE (reels_test1)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test1");
+       auto film = new_test_film ("reels_test1");
        film->set_container (Ratio::from_id ("185"));
-       shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test.mp4"));
+       auto A = make_shared<FFmpegContent>("test/data/test.mp4");
        film->examine_and_add_content (A);
-       shared_ptr<FFmpegContent> B (new FFmpegContent("test/data/test.mp4"));
+       auto B = make_shared<FFmpegContent>("test/data/test.mp4");
        film->examine_and_add_content (B);
        BOOST_REQUIRE (!wait_for_jobs());
        BOOST_CHECK_EQUAL (A->full_length(film).get(), 288000);
 
-       film->set_reel_type (REELTYPE_SINGLE);
-       list<DCPTimePeriod> r = film->reels ();
+       film->set_reel_type (ReelType::SINGLE);
+       auto r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 1U);
        BOOST_CHECK_EQUAL (r.front().from.get(), 0);
        BOOST_CHECK_EQUAL (r.front().to.get(), 288000 * 2);
 
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 2U);
        BOOST_CHECK_EQUAL (r.front().from.get(), 0);
@@ -71,12 +72,12 @@ BOOST_AUTO_TEST_CASE (reels_test1)
        BOOST_CHECK_EQUAL (r.back().to.get(), 288000 * 2);
 
        film->set_j2k_bandwidth (100000000);
-       film->set_reel_type (REELTYPE_BY_LENGTH);
+       film->set_reel_type (ReelType::BY_LENGTH);
        /* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */
        film->set_reel_length (31253154);
        r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3U);
-       list<DCPTimePeriod>::const_iterator i = r.begin ();
+       auto i = r.begin ();
        BOOST_CHECK_EQUAL (i->from.get(), 0);
        BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(60, 24).get());
        ++i;
@@ -92,7 +93,7 @@ BOOST_AUTO_TEST_CASE (reels_test1)
  */
 BOOST_AUTO_TEST_CASE (reels_test2)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test2");
+       auto film = new_test_film ("reels_test2");
        film->set_name ("reels_test2");
        film->set_container (Ratio::from_id ("185"));
        film->set_interop (false);
@@ -119,7 +120,7 @@ BOOST_AUTO_TEST_CASE (reels_test2)
                c->video->set_length (24);
        }
 
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        BOOST_CHECK_EQUAL (film->reels().size(), 3U);
        BOOST_REQUIRE (!wait_for_jobs());
 
@@ -132,15 +133,15 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        film2->set_name ("reels_test2b");
        film2->set_container (Ratio::from_id ("185"));
        film2->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       film2->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film2->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
-       shared_ptr<DCPContent> c (new DCPContent(film->dir(film->dcp_name())));
+       auto c = make_shared<DCPContent>(film->dir(film->dcp_name()));
        film2->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       list<DCPTimePeriod> r = film2->reels ();
+       auto r = film2->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3U);
-       list<DCPTimePeriod>::const_iterator i = r.begin ();
+       auto i = r.begin ();
        BOOST_CHECK_EQUAL (i->from.get(), 0);
        BOOST_CHECK_EQUAL (i->to.get(), 96000);
        ++i;
@@ -157,26 +158,26 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        BOOST_REQUIRE (!wait_for_jobs());
 }
 
-/** Check that REELTYPE_BY_VIDEO_CONTENT adds an extra reel, if necessary, at the end
+/** Check that ReelType::BY_VIDEO_CONTENT adds an extra reel, if necessary, at the end
  *  of all the video content to mop up anything afterward.
  */
 BOOST_AUTO_TEST_CASE (reels_test3)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test3");
+       auto film = new_test_film ("reels_test3");
        film->set_name ("reels_test3");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
-       shared_ptr<Content> dcp (new DCPContent("test/data/reels_test2"));
+       auto dcp = make_shared<DCPContent>("test/data/reels_test2");
        film->examine_and_add_content (dcp);
-       shared_ptr<Content> sub (new StringTextFileContent("test/data/subrip.srt"));
+       auto sub = make_shared<StringTextFileContent>("test/data/subrip.srt");
        film->examine_and_add_content (sub);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       list<DCPTimePeriod> reels = film->reels();
+       auto reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4U);
-       list<DCPTimePeriod>::const_iterator i = reels.begin ();
+       auto i = reels.begin ();
        BOOST_CHECK_EQUAL (i->from.get(), 0);
        BOOST_CHECK_EQUAL (i->to.get(), 96000);
        ++i;
@@ -195,11 +196,11 @@ BOOST_AUTO_TEST_CASE (reels_test3)
  */
 BOOST_AUTO_TEST_CASE (reels_test4)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test4");
+       auto film = new_test_film ("reels_test4");
        film->set_name ("reels_test4");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->set_interop (false);
 
        /* 4 piece of 1s-long content */
@@ -215,9 +216,9 @@ BOOST_AUTO_TEST_CASE (reels_test4)
        film->examine_and_add_content (subs);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       list<DCPTimePeriod> reels = film->reels();
+       auto reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4U);
-       list<DCPTimePeriod>::const_iterator i = reels.begin ();
+       auto i = reels.begin ();
        BOOST_CHECK_EQUAL (i->from.get(), 0);
        BOOST_CHECK_EQUAL (i->to.get(), 96000);
        ++i;
@@ -238,7 +239,7 @@ BOOST_AUTO_TEST_CASE (reels_test4)
 
 BOOST_AUTO_TEST_CASE (reels_test5)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test5");
+       auto film = new_test_film ("reels_test5");
        film->set_sequence (false);
        shared_ptr<DCPContent> dcp (new DCPContent("test/data/reels_test4"));
        film->examine_and_add_content (dcp);
@@ -248,9 +249,9 @@ BOOST_AUTO_TEST_CASE (reels_test5)
        dcp->set_position(film, DCPTime(2123));
 
        {
-               list<DCPTimePeriod> p = dcp->reels (film);
+               auto p = dcp->reels (film);
                BOOST_REQUIRE_EQUAL (p.size(), 4U);
-               list<DCPTimePeriod>::const_iterator i = p.begin();
+               auto i = p.begin();
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 96000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 96000), DCPTime(4000 + 192000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 192000), DCPTime(4000 + 288000)));
@@ -259,9 +260,9 @@ BOOST_AUTO_TEST_CASE (reels_test5)
 
        {
                dcp->set_trim_start (ContentTime::from_seconds (0.5));
-               list<DCPTimePeriod> p = dcp->reels (film);
+               auto p = dcp->reels (film);
                BOOST_REQUIRE_EQUAL (p.size(), 4U);
-               list<DCPTimePeriod>::const_iterator i = p.begin();
+               auto i = p.begin();
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 48000), DCPTime(4000 + 144000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 144000), DCPTime(4000 + 240000)));
@@ -270,9 +271,9 @@ BOOST_AUTO_TEST_CASE (reels_test5)
 
        {
                dcp->set_trim_end (ContentTime::from_seconds (0.5));
-               list<DCPTimePeriod> p = dcp->reels (film);
+               auto p = dcp->reels (film);
                BOOST_REQUIRE_EQUAL (p.size(), 4U);
-               list<DCPTimePeriod>::const_iterator i = p.begin();
+               auto i = p.begin();
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 48000), DCPTime(4000 + 144000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 144000), DCPTime(4000 + 240000)));
@@ -281,9 +282,9 @@ BOOST_AUTO_TEST_CASE (reels_test5)
 
        {
                dcp->set_trim_start (ContentTime::from_seconds (1.5));
-               list<DCPTimePeriod> p = dcp->reels (film);
+               auto p = dcp->reels (film);
                BOOST_REQUIRE_EQUAL (p.size(), 3U);
-               list<DCPTimePeriod>::const_iterator i = p.begin();
+               auto i = p.begin();
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 48000), DCPTime(4000 + 144000)));
                BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 144000), DCPTime(4000 + 192000)));
@@ -293,7 +294,7 @@ BOOST_AUTO_TEST_CASE (reels_test5)
 /** Check reel split with a muxed video/audio source */
 BOOST_AUTO_TEST_CASE (reels_test6)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test6");
+       auto film = new_test_film ("reels_test6");
        film->set_name ("reels_test6");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
@@ -302,7 +303,7 @@ BOOST_AUTO_TEST_CASE (reels_test6)
        BOOST_REQUIRE (!wait_for_jobs ());
 
        film->set_j2k_bandwidth (100000000);
-       film->set_reel_type (REELTYPE_BY_LENGTH);
+       film->set_reel_type (ReelType::BY_LENGTH);
        /* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */
        film->set_reel_length (31253154);
        film->make_dcp ();
@@ -310,24 +311,24 @@ BOOST_AUTO_TEST_CASE (reels_test6)
 }
 
 /** Check the case where the last bit of audio hangs over the end of the video
- *  and we are using REELTYPE_BY_VIDEO_CONTENT.
+ *  and we are using ReelType::BY_VIDEO_CONTENT.
  */
 BOOST_AUTO_TEST_CASE (reels_test7)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test7");
+       auto film = new_test_film ("reels_test7");
        film->set_name ("reels_test7");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       shared_ptr<Content> A = content_factory("test/data/flat_red.png").front();
+       auto A = content_factory("test/data/flat_red.png").front();
        film->examine_and_add_content (A);
        BOOST_REQUIRE (!wait_for_jobs ());
-       shared_ptr<Content> B = content_factory("test/data/awkward_length.wav").front();
+       auto B = content_factory("test/data/awkward_length.wav").front();
        film->examine_and_add_content (B);
        BOOST_REQUIRE (!wait_for_jobs ());
        film->set_video_frame_rate (24);
        A->video->set_length (2 * 24);
 
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        BOOST_REQUIRE_EQUAL (film->reels().size(), 2U);
        BOOST_CHECK (film->reels().front() == DCPTimePeriod(DCPTime(0), DCPTime::from_frames(2 * 24, 24)));
        BOOST_CHECK (film->reels().back() == DCPTimePeriod(DCPTime::from_frames(2 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
@@ -343,7 +344,7 @@ BOOST_AUTO_TEST_CASE (reels_test8)
        film->set_name ("reels_test8");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test2.mp4"));
+       auto A = make_shared<FFmpegContent>("test/data/test2.mp4");
        film->examine_and_add_content (A);
        BOOST_REQUIRE (!wait_for_jobs ());
 
@@ -371,7 +372,7 @@ BOOST_AUTO_TEST_CASE (reels_test9)
        B->set_reference_video(true);
        B->set_reference_audio(true);
        BOOST_REQUIRE(!wait_for_jobs());
-       film2->set_reel_type(REELTYPE_BY_VIDEO_CONTENT);
+       film2->set_reel_type(ReelType::BY_VIDEO_CONTENT);
        film2->write_metadata();
        film2->make_dcp();
        BOOST_REQUIRE(!wait_for_jobs());
@@ -397,7 +398,7 @@ BOOST_AUTO_TEST_CASE (reels_test10)
        BOOST_REQUIRE (!wait_for_jobs());
        B->video->set_length (5 * 24);
 
-       ov->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        ov->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
        ov->write_metadata ();
@@ -407,7 +408,7 @@ BOOST_AUTO_TEST_CASE (reels_test10)
        shared_ptr<DCPContent> ov_dcp(new DCPContent(ov->dir(ov->dcp_name())));
        vf->examine_and_add_content (ov_dcp);
        BOOST_REQUIRE (!wait_for_jobs());
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        ov_dcp->set_reference_video (true);
        ov_dcp->set_reference_audio (true);
        vf->examine_and_add_content (content_factory("test/data/15s.srt").front());
@@ -418,7 +419,7 @@ BOOST_AUTO_TEST_CASE (reels_test10)
        vf->write_metadata ();
 }
 
-/** Another reels error; REELTYPE_BY_VIDEO_CONTENT when the first content is not
+/** Another reels error; ReelType::BY_VIDEO_CONTENT when the first content is not
  *  at time 0.
  */
 BOOST_AUTO_TEST_CASE (reels_test11)
@@ -431,7 +432,7 @@ BOOST_AUTO_TEST_CASE (reels_test11)
        A->video->set_length (240);
        A->set_video_frame_rate (24);
        A->set_position (film, DCPTime::from_seconds(1));
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
        BOOST_CHECK_EQUAL (A->position().get(), DCPTime::from_seconds(1).get());
@@ -452,7 +453,7 @@ BOOST_AUTO_TEST_CASE (reels_test12)
 {
        shared_ptr<Film> film = new_test_film2 ("reels_test12");
        film->set_video_frame_rate (24);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->set_sequence (false);
 
        shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
@@ -531,13 +532,13 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short1)
 }
 
 /** Leaving less than 1 second's gap between two pieces of content with
- *  REELTYPE_BY_VIDEO_CONTENT should not make a <1s reel.
+ *  ReelType::BY_VIDEO_CONTENT should not make a <1s reel.
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short2)
 {
        shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short2");
        film->set_video_frame_rate (24);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
        shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
        film->examine_and_add_content (A);
@@ -560,14 +561,14 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short2)
        BOOST_REQUIRE (notes.empty());
 }
 
-/** Setting REELTYPE_BY_LENGTH and using a small length value should not make
+/** Setting ReelType::BY_LENGTH and using a small length value should not make
  *  <1s reels.
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short3)
 {
        shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short3");
        film->set_video_frame_rate (24);
-       film->set_reel_type (REELTYPE_BY_LENGTH);
+       film->set_reel_type (ReelType::BY_LENGTH);
        film->set_reel_length (1024 * 1024 * 10);
 
        shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
@@ -584,14 +585,14 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short3)
        BOOST_REQUIRE (notes.empty());
 }
 
-/** Having one piece of content less than 1s long in REELTYPE_BY_VIDEO_CONTENT
+/** Having one piece of content less than 1s long in ReelType::BY_VIDEO_CONTENT
  *  should not make a reel less than 1s long.
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short4)
 {
        shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short4");
        film->set_video_frame_rate (24);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
        shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
        film->examine_and_add_content (A);
index a4be8b9b70376e433b76b83868a871ab9c330d7c..5510864d9b94576e78b66b3b3a53a893a574a837 100644 (file)
  */
 
 #include "lib/content_factory.h"
-#include "lib/film.h"
 #include "lib/dcp_content.h"
+#include "lib/film.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
+using std::make_shared;
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
 
@@ -40,14 +41,14 @@ void check_within_n (int64_t a, int64_t b, int64_t n)
 
 BOOST_AUTO_TEST_CASE (required_disk_space_test)
 {
-       shared_ptr<Film> film = new_test_film ("required_disk_space_test");
+       auto film = new_test_film ("required_disk_space_test");
        film->set_j2k_bandwidth (100000000);
        film->set_audio_channels (6);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
-       shared_ptr<Content> content_a = content_factory("test/data/flat_blue.png").front();
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
+       auto content_a = content_factory("test/data/flat_blue.png").front();
        BOOST_REQUIRE (content_a);
        film->examine_and_add_content (content_a);
-       shared_ptr<DCPContent> content_b (new DCPContent("test/data/burnt_subtitle_test_dcp"));
+       auto content_b = make_shared<DCPContent>("test/data/burnt_subtitle_test_dcp");
        film->examine_and_add_content (content_b);
        BOOST_REQUIRE (!wait_for_jobs());
        film->write_metadata ();
index f6a2a358cd6ff0c6e114395f0134855fc3e54f34..d1c5b85338f53272ead9d19e4388a9cea0dd12dc 100644 (file)
@@ -46,10 +46,10 @@ BOOST_AUTO_TEST_CASE (shuffler_test1)
        s.Video.connect (boost::bind (&receive, _1, _2));
 
        for (int i = 0; i < 10; ++i) {
-               push (s, i, EYES_LEFT);
-               push (s, i, EYES_RIGHT);
-               check (i, EYES_LEFT, __LINE__);
-               check (i, EYES_RIGHT, __LINE__);
+               push (s, i, Eyes::LEFT);
+               push (s, i, Eyes::RIGHT);
+               check (i, Eyes::LEFT, __LINE__);
+               check (i, Eyes::RIGHT, __LINE__);
        }
 }
 
@@ -60,14 +60,14 @@ BOOST_AUTO_TEST_CASE (shuffler_test2)
        s.Video.connect (boost::bind (&receive, _1, _2));
 
        for (int i = 0; i < 10; i += 2) {
-               push (s, i, EYES_LEFT);
-               push (s, i + 1, EYES_LEFT);
-               push (s, i, EYES_RIGHT);
-               push (s, i + 1, EYES_RIGHT);
-               check (i, EYES_LEFT, __LINE__);
-               check (i, EYES_RIGHT, __LINE__);
-               check (i + 1, EYES_LEFT, __LINE__);
-               check (i + 1, EYES_RIGHT, __LINE__);
+               push (s, i, Eyes::LEFT);
+               push (s, i + 1, Eyes::LEFT);
+               push (s, i, Eyes::RIGHT);
+               push (s, i + 1, Eyes::RIGHT);
+               check (i, Eyes::LEFT, __LINE__);
+               check (i, Eyes::RIGHT, __LINE__);
+               check (i + 1, Eyes::LEFT, __LINE__);
+               check (i + 1, Eyes::RIGHT, __LINE__);
        }
 }
 
@@ -77,25 +77,25 @@ BOOST_AUTO_TEST_CASE (shuffler_test3)
        Shuffler s;
        s.Video.connect (boost::bind (&receive, _1, _2));
 
-       push (s, 0, EYES_LEFT);
-       check (0, EYES_LEFT, __LINE__);
-       push (s, 0, EYES_RIGHT);
-       check (0, EYES_RIGHT, __LINE__);
-       push (s, 1, EYES_LEFT);
-       check (1, EYES_LEFT, __LINE__);
-       push (s, 1, EYES_RIGHT);
-       check (1, EYES_RIGHT, __LINE__);
-       push (s, 2, EYES_RIGHT);
-       push (s, 3, EYES_LEFT);
-       push (s, 3, EYES_RIGHT);
-       push (s, 4, EYES_LEFT);
-       push (s, 4, EYES_RIGHT);
+       push (s, 0, Eyes::LEFT);
+       check (0, Eyes::LEFT, __LINE__);
+       push (s, 0, Eyes::RIGHT);
+       check (0, Eyes::RIGHT, __LINE__);
+       push (s, 1, Eyes::LEFT);
+       check (1, Eyes::LEFT, __LINE__);
+       push (s, 1, Eyes::RIGHT);
+       check (1, Eyes::RIGHT, __LINE__);
+       push (s, 2, Eyes::RIGHT);
+       push (s, 3, Eyes::LEFT);
+       push (s, 3, Eyes::RIGHT);
+       push (s, 4, Eyes::LEFT);
+       push (s, 4, Eyes::RIGHT);
        s.flush ();
-       check (2, EYES_RIGHT, __LINE__);
-       check (3, EYES_LEFT, __LINE__);
-       check (3, EYES_RIGHT, __LINE__);
-       check (4, EYES_LEFT, __LINE__);
-       check (4, EYES_RIGHT, __LINE__);
+       check (2, Eyes::RIGHT, __LINE__);
+       check (3, Eyes::LEFT, __LINE__);
+       check (3, Eyes::RIGHT, __LINE__);
+       check (4, Eyes::LEFT, __LINE__);
+       check (4, Eyes::RIGHT, __LINE__);
 }
 
 /** One missing right eye image */
@@ -104,25 +104,25 @@ BOOST_AUTO_TEST_CASE (shuffler_test4)
        Shuffler s;
        s.Video.connect (boost::bind (&receive, _1, _2));
 
-       push (s, 0, EYES_LEFT);
-       check (0, EYES_LEFT, __LINE__);
-       push (s, 0, EYES_RIGHT);
-       check (0, EYES_RIGHT, __LINE__);
-       push (s, 1, EYES_LEFT);
-       check (1, EYES_LEFT, __LINE__);
-       push (s, 1, EYES_RIGHT);
-       check (1, EYES_RIGHT, __LINE__);
-       push (s, 2, EYES_LEFT);
-       push (s, 3, EYES_LEFT);
-       push (s, 3, EYES_RIGHT);
-       push (s, 4, EYES_LEFT);
-       push (s, 4, EYES_RIGHT);
+       push (s, 0, Eyes::LEFT);
+       check (0, Eyes::LEFT, __LINE__);
+       push (s, 0, Eyes::RIGHT);
+       check (0, Eyes::RIGHT, __LINE__);
+       push (s, 1, Eyes::LEFT);
+       check (1, Eyes::LEFT, __LINE__);
+       push (s, 1, Eyes::RIGHT);
+       check (1, Eyes::RIGHT, __LINE__);
+       push (s, 2, Eyes::LEFT);
+       push (s, 3, Eyes::LEFT);
+       push (s, 3, Eyes::RIGHT);
+       push (s, 4, Eyes::LEFT);
+       push (s, 4, Eyes::RIGHT);
        s.flush ();
-       check (2, EYES_LEFT, __LINE__);
-       check (3, EYES_LEFT, __LINE__);
-       check (3, EYES_RIGHT, __LINE__);
-       check (4, EYES_LEFT, __LINE__);
-       check (4, EYES_RIGHT, __LINE__);
+       check (2, Eyes::LEFT, __LINE__);
+       check (3, Eyes::LEFT, __LINE__);
+       check (3, Eyes::RIGHT, __LINE__);
+       check (4, Eyes::LEFT, __LINE__);
+       check (4, Eyes::RIGHT, __LINE__);
 }
 
 /** Only one eye */
@@ -132,20 +132,20 @@ BOOST_AUTO_TEST_CASE (shuffler_test5)
        s.Video.connect (boost::bind (&receive, _1, _2));
 
        /* One left should come out straight away */
-       push (s, 0, EYES_LEFT);
-       check (0, EYES_LEFT, __LINE__);
+       push (s, 0, Eyes::LEFT);
+       check (0, Eyes::LEFT, __LINE__);
 
        /* More lefts should be kept in the shuffler in the hope that some rights arrive */
        for (int i = 0; i < s._max_size; ++i) {
-               push (s, i + 1, EYES_LEFT);
+               push (s, i + 1, Eyes::LEFT);
        }
        BOOST_CHECK (pending_cv.empty ());
 
        /* If enough lefts come the shuffler should conclude that there's no rights and start
           giving out the lefts.
        */
-       push (s, s._max_size + 1, EYES_LEFT);
-       check (1, EYES_LEFT, __LINE__);
+       push (s, s._max_size + 1, Eyes::LEFT);
+       check (1, Eyes::LEFT, __LINE__);
 }
 
 /** One complete frame (L+R) missing.
@@ -156,18 +156,18 @@ BOOST_AUTO_TEST_CASE (shuffler_test6)
        Shuffler s;
        s.Video.connect (boost::bind (&receive, _1, _2));
 
-       push (s, 0, EYES_LEFT);
-       check (0, EYES_LEFT, __LINE__);
-       push (s, 0, EYES_RIGHT);
-       check (0, EYES_RIGHT, __LINE__);
+       push (s, 0, Eyes::LEFT);
+       check (0, Eyes::LEFT, __LINE__);
+       push (s, 0, Eyes::RIGHT);
+       check (0, Eyes::RIGHT, __LINE__);
 
-       push (s, 2, EYES_LEFT);
-       push (s, 2, EYES_RIGHT);
-       check (2, EYES_LEFT, __LINE__);
-       check (2, EYES_RIGHT, __LINE__);
+       push (s, 2, Eyes::LEFT);
+       push (s, 2, Eyes::RIGHT);
+       check (2, Eyes::LEFT, __LINE__);
+       check (2, Eyes::RIGHT, __LINE__);
 
-       push (s, 3, EYES_LEFT);
-       check (3, EYES_LEFT, __LINE__);
-       push (s, 3, EYES_RIGHT);
-       check (3, EYES_RIGHT, __LINE__);
+       push (s, 3, Eyes::LEFT);
+       check (3, Eyes::LEFT, __LINE__);
+       push (s, 3, Eyes::RIGHT);
+       check (3, Eyes::RIGHT, __LINE__);
 }
index d8c596c9468d2fc825be0573ed675e9a11fe2ba6..b19fd1cd00fcbf474253f37f25da73d8a08f1658 100644 (file)
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
        BOOST_REQUIRE (!wait_for_jobs ());
        content->only_text()->set_use (true);
        content->only_text()->set_burn (false);
-       film->set_reel_type (REELTYPE_BY_LENGTH);
+       film->set_reel_type (ReelType::BY_LENGTH);
        film->set_interop (true);
        film->set_reel_length (1024 * 1024 * 512);
        film->make_dcp ();
@@ -57,13 +57,13 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
        dcp::DCP dcp ("build/test/subtitle_reel_number_test/" + film->dcp_name());
        dcp.read ();
        BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
-       shared_ptr<dcp::CPL> cpl = dcp.cpls().front();
+       auto cpl = dcp.cpls()[0];
        BOOST_REQUIRE_EQUAL (cpl->reels().size(), 6U);
 
        int n = 1;
        for (auto i: cpl->reels()) {
                if (i->main_subtitle()) {
-                       shared_ptr<dcp::InteropSubtitleAsset> ass = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(i->main_subtitle()->asset());
+                       auto ass = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(i->main_subtitle()->asset());
                        BOOST_REQUIRE (ass);
                        BOOST_CHECK_EQUAL (ass->reel_number(), dcp::raw_convert<string>(n));
                        ++n;
index 906477963fa318a71cca9f26414ef6214e4748fc..c910d4aec3f39a105141c8cee8e0bc2713b5f3ba 100644 (file)
 
 using std::list;
 using std::string;
-using boost::optional;
 using std::shared_ptr;
+using std::make_shared;
+using boost::optional;
 
 
 /* Check that timings are done correctly for multi-reel DCPs with PNG subs */
 BOOST_AUTO_TEST_CASE (subtitle_reel_test)
 {
-       shared_ptr<Film> film = new_test_film2 ("subtitle_reel_test");
+       auto film = new_test_film2 ("subtitle_reel_test");
        film->set_interop (true);
-       shared_ptr<ImageContent> red_a (new ImageContent("test/data/flat_red.png"));
-       shared_ptr<ImageContent> red_b (new ImageContent("test/data/flat_red.png"));
-       shared_ptr<DCPSubtitleContent> sub_a (new DCPSubtitleContent("test/data/png_subs/subs.xml"));
-       shared_ptr<DCPSubtitleContent> sub_b (new DCPSubtitleContent("test/data/png_subs/subs.xml"));
+       auto red_a = make_shared<ImageContent>("test/data/flat_red.png");
+       auto red_b = make_shared<ImageContent>("test/data/flat_red.png");
+       auto sub_a = make_shared<DCPSubtitleContent>("test/data/png_subs/subs.xml");
+       auto sub_b = make_shared<DCPSubtitleContent>("test/data/png_subs/subs.xml");
 
        film->examine_and_add_content (red_a);
        film->examine_and_add_content (red_b);
@@ -64,7 +65,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_test)
        red_b->video->set_length (240);
        sub_b->set_position (film, dcpomatic::DCPTime::from_seconds(10));
 
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
@@ -101,18 +102,18 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_test)
  */
 BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test)
 {
-       shared_ptr<Film> film = new_test_film2 ("subtitle_in_all_reels_test");
+       auto film = new_test_film2 ("subtitle_in_all_reels_test");
        film->set_interop (false);
        film->set_sequence (false);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        for (int i = 0; i < 3; ++i) {
-               shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+               auto video = content_factory("test/data/flat_red.png").front();
                film->examine_and_add_content (video);
                BOOST_REQUIRE (!wait_for_jobs());
                video->video->set_length (15 * 24);
                video->set_position (film, dcpomatic::DCPTime::from_seconds(15 * i));
        }
-       shared_ptr<Content> subs = content_factory("test/data/15s.srt").front();
+       auto subs = content_factory("test/data/15s.srt").front();
        film->examine_and_add_content (subs);
        BOOST_REQUIRE (!wait_for_jobs());
        film->make_dcp ();
@@ -121,7 +122,7 @@ BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test)
        dcp::DCP dcp ("build/test/subtitle_in_all_reels_test/" + film->dcp_name());
        dcp.read ();
        BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
-       shared_ptr<dcp::CPL> cpl = dcp.cpls().front();
+       auto cpl = dcp.cpls()[0];
        BOOST_REQUIRE_EQUAL (cpl->reels().size(), 3U);
 
        for (auto i: cpl->reels()) {
@@ -135,29 +136,29 @@ BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test)
  */
 BOOST_AUTO_TEST_CASE (closed_captions_in_all_reels_test)
 {
-       shared_ptr<Film> film = new_test_film2 ("closed_captions_in_all_reels_test");
+       auto film = new_test_film2 ("closed_captions_in_all_reels_test");
        film->set_interop (false);
        film->set_sequence (false);
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
        for (int i = 0; i < 3; ++i) {
-               shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+               auto video = content_factory("test/data/flat_red.png").front();
                film->examine_and_add_content (video);
                BOOST_REQUIRE (!wait_for_jobs());
                video->video->set_length (15 * 24);
                video->set_position (film, dcpomatic::DCPTime::from_seconds(15 * i));
        }
 
-       shared_ptr<Content> ccap1 = content_factory("test/data/15s.srt").front();
+       auto ccap1 = content_factory("test/data/15s.srt").front();
        film->examine_and_add_content (ccap1);
        BOOST_REQUIRE (!wait_for_jobs());
-       ccap1->text.front()->set_type (TEXT_CLOSED_CAPTION);
+       ccap1->text.front()->set_type (TextType::CLOSED_CAPTION);
        ccap1->text.front()->set_dcp_track (DCPTextTrack("Test", "de-DE"));
 
-       shared_ptr<Content> ccap2 = content_factory("test/data/15s.srt").front();
+       auto ccap2 = content_factory("test/data/15s.srt").front();
        film->examine_and_add_content (ccap2);
        BOOST_REQUIRE (!wait_for_jobs());
-       ccap2->text.front()->set_type (TEXT_CLOSED_CAPTION);
+       ccap2->text.front()->set_type (TextType::CLOSED_CAPTION);
        ccap2->text.front()->set_dcp_track (DCPTextTrack("Other", "en-GB"));
 
        film->make_dcp ();
@@ -166,13 +167,13 @@ BOOST_AUTO_TEST_CASE (closed_captions_in_all_reels_test)
        dcp::DCP dcp ("build/test/closed_captions_in_all_reels_test/" + film->dcp_name());
        dcp.read ();
        BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
-       shared_ptr<dcp::CPL> cpl = dcp.cpls().front();
+       auto cpl = dcp.cpls().front();
        BOOST_REQUIRE_EQUAL (cpl->reels().size(), 3U);
 
        for (auto i: cpl->reels()) {
                BOOST_REQUIRE_EQUAL (i->closed_captions().size(), 2U);
-               optional<string> first = i->closed_captions().front()->language();
-               optional<string> second = i->closed_captions().back()->language();
+               auto first = i->closed_captions().front()->language();
+               auto second = i->closed_captions().back()->language();
                BOOST_REQUIRE (first);
                BOOST_REQUIRE (second);
                BOOST_CHECK (
index 3f646fd1f6071048576c6a758148f069fc71fc41..b82af3e2f4570782ccffbde6ef88e8f575642041 100644 (file)
@@ -798,7 +798,7 @@ dcp::operator<< (std::ostream& s, dcp::Size i)
 }
 
 std::ostream&
-dcp::operator<< (std::ostream& s, Standard t)
+dcp::operator<< (std::ostream& s, dcp::Standard t)
 {
        switch (t) {
        case Standard::INTEROP:
@@ -811,3 +811,10 @@ dcp::operator<< (std::ostream& s, Standard t)
        return s;
 }
 
+std::ostream&
+operator<< (std::ostream&s, VideoFrameType f)
+{
+       s << video_frame_type_to_string(f);
+       return s;
+}
+
index c188a614fc03612e5e76d9b93622cef87072fb1f..da00fe688d58b59eb4ad82a07bfe463ff9cbf68d 100644 (file)
@@ -20,7 +20,7 @@
 
 
 #include "lib/warnings.h"
-#include <dcp/types.h>
+#include "lib/types.h"
 #include <boost/filesystem.hpp>
 
 
@@ -67,9 +67,12 @@ private:
        std::shared_ptr<Log> _old;
 };
 
+
 namespace dcp {
 
 std::ostream& operator<< (std::ostream& s, dcp::Size i);
-std::ostream& operator<< (std::ostream& s, Standard t);
+std::ostream& operator<< (std::ostream& s, dcp::Standard t);
 
 }
+
+std::ostream& operator<< (std::ostream& s, VideoFrameType f);
index b12eb328d661230e412cb8afefc94700d20d56af..78e656830b65158afde56a2a8ca1e12b613fcc87 100644 (file)
@@ -39,7 +39,7 @@
 using std::cout;
 using std::shared_ptr;
 
-/** Basic sanity check of 3D_LEFT_RIGHT */
+/** Basic sanity check of THREE_D_LEFT_RIGHT */
 BOOST_AUTO_TEST_CASE (threed_test1)
 {
        shared_ptr<Film> film = new_test_film ("threed_test1");
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (threed_test1)
        film->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       c->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
+       c->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT);
 
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE (threed_test1)
        BOOST_REQUIRE (!wait_for_jobs ());
 }
 
-/** Basic sanity check of 3D_ALTERNATE; at the moment this is just to make sure
+/** Basic sanity check of THREE_D_ALTERNATE; at the moment this is just to make sure
  *  that such a transcode completes without error.
  */
 BOOST_AUTO_TEST_CASE (threed_test2)
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE (threed_test2)
        film->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       c->video->set_frame_type (VIDEO_FRAME_TYPE_3D_ALTERNATE);
+       c->video->set_frame_type (VideoFrameType::THREE_D_ALTERNATE);
 
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE (threed_test2)
        BOOST_REQUIRE (!wait_for_jobs ());
 }
 
-/** Basic sanity check of 3D_LEFT and 3D_RIGHT; at the moment this is just to make sure
+/** Basic sanity check of THREE_D_LEFT and THREE_D_RIGHT; at the moment this is just to make sure
  *  that such a transcode completes without error.
  */
 BOOST_AUTO_TEST_CASE (threed_test3)
@@ -93,8 +93,8 @@ BOOST_AUTO_TEST_CASE (threed_test3)
        film->examine_and_add_content (R);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
-       R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
+       R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
 
        film->set_three_d (true);
        film->make_dcp ();
@@ -112,8 +112,8 @@ BOOST_AUTO_TEST_CASE (threed_test4)
        film->examine_and_add_content (R);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
-       R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
+       R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
        /* There doesn't seem much point in encoding the whole input, especially as we're only
         * checking for errors during the encode and not the result.  Also decoding these files
         * (4K HQ Prores) is very slow.
@@ -137,8 +137,8 @@ BOOST_AUTO_TEST_CASE (threed_test5)
        film->examine_and_add_content (R);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
-       R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
+       R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
        /* There doesn't seem much point in encoding the whole input, especially as we're only
         * checking for errors during the encode and not the result.
         */
@@ -161,8 +161,8 @@ BOOST_AUTO_TEST_CASE (threed_test6)
        film->examine_and_add_content (R);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
-       R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+       L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
+       R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
 
        film->set_three_d (true);
        film->make_dcp ();
@@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE (threed_test7)
        film->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       c->video->set_frame_type (VIDEO_FRAME_TYPE_3D);
+       c->video->set_frame_type (VideoFrameType::THREE_D);
 
        film->set_three_d (true);
        film->make_dcp ();
index aff9bdae91072aafb7b0b4ff78feb721b603ff7c..b538f967ce23d4477b358ee4fa7ce0c27454037d 100644 (file)
@@ -56,20 +56,20 @@ BOOST_AUTO_TEST_CASE (vf_test1)
        BOOST_REQUIRE (!wait_for_jobs());
 
        /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
-       film->set_reel_type (REELTYPE_SINGLE);
+       film->set_reel_type (ReelType::SINGLE);
        string why_not;
        BOOST_CHECK (!dcp->can_reference_video(film, why_not));
        BOOST_CHECK (!dcp->can_reference_audio(film, why_not));
-       BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
-       BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
+       BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
+       BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
 
        /* Multi-reel DCP can be referenced if we are using by-video-content */
-       film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        BOOST_CHECK (dcp->can_reference_video(film, why_not));
        BOOST_CHECK (dcp->can_reference_audio(film, why_not));
        /* (but reels_test2 has no texts to reference) */
-       BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
-       BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
+       BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
+       BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
 
        shared_ptr<FFmpegContent> other (new FFmpegContent("test/data/test.mp4"));
        film->examine_and_add_content (other);
@@ -85,8 +85,8 @@ BOOST_AUTO_TEST_CASE (vf_test1)
        BOOST_CHECK (dcp->can_reference_video(film, why_not));
        BOOST_CHECK (dcp->can_reference_audio(film, why_not));
        /* (reels_test2 has no texts to reference) */
-       BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
-       BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
+       BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
+       BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
 }
 
 /** Make a OV with video and audio and a VF referencing the OV and adding subs */
@@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE (vf_test2)
        shared_ptr<Film> vf = new_test_film ("vf_test2_vf");
        vf->set_name ("vf_test2_vf");
        vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        shared_ptr<DCPContent> dcp (new DCPContent(ov->dir (ov->dcp_name ())));
        BOOST_REQUIRE (dcp);
        vf->examine_and_add_content (dcp);
@@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE (vf_test3)
        shared_ptr<Film> vf = new_test_film ("vf_test3_vf");
        vf->set_name ("vf_test3_vf");
        vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
        BOOST_REQUIRE (dcp);
        dcp->set_trim_start (ContentTime::from_seconds (1));
@@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE (vf_test4)
        shared_ptr<Film> vf = new_test_film ("vf_test4_vf");
        vf->set_name ("vf_test4_vf");
        vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        vf->set_sequence (false);
        shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
        BOOST_REQUIRE (dcp);
@@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE (vf_test5)
        /* Make the OV */
        shared_ptr<Film> ov = new_test_film ("vf_test5_ov");
        ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       ov->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        for (int i = 0; i < 3; ++i) {
                shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
                ov->examine_and_add_content (video);
@@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE (vf_test5)
        shared_ptr<Film> vf = new_test_film ("vf_test5_vf");
        vf->set_name ("vf_test5_vf");
        vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        vf->set_sequence (false);
        shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
        BOOST_REQUIRE (dcp);
@@ -306,7 +306,7 @@ BOOST_AUTO_TEST_CASE (vf_test6)
        /* Make the OV */
        shared_ptr<Film> ov = new_test_film ("vf_test6_ov");
        ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
-       ov->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
        ov->examine_and_add_content (video);
        BOOST_REQUIRE (!wait_for_jobs());
@@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE (vf_test6)
        shared_ptr<Film> vf = new_test_film ("vf_test6_vf");
        vf->set_name ("vf_test6_vf");
        vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        vf->set_sequence (false);
        shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
        BOOST_REQUIRE (dcp);
@@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE (vf_test7)
        shared_ptr<DCPContent> ov2_dcp (new DCPContent(ov1->dir(ov1->dcp_name())));
        vf->examine_and_add_content (ov2_dcp);
        BOOST_REQUIRE (!wait_for_jobs());
-       vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        ov1_dcp->set_reference_video (true);
        ov2_dcp->set_reference_video (true);
        ov1_dcp->set_position (vf, DCPTime::from_seconds(1));
index 632551fa4a5d8f798df4786a91f547b6434146f6..2461bb9b3eb4827331c9bd5579f41d25676bbae3 100644 (file)
@@ -56,6 +56,7 @@ using std::max;
 using std::pair;
 using std::string;
 using std::dynamic_pointer_cast;
+using std::make_shared;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -67,7 +68,7 @@ static
 shared_ptr<Image>
 grey_image (dcp::Size size, uint8_t pixel)
 {
-       shared_ptr<Image> grey(new Image(AV_PIX_FMT_RGB24, size, true));
+       auto grey = make_shared<Image>(AV_PIX_FMT_RGB24, size, true);
        for (int y = 0; y < size.height; ++y) {
                uint8_t* p = grey->data()[0] + y * grey->stride()[0];
                for (int x = 0; x < size.width; ++x) {
@@ -414,14 +415,14 @@ V_movie_range (shared_ptr<Film> film)
        shared_ptr<TranscodeJob> job (new TranscodeJob(film));
        job->set_encoder (
                shared_ptr<FFmpegEncoder>(
-                       new FFmpegEncoder (film, job, film->file("export.mov"), EXPORT_FORMAT_PRORES, true, false, false, 23)
+                       new FFmpegEncoder (film, job, film->file("export.mov"), ExportFormat::PRORES, true, false, false, 23)
                        )
                );
        JobManager::instance()->add (job);
        BOOST_REQUIRE (!wait_for_jobs());
 
        /* This is a bit of a hack; add the exported file into the project so we can decode it */
-       shared_ptr<FFmpegContent> content(new FFmpegContent(film->file("export.mov")));
+       auto content = make_shared<FFmpegContent>(film->file("export.mov"));
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());