Small bits of pre-release tidying.
[libdcp.git] / src / asset_factory.cc
index 83580cbd18662c9eca41a37e0fbba5f9d6e7cca9..ecda1701476d2aeb81ec2838116ddbe78ac79407 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -42,6 +42,7 @@
 #include <memory>
 
 using std::shared_ptr;
+using std::make_shared;
 using namespace dcp;
 
 shared_ptr<Asset>
@@ -61,27 +62,27 @@ dcp::asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_
                throw ReadError ("MPEG2 video essences are not supported");
        case ASDCP::ESS_JPEG_2000:
                try {
-                       return shared_ptr<MonoPictureAsset> (new MonoPictureAsset (path));
+                       return make_shared<MonoPictureAsset>(path);
                } catch (dcp::MXFFileError& e) {
                        if (ignore_incorrect_picture_mxf_type && e.number() == ASDCP::RESULT_SFORMAT) {
                                /* Tried to load it as mono but the error says it's stereo; try that instead */
-                               return shared_ptr<StereoPictureAsset> (new StereoPictureAsset (path));
+                               return make_shared<StereoPictureAsset>(path);
                        } else {
                                throw;
                        }
                }
        case ASDCP::ESS_PCM_24b_48k:
        case ASDCP::ESS_PCM_24b_96k:
-               return shared_ptr<SoundAsset> (new SoundAsset (path));
+               return make_shared<SoundAsset>(path);
        case ASDCP::ESS_JPEG_2000_S:
-               return shared_ptr<StereoPictureAsset> (new StereoPictureAsset (path));
+               return make_shared<StereoPictureAsset>(path);
        case ASDCP::ESS_TIMED_TEXT:
-               return shared_ptr<SMPTESubtitleAsset> (new SMPTESubtitleAsset (path));
+               return make_shared<SMPTESubtitleAsset>(path);
        case ASDCP::ESS_DCDATA_DOLBY_ATMOS:
-               return shared_ptr<AtmosAsset> (new AtmosAsset (path));
+               return make_shared<AtmosAsset>(path);
        default:
-               throw ReadError (String::compose ("Unknown MXF essence type %1 in %2", int(type), path.string()));
+               throw ReadError (String::compose("Unknown MXF essence type %1 in %2", static_cast<int>(type), path.string()));
        }
 
-       return shared_ptr<Asset>();
+       return {};
 }