From a6a4c4712695b190766f7aba964e1776cc501e3a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 Jul 2017 00:23:25 +0200 Subject: [PATCH] Allow assets() to silently ignore unresolved assets. --- src/dcp.cc | 11 ++++++++--- src/dcp.h | 2 +- 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 > -DCP::assets () const +DCP::assets (bool ignore_unresolved) const { list > assets; BOOST_FOREACH (shared_ptr i, cpls ()) { assets.push_back (i); BOOST_FOREACH (shared_ptr j, i->reel_assets ()) { + if (ignore_unresolved && !j->asset_ref().resolved()) { + continue; + } shared_ptr 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); std::list > cpls () const; - std::list > assets () const; + std::list > assets (bool ignore_unresolved = false) const; bool encrypted () const; -- 2.30.2