std::shared_ptr
[dcpomatic.git] / src / lib / audio_analysis.cc
index 61cdd5fcce2b61a2d9d121038d4f86b6060b1281..41591b062c0f610ef5aa1e0c45db90fa54b620e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #include "util.h"
 #include "playlist.h"
 #include "audio_content.h"
+#include "warnings.h"
 #include <dcp/raw_convert.h>
+DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
+DCPOMATIC_ENABLE_WARNINGS
 #include <boost/filesystem.hpp>
 #include <boost/foreach.hpp>
 #include <stdint.h>
@@ -42,12 +45,13 @@ using std::max;
 using std::pair;
 using std::make_pair;
 using std::list;
-using boost::shared_ptr;
+using std::shared_ptr;
 using boost::optional;
-using boost::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 using dcp::raw_convert;
+using namespace dcpomatic;
 
-int const AudioAnalysis::_current_state_version = 2;
+int const AudioAnalysis::_current_state_version = 3;
 
 AudioAnalysis::AudioAnalysis (int channels)
 {
@@ -90,6 +94,10 @@ AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
        _loudness_range = f.optional_number_child<float> ("LoudnessRange");
 
        _analysis_gain = f.optional_number_child<double> ("AnalysisGain");
+       _samples_per_point = f.number_child<int64_t> ("SamplesPerPoint");
+       _sample_rate = f.number_child<int64_t> ("SampleRate");
+
+       _leqm = f.optional_number_child<double>("Leqm");
 }
 
 void
@@ -156,6 +164,13 @@ AudioAnalysis::write (boost::filesystem::path filename)
                root->add_child("AnalysisGain")->add_child_text (raw_convert<string> (_analysis_gain.get ()));
        }
 
+       root->add_child("SamplesPerPoint")->add_child_text (raw_convert<string> (_samples_per_point));
+       root->add_child("SampleRate")->add_child_text (raw_convert<string> (_sample_rate));
+
+       if (_leqm) {
+               root->add_child("Leqm")->add_child_text(raw_convert<string>(*_leqm));
+       }
+
        doc->write_to_file_formatted (filename.string ());
 }
 
@@ -206,3 +221,4 @@ AudioAnalysis::overall_true_peak () const
 
        return p;
 }
+