diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-26 22:02:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-26 22:02:00 +0100 |
| commit | c8ff422a42eac30517a7acde57ab84e55449f4e4 (patch) | |
| tree | 6715a334126cca5558fb6158f0e9082cdb0afb5b /src/lib/content_subtitle.h | |
| parent | addd3f846ed924710d7a416eedcda87653b75968 (diff) | |
Fix missing subtitles in some cases.
We were passing subtitles back from decoders to SubtitleDecoder
using dcp::SubtitleStrings and relying on their storage of time
to know when the subtitles were. These times are quantised (by
the use of dcp::SubtitleString) and then compared with unquantised
times (kept as ContentTime) in the main checking loop in
SubtitleDecoder::get().
Fix this by storing periods as ContentTimePeriod as well as
in the dcp::SubtitleStrings.
Diffstat (limited to 'src/lib/content_subtitle.h')
| -rw-r--r-- | src/lib/content_subtitle.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/lib/content_subtitle.h b/src/lib/content_subtitle.h index ef904a980..3c0ce523e 100644 --- a/src/lib/content_subtitle.h +++ b/src/lib/content_subtitle.h @@ -31,37 +31,42 @@ class Image; class ContentSubtitle { public: - virtual ContentTimePeriod period () const = 0; + ContentSubtitle (ContentTimePeriod p) + : _period (p) + {} + + ContentTimePeriod period () const { + return _period; + } + +private: + ContentTimePeriod _period; }; class ContentImageSubtitle : public ContentSubtitle { public: ContentImageSubtitle (ContentTimePeriod p, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r) - : sub (im, r) - , _period (p) + : ContentSubtitle (p) + , sub (im, r) {} - ContentTimePeriod period () const { - return _period; - } - /* Our subtitle, with its rectangle unmodified by any offsets or scales that the content specifies */ ImageSubtitle sub; - -private: - ContentTimePeriod _period; }; +/** A text subtitle. We store the time period separately (as well as in the dcp::SubtitleStrings) + * as the dcp::SubtitleString timings are sometimes quite heavily quantised and this causes problems + * when we want to compare the quantised periods to the unquantised ones. + */ class ContentTextSubtitle : public ContentSubtitle { public: - ContentTextSubtitle (std::list<dcp::SubtitleString> s) - : subs (s) + ContentTextSubtitle (ContentTimePeriod p, std::list<dcp::SubtitleString> s) + : ContentSubtitle (p) + , subs (s) {} - ContentTimePeriod period () const; - std::list<dcp::SubtitleString> subs; }; |
