diff --git a/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp b/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp
index 74cc71f49..1df3a3c9e 100644
--- a/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp
+++ b/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp
@@ -15,14 +15,6 @@ DecklinkOutputUI::DecklinkOutputUI(QWidget *parent)
propertiesView = nullptr;
previewPropertiesView = nullptr;
-
- connect(ui->startOutput, SIGNAL(released()), this, SLOT(StartOutput()));
- connect(ui->stopOutput, SIGNAL(released()), this, SLOT(StopOutput()));
-
- connect(ui->startPreviewOutput, SIGNAL(released()), this,
- SLOT(StartPreviewOutput()));
- connect(ui->stopPreviewOutput, SIGNAL(released()), this,
- SLOT(StopPreviewOutput()));
}
void DecklinkOutputUI::ShowHideDialog()
@@ -106,15 +98,10 @@ void DecklinkOutputUI::SavePreviewSettings()
obs_data_save_json_safe(settings, path, "tmp", "bak");
}
-void DecklinkOutputUI::StartOutput()
+void DecklinkOutputUI::on_outputButton_clicked()
{
SaveSettings();
- output_start();
-}
-
-void DecklinkOutputUI::StopOutput()
-{
- output_stop();
+ output_toggle();
}
void DecklinkOutputUI::PropertiesChanged()
@@ -126,24 +113,19 @@ void DecklinkOutputUI::OutputStateChanged(bool active)
{
QString text;
if (active) {
- text = QString(obs_module_text("OutputState.Active"));
+ text = QString(obs_module_text("Stop"));
} else {
- text = QString(obs_module_text("OutputState.Idle"));
+ text = QString(obs_module_text("Start"));
}
- QMetaObject::invokeMethod(ui->outputStatus, "setText",
- Q_ARG(QString, text));
+ ui->outputButton->setChecked(active);
+ ui->outputButton->setText(text);
}
-void DecklinkOutputUI::StartPreviewOutput()
+void DecklinkOutputUI::on_previewOutputButton_clicked()
{
SavePreviewSettings();
- preview_output_start();
-}
-
-void DecklinkOutputUI::StopPreviewOutput()
-{
- preview_output_stop();
+ preview_output_toggle();
}
void DecklinkOutputUI::PreviewPropertiesChanged()
@@ -155,11 +137,11 @@ void DecklinkOutputUI::PreviewOutputStateChanged(bool active)
{
QString text;
if (active) {
- text = QString(obs_module_text("OutputState.Active"));
+ text = QString(obs_module_text("Stop"));
} else {
- text = QString(obs_module_text("OutputState.Idle"));
+ text = QString(obs_module_text("Start"));
}
- QMetaObject::invokeMethod(ui->previewOutputStatus, "setText",
- Q_ARG(QString, text));
+ ui->previewOutputButton->setChecked(active);
+ ui->previewOutputButton->setText(text);
}
diff --git a/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h b/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h
index f0a7133ac..f550a4635 100644
--- a/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h
+++ b/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h
@@ -12,16 +12,12 @@ private:
OBSPropertiesView *previewPropertiesView;
public slots:
- void StartOutput();
- void StopOutput();
+ void on_outputButton_clicked();
void PropertiesChanged();
-
void OutputStateChanged(bool);
- void StartPreviewOutput();
- void StopPreviewOutput();
+ void on_previewOutputButton_clicked();
void PreviewPropertiesChanged();
-
void PreviewOutputStateChanged(bool);
public:
diff --git a/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp b/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp
index 3b85d72c9..1cf71fe2a 100644
--- a/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp
+++ b/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp
@@ -51,34 +51,40 @@ OBSData load_settings()
return nullptr;
}
+void output_stop()
+{
+ obs_output_stop(output);
+ obs_output_release(output);
+ main_output_running = false;
+ doUI->OutputStateChanged(false);
+}
+
void output_start()
{
- if (!main_output_running) {
- OBSData settings = load_settings();
+ OBSData settings = load_settings();
- if (settings != nullptr) {
- output = obs_output_create("decklink_output",
- "decklink_output", settings,
- NULL);
+ if (settings != nullptr) {
+ output = obs_output_create("decklink_output", "decklink_output",
+ settings, NULL);
- obs_output_start(output);
- obs_data_release(settings);
+ bool started = obs_output_start(output);
+ obs_data_release(settings);
- main_output_running = true;
+ main_output_running = started;
- doUI->OutputStateChanged(true);
- }
+ doUI->OutputStateChanged(started);
+
+ if (!started)
+ output_stop();
}
}
-void output_stop()
+void output_toggle()
{
- if (main_output_running) {
- obs_output_stop(output);
- obs_output_release(output);
- main_output_running = false;
- doUI->OutputStateChanged(false);
- }
+ if (main_output_running)
+ output_stop();
+ else
+ output_start();
}
OBSData load_preview_settings()
@@ -100,90 +106,93 @@ OBSData load_preview_settings()
void on_preview_scene_changed(enum obs_frontend_event event, void *param);
void render_preview_source(void *param, uint32_t cx, uint32_t cy);
+void preview_output_stop()
+{
+ obs_output_stop(context.output);
+ obs_output_release(context.output);
+ video_output_stop(context.video_queue);
+
+ obs_remove_main_render_callback(render_preview_source, &context);
+ obs_frontend_remove_event_callback(on_preview_scene_changed, &context);
+
+ obs_source_release(context.current_source);
+
+ obs_enter_graphics();
+ gs_stagesurface_destroy(context.stagesurface);
+ gs_texrender_destroy(context.texrender);
+ obs_leave_graphics();
+
+ video_output_close(context.video_queue);
+
+ preview_output_running = false;
+ doUI->PreviewOutputStateChanged(false);
+}
+
void preview_output_start()
{
- if (!preview_output_running) {
- OBSData settings = load_preview_settings();
+ OBSData settings = load_preview_settings();
- if (settings != nullptr) {
- context.output = obs_output_create(
- "decklink_output", "decklink_preview_output",
- settings, NULL);
+ if (settings != nullptr) {
+ context.output = obs_output_create("decklink_output",
+ "decklink_preview_output",
+ settings, NULL);
- obs_get_video_info(&context.ovi);
+ obs_get_video_info(&context.ovi);
- uint32_t width = context.ovi.base_width;
- uint32_t height = context.ovi.base_height;
+ uint32_t width = context.ovi.base_width;
+ uint32_t height = context.ovi.base_height;
- obs_enter_graphics();
- context.texrender =
- gs_texrender_create(GS_BGRA, GS_ZS_NONE);
- context.stagesurface =
- gs_stagesurface_create(width, height, GS_BGRA);
- obs_leave_graphics();
+ obs_enter_graphics();
+ context.texrender = gs_texrender_create(GS_BGRA, GS_ZS_NONE);
+ context.stagesurface =
+ gs_stagesurface_create(width, height, GS_BGRA);
+ obs_leave_graphics();
- const video_output_info *mainVOI =
- video_output_get_info(obs_get_video());
+ const video_output_info *mainVOI =
+ video_output_get_info(obs_get_video());
- video_output_info vi = {0};
- vi.format = VIDEO_FORMAT_BGRA;
- vi.width = width;
- vi.height = height;
- vi.fps_den = context.ovi.fps_den;
- vi.fps_num = context.ovi.fps_num;
- vi.cache_size = 16;
- vi.colorspace = mainVOI->colorspace;
- vi.range = mainVOI->range;
- vi.name = "decklink_preview_output";
+ video_output_info vi = {0};
+ vi.format = VIDEO_FORMAT_BGRA;
+ vi.width = width;
+ vi.height = height;
+ vi.fps_den = context.ovi.fps_den;
+ vi.fps_num = context.ovi.fps_num;
+ vi.cache_size = 16;
+ vi.colorspace = mainVOI->colorspace;
+ vi.range = mainVOI->range;
+ vi.name = "decklink_preview_output";
- video_output_open(&context.video_queue, &vi);
+ video_output_open(&context.video_queue, &vi);
- obs_frontend_add_event_callback(
- on_preview_scene_changed, &context);
- if (obs_frontend_preview_program_mode_active()) {
- context.current_source =
- obs_frontend_get_current_preview_scene();
- } else {
- context.current_source =
- obs_frontend_get_current_scene();
- }
- obs_add_main_render_callback(render_preview_source,
- &context);
-
- obs_output_set_media(context.output,
- context.video_queue,
- obs_get_audio());
- obs_output_start(context.output);
-
- preview_output_running = true;
- doUI->PreviewOutputStateChanged(true);
+ obs_frontend_add_event_callback(on_preview_scene_changed,
+ &context);
+ if (obs_frontend_preview_program_mode_active()) {
+ context.current_source =
+ obs_frontend_get_current_preview_scene();
+ } else {
+ context.current_source =
+ obs_frontend_get_current_scene();
}
+ obs_add_main_render_callback(render_preview_source, &context);
+
+ obs_output_set_media(context.output, context.video_queue,
+ obs_get_audio());
+ bool started = obs_output_start(context.output);
+
+ preview_output_running = started;
+ doUI->PreviewOutputStateChanged(started);
+
+ if (!started)
+ preview_output_stop();
}
}
-void preview_output_stop()
+void preview_output_toggle()
{
- if (preview_output_running) {
- obs_output_stop(context.output);
- video_output_stop(context.video_queue);
-
- obs_remove_main_render_callback(render_preview_source,
- &context);
- obs_frontend_remove_event_callback(on_preview_scene_changed,
- &context);
-
- obs_source_release(context.current_source);
-
- obs_enter_graphics();
- gs_stagesurface_destroy(context.stagesurface);
- gs_texrender_destroy(context.texrender);
- obs_leave_graphics();
-
- video_output_close(context.video_queue);
-
- preview_output_running = false;
- doUI->PreviewOutputStateChanged(false);
- }
+ if (preview_output_running)
+ preview_output_stop();
+ else
+ preview_output_start();
}
void on_preview_scene_changed(enum obs_frontend_event event, void *param)
diff --git a/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.h b/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.h
index ec91b8c7e..b4af11393 100644
--- a/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.h
+++ b/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.h
@@ -1,8 +1,6 @@
#pragma once
-void output_start();
-void output_stop();
+void output_toggle();
OBSData load_settings();
-void preview_output_start();
-void preview_output_stop();
-OBSData load_preview_settings();
\ No newline at end of file
+void preview_output_toggle();
+OBSData load_preview_settings();
diff --git a/UI/frontend-plugins/decklink-output-ui/forms/output.ui b/UI/frontend-plugins/decklink-output-ui/forms/output.ui
index 0b6048c9b..3f63a8027 100644
--- a/UI/frontend-plugins/decklink-output-ui/forms/output.ui
+++ b/UI/frontend-plugins/decklink-output-ui/forms/output.ui
@@ -58,23 +58,12 @@
-
-
-
- OutputState.Idle
-
-
-
- -
-
+
Start
-
-
- -
-
-
- Stop
+
+ true
@@ -106,28 +95,30 @@
-
-
-
- OutputState.Idle
-
-
-
- -
-
+
Start
-
-
- -
-
-
- Stop
+
+ true
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
-