shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)),
time,
Crop (),
- optional<float> (),
+ optional<double> (),
_video_container_size,
_video_container_size,
EYES_BOTH,
setup_pieces ();
}
- Frame const length_frames = length.frames (_film->audio_frame_rate ());
+ Frame const length_frames = length.frames_round (_film->audio_frame_rate ());
shared_ptr<AudioBuffers> audio (new AudioBuffers (_film->audio_channels(), length_frames));
audio->make_silent ();
the stuff we get back.
*/
offset = -request;
- request_frames += request.frames (_film->audio_frame_rate ());
+ request_frames += request.frames_round (_film->audio_frame_rate ());
if (request_frames < 0) {
request_frames = 0;
}
audio->accumulate_frames (
all.audio.get(),
content_frame - all.frame,
- offset.frames (_film->audio_frame_rate()),
+ offset.frames_round (_film->audio_frame_rate()),
min (Frame (all.audio->frames()), request_frames)
);
}
shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (piece->content);
DCPTime s = t - piece->content->position ();
s = min (piece->content->length_after_trim(), s);
- return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start ()).frames (vc->video_frame_rate ());
+ /* We're returning a frame index here so we need to floor() the conversion since we want to know the frame
+ that contains t, I think
+ */
+ return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start ()).frames_floor (vc->video_frame_rate ());
}
DCPTime
Frame
Player::dcp_to_resampled_audio (shared_ptr<const Piece> piece, DCPTime t) const
{
- DCPTime s = t - piece->content->position () + DCPTime (piece->content->trim_start (), piece->frc);
- s = max (DCPTime (), min (piece->content->length_after_trim(), s));
- return s.frames (_film->audio_frame_rate ());
+ DCPTime s = t - piece->content->position ();
+ s = min (piece->content->length_after_trim(), s);
+ /* See notes in dcp_to_content_video */
+ return max (DCPTime (), DCPTime (piece->content->trim_start (), piece->frc) + s).frames_floor (_film->audio_frame_rate ());
}
ContentTime