summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-03-02 10:48:13 +0000
committerCarl Hetherington <cth@carlh.net>2016-03-02 10:48:13 +0000
commitca045c71b2e76f86fef1ca99d7e7703a41dfcf33 (patch)
treeb0b66f7120ae61bff858ec8e10ca1ba525d3643d
parent9894a46a5985ffd36579e8eca1984841c09fa4ec (diff)
Add configure option to disable EBUR128 analysis of audio.
-rw-r--r--ChangeLog5
-rw-r--r--src/lib/analyse_audio_job.cc21
-rw-r--r--src/lib/config.cc3
-rw-r--r--src/lib/config.h9
-rw-r--r--src/wx/config_dialog.cc22
5 files changed, 52 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c038c2e2..c3a3072a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-02 c.hetherington <cth@carlh.net>
+
+ * Add configurable option to disable EBUR128
+ analysis.
+
2016-03-01 Carl Hetherington <cth@carlh.net>
* Version 2.6.30 released.
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc
index d17c4c30b..d81f25cac 100644
--- a/src/lib/analyse_audio_job.cc
+++ b/src/lib/analyse_audio_job.cc
@@ -27,6 +27,7 @@
#include "playlist.h"
#include "filter.h"
#include "audio_filter_graph.h"
+#include "config.h"
extern "C" {
#include <libavutil/channel_layout.h>
#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
@@ -116,7 +117,9 @@ AnalyseAudioJob::run ()
for (DCPTime t = start; t < length; t += block) {
shared_ptr<const AudioBuffers> audio = player->get_audio (t, block, false);
#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
- _ebur128->process (audio);
+ if (Config::instance()->analyse_ebur128 ()) {
+ _ebur128->process (audio);
+ }
#endif
analyse (audio);
set_progress ((t.seconds() - start.seconds()) / (length.seconds() - start.seconds()));
@@ -126,14 +129,16 @@ AnalyseAudioJob::run ()
_analysis->set_sample_peak (_sample_peak, DCPTime::from_frames (_sample_peak_frame, _film->audio_frame_rate ()));
#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
- 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]);
+ 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]);
+ }
+ _analysis->set_true_peak (true_peak);
+ _analysis->set_integrated_loudness (av_ebur128_get_integrated_loudness(eb));
+ _analysis->set_loudness_range (av_ebur128_get_loudness_range(eb));
}
- _analysis->set_true_peak (true_peak);
- _analysis->set_integrated_loudness (av_ebur128_get_integrated_loudness(eb));
- _analysis->set_loudness_range (av_ebur128_get_loudness_range(eb));
#endif
if (_playlist->content().size() == 1) {
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 8370be7d1..ba285fd2c 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -98,6 +98,7 @@ Config::set_defaults ()
_check_for_test_updates = false;
_maximum_j2k_bandwidth = 250000000;
_log_types = LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR;
+ _analyse_ebur128 = true;
_automatic_audio_analysis = false;
#ifdef DCPOMATIC_WINDOWS
_win32_console = false;
@@ -247,6 +248,7 @@ Config::read ()
_allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate").get_value_or (false);
_log_types = f.optional_number_child<int> ("LogTypes").get_value_or (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
+ _analyse_ebur128 = f.optional_bool_child("AnalyseEBUR128").get_value_or (true);
_automatic_audio_analysis = f.optional_bool_child ("AutomaticAudioAnalysis").get_value_or (false);
#ifdef DCPOMATIC_WINDOWS
_win32_console = f.optional_bool_child ("Win32Console").get_value_or (false);
@@ -411,6 +413,7 @@ Config::write_config_xml () const
root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert<string> (_maximum_j2k_bandwidth));
root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
root->add_child("LogTypes")->add_child_text (raw_convert<string> (_log_types));
+ root->add_child("AnalyseEBUR128")->add_child_text (_analyse_ebur128 ? "1" : "0");
root->add_child("AutomaticAudioAnalysis")->add_child_text (_automatic_audio_analysis ? "1" : "0");
#ifdef DCPOMATIC_WINDOWS
root->add_child("Win32Console")->add_child_text (_win32_console ? "1" : "0");
diff --git a/src/lib/config.h b/src/lib/config.h
index 109f7b603..e5795d2c3 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -231,6 +231,10 @@ public:
return _log_types;
}
+ bool analyse_ebur128 () const {
+ return _analyse_ebur128;
+ }
+
bool automatic_audio_analysis () const {
return _automatic_audio_analysis;
}
@@ -431,6 +435,10 @@ public:
maybe_set (_log_types, t);
}
+ void set_analyse_ebur128 (bool a) {
+ maybe_set (_analyse_ebur128, a);
+ }
+
void set_automatic_audio_analysis (bool a) {
maybe_set (_automatic_audio_analysis, a);
}
@@ -546,6 +554,7 @@ private:
/** maximum allowed J2K bandwidth in bits per second */
int _maximum_j2k_bandwidth;
int _log_types;
+ bool _analyse_ebur128;
bool _automatic_audio_analysis;
#ifdef DCPOMATIC_WINDOWS
bool _win32_console;
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index de0ac8176..c0121b8fe 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -194,6 +194,12 @@ private:
table->Add (_cinemas_file, wxGBPosition (r, 1));
++r;
+#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
+ _analyse_ebur128 = new wxCheckBox (_panel, wxID_ANY, _("Find integrated loudness, true peak and loudness range when analysing audio"));
+ table->Add (_analyse_ebur128, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+#endif
+
_automatic_audio_analysis = new wxCheckBox (_panel, wxID_ANY, _("Automatically analyse content audio"));
table->Add (_automatic_audio_analysis, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
@@ -227,6 +233,9 @@ private:
_num_local_encoding_threads->SetRange (1, 128);
_num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this));
+#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
+ _analyse_ebur128->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::analyse_ebur128_changed, this));
+#endif
_automatic_audio_analysis->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::automatic_audio_analysis_changed, this));
_check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_updates_changed, this));
_check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_test_updates_changed, this));
@@ -270,6 +279,9 @@ private:
}
checked_set (_num_local_encoding_threads, config->num_local_encoding_threads ());
+#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
+ checked_set (_analyse_ebur128, config->analyse_ebur128 ());
+#endif
checked_set (_automatic_audio_analysis, config->automatic_audio_analysis ());
checked_set (_check_for_updates, config->check_for_updates ());
checked_set (_check_for_test_updates, config->check_for_test_updates ());
@@ -341,6 +353,13 @@ private:
}
}
+#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
+ void analyse_ebur128_changed ()
+ {
+ Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue ());
+ }
+#endif
+
void automatic_audio_analysis_changed ()
{
Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue ());
@@ -380,6 +399,9 @@ private:
wxChoice* _language;
wxSpinCtrl* _num_local_encoding_threads;
FilePickerCtrl* _cinemas_file;
+#ifdef DCPOMATIC_HAVE_PATCHED_FFMPEG
+ wxCheckBox* _analyse_ebur128;
+#endif
wxCheckBox* _automatic_audio_analysis;
wxCheckBox* _check_for_updates;
wxCheckBox* _check_for_test_updates;