diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-06-20 17:34:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-06-20 21:20:38 +0100 |
| commit | 50cb31af16240b248700dab1484d7f07656c66df (patch) | |
| tree | 393568f3c24506ac6b004346b9ef5101f9fdcf61 /src/lib/audio_content.cc | |
| parent | edfd92e5554e3389e6456f497f44ca6e866800bf (diff) | |
Various fixes to make audio analysis sort-of work.
Diffstat (limited to 'src/lib/audio_content.cc')
| -rw-r--r-- | src/lib/audio_content.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 9940574f9..e93f348f4 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -19,11 +19,14 @@ #include <libcxml/cxml.h> #include "audio_content.h" +#include "analyse_audio_job.h" +#include "job_manager.h" #include "film.h" using std::string; using boost::shared_ptr; using boost::lexical_cast; +using boost::dynamic_pointer_cast; int const AudioContentProperty::AUDIO_CHANNELS = 200; int const AudioContentProperty::AUDIO_LENGTH = 201; @@ -93,3 +96,27 @@ AudioContent::set_audio_delay (int d) signal_changed (AudioContentProperty::AUDIO_DELAY); } + +void +AudioContent::analyse_audio (boost::function<void()> finished) +{ + shared_ptr<const Film> film = _film.lock (); + if (!film) { + return; + } + + shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, dynamic_pointer_cast<AudioContent> (shared_from_this()))); + job->Finished.connect (finished); + JobManager::instance()->add (job); +} + +boost::filesystem::path +AudioContent::audio_analysis_path () const +{ + shared_ptr<const Film> film = _film.lock (); + if (!film) { + return boost::filesystem::path (); + } + + return film->audio_analysis_path (dynamic_pointer_cast<const AudioContent> (shared_from_this ())); +} |
