+2014-01-14 Carl Hetherington <cth@carlh.net>
+
+ * Try to fix subtitle problems when the video frame rate is being changed
+ from content to DCP.
+
2014-01-13 Carl Hetherington <cth@carlh.net>
* Change 4:3 and 5:3 ratios to be precise rather than 1.33:1 and 1.66:1, and
source that we may have chopped off for the DCP)
*/
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;
Time const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ;
pi->set_subtitle (_out_subtitle.image, _out_subtitle.position + container_offset);
}
+
#ifdef DCPOMATIC_DEBUG
_last_video = piece->content;
_in_subtitle.image->pixel_format (),
true
);
- _out_subtitle.from = _in_subtitle.from + piece->content->position ();
- _out_subtitle.to = _in_subtitle.to + piece->content->position ();
+
+ /* XXX: hack */
+ Time from = _in_subtitle.from;
+ Time to = _in_subtitle.to;
+ shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (piece->content);
+ if (vc) {
+ from = rint (from * vc->video_frame_rate() / _film->video_frame_rate());
+ to = rint (to * vc->video_frame_rate() / _film->video_frame_rate());
+ }
+
+ _out_subtitle.from = from * piece->content->position ();
+ _out_subtitle.to = to + piece->content->position ();
}
/** Re-emit the last frame that was emitted, using current settings for crop, ratio, scaler and subtitles.