diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-09-17 14:00:21 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-09-17 23:07:19 +0200 |
| commit | 40f6f7d9e8fe6107dff0e5e355b577a2b289e3fa (patch) | |
| tree | 8108765ff8583349c1dd28d97bb9a142d97922f9 | |
| parent | c19f63dd173e5497070b26528dbac240d5595583 (diff) | |
Prevent DCP::assets() from returning duplicates.combine
| -rw-r--r-- | src/dcp.cc | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -507,12 +507,23 @@ DCP::assets (bool ignore_unresolved) const if (ignore_unresolved && !j->asset_ref().resolved()) { continue; } - shared_ptr<Asset> o = j->asset_ref().asset (); - assets.push_back (o); - /* More Interop special-casing */ - shared_ptr<InteropSubtitleAsset> sub = dynamic_pointer_cast<InteropSubtitleAsset> (o); - if (sub) { - sub->add_font_assets (assets); + + string const id = j->asset_ref().id(); + bool already_got = false; + BOOST_FOREACH (shared_ptr<Asset> k, assets) { + if (k->id() == id) { + already_got = true; + } + } + + if (!already_got) { + shared_ptr<Asset> o = j->asset_ref().asset(); + assets.push_back (o); + /* More Interop special-casing */ + shared_ptr<InteropSubtitleAsset> sub = dynamic_pointer_cast<InteropSubtitleAsset> (o); + if (sub) { + sub->add_font_assets (assets); + } } } } |
