f592c33eec
When stream delay is active, the "Start/Stop Streaming" button is changed in to a menu button, which allows the user to select either the option to stop the stream (which causes it to count down), or forcibly stop the stream (which immediately stops the stream and cuts off all delayed data). If the user decides they want to start the stream again while in the process of counting down, they can safely do so without having to wait for it to stop, and it will schedule it to start up again with the same delay after the stop. On the status bar, it will now show whether delay is active, and its duration. If the stream is in the process of stopping/starting, it will count down to the stop/start. If the option to preserve stream cutoff point on unexpected disconnections/reconnections is enabled, it will update the current delay duration accordingly.
69 lines
1.3 KiB
C++
69 lines
1.3 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 *delayInfo;
|
|
QLabel *droppedFrames;
|
|
QLabel *sessionTime;
|
|
QLabel *cpuUsage;
|
|
QLabel *kbps;
|
|
|
|
obs_output_t *streamOutput = nullptr;
|
|
obs_output_t *recordOutput = nullptr;
|
|
bool active = false;
|
|
|
|
int retries = 0;
|
|
int totalSeconds = 0;
|
|
|
|
int reconnectTimeout = 0;
|
|
|
|
int delaySecTotal = 0;
|
|
int delaySecStarting = 0;
|
|
int delaySecStopping = 0;
|
|
|
|
int bitrateUpdateSeconds = 0;
|
|
uint64_t lastBytesSent = 0;
|
|
uint64_t lastBytesSentTime = 0;
|
|
|
|
QPointer<QTimer> refreshTimer;
|
|
|
|
obs_output_t *GetOutput();
|
|
|
|
void Activate();
|
|
void Deactivate();
|
|
|
|
void UpdateDelayMsg();
|
|
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(int seconds);
|
|
void ReconnectSuccess();
|
|
void UpdateStatusBar();
|
|
void UpdateCPUUsage();
|
|
|
|
public:
|
|
OBSBasicStatusBar(QWidget *parent);
|
|
|
|
void StreamDelayStarting(int sec);
|
|
void StreamDelayStopping(int sec);
|
|
void StreamStarted(obs_output_t *output);
|
|
void StreamStopped();
|
|
void RecordingStarted(obs_output_t *output);
|
|
void RecordingStopped();
|
|
};
|