2017-05-10 19:37:45 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <obs.hpp>
|
|
|
|
#include <util/platform.h>
|
2020-04-08 17:20:52 -07:00
|
|
|
#include <obs-frontend-api.h>
|
2017-05-10 19:37:45 -07:00
|
|
|
#include <QPointer>
|
2017-05-15 15:02:56 -07:00
|
|
|
#include <QWidget>
|
2017-05-10 19:37:45 -07:00
|
|
|
#include <QTimer>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QList>
|
|
|
|
|
|
|
|
class QGridLayout;
|
2017-05-13 20:48:11 -07:00
|
|
|
class QCloseEvent;
|
2017-05-10 19:37:45 -07:00
|
|
|
|
2017-05-15 15:02:56 -07:00
|
|
|
class OBSBasicStats : public QWidget {
|
2017-05-10 19:37:45 -07:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QLabel *fps = nullptr;
|
|
|
|
QLabel *cpuUsage = nullptr;
|
|
|
|
QLabel *hddSpace = nullptr;
|
2019-03-13 03:27:36 -07:00
|
|
|
QLabel *recordTimeLeft = nullptr;
|
2017-05-10 19:37:45 -07:00
|
|
|
QLabel *memUsage = nullptr;
|
|
|
|
|
|
|
|
QLabel *renderTime = nullptr;
|
|
|
|
QLabel *skippedFrames = nullptr;
|
|
|
|
QLabel *missedFrames = nullptr;
|
|
|
|
|
|
|
|
QGridLayout *outputLayout = nullptr;
|
|
|
|
|
|
|
|
os_cpu_usage_info_t *cpu_info = nullptr;
|
|
|
|
|
|
|
|
QTimer timer;
|
2019-03-13 03:27:36 -07:00
|
|
|
QTimer recTimeLeft;
|
|
|
|
uint64_t num_bytes = 0;
|
|
|
|
std::vector<long double> bitrates;
|
2017-05-10 19:37:45 -07:00
|
|
|
|
|
|
|
struct OutputLabels {
|
|
|
|
QPointer<QLabel> name;
|
|
|
|
QPointer<QLabel> status;
|
|
|
|
QPointer<QLabel> droppedFrames;
|
|
|
|
QPointer<QLabel> megabytesSent;
|
|
|
|
QPointer<QLabel> bitrate;
|
|
|
|
|
|
|
|
uint64_t lastBytesSent = 0;
|
|
|
|
uint64_t lastBytesSentTime = 0;
|
|
|
|
|
|
|
|
int first_total = 0;
|
|
|
|
int first_dropped = 0;
|
|
|
|
|
2017-08-11 08:52:09 -07:00
|
|
|
void Update(obs_output_t *output, bool rec);
|
2017-05-10 19:37:45 -07:00
|
|
|
void Reset(obs_output_t *output);
|
2019-03-13 03:27:36 -07:00
|
|
|
|
|
|
|
long double kbps = 0.0l;
|
2017-05-10 19:37:45 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
QList<OutputLabels> outputLabels;
|
|
|
|
|
|
|
|
void AddOutputLabels(QString name);
|
|
|
|
void Update();
|
|
|
|
|
2017-05-13 20:48:11 -07:00
|
|
|
virtual void closeEvent(QCloseEvent *event) override;
|
|
|
|
|
2019-03-13 03:27:36 -07:00
|
|
|
static void OBSFrontendEvent(enum obs_frontend_event event, void *ptr);
|
|
|
|
|
2017-05-10 19:37:45 -07:00
|
|
|
public:
|
2018-08-28 07:39:50 -07:00
|
|
|
OBSBasicStats(QWidget *parent = nullptr, bool closable = true);
|
2017-05-10 19:37:45 -07:00
|
|
|
~OBSBasicStats();
|
2017-06-19 15:33:12 -07:00
|
|
|
|
|
|
|
static void InitializeValues();
|
2019-03-13 03:27:36 -07:00
|
|
|
|
|
|
|
void StartRecTimeLeft();
|
|
|
|
void ResetRecTimeLeft();
|
|
|
|
|
2019-01-30 18:33:15 -08:00
|
|
|
private:
|
|
|
|
QPointer<QObject> shortcutFilter;
|
2019-04-06 05:11:23 -07:00
|
|
|
|
2019-03-13 03:27:36 -07:00
|
|
|
private slots:
|
|
|
|
void RecordingTimeLeft();
|
|
|
|
|
2019-10-15 21:20:35 -07:00
|
|
|
public slots:
|
|
|
|
void Reset();
|
|
|
|
|
2019-04-06 05:11:23 -07:00
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *event) override;
|
|
|
|
virtual void hideEvent(QHideEvent *event) override;
|
2017-05-10 19:37:45 -07:00
|
|
|
};
|