0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
obs-studio/obs/window-basic-status-bar.hpp
jp9000 c9df41c1e2 (API Change) Remove pointers from all typedefs
Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
2014-09-25 21:48:11 -07:00

59 lines
1.1 KiB
C++

#pragma once
#include <QStatusBar>
#include <QPointer>
#include <QTimer>
#include <util/platform.h>
#include <obs.h>
class QLabel;
class OBSBasicStatusBar : public QStatusBar {
Q_OBJECT
private:
QLabel *droppedFrames;
QLabel *sessionTime;
QLabel *cpuUsage;
QLabel *kbps;
obs_output_t *streamOutput = nullptr;
obs_output_t *recordOutput = nullptr;
int retries = 0;
int activeRefs = 0;
int totalSeconds = 0;
int bitrateUpdateSeconds = 0;
uint64_t lastBytesSent = 0;
uint64_t lastBytesSentTime = 0;
QPointer<QTimer> refreshTimer;
void DecRef();
void IncRef();
obs_output_t *GetOutput();
void UpdateBandwidth();
void UpdateSessionTime();
void UpdateDroppedFrames();
static void OBSOutputReconnect(void *data, calldata_t *params);
static void OBSOutputReconnectSuccess(void *data, calldata_t *params);
private slots:
void Reconnect();
void ReconnectSuccess();
void UpdateStatusBar();
void UpdateCPUUsage();
public:
OBSBasicStatusBar(QWidget *parent);
void StreamStarted(obs_output_t *output);
void StreamStopped();
void RecordingStarted(obs_output_t *output);
void RecordingStopped();
};