summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-08-19 23:35:37 +0200
committerCarl Hetherington <cth@carlh.net>2025-08-25 11:46:54 +0200
commitfd0aeb0a2cfee9e5d313740b860208a50ec1eab6 (patch)
tree2226e858a4655278a1a7a7f9dff9383954c65a64 /src
parentd12b5fbca1b961124577ed394d70e1a0149d4633 (diff)
Don't write subtitles to combined Interop DCPs twice (#3079).
Diffstat (limited to 'src')
-rw-r--r--src/combine.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/combine.cc b/src/combine.cc
index 7d5c51fb..275b1d9b 100644
--- a/src/combine.cc
+++ b/src/combine.cc
@@ -126,6 +126,7 @@ dcp::combine(
vector<boost::filesystem::path> paths;
vector<shared_ptr<dcp::Asset>> assets;
+ set<string> already_written;
for (auto i: inputs) {
DCP dcp(i);
@@ -150,10 +151,11 @@ dcp::combine(
for (auto const& k: fonts) {
sub->set_font_file(k.first, make_unique(output / k.second.filename()));
}
- auto file = sub->file();
+ auto const file = sub->file();
DCP_ASSERT(file);
- auto new_path = make_unique(output / file->filename());
+ auto const new_path = make_unique(output / file->filename());
sub->write(new_path);
+ already_written.insert(sub->id());
add_to_container(assets, sub->font_assets());
}
@@ -165,11 +167,13 @@ dcp::combine(
for (auto i: output_dcp.assets()) {
if (!dynamic_pointer_cast<dcp::FontAsset>(i) && !dynamic_pointer_cast<dcp::CPL>(i)) {
- auto file = i->file();
- DCP_ASSERT(file);
- auto new_path = make_unique(output / file->filename());
- create_hard_link_or_copy(*file, new_path);
- i->set_file(new_path);
+ if (already_written.find(i->id()) == already_written.end()) {
+ auto file = i->file();
+ DCP_ASSERT(file);
+ auto new_path = make_unique(output / file->filename());
+ create_hard_link_or_copy(*file, new_path);
+ i->set_file(new_path);
+ }
}
}