diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-20 14:27:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-20 14:27:00 +0100 |
| commit | f2caad0df1a451e2aff68dfd37277faa72116e12 (patch) | |
| tree | 3ebf116a6cb847dd099ad113c80b3249d99fa264 /src/lib/subtitle.cc | |
| parent | 21ce34c2cd04a2e7e133ff693b84c054182f4f91 (diff) | |
Various time-related fixes; fix daft hang on decodes.
Diffstat (limited to 'src/lib/subtitle.cc')
| -rw-r--r-- | src/lib/subtitle.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc index 5c1ad9706..eafccd9b5 100644 --- a/src/lib/subtitle.cc +++ b/src/lib/subtitle.cc @@ -1,3 +1,5 @@ +/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */ + /* Copyright (C) 2012 Carl Hetherington <cth@carlh.net> @@ -45,8 +47,8 @@ TimedSubtitle::TimedSubtitle (AVSubtitle const & sub) double const packet_time = static_cast<double> (sub.pts) / AV_TIME_BASE; /* hence start time for this sub */ - _from = packet_time + (double (sub.start_display_time) / 1e3); - _to = packet_time + (double (sub.end_display_time) / 1e3); + _from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ; + _to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ; if (sub.num_rects > 1) { throw DecodeError (_("multi-part subtitles not yet supported")); @@ -80,9 +82,9 @@ TimedSubtitle::TimedSubtitle (AVSubtitle const & sub) _subtitle.reset (new Subtitle (Position (rect->x, rect->y), image)); } -/** @param t Time in seconds from the start of the source */ +/** @param t Time from the start of the source */ bool -TimedSubtitle::displayed_at (double t) const +TimedSubtitle::displayed_at (Time t) const { return t >= _from && t <= _to; } |
