}
}
- auto piece = make_shared<Piece>(_film, i, decoder, frc, _fast);
+ vector<Piece::Pair> content = {
+ Piece::Pair(i, decoder)
+ };
+
+ auto piece = make_shared<Piece>(_film, content, frc, _fast);
_pieces.push_back (piece);
if (i->video) {
return;
}
- if (!piece->use_video()) {
- return;
- }
-
- auto frc = piece->frame_rate_change();
- if (frc.skip && (video.frame % 2) == 1) {
- return;
- }
-
LOG_DEBUG_PLAYER("Received video frame %1 at %2", video.frame, to_string(video.time));
/* Discard if it's before the content's period or the last accurate seek. We can't discard
return;
}
- if (piece->ignore_video_at(video.time)) {
- return;
- }
-
/* Fill gaps that we discover now that we have some video which needs to be emitted.
This is where we need to fill to.
*/
_last_video[wp] = piece->player_video (video, _video_container_size);
DCPTime t = video.time;
+ auto const frc = piece->frame_rate_change();
for (int i = 0; i < frc.repeat; ++i) {
if (t < piece->end()) {
emit_video (_last_video[wp], t);
return;
}
- int const rfr = piece->resampled_audio_frame_rate ();
+ LOG_DEBUG_PLAYER("Received audio at %1", to_string(audio.time));
- /* Compute time in the DCP */
- auto time = piece->resampled_audio_to_dcp (audio.frame);
- LOG_DEBUG_PLAYER("Received audio frame %1 at %2", audio.frame, to_string(time));
+ /* The end of this block in the DCP */
+ int const rfr = piece->resampled_audio_frame_rate ();
+ auto end = audio.time + DCPTime::from_frames(audio.audio->frames(), rfr);
- /* And the end of this block in the DCP */
- auto end = time + DCPTime::from_frames(audio.audio->frames(), rfr);
+ /* XXX: is this still necessary? don't the checks in Piece take care of this now?
+ * Maybe replace with some assertions & run tests.
+ */
/* Remove anything that comes before the start or after the end of the content */
- if (time < piece->position()) {
- auto cut = discard_audio (audio.audio, time, piece->position());
+ if (audio.time < piece->position()) {
+ auto cut = discard_audio (audio.audio, audio.time, piece->position());
if (!cut.first) {
/* This audio is entirely discarded */
return;
}
audio.audio = cut.first;
- time = cut.second;
- } else if (time > piece->end()) {
+ audio.time = cut.second;
+ } else if (audio.time > piece->end()) {
/* Discard it all */
return;
} else if (end > piece->end()) {
- Frame const remaining_frames = DCPTime(piece->end() - time).frames_round(rfr);
+ Frame const remaining_frames = DCPTime(piece->end() - audio.time).frames_round(rfr);
if (remaining_frames == 0) {
return;
}
/* Remap */
- audio.audio = remap (audio.audio, _film->audio_channels(), audio.stream->mapping());
+ audio.audio = remap (audio.audio, _film->audio_channels(), audio.mapping);
/* Process */
if (_audio_processor) {
- audio.audio = _audio_processor->run (audio.audio, _film->audio_channels ());
+ audio.audio = _audio_processor->run (audio.audio, _film->audio_channels());
}
/* Push */
- _audio_merger.push (audio.audio, time);
- piece->set_last_push_end (audio.stream, time + DCPTime::from_frames(audio.audio->frames(), _film->audio_frame_rate()));
+ _audio_merger.push (audio.audio, audio.time);
+ piece->set_last_push_end (audio.stream, audio.time + DCPTime::from_frames(audio.audio->frames(), _film->audio_frame_rate()));
}