- for (DCPTime t; t < _film->length(); t += block) {
- analyse (player->get_audio (t, block, false));
- set_progress (t.seconds() / _film->length().seconds());
+ for (DCPTime t = start; t < length; t += block) {
+ shared_ptr<const AudioBuffers> audio = player->get_audio (t, block, false);
+#ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
+ if (Config::instance()->analyse_ebur128 ()) {
+ _ebur128->process (audio);
+ }
+#endif
+ analyse (audio);
+ set_progress ((t.seconds() - start.seconds()) / (length.seconds() - start.seconds()));
+ }
+ }
+
+ _analysis->set_sample_peak (_sample_peak, DCPTime::from_frames (_sample_peak_frame, _film->audio_frame_rate ()));
+
+#ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
+ if (Config::instance()->analyse_ebur128 ()) {
+ void* eb = _ebur128->get("Parsed_ebur128_0")->priv;
+ double true_peak = 0;
+ for (int i = 0; i < _film->audio_channels(); ++i) {
+ true_peak = max (true_peak, av_ebur128_get_true_peaks(eb)[i]);