uint8_t remainder[-_delay_in_bytes];
_delay_line->get_remaining (remainder);
_audio_frames_processed += _delay_in_bytes / (_fs->audio_channels() * bytes_per_audio_sample());
- emit_audio (remainder, _delay_in_bytes);
+ emit_audio (remainder, -_delay_in_bytes);
}
/* If we cut the decode off, the audio may be short; push some silence
in to get it to the right length.
*/
- int64_t const video_length_in_audio_frames = ((int64_t) _fs->dcp_length() * _fs->target_sample_rate() / _fs->frames_per_second());
+ int64_t const video_length_in_audio_frames = ((int64_t) _fs->dcp_length() * _fs->audio_sample_rate() / _fs->frames_per_second());
int64_t const audio_short_by_frames = video_length_in_audio_frames - _audio_frames_processed;
_log->log (
_log->log (String::compose ("DCP length is %1; %2 frames of audio processed.", _fs->dcp_length(), _audio_frames_processed));
_log->log (String::compose ("Adding %1 frames of silence to the end.", audio_short_by_frames));
+ /* XXX: this is slightly questionable; does memset () give silence with all
+ sample formats?
+ */
+
int64_t bytes = audio_short_by_frames * _fs->audio_channels() * bytes_per_audio_sample();
int64_t const silence_size = 16 * 1024 * _fs->audio_channels() * bytes_per_audio_sample();
}
/* Update the number of audio frames we've pushed to the encoder */
- _audio_frames_processed += frames;
+ _audio_frames_processed += audio->frames ();
Audio (audio);
}
}
shared_ptr<Subtitle> sub;
- if (_timed_subtitle && _timed_subtitle->displayed_at (double (last_video_frame()) / rint (_fs->frames_per_second()))) {
+ if (_timed_subtitle && _timed_subtitle->displayed_at (double (last_video_frame()) / _fs->frames_per_second())) {
sub = _timed_subtitle->subtitle ();
}
{
_timed_subtitle = s;
- if (_opt->apply_crop) {
+ if (_timed_subtitle && _opt->apply_crop) {
Position const p = _timed_subtitle->subtitle()->position ();
_timed_subtitle->subtitle()->set_position (Position (p.x - _fs->crop().left, p.y - _fs->crop().top));
}