summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-07-09 00:23:25 +0200
committerCarl Hetherington <cth@carlh.net>2017-07-09 00:23:25 +0200
commita6a4c4712695b190766f7aba964e1776cc501e3a (patch)
treecba5d513c913cafaf46174a8174ebb6799272e7d /src
parentadc78d62964377960c907cdb538a5bc3a224dafc (diff)
Allow assets() to silently ignore unresolved assets.
Diffstat (limited to 'src')
-rw-r--r--src/dcp.cc11
-rw-r--r--src/dcp.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index b089eee1..c0fe70f6 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -69,7 +69,6 @@ using std::vector;
using std::cout;
using std::make_pair;
using std::map;
-using std::cout;
using std::cerr;
using std::exception;
using boost::shared_ptr;
@@ -481,14 +480,20 @@ DCP::cpls () const
return _cpls;
}
-/** @return All assets (including CPLs) */
+/** @param ignore_unresolved true to silently ignore unresolved assets, otherwise
+ * an exception is thrown if they are found.
+ * @return All assets (including CPLs).
+ */
list<shared_ptr<Asset> >
-DCP::assets () const
+DCP::assets (bool ignore_unresolved) const
{
list<shared_ptr<Asset> > assets;
BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
assets.push_back (i);
BOOST_FOREACH (shared_ptr<const ReelAsset> j, i->reel_assets ()) {
+ if (ignore_unresolved && !j->asset_ref().resolved()) {
+ continue;
+ }
shared_ptr<Asset> o = j->asset_ref().asset ();
assets.push_back (o);
/* More Interop special-casing */
diff --git a/src/dcp.h b/src/dcp.h
index b8651db8..811f62f6 100644
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -104,7 +104,7 @@ public:
void add (boost::shared_ptr<CPL> cpl);
std::list<boost::shared_ptr<CPL> > cpls () const;
- std::list<boost::shared_ptr<Asset> > assets () const;
+ std::list<boost::shared_ptr<Asset> > assets (bool ignore_unresolved = false) const;
bool encrypted () const;