window-basic-status-bar.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include <QStatusBar>
  3. #include <QPointer>
  4. #include <QTimer>
  5. #include <util/platform.h>
  6. #include <obs.h>
  7. class QLabel;
  8. class OBSBasicStatusBar : public QStatusBar {
  9. Q_OBJECT
  10. private:
  11. QLabel *delayInfo;
  12. QLabel *droppedFrames;
  13. QLabel *sessionTime;
  14. QLabel *cpuUsage;
  15. QLabel *kbps;
  16. obs_output_t *streamOutput = nullptr;
  17. obs_output_t *recordOutput = nullptr;
  18. bool active = false;
  19. bool overloadedNotify = true;
  20. int retries = 0;
  21. int totalSeconds = 0;
  22. int reconnectTimeout = 0;
  23. int delaySecTotal = 0;
  24. int delaySecStarting = 0;
  25. int delaySecStopping = 0;
  26. int startSkippedFrameCount = 0;
  27. int startTotalFrameCount = 0;
  28. int lastSkippedFrameCount = 0;
  29. int bitrateUpdateSeconds = 0;
  30. uint64_t lastBytesSent = 0;
  31. uint64_t lastBytesSentTime = 0;
  32. QPointer<QTimer> refreshTimer;
  33. obs_output_t *GetOutput();
  34. void Activate();
  35. void Deactivate();
  36. void UpdateDelayMsg();
  37. void UpdateBandwidth();
  38. void UpdateSessionTime();
  39. void UpdateDroppedFrames();
  40. static void OBSOutputReconnect(void *data, calldata_t *params);
  41. static void OBSOutputReconnectSuccess(void *data, calldata_t *params);
  42. private slots:
  43. void Reconnect(int seconds);
  44. void ReconnectSuccess();
  45. void UpdateStatusBar();
  46. void UpdateCPUUsage();
  47. public:
  48. OBSBasicStatusBar(QWidget *parent);
  49. void StreamDelayStarting(int sec);
  50. void StreamDelayStopping(int sec);
  51. void StreamStarted(obs_output_t *output);
  52. void StreamStopped();
  53. void RecordingStarted(obs_output_t *output);
  54. void RecordingStopped();
  55. void ReconnectClear();
  56. };