/*
- 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.
#include "util.h"
#include <boost/thread/mutex.hpp>
+using boost::optional;
+
EventHistory::EventHistory (int size)
: _size (size)
{
}
-float
+optional<float>
EventHistory::rate () const
{
boost::mutex::scoped_lock lock (_mutex);
if (int (_history.size()) < _size) {
- return 0;
+ return optional<float>();
}
struct timeval now;
/*
- 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:
explicit EventHistory (int size);
- float rate () const;
+ boost::optional<float> rate () const;
void event ();
private:
}
/** @return an estimate of the current number of frames we are encoding per second,
- * or 0 if not known.
+ * if known.
*/
-float
+optional<float>
J2KEncoder::current_encoding_rate () const
{
return _history.rate ();
/** Called when a processing run has finished */
void end ();
- float current_encoding_rate () const;
+ boost::optional<float> current_encoding_rate () const;
int video_frames_enqueued () const;
void servers_list_changed ();