Fix build.
[dcpomatic.git] / src / lib / analyse_audio_job.cc
index 2848c1ed773c16dfe5b6acbf0b3c0f6b61f65aac..fc0abe0a3b5914fa953d1c06247e1f60d20759da 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "audio_analysis.h"
+#include "audio_buffers.h"
 #include "analyse_audio_job.h"
 #include "compose.hpp"
 #include "film.h"
@@ -45,12 +46,13 @@ AnalyseAudioJob::AnalyseAudioJob (shared_ptr<const Film> f, shared_ptr<AudioCont
 string
 AnalyseAudioJob::name () const
 {
-       shared_ptr<AudioContent> content = _content.lock ();
-       if (!content) {
-               return "";
-       }
-       
-       return String::compose (_("Analyse audio of %1"), content->file().filename());
+       return _("Analyse audio");
+}
+
+string
+AnalyseAudioJob::json_name () const
+{
+       return N_("analyse_audio");
 }
 
 void
@@ -68,14 +70,15 @@ AnalyseAudioJob::run ()
        
        player->Audio.connect (bind (&AnalyseAudioJob::audio, this, _1, _2));
 
-       _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length()) / _num_points);
+       int64_t const len = _film->length().frames (_film->audio_frame_rate());
+       _samples_per_point = max (int64_t (1), len / _num_points);
 
-       _current.resize (_film->dcp_audio_channels ());
-       _analysis.reset (new AudioAnalysis (_film->dcp_audio_channels ()));
+       _current.resize (_film->audio_channels ());
+       _analysis.reset (new AudioAnalysis (_film->audio_channels ()));
 
        _done = 0;
        while (!player->pass ()) {
-               set_progress (double (_film->audio_frames_to_time (_done)) / _film->length ());
+               set_progress (double (_done) / len);
        }
 
        _analysis->write (content->audio_analysis_path ());
@@ -85,7 +88,7 @@ AnalyseAudioJob::run ()
 }
 
 void
-AnalyseAudioJob::audio (shared_ptr<const AudioBuffers> b, Time)
+AnalyseAudioJob::audio (shared_ptr<const AudioBuffers> b, DCPTime)
 {
        for (int i = 0; i < b->frames(); ++i) {
                for (int j = 0; j < b->channels(); ++j) {