C++11 tidying.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Feb 2021 16:19:34 +0000 (17:19 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 4 Feb 2021 16:19:34 +0000 (17:19 +0100)
src/lib/dcp_decoder.cc
src/lib/player.cc

index 4076936ddca2460898d06f4aae30046fbc3ef9ba..566ed2935ccb10206df23acea28e49507f0f7728 100644 (file)
@@ -60,6 +60,7 @@ using std::string;
 using std::vector;
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
+using std::make_shared;
 using boost::optional;
 using namespace dcpomatic;
 
@@ -70,17 +71,17 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
 {
        if (c->can_be_played()) {
                if (c->video) {
-                       video.reset (new VideoDecoder (this, c));
+                       video = make_shared<VideoDecoder>(this, c);
                }
                if (c->audio) {
-                       audio.reset (new AudioDecoder (this, c->audio, fast));
+                       audio = make_shared<AudioDecoder>(this, c->audio, fast);
                }
                for (auto i: c->text) {
                        /* XXX: this time here should be the time of the first subtitle, not 0 */
-                       text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, i, ContentTime())));
+                       text.push_back (make_shared<TextDecoder>(this, i, ContentTime()));
                }
                if (c->atmos) {
-                       atmos.reset (new AtmosDecoder (this, c));
+                       atmos = make_shared<AtmosDecoder>(this, c);
                }
        }
 
@@ -98,7 +99,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
                _reels = old->_reels;
        } else {
 
-               list<shared_ptr<dcp::CPL> > cpl_list = cpls ();
+               auto cpl_list = cpls ();
 
                if (cpl_list.empty()) {
                        throw DCPError (_("No CPLs found in DCP."));
@@ -242,7 +243,7 @@ DCPDecoder::pass ()
 void
 DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
 {
-       list<shared_ptr<TextDecoder> >::const_iterator decoder = text.begin ();
+       auto decoder = text.begin ();
        if (decoder == text.end()) {
                /* It's possible that there is now a main subtitle but no TextDecoders, for example if
                   the CPL has just changed but the TextContent's texts have not been recreated yet.
index b696f04c196d9cb6c7472448dd77718c4fba768d..59e3773034aa5a9ff1a15dede90137318fbfef13 100644 (file)
@@ -775,14 +775,14 @@ Player::open_subtitles_for_frame (DCPTime time) const
                }
 
                /* String subtitles (rendered to an image) */
-               if (!j.string.empty ()) {
-                       list<PositionImage> s = render_text (j.string, j.fonts, _video_container_size, time, vfr);
+               if (!j.string.empty()) {
+                       auto s = render_text (j.string, j.fonts, _video_container_size, time, vfr);
                        copy (s.begin(), s.end(), back_inserter (captions));
                }
        }
 
-       if (captions.empty ()) {
-               return optional<PositionImage> ();
+       if (captions.empty()) {
+               return {};
        }
 
        return merge (captions);