summaryrefslogtreecommitdiff
path: root/src/lib/film.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/film.cc')
-rw-r--r--src/lib/film.cc46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index c119f1515..510158e94 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -51,6 +51,7 @@
#include "video_decoder.h"
#include "audio_decoder.h"
#include "external_audio_decoder.h"
+#include "analyse_audio_job.h"
#include "i18n.h"
@@ -239,6 +240,15 @@ Film::video_mxf_filename () const
return video_state_identifier() + N_(".mxf");
}
+string
+Film::audio_analysis_path () const
+{
+ boost::filesystem::path p;
+ p /= "analysis";
+ p /= content_digest();
+ return file (p.string ());
+}
+
/** Add suitable Jobs to the JobManager to create a DCP for this Film */
void
Film::make_dcp ()
@@ -305,6 +315,19 @@ Film::make_dcp ()
}
}
+/** Start a job to analyse the audio of our content file */
+void
+Film::analyse_audio ()
+{
+ if (_analyse_audio_job) {
+ return;
+ }
+
+ _analyse_audio_job.reset (new AnalyseAudioJob (shared_from_this()));
+ _analyse_audio_job->Finished.connect (bind (&Film::analyse_audio_finished, this));
+ JobManager::instance()->add (_analyse_audio_job);
+}
+
/** Start a job to examine our content file */
void
Film::examine_content ()
@@ -319,6 +342,15 @@ Film::examine_content ()
}
void
+Film::analyse_audio_finished ()
+{
+ ensure_ui_thread ();
+ _analyse_audio_job.reset ();
+
+ AudioAnalysisFinished ();
+}
+
+void
Film::examine_content_finished ()
{
_examine_content_job.reset ();
@@ -872,6 +904,13 @@ Film::set_content (string c)
set_content_audio_streams (d.audio->audio_streams ());
}
+ {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ _content = c;
+ }
+
+ signal_changed (CONTENT);
+
/* Start off with the first audio and subtitle streams */
if (d.audio && !d.audio->audio_streams().empty()) {
set_content_audio_stream (d.audio->audio_streams().front());
@@ -881,13 +920,6 @@ Film::set_content (string c)
set_subtitle_stream (d.video->subtitle_streams().front());
}
- {
- boost::mutex::scoped_lock lm (_state_mutex);
- _content = c;
- }
-
- signal_changed (CONTENT);
-
examine_content ();
} catch (...) {