Fix mis-timed subtitles with non-zero video PTS offsets.
authorCarl Hetherington <cth@carlh.net>
Mon, 6 Jan 2014 11:44:07 +0000 (11:44 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 6 Jan 2014 11:44:07 +0000 (11:44 +0000)
ChangeLog
src/lib/ffmpeg_decoder.cc

index 212847438e9a4ec2a823330547126a2a88d2162b..1e5c1a6ef4e63ff0fb27cef24cedade52b1010fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-01-06  Carl Hetherington  <cth@carlh.net>
 
+       * Fix mis-timed subtitles when there is a non-zero video PTS offset.
+
        * Remove seemingly unnecessary checks on image directories.
 
        * Leave DCP directory creation until the last minute to help
index 5a1b78762d92e6e30d55108dfae637f8b348e676..1546031b880b56ffb2af25adcff9258f40b13f09 100644 (file)
@@ -559,7 +559,7 @@ FFmpegDecoder::decode_subtitle_packet ()
        /* Subtitle PTS in seconds (within the source, not taking into account any of the
           source that we may have chopped off for the DCP)
        */
-       double const packet_time = static_cast<double> (sub.pts) / AV_TIME_BASE;
+       double const packet_time = (static_cast<double> (sub.pts ) / AV_TIME_BASE) + _video_pts_offset;
        
        /* hence start time for this sub */
        Time const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ;