int64_t const reel_duration = k->main_picture()->duration();
/* See doc/design/trim_reels.svg */
- Frame const reel_trim_start = min(reel_duration, max(0L, trim_start - offset_from_start));
- Frame const reel_trim_end = min(reel_duration, max(0L, reel_duration - (offset_from_end - trim_end)));
+ Frame const reel_trim_start = min(reel_duration, max(int64_t(0), trim_start - offset_from_start));
+ Frame const reel_trim_end = min(reel_duration, max(int64_t(0), reel_duration - (offset_from_end - trim_end)));
DCPTime const from = i->position() + DCPTime::from_frames (offset_from_start, _film->video_frame_rate());
if (j->reference_video ()) {
switch (which) {
case CONTENT:
+ {
earliest_content->done = earliest_content->decoder->pass ();
+ shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(earliest_content->content);
+ if (dcp && !_play_referenced && dcp->reference_audio()) {
+ /* We are skipping some referenced DCP audio content, so we need to update _last_audio_time
+ to `hide' the fact that no audio was emitted during the referenced DCP (though
+ we need to behave as though it was).
+ */
+ _last_audio_time = dcp->end (_film);
+ }
break;
+ }
case BLACK:
emit_video (black_player_video_frame(EYES_BOTH), _black.position());
_black.set_position (_black.position() + one_video_frame());
if (_last_audio_time) {
/* Sometimes the thing that happened last finishes fractionally before
or after this silence. Bodge the start time of the silence to fix it.
+ I think this is nothing to worry about since we will just add or
+ remove a little silence at the end of some content.
*/
- DCPOMATIC_ASSERT (labs(period.from.get() - _last_audio_time->get()) < 2);
+ int64_t const error = labs(period.from.get() - _last_audio_time->get());
+ int64_t const too_much_error = 4;
+ if (error >= too_much_error) {
+ _film->log()->log(String::compose("Silence starting before or after last audio by %1", error), LogEntry::TYPE_ERROR);
+ }
+ DCPOMATIC_ASSERT (error < too_much_error);
period.from = *_last_audio_time;
}
if (period.duration() > one_video_frame()) {