summaryrefslogtreecommitdiff
path: root/src/lib/audio_analysis.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/audio_analysis.cc')
-rw-r--r--src/lib/audio_analysis.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc
index 19a0d876e..ee34b0d80 100644
--- a/src/lib/audio_analysis.cc
+++ b/src/lib/audio_analysis.cc
@@ -22,6 +22,7 @@
#include "cross.h"
#include <boost/filesystem.hpp>
#include <stdint.h>
+#include <inttypes.h>
#include <cmath>
#include <cassert>
#include <cstdio>
@@ -115,6 +116,17 @@ AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
}
}
+ /* These may not exist in old analysis files, so be careful
+ about reading them.
+ */
+
+ float peak;
+ DCPTime::Type peak_time;
+ if (fscanf (f, "%f%" SCNd64, &peak, &peak_time) == 2) {
+ _peak = peak;
+ _peak_time = DCPTime (peak_time);
+ }
+
fclose (f);
}
@@ -164,6 +176,10 @@ AudioAnalysis::write (boost::filesystem::path filename)
}
}
+ if (_peak) {
+ fprintf (f, "%f%" PRId64, _peak.get (), _peak_time.get().get ());
+ }
+
fclose (f);
boost::filesystem::rename (tmp, filename);
}