Small bits of tidying up.
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 18:49:18 +0000 (20:49 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 18:50:12 +0000 (20:50 +0200)
src/cpl.cc
src/reel_encryptable_asset.cc
test/combine_test.cc
test/cpl_metadata_test.cc
test/dcp_font_test.cc
test/reel_asset_test.cc
test/test.cc

index 8766cf76d9c4c34d4a20a5a10ab9fca2c2c1375f..39e78baa89a723b89d9a23352aeaf7a3a29f3588 100644 (file)
 #include <boost/algorithm/string.hpp>
 
 
-using std::string;
+using std::cout;
+using std::dynamic_pointer_cast;
 using std::list;
-using std::pair;
 using std::make_pair;
-using std::cout;
+using std::make_shared;
+using std::pair;
 using std::set;
-using std::vector;
 using std::shared_ptr;
+using std::string;
+using std::vector;
 using boost::optional;
-using std::dynamic_pointer_cast;
 using namespace dcp;
 
 
@@ -291,9 +292,9 @@ CPL::read_composition_metadata_asset (cxml::ConstNodePtr node)
                /* If the first language on SubtitleLanguageList is the same as the language of the first subtitle we'll ignore it */
                size_t first = 0;
                if (!_reels.empty()) {
-                       shared_ptr<dcp::ReelSubtitleAsset> sub = _reels.front()->main_subtitle();
+                       auto sub = _reels.front()->main_subtitle();
                        if (sub) {
-                               optional<string> lang = sub->language();
+                               auto lang = sub->language();
                                if (lang && lang == sll_split[0]) {
                                        first = 1;
                                }
index feb71b59c5c2d65fb7319a5f02b79736eed56783..82dc9c8921f73b0cabf328d671267bf7ff54fd92 100644 (file)
@@ -59,7 +59,7 @@ ReelEncryptableAsset::ReelEncryptableAsset (optional<string> key_id)
 
 
 ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr<const cxml::Node> node)
-       : _key_id (node->optional_string_child ("KeyId"))
+       : _key_id (node->optional_string_child("KeyId"))
 {
        if (_key_id) {
                _key_id = remove_urn_uuid (*_key_id);
index 59931be7b41611a0d143dc839c9a15ab4ea7c2c2..99795592d6596903e7540a5918d0a3da64b27b2f 100644 (file)
@@ -195,10 +195,10 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_interop_subs_test)
        using namespace boost::filesystem;
        boost::filesystem::path const out = "build/test/combine_two_dcps_with_interop_subs_test";
 
-       shared_ptr<dcp::DCP> first = make_simple_with_interop_subs ("build/test/combine_input1");
+       auto first = make_simple_with_interop_subs ("build/test/combine_input1");
        first->write_xml (dcp::Standard::INTEROP);
 
-       shared_ptr<dcp::DCP> second = make_simple_with_interop_subs ("build/test/combine_input2");
+       auto second = make_simple_with_interop_subs ("build/test/combine_input2");
        second->write_xml (dcp::Standard::INTEROP);
 
        remove_all (out);
index c9ee3b9b834b2e805f2f37d7c75c44c554cd5471..2c88d6a8b8a780ce772e7fb2509a15ce959540f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -37,7 +37,7 @@
 #include "exceptions.h"
 #include "language_tag.h"
 #include "reel.h"
-#include "reel_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include "stream_operators.h"
 #include "test.h"
 #include <memory>
 
 
 using std::list;
+using std::make_shared;
+using std::shared_ptr;
 using std::string;
 using std::vector;
-using std::shared_ptr;
 
 
 BOOST_AUTO_TEST_CASE (cpl_metadata_bad_values_test)
@@ -301,7 +302,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test1)
 
        shared_ptr<dcp::Reel> reel(new dcp::Reel());
        reel->add (black_picture_asset("build/test/cpl_metadata_write_test1"));
-       reel->add (shared_ptr<dcp::ReelSubtitleAsset>(new dcp::ReelSubtitleAsset(doc)));
+       reel->add (make_shared<dcp::ReelSMPTESubtitleAsset>(doc));
        cpl.add (reel);
 
        vector<dcp::LanguageTag> lt;
index da9d3000f83b19069c2dc9f46f4d53116918aabc..2ac68273e925e27f84e01a09596335c09024838a 100644 (file)
@@ -31,6 +31,7 @@
     files in the program, then also delete it here.
 */
 
+
 #include "interop_subtitle_asset.h"
 #include "smpte_subtitle_asset.h"
 #include "dcp.h"
 #include "test.h"
 #include "reel.h"
 #include "util.h"
-#include "reel_subtitle_asset.h"
+#include "reel_interop_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include <boost/test/unit_test.hpp>
 #include <cstdio>
 
+
 using std::list;
 using std::string;
 using std::shared_ptr;
@@ -55,13 +58,13 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test)
        boost::filesystem::path directory = "build/test/interop_dcp_font_test";
        dcp::DCP dcp (directory);
 
-       shared_ptr<dcp::InteropSubtitleAsset> subs (new dcp::InteropSubtitleAsset ());
+       auto subs = make_shared<dcp::InteropSubtitleAsset>();
        subs->add_font ("theFontId", dcp::ArrayData("test/data/dummy.ttf"));
        subs->write (directory / "frobozz.xml");
        check_file ("test/data/dummy.ttf", "build/test/interop_dcp_font_test/font_0.ttf");
 
        auto reel = make_shared<dcp::Reel>();
-       reel->add (make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction (24, 1), 24, 0));
+       reel->add (make_shared<dcp::ReelInteropSubtitleAsset>(subs, dcp::Fraction (24, 1), 24, 0));
 
        auto cpl = make_shared<dcp::CPL>("", dcp::ContentKind::TRAILER);
        cpl->add (reel);
@@ -98,7 +101,7 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test)
        subs->write (directory / "frobozz.mxf");
 
        auto reel = make_shared<dcp::Reel>();
-       reel->add (make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction (24, 1), 24, 0));
+       reel->add (make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction (24, 1), 24, 0));
 
        auto cpl = make_shared<dcp::CPL>("", dcp::ContentKind::TRAILER);
        cpl->add (reel);
index e0c7f781459e5c9621e39e9cd18f7d41aa026e2e..8d7a89712958650bf43d97e19e0a477217764278 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 #include "reel_mono_picture_asset.h"
-#include "reel_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include <libcxml/cxml.h>
 #include <boost/test/unit_test.hpp>
 #include "stream_operators.h"
 #include "test.h"
 
 
+using std::make_shared;
 using std::string;
-using boost::optional;
 using std::shared_ptr;
+using boost::optional;
 
 
 /** Test the XML constructor of ReelPictureAsset */
 BOOST_AUTO_TEST_CASE (reel_picture_asset_test)
 {
-       shared_ptr<cxml::Document> doc (new cxml::Document ("MainPicture"));
+       auto doc = make_shared<cxml::Document>("MainPicture");
 
        doc->read_string (
                "<MainPicture>"
index 069d02ec12a6cd122c170f1f30cfe369adf2b84e..c48ecffe013e07a3ad3abb7cefe4af0182852b5d 100644 (file)
 #include "cpl.h"
 #include "dcp.h"
 #include "interop_subtitle_asset.h"
+#include "j2k_transcode.h"
+#include "mono_picture_asset.h"
 #include "mono_picture_asset.h"
+#include "openjpeg_image.h"
+#include "picture_asset_writer.h"
 #include "picture_asset_writer.h"
 #include "reel.h"
+#include "reel_asset.h"
+#include "reel_closed_caption_asset.h"
+#include "reel_interop_subtitle_asset.h"
+#include "reel_markers_asset.h"
+#include "reel_mono_picture_asset.h"
 #include "reel_mono_picture_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include "reel_sound_asset.h"
-#include "reel_closed_caption_asset.h"
-#include "reel_subtitle_asset.h"
+#include "smpte_subtitle_asset.h"
 #include "sound_asset.h"
 #include "sound_asset_writer.h"
-#include "smpte_subtitle_asset.h"
-#include "mono_picture_asset.h"
-#include "openjpeg_image.h"
-#include "j2k_transcode.h"
-#include "picture_asset_writer.h"
-#include "reel_mono_picture_asset.h"
-#include "reel_asset.h"
 #include "test.h"
 #include "util.h"
-#include "reel_markers_asset.h"
 #include <asdcp/KM_util.h>
 #include <asdcp/KM_prng.h>
 #include <sndfile.h>
@@ -64,6 +65,7 @@
 #include <cstdio>
 #include <iostream>
 
+
 using std::string;
 using std::min;
 using std::vector;
@@ -95,6 +97,7 @@ struct TestConfig
        }
 };
 
+
 void
 check_xml (xmlpp::Element* ref, xmlpp::Element* test, vector<string> ignore_tags, bool ignore_whitespace)
 {
@@ -186,12 +189,12 @@ check_xml (xmlpp::Element* ref, xmlpp::Element* test, vector<string> ignore_tags
 void
 check_xml (string ref, string test, vector<string> ignore, bool ignore_whitespace)
 {
-       xmlpp::DomParser* ref_parser = new xmlpp::DomParser ();
+       auto ref_parser = new xmlpp::DomParser ();
        ref_parser->parse_memory (ref);
-       xmlpp::Element* ref_root = ref_parser->get_document()->get_root_node ();
-       xmlpp::DomParser* test_parser = new xmlpp::DomParser ();
+       auto ref_root = ref_parser->get_document()->get_root_node ();
+       auto test_parser = new xmlpp::DomParser ();
        test_parser->parse_memory (test);
-       xmlpp::Element* test_root = test_parser->get_document()->get_root_node ();
+       auto test_root = test_parser->get_document()->get_root_node ();
 
        check_xml (ref_root, test_root, ignore, ignore_whitespace);
 }
@@ -201,14 +204,14 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
 {
        uintmax_t size = boost::filesystem::file_size (ref);
        BOOST_CHECK_EQUAL (size, boost::filesystem::file_size(check));
-       FILE* ref_file = dcp::fopen_boost (ref, "rb");
+       auto ref_file = dcp::fopen_boost (ref, "rb");
        BOOST_REQUIRE (ref_file);
-       FILE* check_file = dcp::fopen_boost (check, "rb");
+       auto check_file = dcp::fopen_boost (check, "rb");
        BOOST_REQUIRE (check_file);
 
        int const buffer_size = 65536;
-       uint8_t* ref_buffer = new uint8_t[buffer_size];
-       uint8_t* check_buffer = new uint8_t[buffer_size];
+       auto ref_buffer = new uint8_t[buffer_size];
+       auto check_buffer = new uint8_t[buffer_size];
 
        uintmax_t pos = 0;
 
@@ -421,7 +424,7 @@ make_simple_with_interop_subs (boost::filesystem::path path)
        subs->add_font ("afont", data);
        subs->write (path / "subs" / "subs.xml");
 
-       shared_ptr<dcp::ReelSubtitleAsset> reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 240, 0));
+       auto reel_subs = make_shared<dcp::ReelInteropSubtitleAsset>(subs, dcp::Fraction(24, 1), 240, 0);
        dcp->cpls().front()->reels().front()->add (reel_subs);
 
        return dcp;
@@ -440,7 +443,7 @@ make_simple_with_smpte_subs (boost::filesystem::path path)
 
        subs->write (path / "subs.mxf");
 
-       shared_ptr<dcp::ReelSubtitleAsset> reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 192, 0));
+       auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 192, 0);
        dcp->cpls().front()->reels().front()->add (reel_subs);
 
        return dcp;