property == ContentProperty::TRIM_END ||
property == ContentProperty::PATH ||
property == VideoContentProperty::FRAME_TYPE ||
+ property == VideoContentProperty::COLOUR_CONVERSION ||
+ property == AudioContentProperty::STREAMS ||
property == DCPContentProperty::NEEDS_ASSETS ||
property == DCPContentProperty::NEEDS_KDM ||
property == SubtitleContentProperty::COLOUR ||
property == SubtitleContentProperty::EFFECT ||
property == SubtitleContentProperty::EFFECT_COLOUR ||
property == FFmpegContentProperty::SUBTITLE_STREAM ||
- property == FFmpegContentProperty::FILTERS ||
- property == VideoContentProperty::COLOUR_CONVERSION
+ property == FFmpegContentProperty::FILTERS
) {
_have_valid_pieces = false;
/* We will scale the subtitle up to fit _video_container_size */
dcp::Size scaled_size (i->rectangle.width * _video_container_size.width, i->rectangle.height * _video_container_size.height);
- /* Then we need a corrective translation, consisting of two parts:
- *
- * 1. that which is the result of the scaling of the subtitle by _video_container_size; this will be
- * rect.x * _video_container_size.width and rect.y * _video_container_size.height.
- *
- * 2. that to shift the origin of the scale by subtitle_scale to the centre of the subtitle; this will be
- * (width_before_subtitle_scale * (1 - subtitle_x_scale) / 2) and
- * (height_before_subtitle_scale * (1 - subtitle_y_scale) / 2).
- *
- * Combining these two translations gives these expressions.
- */
-
all.push_back (
PositionImage (
i->image->scale (
continue;
}
- DCPTime const t = content_time_to_dcp (i, i->decoder->position());
+ DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start()));
if (t > i->content->end()) {
i->done = true;
} else {
PlayerSubtitles ps;
DCPTime const from (content_time_to_dcp (piece, subtitle.from()));
+ if (from > piece->content->end()) {
+ return;
+ }
+
BOOST_FOREACH (dcp::SubtitleString s, subtitle.subs) {
s.set_h_position (s.h_position() + piece->content->subtitle->x_offset ());
s.set_v_position (s.v_position() + piece->content->subtitle->y_offset ());
DCPTime const dcp_to = content_time_to_dcp (piece, to);
+ if (dcp_to > piece->content->end()) {
+ return;
+ }
+
pair<PlayerSubtitles, DCPTime> from = _active_subtitles.add_to (wp, dcp_to);
if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) {
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
if (time < i->content->position()) {
- /* Before; seek to 0 */
- i->decoder->seek (ContentTime(), accurate);
+ /* Before; seek to the start of the content */
+ i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate);
i->done = false;
} else if (i->content->position() <= time && time < i->content->end()) {
/* During; seek to position */
_have_valid_pieces = false;
Changed (PlayerProperty::DCP_DECODE_REDUCTION, false);
}
+
+DCPTime
+Player::content_time_to_dcp (shared_ptr<Content> content, ContentTime t)
+{
+ if (_have_valid_pieces) {
+ setup_pieces ();
+ }
+
+ BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
+ if (i->content == content) {
+ return content_time_to_dcp (i, t);
+ }
+ }
+
+ DCPOMATIC_ASSERT (false);
+ return DCPTime ();
+}