From 6a77d4a19541446008ab4c457d0fbeb256712d39 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 28 Mar 2022 00:23:16 +0200 Subject: WIP: hacks to allow joining of files which don't all have subtitle streams. --- src/lib/text_content.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib/text_content.cc') diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index 87bb2db46..e65469541 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -258,15 +258,18 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version, TextContent::TextContent (Content* parent, vector> content) : ContentPart (parent) { - /* This constructor is for join which is only supported for content types - that have a single text, so we can use only_text() here. - */ - auto ref = content[0]->only_text(); + auto ref_iter = std::find_if(content.begin(), content.end(), [](shared_ptr c) { return !c->text.empty(); }); + DCPOMATIC_ASSERT (ref_iter != content.end()); + auto ref = (*ref_iter)->only_text(); DCPOMATIC_ASSERT (ref); auto ref_fonts = ref->fonts (); for (size_t i = 1; i < content.size(); ++i) { + if (content[i]->text.empty()) { + continue; + } + if (content[i]->only_text()->use() != ref->use()) { throw JoinError (_("Content to be joined must have the same 'use subtitles' setting.")); } -- cgit v1.2.3