summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-21 23:18:22 +0100
committerCarl Hetherington <cth@carlh.net>2023-02-18 00:41:34 +0100
commit03cf7a7cbf1c2b38351eb0fbce5bb6e24dda04f0 (patch)
treef75aba5862a6153071019a87f1a94a84ef83bfdf /src
parent428c49073bd647aa2091552c3c6e0d7a218f169a (diff)
Show possible subtitle bounding boxes due to SMPTE standard misunderstandings.
Diffstat (limited to 'src')
-rw-r--r--src/lib/analyse_subtitles_job.cc36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/lib/analyse_subtitles_job.cc b/src/lib/analyse_subtitles_job.cc
index f140f13d1..b41b65c3b 100644
--- a/src/lib/analyse_subtitles_job.cc
+++ b/src/lib/analyse_subtitles_job.cc
@@ -112,15 +112,33 @@ AnalyseSubtitlesJob::analyse(PlayerText const& text, TextType type)
/* We can provide dummy values for time and frame rate here as they are only used to calculate fades */
dcp::Size const frame = _film->frame_size();
- for (auto i: bounding_box(text.string, frame)) {
- dcpomatic::Rect<double> rect (
- double(i.x) / frame.width, double(i.y) / frame.height,
- double(i.width) / frame.width, double(i.height) / frame.height
- );
- if (!_bounding_box) {
- _bounding_box = rect;
- } else {
- _bounding_box->extend (rect);
+ std::vector<dcp::SubtitleStandard> override_standard;
+ if (_film->interop()) {
+ /* Since the film is Interop there is only one way the vpositions in the subs can be interpreted
+ * (we assume).
+ */
+ override_standard.push_back(dcp::SubtitleStandard::INTEROP);
+ } else {
+ /* We're using the great new SMPTE standard, which means there are two different ways that vposition
+ * could be interpreted; we will write SMPTE-2014 standard assets, but if the projection system uses
+ * SMPTE 20{07,10} instead they won't be placed how we intended. To show the user this, make the
+ * bounding rectangle enclose both possibilities.
+ */
+ override_standard.push_back(dcp::SubtitleStandard::SMPTE_2007);
+ override_standard.push_back(dcp::SubtitleStandard::SMPTE_2014);
+ }
+
+ for (auto standard: override_standard) {
+ for (auto i: bounding_box(text.string, frame, standard)) {
+ dcpomatic::Rect<double> rect (
+ double(i.x) / frame.width, double(i.y) / frame.height,
+ double(i.width) / frame.width, double(i.height) / frame.height
+ );
+ if (!_bounding_box) {
+ _bounding_box = rect;
+ } else {
+ _bounding_box->extend (rect);
+ }
}
}
}