wip: encoding; crashes on startup.
[dcpomatic.git] / src / lib / event_history.h
index f723591fbd19bd81c0fa052e997a59c88195a22c..51684ea1611d60620738c6f2c2cfdba07999575e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #define DCPOMATIC_EVENT_HISTORY_H
 
 #include <boost/thread/mutex.hpp>
+#include <boost/optional.hpp>
 #include <list>
 
 class EventHistory
 {
 public:
-       EventHistory (int size);
+       explicit EventHistory (int size);
 
-       float rate () const;
-       void event ();
+       boost::optional<float> rate () const;
+       void event (int count = 1);
 
 private:
        /** Mutex for _history */
@@ -38,8 +39,8 @@ private:
        /** List of the times of the last _history_size events
            first is the most recently completed.
        */
-       std::list<struct timeval> _history;
-       /** Number of events that we should keep history for */
+       std::list<std::pair<struct timeval, int> > _history;
+       /** Maximum size of _history */
        int const _size;
 };