diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-11-21 16:57:15 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-04-19 23:04:32 +0100 |
| commit | de2af791bdfdcd653752cba970e59efc7bf810c7 (patch) | |
| tree | 1aa5dbc35daee0babd0def347944a6bea4154deb /src/lib/analyse_audio_job.cc | |
| parent | 06152300e69e8faca44ff8d7f12a6fd354848b9a (diff) | |
Basic grunt-work, untested and unfinished, but it compiles.
Diffstat (limited to 'src/lib/analyse_audio_job.cc')
| -rw-r--r-- | src/lib/analyse_audio_job.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 4274cc350..1378b66a4 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -102,6 +102,7 @@ AnalyseAudioJob::run () player->set_ignore_video (); player->set_fast (); player->set_play_referenced (); + player->Audio.connect (bind (&AnalyseAudioJob::analyse, this, _1, _2)); DCPTime const start = _playlist->start().get_value_or (DCPTime ()); DCPTime const length = _playlist->length (); @@ -122,17 +123,7 @@ AnalyseAudioJob::run () if (has_any_audio) { _done = 0; - DCPTime const block = DCPTime::from_seconds (1.0 / 8); - 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())); - } + while (!player->pass ()) {} } vector<AudioAnalysis::PeakTime> sample_peak; @@ -172,8 +163,14 @@ AnalyseAudioJob::run () } void -AnalyseAudioJob::analyse (shared_ptr<const AudioBuffers> b) +AnalyseAudioJob::analyse (shared_ptr<const AudioBuffers> b, DCPTime time) { +#ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG + if (Config::instance()->analyse_ebur128 ()) { + _ebur128->process (b); + } +#endif + int const frames = b->frames (); int const channels = b->channels (); @@ -204,4 +201,8 @@ AnalyseAudioJob::analyse (shared_ptr<const AudioBuffers> b) } _done += frames; + + DCPTime const start = _playlist->start().get_value_or (DCPTime ()); + DCPTime const length = _playlist->length (); + set_progress ((time.seconds() - start.seconds()) / (length.seconds() - start.seconds())); } |
