#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;
/* 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;
}
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);
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);
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#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)
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;
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;
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);
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);
/*
- 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>"
#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>
#include <cstdio>
#include <iostream>
+
using std::string;
using std::min;
using std::vector;
}
};
+
void
check_xml (xmlpp::Element* ref, xmlpp::Element* test, vector<string> ignore_tags, bool ignore_whitespace)
{
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);
}
{
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;
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;
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;