diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-05-11 13:47:35 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-05-12 22:11:06 +0200 |
| commit | 2f0b79afd2110617fe694745a65b2350a448bd77 (patch) | |
| tree | f4b769af762b8f7ac548c229c5927015da628540 | |
| parent | 4f81cdeb7802d2087244590a801ecc1a64eff0aa (diff) | |
Fix _text_count for ccaps when there are multiple reels.
Previously we would get a _text_count of 1 for open subs, no matter
how many reels there were, but for ccaps the _text_count would
increase with the number of tracks _and_ the number of reels.
| -rw-r--r-- | src/lib/dcp_examiner.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 536c9ec1a..6586e6e81 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -208,6 +208,18 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant) } } + _text_count[TextType::CLOSED_CAPTION] = std::max(_text_count[TextType::CLOSED_CAPTION], static_cast<int>(reel->closed_captions().size())); + if (_dcp_text_tracks.size() < reel->closed_captions().size()) { + /* We only want to add 1 DCPTextTrack to _dcp_text_tracks per closed caption. I guess it's possible that different + * reels have different numbers of tracks (though I don't think they should) so make sure that _dcp_text_tracks ends + * up with the maximum. + */ + _dcp_text_tracks.clear(); + for (auto ccap: reel->closed_captions()) { + _dcp_text_tracks.push_back(DCPTextTrack(ccap->annotation_text().get_value_or(""), try_to_parse_language(ccap->language()))); + } + } + for (auto ccap: reel->closed_captions()) { if (!ccap->asset_ref().resolved()) { /* We are missing this asset so we can't continue; examination will be repeated later */ @@ -218,8 +230,6 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant) LOG_GENERAL("Closed caption %1 of reel %2 found", ccap->id(), reel->id()); - _text_count[TextType::CLOSED_CAPTION]++; - _dcp_text_tracks.push_back(DCPTextTrack(ccap->annotation_text().get_value_or(""), try_to_parse_language(ccap->language()))); } if (reel->main_markers ()) { |
