diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-24 00:57:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-24 00:57:46 +0100 |
| commit | 6d1748f37097e6f61ee1c6fb66c4352b0834ec8c (patch) | |
| tree | eadd9dc24388fff2e54a0cab07afd9a9ed27602e /src/lib/subtitle.cc | |
| parent | 2783bac450101e809c485ef249ce55a9c6d7996e (diff) | |
Try to fix up subtitle timing a bit.
Diffstat (limited to 'src/lib/subtitle.cc')
| -rw-r--r-- | src/lib/subtitle.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc index f851d5643..37c372c20 100644 --- a/src/lib/subtitle.cc +++ b/src/lib/subtitle.cc @@ -32,13 +32,14 @@ using namespace boost; /** Construct a TimedSubtitle. This is a subtitle image, position, * and a range of time over which it should be shown. * @param sub AVSubtitle to read. + * @param c Fractional seconds that should be subtracted from the AVSubtitle's PTS. */ -TimedSubtitle::TimedSubtitle (AVSubtitle const & sub) +TimedSubtitle::TimedSubtitle (AVSubtitle const & sub, double c) { assert (sub.rects > 0); /* subtitle PTS in seconds */ - float const packet_time = (sub.pts / AV_TIME_BASE) + float (sub.pts % AV_TIME_BASE) / 1e6; + double const packet_time = ((sub.pts / AV_TIME_BASE) + float (sub.pts % AV_TIME_BASE) / 1e6) - c; /* hence start time for this sub */ _from = packet_time + (double (sub.start_display_time) / 1e3); |
