Allow assets() to silently ignore unresolved assets.
authorCarl Hetherington <cth@carlh.net>
Sat, 8 Jul 2017 22:23:25 +0000 (00:23 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 8 Jul 2017 22:23:25 +0000 (00:23 +0200)
src/dcp.cc
src/dcp.h

index b089eee1cf5da29820ac27dc6569ba06ea6496e4..c0fe70f64ad4d0a99d2503c9f03d7b12a40edca2 100644 (file)
@@ -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 */
index b8651db80e02eb4f92dccdce68b52922109a0dca..811f62f636dd459402c4c4d441cea0e4d0c45737 100644 (file)
--- 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;