, decoder (d)
, video_position (c->position ())
, audio_position (c->position ())
+ , repeat_to_do (0)
+ , repeat_done (0)
{}
/** Set this piece to repeat a video frame a given number of times */
continue;
}
- if (dynamic_pointer_cast<AudioDecoder> ((*i)->decoder)) {
+ shared_ptr<AudioDecoder> ad = dynamic_pointer_cast<AudioDecoder> ((*i)->decoder);
+ if (ad && ad->has_audio ()) {
audio_done_up_to = min (audio_done_up_to.get_value_or (TIME_MAX), (*i)->audio_position);
}
}
pi->set_subtitle (_out_subtitle.image, _out_subtitle.position + container_offset);
}
+
#ifdef DCPOMATIC_DEBUG
_last_video = piece->content;
_have_valid_pieces = false;
Changed (frequent);
- } else if (property == SubtitleContentProperty::SUBTITLE_OFFSET || property == SubtitleContentProperty::SUBTITLE_SCALE) {
+ } else if (
+ property == SubtitleContentProperty::SUBTITLE_X_OFFSET ||
+ property == SubtitleContentProperty::SUBTITLE_Y_OFFSET ||
+ property == SubtitleContentProperty::SUBTITLE_SCALE
+ ) {
update_subtitle ();
Changed (frequent);
dcpomatic::Rect<double> in_rect = _in_subtitle.rect;
libdcp::Size scaled_size;
- in_rect.y += sc->subtitle_offset ();
+ in_rect.x += sc->subtitle_x_offset ();
+ in_rect.y += sc->subtitle_y_offset ();
/* We will scale the subtitle up to fit _video_container_size, and also by the additional subtitle_scale */
scaled_size.width = in_rect.width * _video_container_size.width * sc->subtitle_scale ();
_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.