2015-04-04 00:37:02 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <obs.hpp>
|
|
|
|
#include "qt-display.hpp"
|
2018-02-27 19:57:54 -08:00
|
|
|
|
|
|
|
enum class ProjectorType {
|
|
|
|
Source,
|
2018-02-28 10:01:31 -08:00
|
|
|
Scene,
|
2018-02-27 19:57:54 -08:00
|
|
|
Preview,
|
|
|
|
StudioProgram,
|
2019-06-22 22:13:45 -07:00
|
|
|
Multiview,
|
2018-02-27 19:57:54 -08:00
|
|
|
};
|
2015-04-04 00:37:02 -07:00
|
|
|
|
2015-04-13 14:31:36 -07:00
|
|
|
class QMouseEvent;
|
|
|
|
|
2018-03-07 01:12:55 -08:00
|
|
|
enum class MultiviewLayout : uint8_t {
|
2018-03-20 17:41:39 -07:00
|
|
|
HORIZONTAL_TOP_8_SCENES = 0,
|
|
|
|
HORIZONTAL_BOTTOM_8_SCENES = 1,
|
|
|
|
VERTICAL_LEFT_8_SCENES = 2,
|
2018-03-22 20:57:15 -07:00
|
|
|
VERTICAL_RIGHT_8_SCENES = 3,
|
2019-06-22 22:13:45 -07:00
|
|
|
HORIZONTAL_TOP_24_SCENES = 4,
|
2018-03-07 01:12:55 -08:00
|
|
|
};
|
|
|
|
|
2015-04-04 00:37:02 -07:00
|
|
|
class OBSProjector : public OBSQTDisplay {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
OBSSource source;
|
|
|
|
OBSSignal removedSignal;
|
|
|
|
|
2017-10-21 10:51:01 -07:00
|
|
|
static void OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy);
|
2015-04-04 00:37:02 -07:00
|
|
|
static void OBSRender(void *data, uint32_t cx, uint32_t cy);
|
|
|
|
static void OBSSourceRemoved(void *data, calldata_t *params);
|
|
|
|
|
2015-04-13 14:31:36 -07:00
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
2017-12-12 12:45:15 -08:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2019-10-07 22:43:10 -07:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2015-04-13 14:31:36 -07:00
|
|
|
|
2019-10-07 22:43:10 -07:00
|
|
|
int savedMonitor = -1;
|
2017-10-21 10:51:01 -07:00
|
|
|
ProjectorType type = ProjectorType::Source;
|
2018-03-22 20:57:15 -07:00
|
|
|
std::vector<OBSWeakSource> multiviewScenes;
|
|
|
|
std::vector<OBSSource> multiviewLabels;
|
2019-06-22 22:13:45 -07:00
|
|
|
gs_vertbuffer_t *actionSafeMargin = nullptr;
|
|
|
|
gs_vertbuffer_t *graphicsSafeMargin = nullptr;
|
2018-03-18 18:00:18 -07:00
|
|
|
gs_vertbuffer_t *fourByThreeSafeMargin = nullptr;
|
2019-06-22 22:13:45 -07:00
|
|
|
gs_vertbuffer_t *leftLine = nullptr;
|
|
|
|
gs_vertbuffer_t *topLine = nullptr;
|
|
|
|
gs_vertbuffer_t *rightLine = nullptr;
|
2018-03-19 23:20:45 -07:00
|
|
|
gs_effect_t *solid = nullptr;
|
|
|
|
gs_eparam_t *color = nullptr;
|
2018-03-22 18:07:59 -07:00
|
|
|
// Multiview position helpers
|
2018-03-19 23:20:45 -07:00
|
|
|
float thickness = 4;
|
2019-06-22 22:13:45 -07:00
|
|
|
float offset, thicknessx2 = thickness * 2, pvwprgCX, pvwprgCY, sourceX,
|
|
|
|
sourceY, labelX, labelY, scenesCX, scenesCY, ppiCX, ppiCY,
|
|
|
|
siX, siY, siCX, siCY, ppiScaleX, ppiScaleY, siScaleX,
|
|
|
|
siScaleY, fw, fh, ratio;
|
2018-03-19 23:20:45 -07:00
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
float lineLength = 0.1f;
|
2018-03-18 18:00:18 -07:00
|
|
|
// Rec. ITU-R BT.1848-1 / EBU R 95
|
2019-06-22 22:13:45 -07:00
|
|
|
float actionSafePercentage = 0.035f; // 3.5%
|
|
|
|
float graphicsSafePercentage = 0.05f; // 5.0%
|
2018-03-18 18:00:18 -07:00
|
|
|
float fourByThreeSafePercentage = 0.1625f; // 16.25%
|
2017-10-21 10:51:01 -07:00
|
|
|
bool ready = false;
|
|
|
|
|
2018-03-08 11:04:22 -08:00
|
|
|
// argb colors
|
2019-06-22 22:13:45 -07:00
|
|
|
static const uint32_t outerColor = 0xFFD0D0D0;
|
|
|
|
static const uint32_t labelColor = 0xD91F1F1F;
|
2018-03-08 11:04:22 -08:00
|
|
|
static const uint32_t backgroundColor = 0xFF000000;
|
2019-06-22 22:13:45 -07:00
|
|
|
static const uint32_t previewColor = 0xFF00D000;
|
|
|
|
static const uint32_t programColor = 0xFFD00000;
|
2018-03-08 11:04:22 -08:00
|
|
|
|
2017-10-21 10:51:01 -07:00
|
|
|
void UpdateMultiview();
|
2018-02-28 16:43:07 -08:00
|
|
|
void UpdateProjectorTitle(QString name);
|
2016-12-29 07:21:53 -08:00
|
|
|
|
2019-10-07 22:43:10 -07:00
|
|
|
QRect prevGeometry;
|
|
|
|
void SetHideCursor();
|
|
|
|
void SetMonitor(int monitor);
|
|
|
|
|
2015-04-04 00:37:02 -07:00
|
|
|
private slots:
|
|
|
|
void EscapeTriggered();
|
2019-10-07 22:43:10 -07:00
|
|
|
void OpenFullScreenProjector();
|
|
|
|
void OpenWindowedProjector();
|
2015-04-04 00:37:02 -07:00
|
|
|
|
|
|
|
public:
|
2018-02-28 18:34:11 -08:00
|
|
|
OBSProjector(QWidget *widget, obs_source_t *source_, int monitor,
|
2019-10-07 22:43:10 -07:00
|
|
|
ProjectorType type_);
|
2015-04-04 00:37:02 -07:00
|
|
|
~OBSProjector();
|
|
|
|
|
2018-02-28 10:34:17 -08:00
|
|
|
OBSSource GetSource();
|
|
|
|
ProjectorType GetProjectorType();
|
|
|
|
int GetMonitor();
|
2017-10-21 10:51:01 -07:00
|
|
|
static void UpdateMultiviewProjectors();
|
2019-10-07 22:43:10 -07:00
|
|
|
void RenameProjector(QString oldName, QString newName);
|
2015-04-04 00:37:02 -07:00
|
|
|
};
|