summaryrefslogtreecommitdiff
path: root/src/lib/dcp_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-12-01 23:20:47 +0000
committerCarl Hetherington <cth@carlh.net>2018-12-03 00:24:04 +0000
commit438aa086ba4c0be8f464ac903d23bcd0efff786b (patch)
treeeb958c8084ea258e989012c18914b19dc2f5cc4f /src/lib/dcp_decoder.cc
parent08f133789b963d860c59a654d8fa1507b5830b99 (diff)
Backport of c75484af73d38b00a4f27143f8e434b6f25bf355 from master; fix for overlaid in partially-marked-up subtitle lines.
Diffstat (limited to 'src/lib/dcp_decoder.cc')
-rw-r--r--src/lib/dcp_decoder.cc28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index 0250fa9fe..ad5beeba8 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -194,16 +194,34 @@ DCPDecoder::pass_subtitles (ContentTime next)
true
);
+ list<dcp::SubtitleString> strings;
+
BOOST_FOREACH (dcp::SubtitleString i, subs) {
- list<dcp::SubtitleString> s;
- s.push_back (i);
+ if (!strings.empty() && (strings.back().in() != i.in() || strings.back().out() != i.out())) {
+ dcp::SubtitleString b = strings.back();
+ subtitle->emit_text (
+ ContentTimePeriod (
+ ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.in().as_seconds()),
+ ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds())
+ ),
+ strings
+ );
+ strings.clear ();
+ }
+
+ strings.push_back (i);
+ }
+
+ if (!strings.empty()) {
+ dcp::SubtitleString b = strings.back();
subtitle->emit_text (
ContentTimePeriod (
- ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i.in().as_seconds ()),
- ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i.out().as_seconds ())
+ ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.in().as_seconds()),
+ ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds())
),
- s
+ strings
);
+ strings.clear ();
}
}
}