return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start());
}
+DCPTime
+Player::content_subtitle_to_dcp (shared_ptr<const Piece> piece, ContentTime t) const
+{
+ return max (DCPTime (), DCPTime (t - piece->content->trim_start(), piece->frc) + piece->content->position());
+}
+
/** @param burnt true to return only subtitles to be burnt, false to return only
* subtitles that should not be burnt. This parameter will be ignored if
* _always_burn_subtitles is true; in this case, all subtitles will be returned.
list<ContentTextSubtitle> text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting);
BOOST_FOREACH (ContentTextSubtitle& ts, text) {
- BOOST_FOREACH (dcp::SubtitleString& s, ts.subs) {
+ BOOST_FOREACH (dcp::SubtitleString s, ts.subs) {
s.set_h_position (s.h_position() + subtitle_content->subtitle_x_offset ());
s.set_v_position (s.v_position() + subtitle_content->subtitle_y_offset ());
float const xs = subtitle_content->subtitle_x_scale();
if (fabs (1.0 - xs / ys) > dcp::ASPECT_ADJUST_EPSILON) {
s.set_aspect_adjust (xs / ys);
}
+ s.set_in (dcp::Time(content_subtitle_to_dcp (*j, ts.period().from).seconds()));
+ s.set_out (dcp::Time(content_subtitle_to_dcp (*j, ts.period().to).seconds()));
ps.text.push_back (s);
ps.add_fonts (subtitle_content->fonts ());
}
DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const;
Frame dcp_to_resampled_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const;
ContentTime dcp_to_content_subtitle (boost::shared_ptr<const Piece> piece, DCPTime t) const;
+ DCPTime content_subtitle_to_dcp (boost::shared_ptr<const Piece> piece, ContentTime t) const;
boost::shared_ptr<PlayerVideo> black_player_video_frame (DCPTime) const;
/** @return Pieces of content type C that overlap a specified time range in the DCP */