#ifndef DCPOMATIC_AUDIO_ANALYSIS_H
#define DCPOMATIC_AUDIO_ANALYSIS_H
-#include <vector>
-#include <list>
-#include <boost/filesystem.hpp>
-#include <boost/optional.hpp>
+#include "dcpomatic_time.h"
+#include "audio_point.h"
#include <libcxml/cxml.h>
-#include "types.h"
+#include <boost/optional.hpp>
+#include <boost/filesystem.hpp>
+#include <vector>
-class AudioPoint
-{
-public:
- enum Type {
- PEAK,
- RMS,
- COUNT
- };
-
- AudioPoint ();
- AudioPoint (cxml::ConstNodePtr node);
- AudioPoint (AudioPoint const &);
- AudioPoint& operator= (AudioPoint const &);
-
- void as_xml (xmlpp::Element *) const;
-
- float& operator[] (int t) {
- return _data[t];
- }
+namespace xmlpp {
+ class Element;
+}
-private:
- float _data[COUNT];
-};
+class Playlist;
class AudioAnalysis : public boost::noncopyable
{
_peak = peak;
_peak_time = time;
}
-
+
AudioPoint get_point (int c, int p) const;
int points (int c) const;
int channels () const;
return _peak_time;
}
+ boost::optional<double> analysis_gain () const {
+ return _analysis_gain;
+ }
+
+ void set_analysis_gain (double gain) {
+ _analysis_gain = gain;
+ }
+
void write (boost::filesystem::path);
+ float gain_correction (boost::shared_ptr<const Playlist> playlist);
+
private:
std::vector<std::vector<AudioPoint> > _data;
boost::optional<float> _peak;
boost::optional<DCPTime> _peak_time;
+ /** If this analysis was run on a single piece of
+ * content we store its gain in dB when the analysis
+ * happened.
+ */
+ boost::optional<double> _analysis_gain;
};
#endif