}
std::cout << "DCP has " << dcp.cpls().size() << " CPLs.\n";
- std::list<std::shared_ptr<dcp::Asset> > assets = dcp.assets ();
+ auto assets = dcp.assets ();
std::cout << "DCP has " << assets.size() << " assets.\n";
- for (std::list<std::shared_ptr<dcp::Asset> >::const_iterator i = assets.begin(); i != assets.end(); ++i) {
- if (std::dynamic_pointer_cast<dcp::MonoPictureAsset> (*i)) {
+ for (auto i: assets) {
+ if (std::dynamic_pointer_cast<dcp::MonoPictureAsset>(i)) {
std::cout << "2D picture\n";
- } else if (std::dynamic_pointer_cast<dcp::StereoPictureAsset> (*i)) {
+ } else if (std::dynamic_pointer_cast<dcp::StereoPictureAsset>(i)) {
std::cout << "3D picture\n";
- } else if (std::dynamic_pointer_cast<dcp::SoundAsset> (*i)) {
+ } else if (std::dynamic_pointer_cast<dcp::SoundAsset>(i)) {
std::cout << "Sound\n";
- } else if (std::dynamic_pointer_cast<dcp::SubtitleAsset> (*i)) {
+ } else if (std::dynamic_pointer_cast<dcp::SubtitleAsset>(i)) {
std::cout << "Subtitle\n";
- } else if (std::dynamic_pointer_cast<dcp::CPL> (*i)) {
+ } else if (std::dynamic_pointer_cast<dcp::CPL>(i)) {
std::cout << "CPL\n";
}
- std::cout << "\t" << (*i)->file()->leaf().string() << "\n";
+ std::cout << "\t" << i->file()->leaf().string() << "\n";
}
/* Take the first CPL */
CertificateChain::leaf_to_root () const
{
List l = root_to_leaf ();
- l.reverse ();
+ std::reverse (l.begin(), l.end());
return l;
}
void
CertificateChain::remove (Certificate c)
{
- _certificates.remove (c);
+ auto i = std::find(_certificates.begin(), _certificates.end(), c);
+ if (i != _certificates.end()) {
+ _certificates.erase (i);
+ }
}
/** Remove the i'th certificate in the list, as listed
CertificateChain::root_to_leaf () const
{
List rtl = _certificates;
- rtl.sort ();
+ std::sort (rtl.begin(), rtl.end());
do {
if (chain_valid (rtl)) {
return rtl;
Certificate root () const;
Certificate leaf () const;
- typedef std::list<Certificate> List;
+ typedef std::vector<Certificate> List;
List leaf_to_root () const;
List root_to_leaf () const;
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#include <vector>
-using std::list;
using std::map;
using std::set;
using std::string;
}
}
- list<path> paths;
- list<shared_ptr<dcp::Asset> > assets;
+ vector<path> paths;
+ vector<shared_ptr<dcp::Asset>> assets;
BOOST_FOREACH (path i, inputs) {
DCP dcp (i);
}
-list<shared_ptr<ReelMXF>>
+vector<shared_ptr<ReelMXF>>
CPL::reel_mxfs ()
{
- list<shared_ptr<ReelMXF>> c;
+ vector<shared_ptr<ReelMXF>> c;
for (auto i: _reels) {
if (i->main_picture ()) {
return c;
}
-list<shared_ptr<const ReelMXF>>
+vector<shared_ptr<const ReelMXF>>
CPL::reel_mxfs () const
{
- list<shared_ptr<const ReelMXF>> c;
+ vector<shared_ptr<const ReelMXF>> c;
for (auto i: _reels) {
if (i->main_picture ()) {
}
void
-CPL::resolve_refs (list<shared_ptr<Asset>> assets)
+CPL::resolve_refs (vector<shared_ptr<Asset>> assets)
{
for (auto i: _reels) {
i->resolve_refs (assets);
/*
- Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#include <boost/function.hpp>
#include <boost/optional.hpp>
#include <memory>
-#include <list>
#include <vector>
void add (DecryptedKDM const &);
/** @return the reels in this CPL */
- std::list<std::shared_ptr<Reel> > reels () const {
+ std::vector<std::shared_ptr<Reel>> reels () const {
return _reels;
}
/** @return the ReelMXFs in this CPL in all reels */
- std::list<std::shared_ptr<const ReelMXF> > reel_mxfs () const;
- std::list<std::shared_ptr<ReelMXF> > reel_mxfs ();
+ std::vector<std::shared_ptr<const ReelMXF>> reel_mxfs () const;
+ std::vector<std::shared_ptr<ReelMXF>> reel_mxfs ();
bool encrypted () const;
std::shared_ptr<const CertificateChain>
) const;
- void resolve_refs (std::list<std::shared_ptr<Asset> >);
+ void resolve_refs (std::vector<std::shared_ptr<Asset>>);
int64_t duration () const;
/* See note for _release_territory above */
std::vector<std::string> _additional_subtitle_languages;
- std::list<std::shared_ptr<Reel> > _reels;
+ std::vector<std::shared_ptr<Reel>> _reels;
/** Standard of CPL that was read in */
boost::optional<Standard> _standard;
*
* Errors that are not fatal will be added to notes, if it's non-0. For example,
* if the DCP contains a mixture of Interop and SMPTE elements this will result
- * in a note being added to the list.
+ * in a note being added to the vector.
*/
void
-DCP::read (list<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_mxf_type)
+DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_mxf_type)
{
/* Read the ASSETMAP and PKL */
auto asset_nodes = asset_map.node_child("AssetList")->node_children ("Asset");
map<string, boost::filesystem::path> paths;
- list<boost::filesystem::path> pkl_paths;
+ vector<boost::filesystem::path> pkl_paths;
for (auto i: asset_nodes) {
if (i->node_child("ChunkList")->node_children("Chunk").size() != 1) {
boost::throw_exception (XMLError ("unsupported asset chunk count"));
/* Make a list of non-CPL/PKL assets so that we can resolve the references
from the CPLs.
*/
- list<shared_ptr<Asset>> other_assets;
+ vector<shared_ptr<Asset>> other_assets;
for (auto i: paths) {
auto path = _directory / i.second;
}
void
-DCP::resolve_refs (list<shared_ptr<Asset>> assets)
+DCP::resolve_refs (vector<shared_ptr<Asset>> assets)
{
for (auto i: cpls()) {
i->resolve_refs (assets);
write_assetmap (standard, pkl->id(), pkl_path, issuer, creator, issue_date, annotation_text);
}
-list<shared_ptr<CPL>>
+vector<shared_ptr<CPL>>
DCP::cpls () const
{
return _cpls;
* an exception is thrown if they are found.
* @return All assets (including CPLs).
*/
-list<shared_ptr<Asset>>
+vector<shared_ptr<Asset>>
DCP::assets (bool ignore_unresolved) const
{
- list<shared_ptr<Asset>> assets;
+ vector<shared_ptr<Asset>> assets;
for (auto i: cpls()) {
assets.push_back (i);
for (auto j: i->reel_mxfs()) {
* as stereoscopic if the monoscopic load fails; fixes problems some 3D DCPs that (I think)
* have an incorrect descriptor in their MXF.
*/
- void read (std::list<VerificationNote>* notes = 0, bool ignore_incorrect_picture_mxf_type = false);
+ void read (std::vector<VerificationNote>* notes = 0, bool ignore_incorrect_picture_mxf_type = false);
/** Compare this DCP with another, according to various options.
* @param other DCP to compare this one to.
void add (std::shared_ptr<CPL> cpl);
- std::list<std::shared_ptr<CPL> > cpls () const;
- std::list<std::shared_ptr<Asset> > assets (bool ignore_unresolved = false) const;
+ std::vector<std::shared_ptr<CPL>> cpls () const;
+ std::vector<std::shared_ptr<Asset>> assets (bool ignore_unresolved = false) const;
bool encrypted () const;
NameFormat name_format = NameFormat("%t")
);
- void resolve_refs (std::list<std::shared_ptr<Asset> > assets);
+ void resolve_refs (std::vector<std::shared_ptr<Asset>> assets);
/** @return Standard of a DCP that was read in */
boost::optional<Standard> standard () const {
}
/** @return PKLs if this DCP was read from an existing one, or if write_xml() has been called on it.
- * If neither is true, this method returns an empty list.
+ * If neither is true, this method returns an empty vector.
*/
- std::list<std::shared_ptr<PKL> > pkls () const {
+ std::vector<std::shared_ptr<PKL>> pkls () const {
return _pkls;
}
/** The directory that we are writing to */
boost::filesystem::path _directory;
/** The CPLs that make up this DCP */
- std::list<std::shared_ptr<CPL> > _cpls;
+ std::vector<std::shared_ptr<CPL>> _cpls;
/** The PKLs that make up this DCP */
- std::list<std::shared_ptr<PKL> > _pkls;
+ std::vector<std::shared_ptr<PKL>> _pkls;
/** File that the ASSETMAP was read from or last written to */
mutable boost::optional<boost::filesystem::path> _asset_map;
}
}
- list<pair<string, string> > key_ids;
- list<string> keys;
+ vector<pair<string, string>> key_ids;
+ vector<string> keys;
BOOST_FOREACH (DecryptedKDMKey const & i, _keys) {
/* We're making SMPTE keys so we must have a type for each one */
DCP_ASSERT (i.type());
void add_key (DecryptedKDMKey key);
/** @return This KDM's (decrypted) keys, which could be used to decrypt assets. */
- std::list<DecryptedKDMKey> keys () const {
+ std::vector<DecryptedKDMKey> keys () const {
return _keys;
}
boost::optional<std::string> _annotation_text;
std::string _content_title_text;
std::string _issue_date;
- std::list<DecryptedKDMKey> _keys;
+ std::vector<DecryptedKDMKey> _keys;
};
}
SignedInfo signed_info;
string signature_value;
- list<X509Data> x509_data;
+ vector<X509Data> x509_data;
};
class AuthenticatedPrivate
}
}
- list<string> encrypted_key;
+ vector<string> encrypted_key;
};
class TypedKeyId
}
}
- list<TypedKeyId> typed_key_id;
+ vector<TypedKeyId> typed_key_id;
};
class AuthorizedDeviceInfo
/** DeviceListIdentifier without the urn:uuid: prefix */
string device_list_identifier;
boost::optional<string> device_list_description;
- std::list<string> certificate_thumbprints;
+ std::vector<string> certificate_thumbprints;
};
class X509IssuerSerial
Formulation formulation,
bool disable_forensic_marking_picture,
optional<int> disable_forensic_marking_audio,
- list<pair<string, string> > key_ids,
- list<string> keys
+ vector<pair<string, string>> key_ids,
+ vector<string> keys
)
: _data (new data::EncryptedKDMData)
{
return _data->as_xml()->write_to_string ("UTF-8");
}
-list<string>
+vector<string>
EncryptedKDM::keys () const
{
return _data->authenticated_private.encrypted_key;
* Note that the returned `keys' contain more than just the asset decryption
* keys (also key id, CPL id etc.)
*/
- std::list<std::string> keys () const;
+ std::vector<std::string> keys () const;
std::string id () const;
boost::optional<std::string> annotation_text () const;
Formulation formulation,
bool disable_forensic_marking_picture,
boost::optional<int> disable_forensic_marking_audio,
- std::list<std::pair<std::string, std::string> > key_ids,
- std::list<std::string> keys
+ std::vector<std::pair<std::string, std::string>> key_ids,
+ std::vector<std::string> keys
);
data::EncryptedKDMData* _data;
using std::cerr;
using std::map;
using std::shared_ptr;
+using std::dynamic_pointer_cast;
+using std::vector;
using boost::shared_array;
using boost::optional;
-using std::dynamic_pointer_cast;
using namespace dcp;
InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file)
/* Now we need to drop down to xmlpp */
- list<ParseState> ps;
+ vector<ParseState> ps;
xmlpp::Node::NodeList c = xml->node()->get_children ();
for (xmlpp::Node::NodeList::const_iterator i = c.begin(); i != c.end(); ++i) {
xmlpp::Element const * e = dynamic_cast<xmlpp::Element const *> (*i);
root->add_child("ReelNumber")->add_child_text (raw_convert<string> (_reel_number));
root->add_child("Language")->add_child_text (_language);
- for (list<shared_ptr<InteropLoadFontNode> >::const_iterator i = _load_font_nodes.begin(); i != _load_font_nodes.end(); ++i) {
+ for (auto i: _load_font_nodes) {
xmlpp::Element* load_font = root->add_child("LoadFont");
- load_font->set_attribute ("Id", (*i)->id);
- load_font->set_attribute ("URI", (*i)->uri);
+ load_font->set_attribute ("Id", i->id);
+ load_font->set_attribute ("URI", i->uri);
}
subtitles_as_xml (root, 250, INTEROP);
}
if (!options.load_font_nodes_can_differ) {
- list<shared_ptr<InteropLoadFontNode> >::const_iterator i = _load_font_nodes.begin ();
- list<shared_ptr<InteropLoadFontNode> >::const_iterator j = other->_load_font_nodes.begin ();
+ auto i = _load_font_nodes.begin();
+ auto j = other->_load_font_nodes.begin();
while (i != _load_font_nodes.end ()) {
if (j == other->_load_font_nodes.end ()) {
return true;
}
-list<shared_ptr<LoadFontNode> >
+vector<shared_ptr<LoadFontNode>>
InteropSubtitleAsset::load_font_nodes () const
{
- list<shared_ptr<LoadFontNode> > lf;
+ vector<shared_ptr<LoadFontNode>> lf;
copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf));
return lf;
}
/* Fonts */
BOOST_FOREACH (shared_ptr<InteropLoadFontNode> i, _load_font_nodes) {
boost::filesystem::path file = p.parent_path() / i->uri;
- list<Font>::const_iterator j = _fonts.begin ();
+ auto j = _fonts.begin();
while (j != _fonts.end() && j->load_id != i->id) {
++j;
}
* a list of font ID, load ID and data.
*/
void
-InteropSubtitleAsset::resolve_fonts (list<shared_ptr<Asset> > assets)
+InteropSubtitleAsset::resolve_fonts (vector<shared_ptr<Asset>> assets)
{
BOOST_FOREACH (shared_ptr<Asset> i, assets) {
shared_ptr<FontAsset> font = dynamic_pointer_cast<FontAsset> (i);
}
void
-InteropSubtitleAsset::add_font_assets (list<shared_ptr<Asset> >& assets)
+InteropSubtitleAsset::add_font_assets (vector<shared_ptr<Asset>>& assets)
{
BOOST_FOREACH (Font const & i, _fonts) {
DCP_ASSERT (i.file);
void write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const;
void add_to_pkl (std::shared_ptr<PKL> pkl, boost::filesystem::path root) const;
- std::list<std::shared_ptr<LoadFontNode> > load_font_nodes () const;
+ std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes () const;
void add_font (std::string load_id, dcp::ArrayData data);
std::string xml_as_string () const;
void write (boost::filesystem::path path) const;
- void resolve_fonts (std::list<std::shared_ptr<Asset> > assets);
- void add_font_assets (std::list<std::shared_ptr<Asset> >& assets);
+ void resolve_fonts (std::vector<std::shared_ptr<Asset>> assets);
+ void add_font_assets (std::vector<std::shared_ptr<Asset>>& assets);
void set_font_file (std::string load_id, boost::filesystem::path file);
/** Set the reel number or sub-element identifier
std::string _reel_number;
std::string _language;
std::string _movie_title;
- std::list<std::shared_ptr<InteropLoadFontNode> > _load_font_nodes;
+ std::vector<std::shared_ptr<InteropLoadFontNode>> _load_font_nodes;
};
}
std::string _issue_date;
std::string _issuer;
std::string _creator;
- std::list<std::shared_ptr<Asset> > _asset_list;
+ std::vector<std::shared_ptr<Asset>> _asset_list;
/** The most recent disk file used to read or write this PKL */
mutable boost::optional<boost::filesystem::path> _file;
};
#endif
using std::string;
-using std::list;
using std::cout;
using std::min;
using std::make_shared;
using std::shared_ptr;
using std::dynamic_pointer_cast;
+using std::vector;
using namespace dcp;
Reel::Reel (std::shared_ptr<const cxml::Node> node)
}
}
-list<shared_ptr<ReelAsset>>
+vector<shared_ptr<ReelAsset>>
Reel::assets () const
{
- list<shared_ptr<ReelAsset>> a;
+ vector<shared_ptr<ReelAsset>> a;
if (_main_picture) {
a.push_back (_main_picture);
}
}
void
-Reel::resolve_refs (list<shared_ptr<Asset>> assets)
+Reel::resolve_refs (vector<shared_ptr<Asset>> assets)
{
if (_main_picture) {
_main_picture->asset_ref().resolve (assets);
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#include "ref.h"
#include <memory>
#include <boost/function.hpp>
-#include <list>
namespace cxml {
class Node;
return _main_markers;
}
- std::list<std::shared_ptr<ReelClosedCaptionAsset> > closed_captions () const {
+ std::vector<std::shared_ptr<ReelClosedCaptionAsset>> closed_captions () const {
return _closed_captions;
}
void add (std::shared_ptr<ReelAsset> asset);
- std::list<std::shared_ptr<ReelAsset> > assets () const;
+ std::vector<std::shared_ptr<ReelAsset>> assets () const;
xmlpp::Element* write_to_cpl (xmlpp::Element* node, Standard standard) const;
void add (DecryptedKDM const &);
- void resolve_refs (std::list<std::shared_ptr<Asset> >);
+ void resolve_refs (std::vector<std::shared_ptr<Asset>>);
private:
std::shared_ptr<ReelPictureAsset> _main_picture;
std::shared_ptr<ReelSoundAsset> _main_sound;
std::shared_ptr<ReelSubtitleAsset> _main_subtitle;
std::shared_ptr<ReelMarkersAsset> _main_markers;
- std::list<std::shared_ptr<ReelClosedCaptionAsset> > _closed_captions;
+ std::vector<std::shared_ptr<ReelClosedCaptionAsset>> _closed_captions;
std::shared_ptr<ReelAtmosAsset> _atmos;
};
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#include "ref.h"
-using std::list;
using std::shared_ptr;
+using std::vector;
using namespace dcp;
/** Look through a list of assets and copy a shared_ptr to any asset
* which matches the ID of this one.
*/
void
-Ref::resolve (list<shared_ptr<Asset> > assets)
+Ref::resolve (vector<shared_ptr<Asset>> assets)
{
- list<shared_ptr<Asset> >::iterator i = assets.begin();
+ auto i = assets.begin();
while (i != assets.end() && !ids_equal ((*i)->id(), _id)) {
++i;
}
* which represents the thing.
*
* If the Ref does not have a shared_ptr it may be given one by
- * calling resolve() with a list of assets. The shared_ptr will be
- * set up using any object on the list which has a matching ID.
+ * calling resolve() with a vector of assets. The shared_ptr will be
+ * set up using any object on the vector which has a matching ID.
*/
class Ref
{
_id = id;
}
- void resolve (std::list<std::shared_ptr<Asset> > assets);
+ void resolve (std::vector<std::shared_ptr<Asset>> assets);
/** @return the ID of the thing that we are pointing to */
std::string id () const {
/* Now we need to drop down to xmlpp */
- list<ParseState> ps;
+ vector<ParseState> ps;
xmlpp::Node::NodeList c = xml->node()->get_children ();
for (xmlpp::Node::NodeList::const_iterator i = c.begin(); i != c.end(); ++i) {
xmlpp::Element const * e = dynamic_cast<xmlpp::Element const *> (*i);
switch (i->Type) {
case ASDCP::TimedText::MT_OPENTYPE:
{
- list<shared_ptr<SMPTELoadFontNode> >::const_iterator j = _load_font_nodes.begin ();
+ auto j = _load_font_nodes.begin();
while (j != _load_font_nodes.end() && (*j)->urn != id) {
++j;
}
}
case ASDCP::TimedText::MT_PNG:
{
- list<shared_ptr<Subtitle> >::const_iterator j = _subtitles.begin ();
+ auto j = _subtitles.begin();
while (j != _subtitles.end() && ((!dynamic_pointer_cast<SubtitleImage>(*j)) || dynamic_pointer_cast<SubtitleImage>(*j)->id() != id)) {
++j;
}
read_mxf_descriptor (reader, dec);
}
-list<shared_ptr<LoadFontNode> >
+vector<shared_ptr<LoadFontNode>>
SMPTESubtitleAsset::load_font_nodes () const
{
- list<shared_ptr<LoadFontNode> > lf;
+ vector<shared_ptr<LoadFontNode>> lf;
copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf));
return lf;
}
/* Font references */
BOOST_FOREACH (shared_ptr<dcp::SMPTELoadFontNode> i, _load_font_nodes) {
- list<Font>::const_iterator j = _fonts.begin ();
+ auto j = _fonts.begin();
while (j != _fonts.end() && j->load_id != i->id) {
++j;
}
/* Font payload */
BOOST_FOREACH (shared_ptr<dcp::SMPTELoadFontNode> i, _load_font_nodes) {
- list<Font>::const_iterator j = _fonts.begin ();
+ auto j = _fonts.begin();
while (j != _fonts.end() && j->load_id != i->id) {
++j;
}
return false;
}
- list<shared_ptr<SMPTELoadFontNode> >::const_iterator i = _load_font_nodes.begin ();
- list<shared_ptr<SMPTELoadFontNode> >::const_iterator j = other->_load_font_nodes.begin ();
+ auto i = _load_font_nodes.begin();
+ auto j = other->_load_font_nodes.begin();
while (i != _load_font_nodes.end ()) {
if (j == other->_load_font_nodes.end ()) {
NoteHandler note
) const;
- std::list<std::shared_ptr<LoadFontNode> > load_font_nodes () const;
+ std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes () const;
std::string xml_as_string () const;
void write (boost::filesystem::path path) const;
int _time_code_rate;
boost::optional<Time> _start_time;
- std::list<std::shared_ptr<SMPTELoadFontNode> > _load_font_nodes;
+ std::vector<std::shared_ptr<SMPTELoadFontNode>> _load_font_nodes;
/** UUID for the XML inside the MXF, which should be different to the ID of the MXF according to
* Doremi's 2.8.18 release notes.
*/
#include <boost/shared_array.hpp>
#include <boost/foreach.hpp>
+using std::dynamic_pointer_cast;
using std::string;
-using std::list;
using std::cout;
using std::cerr;
using std::map;
using std::shared_ptr;
+using std::vector;
using boost::shared_array;
using boost::optional;
-using std::dynamic_pointer_cast;
using boost::lexical_cast;
using namespace dcp;
}
void
-SubtitleAsset::parse_subtitles (xmlpp::Element const * node, list<ParseState>& state, optional<int> tcr, Standard standard)
+SubtitleAsset::parse_subtitles (xmlpp::Element const * node, vector<ParseState>& state, optional<int> tcr, Standard standard)
{
if (node->get_name() == "Font") {
state.push_back (font_node_state (node, standard));
}
void
-SubtitleAsset::maybe_add_subtitle (string text, list<ParseState> const & parse_state, Standard standard)
+SubtitleAsset::maybe_add_subtitle (string text, vector<ParseState> const & parse_state, Standard standard)
{
if (empty_or_white_space (text)) {
return;
}
}
-list<shared_ptr<Subtitle> >
+vector<shared_ptr<Subtitle>>
SubtitleAsset::subtitles_during (Time from, Time to, bool starting) const
{
- list<shared_ptr<Subtitle> > s;
+ vector<shared_ptr<Subtitle> > s;
BOOST_FOREACH (shared_ptr<Subtitle> i, _subtitles) {
if ((starting && from <= i->in() && i->in() < to) || (!starting && i->out() >= from && i->in() <= to)) {
s.push_back (i);
return false;
}
- list<shared_ptr<Subtitle> >::const_iterator i = _subtitles.begin ();
- list<shared_ptr<Subtitle> >::const_iterator j = other->_subtitles.begin ();
+ auto i = _subtitles.begin();
+ auto j = other->_subtitles.begin();
while (i != _subtitles.end()) {
shared_ptr<SubtitleString> string_i = dynamic_pointer_cast<SubtitleString> (*i);
}
/* Merge adjacent children with the same font */
- list<shared_ptr<order::Part> >::const_iterator i = part->children.begin();
- list<shared_ptr<order::Part> > merged;
+ auto i = part->children.begin();
+ vector<shared_ptr<order::Part>> merged;
while (i != part->children.end()) {
merged.push_back (*i);
++i;
} else {
- list<shared_ptr<order::Part> >::const_iterator j = i;
+ auto j = i;
++j;
while (j != part->children.end() && (*i)->font == (*j)->font) {
++j;
++i;
} else {
shared_ptr<order::Part> group (new order::Part (part, (*i)->font));
- for (list<shared_ptr<order::Part> >::const_iterator k = i; k != j; ++k) {
+ for (auto k = i; k != j; ++k) {
(*k)->font.clear ();
group->children.push_back (*k);
}
void
SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, Standard standard) const
{
- list<shared_ptr<Subtitle> > sorted = _subtitles;
- sorted.sort (SubtitleSorter ());
+ vector<shared_ptr<Subtitle> > sorted = _subtitles;
+ std::stable_sort(sorted.begin(), sorted.end(), SubtitleSorter());
/* Gather our subtitles into a hierarchy of Subtitle/Text/String objects, writing
font information into the bottom level (String) objects.
SubtitleAsset::fix_empty_font_ids ()
{
bool have_empty = false;
- list<string> ids;
+ vector<string> ids;
BOOST_FOREACH (shared_ptr<LoadFontNode> i, load_font_nodes()) {
if (i->id == "") {
have_empty = true;
NoteHandler note
) const;
- std::list<std::shared_ptr<Subtitle> > subtitles_during (Time from, Time to, bool starting) const;
- std::list<std::shared_ptr<Subtitle> > const & subtitles () const {
+ std::vector<std::shared_ptr<Subtitle>> subtitles_during (Time from, Time to, bool starting) const;
+ std::vector<std::shared_ptr<Subtitle>> const & subtitles () const {
return _subtitles;
}
void fix_empty_font_ids ();
- virtual std::list<std::shared_ptr<LoadFontNode> > load_font_nodes () const = 0;
+ virtual std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes () const = 0;
std::string raw_xml () const {
return _raw_xml;
boost::optional<Type> type;
};
- void parse_subtitles (xmlpp::Element const * node, std::list<ParseState>& state, boost::optional<int> tcr, Standard standard);
+ void parse_subtitles (xmlpp::Element const * node, std::vector<ParseState>& state, boost::optional<int> tcr, Standard standard);
ParseState font_node_state (xmlpp::Element const * node, Standard standard) const;
ParseState text_node_state (xmlpp::Element const * node) const;
ParseState image_node_state (xmlpp::Element const * node) const;
void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Standard standard) const;
/** All our subtitles, in no particular order */
- std::list<std::shared_ptr<Subtitle> > _subtitles;
+ std::vector<std::shared_ptr<Subtitle>> _subtitles;
class Font
{
};
/** TTF font data that we need */
- std::list<Font> _fonts;
+ std::vector<Font> _fonts;
/** The raw XML data that we read from our asset; useful for validation */
std::string _raw_xml;
friend struct ::pull_fonts_test2;
friend struct ::pull_fonts_test3;
- void maybe_add_subtitle (std::string text, std::list<ParseState> const & parse_state, Standard standard);
+ void maybe_add_subtitle (std::string text, std::vector<ParseState> const & parse_state, Standard standard);
static void pull_fonts (std::shared_ptr<order::Part> part);
};
std::shared_ptr<Part> parent;
Font font;
- std::list<std::shared_ptr<Part> > children;
+ std::vector<std::shared_ptr<Part>> children;
};
class String : public Part
using std::cout;
using std::min;
using std::max;
-using std::list;
using std::setw;
using std::setfill;
using std::ostream;
using std::shared_ptr;
+using std::vector;
using boost::shared_array;
using boost::optional;
using boost::function;
* not in \ref existing.
*/
string
-dcp::unique_string (list<string> existing, string base)
+dcp::unique_string (vector<string> existing, string base)
{
int const max_tries = existing.size() + 1;
for (int i = 0; i < max_tries; ++i) {
extern void indent (xmlpp::Element* element, int initial);
extern bool day_less_than_or_equal (LocalTime a, LocalTime b);
extern bool day_greater_than_or_equal (LocalTime a, LocalTime b);
-extern std::string unique_string (std::list<std::string> existing, std::string base);
+extern std::string unique_string (std::vector<std::string> existing, std::string base);
extern ASDCP::Dictionary const* asdcp_smpte_dict;
#include <boost/noncopyable.hpp>
#include <boost/algorithm/string.hpp>
#include <map>
-#include <list>
#include <vector>
#include <iostream>
template <class T>
void
-validate_xml (T xml, boost::filesystem::path xsd_dtd_directory, list<VerificationNote>& notes)
+validate_xml (T xml, boost::filesystem::path xsd_dtd_directory, vector<VerificationNote>& notes)
{
try {
XMLPlatformUtils::Initialize ();
void
-verify_language_tag (string tag, list<VerificationNote>& notes)
+verify_language_tag (string tag, vector<VerificationNote>& notes)
{
try {
dcp::LanguageTag test (tag);
shared_ptr<const ReelPictureAsset> reel_asset,
function<void (string, optional<boost::filesystem::path>)> stage,
function<void (float)> progress,
- list<VerificationNote>& notes
+ vector<VerificationNote>& notes
)
{
auto asset = reel_asset->asset();
shared_ptr<const ReelSoundAsset> reel_asset,
function<void (string, optional<boost::filesystem::path>)> stage,
function<void (float)> progress,
- list<VerificationNote>& notes
+ vector<VerificationNote>& notes
)
{
auto asset = reel_asset->asset();
static void
-verify_main_subtitle_reel (shared_ptr<const ReelSubtitleAsset> reel_asset, list<VerificationNote>& notes)
+verify_main_subtitle_reel (shared_ptr<const ReelSubtitleAsset> reel_asset, vector<VerificationNote>& notes)
{
/* XXX: is Language compulsory? */
if (reel_asset->language()) {
static void
-verify_closed_caption_reel (shared_ptr<const ReelClosedCaptionAsset> reel_asset, list<VerificationNote>& notes)
+verify_closed_caption_reel (shared_ptr<const ReelClosedCaptionAsset> reel_asset, vector<VerificationNote>& notes)
{
/* XXX: is Language compulsory? */
if (reel_asset->language()) {
shared_ptr<const SubtitleAsset> asset,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
- list<VerificationNote>& notes,
+ vector<VerificationNote>& notes,
State& state,
bool first_reel
)
if (first_reel) {
auto subs = smpte->subtitles();
- subs.sort ([](shared_ptr<Subtitle> a, shared_ptr<Subtitle> b) {
+ sort (subs.begin(), subs.end(), [](shared_ptr<Subtitle> a, shared_ptr<Subtitle> b) {
return a->in() < b->in();
});
if (!subs.empty() && subs.front()->in() < dcp::Time(0, 0, 4, 0, 24)) {
shared_ptr<const SubtitleAsset> asset,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
- list<VerificationNote>& notes,
+ vector<VerificationNote>& notes,
State& state,
bool first_reel
)
}
-list<VerificationNote>
+vector<VerificationNote>
dcp::verify (
vector<boost::filesystem::path> directories,
function<void (string, optional<boost::filesystem::path>)> stage,
{
xsd_dtd_directory = boost::filesystem::canonical (xsd_dtd_directory);
- list<VerificationNote> notes;
+ vector<VerificationNote> notes;
State state;
- list<shared_ptr<DCP>> dcps;
+ vector<shared_ptr<DCP>> dcps;
for (auto i: directories) {
dcps.push_back (shared_ptr<DCP> (new DCP (i)));
}
#include <boost/function.hpp>
#include <boost/optional.hpp>
#include <string>
-#include <list>
#include <vector>
namespace dcp {
uint64_t _line;
};
-std::list<VerificationNote> verify (
+std::vector<VerificationNote> verify (
std::vector<boost::filesystem::path> directories,
boost::function<void (std::string, boost::optional<boost::filesystem::path>)> stage,
boost::function<void (float)> progress,
}
template <class T>
-std::list<std::shared_ptr<T>>
+std::vector<std::shared_ptr<T>>
type_children (cxml::Node const & node, std::string name)
{
- std::list<std::shared_ptr<T> > r;
+ std::vector<std::shared_ptr<T>> r;
for (auto i: node.node_children(name)) {
r.push_back (std::make_shared<T>(i));
}
}
template <class T>
-std::list<std::shared_ptr<T>>
+std::vector<std::shared_ptr<T>>
type_children (std::shared_ptr<const cxml::Node> node, std::string name)
{
return type_children<T> (*node.get(), name);
}
template <class T>
-std::list<std::shared_ptr<T>>
+std::vector<std::shared_ptr<T>>
type_grand_children (cxml::Node const & node, std::string name, std::string sub)
{
return type_children<T> (node.node_child(name), sub);
}
template <class T>
-std::list<std::shared_ptr<T>>
+std::vector<std::shared_ptr<T>>
type_grand_children (std::shared_ptr<const cxml::Node> node, std::string name, std::string sub)
{
return type_grand_children<T> (*node.get(), name, sub);
static
void
-dump_notes (list<dcp::VerificationNote> const & notes)
+dump_notes (vector<dcp::VerificationNote> const & notes)
{
BOOST_FOREACH (dcp::VerificationNote i, notes) {
std::cout << dcp::note_to_string(i) << "\n";
{
vector<boost::filesystem::path> directories;
directories.push_back (path);
- list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test);
- for (list<dcp::VerificationNote>::iterator i = notes.begin(); i != notes.end(); ) {
- list<dcp::VerificationNote>::iterator tmp = i;
- ++tmp;
- if (i->code() == dcp::VerificationNote::NOT_SMPTE) {
- notes.erase (i);
- }
- i = tmp;
- }
- dump_notes (notes);
- BOOST_CHECK (notes.empty());
+ auto notes = dcp::verify (directories, &stage, &progress, xsd_test);
+ vector<dcp::VerificationNote> filtered_notes;
+ std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered_notes), [](dcp::VerificationNote const& i) {
+ return i.code() != dcp::VerificationNote::NOT_SMPTE;
+ });
+ dump_notes (filtered_notes);
+ BOOST_CHECK (filtered_notes.empty());
}
template <class T>
shared_ptr<T>
-pointer_to_id_in_list (shared_ptr<T> needle, list<shared_ptr<T> > haystack)
+pointer_to_id_in_vector (shared_ptr<T> needle, vector<shared_ptr<T> > haystack)
{
BOOST_FOREACH (shared_ptr<T> i, haystack) {
if (i->id() == needle->id()) {
BOOST_REQUIRE (input_dcp.cpls().size() == 1);
shared_ptr<dcp::CPL> input_cpl = input_dcp.cpls().front();
- shared_ptr<dcp::CPL> output_cpl = pointer_to_id_in_list (input_cpl, output_dcp.cpls());
+ shared_ptr<dcp::CPL> output_cpl = pointer_to_id_in_vector (input_cpl, output_dcp.cpls());
BOOST_REQUIRE (output_cpl);
BOOST_FOREACH (shared_ptr<dcp::Asset> i, input_dcp.assets(true)) {
- shared_ptr<dcp::Asset> o = pointer_to_id_in_list(i, output_dcp.assets());
+ shared_ptr<dcp::Asset> o = pointer_to_id_in_vector(i, output_dcp.assets());
BOOST_REQUIRE_MESSAGE (o, "Could not find " << i->id() << " in combined DCP.");
BOOST_CHECK (i->equals(o, options, note_handler));
}
BOOST_CHECK (cpl.main_picture_stored_area().get() == dcp::Size(1998, 1080));
BOOST_CHECK (cpl.main_picture_active_area().get() == dcp::Size(1440, 1080));
- list<shared_ptr<dcp::Reel> > reels = cpl.reels ();
+ auto reels = cpl.reels ();
BOOST_REQUIRE_EQUAL (reels.size(), 1);
BOOST_REQUIRE (reels.front()->main_subtitle()->language());
BOOST_CHECK_EQUAL (reels.front()->main_subtitle()->language().get(), "de-DE");
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test1.xml"),
dcp::file_to_string("build/test/cpl_metadata_write_test1.xml"),
- list<string>()
+ vector<string>()
);
}
{
dcp::CPL cpl ("test/ref/cpl_metadata_test1.xml");
cpl.write_xml ("build/test/cpl_metadata_roundtrip_test1.xml", dcp::SMPTE, shared_ptr<dcp::CertificateChain>());
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("Id");
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test1.xml"),
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test2.xml"),
dcp::file_to_string("build/test/cpl_metadata_write_test2.xml"),
- list<string>()
+ vector<string>()
);
}
BOOST_CHECK (cpl.main_picture_stored_area().get() == dcp::Size(1998, 1080));
BOOST_CHECK (cpl.main_picture_active_area().get() == dcp::Size(1440, 1080));
- list<shared_ptr<dcp::Reel> > reels = cpl.reels ();
+ auto reels = cpl.reels ();
BOOST_REQUIRE_EQUAL (reels.size(), 1);
}
{
dcp::CPL cpl ("test/ref/cpl_metadata_test2.xml");
cpl.write_xml ("build/test/cpl_metadata_roundtrip_test2.xml", dcp::SMPTE, shared_ptr<dcp::CertificateChain>());
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("Id");
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test2.xml"),
cpl.write_xml ("build/test/cpl_ratings.xml", dcp::SMPTE, std::shared_ptr<dcp::CertificateChain>());
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("Id");
ignore.push_back ("Issuer");
ignore.push_back ("Creator");
cxml::Document ref("CompositionPlaylist", private_test / dcp::String::compose("51_sound_with_mca_%1.cpl", i));
cxml::Document check("CompositionPlaylist", dcp::String::compose("build/test/parse_mca_descriptors_from_mxf_test%1/cpl.xml", i));
- list<string> ignore;
+ vector<string> ignore;
check_xml (
dynamic_cast<xmlpp::Element*>(
ref.node_child("ReelList")->node_children("Reel").front()->node_child("AssetList")->node_child("CompositionMetadataAsset")->node_child("MCASubDescriptors")->node()
cxml::Document ref("CompositionPlaylist", private_test / "51_sound_with_mca_1.cpl");
cxml::Document check("CompositionPlaylist", "build/test/write_mca_descriptors_to_mxf_test/cpl.xml");
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("InstanceID");
ignore.push_back ("MCALinkID");
ignore.push_back ("SoundfieldGroupLinkID");
dcp::DCP d ("test/ref/DCP/dcp_test1");
d.read ();
- list<shared_ptr<dcp::CPL> > cpls = d.cpls ();
+ auto cpls = d.cpls ();
BOOST_CHECK_EQUAL (cpls.size(), 1);
BOOST_CHECK_EQUAL (cpls.front()->annotation_text(), "A Test DCP");
dcp::DCP d ("test/ref/DCP/dcp_test3");
d.read ();
- list<shared_ptr<dcp::CPL> > cpls = d.cpls ();
+ auto cpls = d.cpls ();
BOOST_CHECK_EQUAL (cpls.size(), 1);
BOOST_CHECK_EQUAL (cpls.front()->annotation_text(), "Test_FTR-1_F-119_10_2K_20160524_IOP_OV");
BOOST_CHECK_EQUAL (subs.reel_number(), "1");
BOOST_CHECK_EQUAL (subs.language(), "French");
- list<shared_ptr<dcp::LoadFontNode> > lfn = subs.load_font_nodes ();
+ auto lfn = subs.load_font_nodes ();
BOOST_REQUIRE_EQUAL (lfn.size(), 1);
shared_ptr<dcp::InteropLoadFontNode> interop_lfn = dynamic_pointer_cast<dcp::InteropLoadFontNode> (lfn.front ());
BOOST_REQUIRE (interop_lfn);
BOOST_CHECK_EQUAL (interop_lfn->id, "theFontId");
BOOST_CHECK_EQUAL (interop_lfn->uri, "arial.ttf");
- list<shared_ptr<dcp::Subtitle> > s = subs.subtitles_during (dcp::Time (0, 0, 6, 1, 250), dcp::Time (0, 0, 6, 2, 250), false);
+ auto s = subs.subtitles_during (dcp::Time (0, 0, 6, 1, 250), dcp::Time (0, 0, 6, 2, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 1);
BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
{
dcp::InteropSubtitleAsset subs ("test/data/subs2.xml");
- list<shared_ptr<dcp::Subtitle> > s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false);
+ auto s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
BOOST_CHECK_EQUAL (sc.edit_rate(), dcp::Fraction (25, 1));
BOOST_CHECK_EQUAL (sc.time_code_rate(), 25);
BOOST_CHECK_EQUAL (sc.start_time(), dcp::Time (0, 0, 0, 0, 25));
- list<shared_ptr<dcp::LoadFontNode> > lfn = sc.load_font_nodes ();
+ auto lfn = sc.load_font_nodes ();
BOOST_REQUIRE_EQUAL (lfn.size(), 1);
shared_ptr<dcp::SMPTELoadFontNode> smpte_lfn = dynamic_pointer_cast<dcp::SMPTELoadFontNode> (lfn.front ());
BOOST_REQUIRE (smpte_lfn);
dcp::SMPTESubtitleAsset sc (private_test / "olsson.xml");
BOOST_REQUIRE_EQUAL (sc.subtitles().size(), 6);
- list<shared_ptr<dcp::Subtitle> >::const_iterator i = sc.subtitles().begin();
+ auto i = sc.subtitles().begin();
shared_ptr<dcp::SubtitleString> is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
BOOST_REQUIRE (is);
BOOST_CHECK_EQUAL (is->text(), "Testing is ");
DCP* dcp = new DCP (argv[1]);
dcp->read ();
- list<shared_ptr<CPL> > cpls = dcp->cpls ();
- for (list<std::shared_ptr<CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
-
- list<shared_ptr<Reel> > reels = (*i)->reels ();
- for (list<shared_ptr<Reel> >::iterator j = reels.begin(); j != reels.end(); ++j) {
-
- if ((*j)->main_subtitle()) {
- (*j)->main_subtitle()->asset()->write ((*j)->main_subtitle()->asset()->file().get());
+ for (auto i: dcp->cpls()) {
+ for (auto j: i->reels()) {
+ if (j->main_subtitle()) {
+ j->main_subtitle()->asset()->write(j->main_subtitle()->asset()->file().get());
}
}
}
/* Check that the decrypted KDMKeys are the same as the ones we started with */
BOOST_CHECK_EQUAL (kdm_A.keys().size(), kdm_B.keys().size());
- list<dcp::DecryptedKDMKey> keys_A = kdm_A.keys ();
- list<dcp::DecryptedKDMKey> keys_B = kdm_B.keys ();
- list<dcp::DecryptedKDMKey>::const_iterator i = keys_A.begin();
- list<dcp::DecryptedKDMKey>::const_iterator j = keys_B.begin();
+ auto keys_A = kdm_A.keys ();
+ auto keys_B = kdm_B.keys ();
+ auto i = keys_A.begin();
+ auto j = keys_B.begin();
while (i != keys_A.end ()) {
BOOST_CHECK (*i == *j);
++i;
using std::string;
using std::min;
-using std::list;
using std::vector;
using std::shared_ptr;
using boost::optional;
};
void
-check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore_tags, bool ignore_whitespace)
+check_xml (xmlpp::Element* ref, xmlpp::Element* test, vector<string> ignore_tags, bool ignore_whitespace)
{
BOOST_CHECK_EQUAL (ref->get_name (), test->get_name ());
BOOST_CHECK_EQUAL (ref->get_namespace_prefix (), test->get_namespace_prefix ());
}
void
-check_xml (string ref, string test, list<string> ignore, bool ignore_whitespace)
+check_xml (string ref, string test, vector<string> ignore, bool ignore_whitespace)
{
xmlpp::DomParser* ref_parser = new xmlpp::DomParser ();
ref_parser->parse_memory (ref);
extern boost::filesystem::path private_test;
extern boost::filesystem::path xsd_test;
-extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::list<std::string> ignore_tags, bool ignore_whitespace = false);
-extern void check_xml (std::string ref, std::string test, std::list<std::string> ignore, bool ignore_whitespace = false);
+extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::vector<std::string> ignore_tags, bool ignore_whitespace = false);
+extern void check_xml (std::string ref, std::string test, std::vector<std::string> ignore, bool ignore_whitespace = false);
extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
extern std::shared_ptr<dcp::MonoPictureAsset> simple_picture (boost::filesystem::path path, std::string suffix);
extern std::shared_ptr<dcp::SoundAsset> simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language);
using std::ifstream;
using std::string;
-using std::list;
+using std::vector;
/** Test dcp::base64_decode */
BOOST_AUTO_TEST_CASE (base64_decode_test)
BOOST_AUTO_TEST_CASE (unique_string_test)
{
- list<string> existing;
+ vector<string> existing;
for (int i = 0; i < 16; i++) {
string s;
BOOST_CHECK_NO_THROW (s = dcp::unique_string(existing, "foo"));
static
void
-dump_notes (list<dcp::VerificationNote> const & notes)
+dump_notes (vector<dcp::VerificationNote> const & notes)
{
for (auto i: notes) {
std::cout << dcp::note_to_string(i) << "\n";
static
-list<dcp::VerificationNote>
+vector<dcp::VerificationNote>
check_picture_size (int width, int height, int frame_rate, bool three_d)
{
using namespace boost::filesystem;
#include "util.h"
#include <boost/test/unit_test.hpp>
-using std::list;
using std::string;
-using boost::optional;
using std::shared_ptr;
+using std::vector;
+using boost::optional;
/** Test dcp::order::Font::take_intersection */
BOOST_AUTO_TEST_CASE (take_intersection_test)
"</Font>"
"</DCSubtitle>",
c.xml_as_string (),
- list<string> ()
+ vector<string>()
);
}
"</Font>"
"</DCSubtitle>",
c.xml_as_string (),
- list<string> ()
+ vector<string>()
);
}
check_xml (
dcp::file_to_string("test/ref/write_interop_subtitle_test3/subs.xml"),
dcp::file_to_string("build/test/write_interop_subtitle_test3/subs.xml"),
- list<string>()
+ vector<string>()
);
check_file ("build/test/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png", "test/data/sub.png");
check_xml (
dcp::file_to_string("test/ref/write_interop_subtitle_test3/ASSETMAP"),
dcp::file_to_string("build/test/write_interop_subtitle_test3/ASSETMAP"),
- list<string>()
+ vector<string>()
);
check_xml (
dcp::file_to_string("test/ref/write_interop_subtitle_test3/pkl.xml"),
dcp::file_to_string("build/test/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml"),
- list<string>()
+ vector<string>()
);
}
"</dcst:SubtitleList>"
"</dcst:SubtitleReel>",
c.xml_as_string (),
- list<string> ()
+ vector<string>()
);
}
"</dcst:Font>"
"</dcst:SubtitleList>"
"</dcst:SubtitleReel>",
- list<string> ()
+ vector<string>()
);
}
#include "common.h"
#include "dcp.h"
-using std::list;
-using std::shared_ptr;
using std::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::vector;
void
-dcp::filter_notes (list<dcp::VerificationNote>& notes, bool ignore_missing_assets)
+dcp::filter_notes (vector<dcp::VerificationNote>& notes, bool ignore_missing_assets)
{
- for (list<dcp::VerificationNote>::iterator i = notes.begin(); i != notes.end(); ) {
-
- list<dcp::VerificationNote>::iterator tmp = i;
- ++tmp;
+ if (!ignore_missing_assets) {
+ return;
+ }
- if (ignore_missing_assets && (i->code() == dcp::VerificationNote::MISSING_ASSET || i->code() == dcp::VerificationNote::EXTERNAL_ASSET)) {
- notes.erase (i);
- }
+ vector<dcp::VerificationNote> filtered;
+ std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered), [](dcp::VerificationNote const& i) {
+ return i.code() != dcp::VerificationNote::MISSING_ASSET && i.code() != dcp::VerificationNote::EXTERNAL_ASSET;
+ });
- i = tmp;
- }
+ notes = filtered;
}
namespace dcp {
-extern void filter_notes (std::list<dcp::VerificationNote>& notes, bool ignore_missing_assets);
+extern void filter_notes (std::vector<dcp::VerificationNote>& notes, bool ignore_missing_assets);
}
using std::cout;
using std::string;
using std::shared_ptr;
+using std::vector;
using boost::optional;
using std::dynamic_pointer_cast;
#if BOOST_VERSION >= 106100
DCP* dcp = 0;
try {
dcp = new DCP (path);
- list<dcp::VerificationNote> notes;
+ vector<dcp::VerificationNote> notes;
dcp->read (¬es);
filter_notes (notes, ignore_missing_assets);
BOOST_FOREACH (dcp::VerificationNote i, notes) {
}
if (key) {
- list<shared_ptr<Asset> > assets = dcp->assets ();
- for (list<shared_ptr<Asset> >::const_iterator i = assets.begin(); i != assets.end(); ++i) {
- shared_ptr<MXF> mxf = dynamic_pointer_cast<MXF> (*i);
+ auto assets = dcp->assets ();
+ for (auto i: assets) {
+ shared_ptr<MXF> mxf = dynamic_pointer_cast<MXF>(i);
if (mxf) {
mxf->set_key (Key (key.get ()));
}
OUTPUT_SUBTITLE(" Subtitle ID: %1", ms->id());
if (ms->asset_ref().resolved()) {
- list<shared_ptr<Subtitle> > subs = ms->asset()->subtitles ();
+ auto subs = ms->asset()->subtitles ();
OUTPUT_SUBTITLE("\n Subtitle: %1 subtitles", subs.size());
shared_ptr<InteropSubtitleAsset> iop = dynamic_pointer_cast<InteropSubtitleAsset> (ms->asset());
if (iop) {
only = boost::split(only, *only_string, boost::is_any_of(","));
}
- list<shared_ptr<CPL> > cpls;
+ vector<shared_ptr<CPL> > cpls;
if (boost::filesystem::is_directory(argv[optind])) {
DCP* dcp = 0;
- list<dcp::VerificationNote> notes;
+ vector<dcp::VerificationNote> notes;
try {
dcp = new DCP (argv[optind]);
dcp->read (¬es);
using std::cerr;
using std::cout;
using std::string;
-using std::list;
using std::shared_ptr;
+using std::vector;
using boost::optional;
static void
/* Try to read it and report errors */
dcp::DCP dcp (dcp_dir);
- list<dcp::VerificationNote> notes;
+ vector<dcp::VerificationNote> notes;
try {
dcp.read (¬es, true);
} catch (dcp::ReadError& e) {
}
/* Read all MXF assets */
- list<shared_ptr<dcp::Asset> > assets;
+ vector<shared_ptr<dcp::Asset>> assets;
for (boost::filesystem::directory_iterator i(dcp_dir); i != boost::filesystem::directory_iterator(); ++i) {
if (i->path().extension() == ".mxf") {
try {
vector<boost::filesystem::path> directories;
directories.push_back (argv[optind]);
- list<dcp::VerificationNote> notes = dcp::verify (directories, bind(&stage, quiet, _1, _2), bind(&progress), "xsd");
+ auto notes = dcp::verify (directories, bind(&stage, quiet, _1, _2), bind(&progress), "xsd");
dcp::filter_notes (notes, ignore_missing_assets);
bool failed = false;