projects
/
libdcp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2c4dcc7
)
Replace slightly weird add_font_assets() API.
author
Carl Hetherington
<cth@carlh.net>
Fri, 14 Apr 2023 14:05:59 +0000
(16:05 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 14 Apr 2023 14:05:59 +0000
(16:05 +0200)
src/combine.cc
patch
|
blob
|
history
src/dcp.cc
patch
|
blob
|
history
src/interop_subtitle_asset.cc
patch
|
blob
|
history
src/interop_subtitle_asset.h
patch
|
blob
|
history
src/util.h
patch
|
blob
|
history
diff --git
a/src/combine.cc
b/src/combine.cc
index 86762dda3e518c29fa38cdf596e034610a15d384..b728298ad2f3ba2c9f45cb587a6b2fc8f84b83bc 100644
(file)
--- a/
src/combine.cc
+++ b/
src/combine.cc
@@
-155,7
+155,7
@@
dcp::combine (
DCP_ASSERT (file);
path new_path = make_unique(output / file->filename());
sub->write (new_path);
DCP_ASSERT (file);
path new_path = make_unique(output / file->filename());
sub->write (new_path);
-
sub->add_font_assets(assets
);
+
add_to_container(assets, sub->font_assets()
);
}
assets.push_back (j);
}
assets.push_back (j);
diff --git
a/src/dcp.cc
b/src/dcp.cc
index a73ebbf59461fa0ab45a625db83f5a20e3aa9e9f..2c327b745f4486c9330c37f361e5379fb1f10f0d 100644
(file)
--- a/
src/dcp.cc
+++ b/
src/dcp.cc
@@
-497,7
+497,7
@@
DCP::assets (bool ignore_unresolved) const
/* More Interop special-casing */
auto sub = dynamic_pointer_cast<InteropSubtitleAsset>(o);
if (sub) {
/* More Interop special-casing */
auto sub = dynamic_pointer_cast<InteropSubtitleAsset>(o);
if (sub) {
-
sub->add_font_assets (assets
);
+
add_to_container(assets, sub->font_assets()
);
}
}
}
}
}
}
diff --git
a/src/interop_subtitle_asset.cc
b/src/interop_subtitle_asset.cc
index 4bf3958f44359893e08e3e7aad4a7606564db9c0..8fb115a73ee8a6eef4a6294dc3409f511ff45a57 100644
(file)
--- a/
src/interop_subtitle_asset.cc
+++ b/
src/interop_subtitle_asset.cc
@@
-253,23
+253,27
@@
InteropSubtitleAsset::resolve_fonts (vector<shared_ptr<Asset>> assets)
}
}
-v
oid
-InteropSubtitleAsset::
add_font_assets (vector<shared_ptr<Asset>>& assets
)
+v
ector<shared_ptr<Asset>>
+InteropSubtitleAsset::
font_assets(
)
{
{
+ vector<shared_ptr<Asset>> assets;
for (auto const& i: _fonts) {
DCP_ASSERT (i.file);
for (auto const& i: _fonts) {
DCP_ASSERT (i.file);
- assets.push_back
(make_shared<FontAsset>(i.uuid, i.file.get()));
+ assets.push_back(make_shared<FontAsset>(i.uuid, i.file.get()));
}
}
+ return assets;
}
}
-v
oid
-InteropSubtitleAsset::
add_font_assets(vector<shared_ptr<const Asset>>& assets)
+v
ector<shared_ptr<const Asset>>
+InteropSubtitleAsset::
font_assets() const
{
{
+ vector<shared_ptr<const Asset>> assets;
for (auto const& i: _fonts) {
DCP_ASSERT (i.file);
for (auto const& i: _fonts) {
DCP_ASSERT (i.file);
- assets.push_back
(make_shared<
FontAsset>(i.uuid, i.file.get()));
+ assets.push_back
(make_shared<const
FontAsset>(i.uuid, i.file.get()));
}
}
+ return assets;
}
}
diff --git
a/src/interop_subtitle_asset.h
b/src/interop_subtitle_asset.h
index 72d862ad9587f8944cf602ab7491cacaf8bd91fe..3005c8fc1249cb7fc6e16b8902dda55d3638af9d 100644
(file)
--- a/
src/interop_subtitle_asset.h
+++ b/
src/interop_subtitle_asset.h
@@
-82,9
+82,9
@@
public:
void write (boost::filesystem::path path) const override;
void resolve_fonts (std::vector<std::shared_ptr<Asset>> assets);
void write (boost::filesystem::path path) const override;
void resolve_fonts (std::vector<std::shared_ptr<Asset>> assets);
- void add_font_assets (std::vector<std::shared_ptr<Asset>>& assets);
- void add_font_assets(std::vector<std::shared_ptr<const Asset>>& assets);
void set_font_file (std::string load_id, boost::filesystem::path file);
void set_font_file (std::string load_id, boost::filesystem::path file);
+ std::vector<std::shared_ptr<Asset>> font_assets();
+ std::vector<std::shared_ptr<const Asset>> font_assets() const;
/** @return the <LoadFont> IDs of fonts for which we have not (yet) found a font asset.
* This could be because resolve_fonts() has not yet been called, or because there is
/** @return the <LoadFont> IDs of fonts for which we have not (yet) found a font asset.
* This could be because resolve_fonts() has not yet been called, or because there is
diff --git
a/src/util.h
b/src/util.h
index 8261a8125165900760ed95eef107ef86f43b773a..8338e7cc170d25e0994bb50871a775a4f410f5ea 100644
(file)
--- a/
src/util.h
+++ b/
src/util.h
@@
-155,6
+155,14
@@
private:
};
};
+template <class From, class To>
+void
+add_to_container(To& container, From source)
+{
+ std::copy(source.begin(), source.end(), std::back_inserter(container));
+}
+
+
}
}