mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-28 16:12:08 -05:00
UI: Create output before calling start stream event
Allows modifying the output OBS_FRONTEND_EVENT_STREAMING_STARTING.
This commit is contained in:
@@ -5496,6 +5496,23 @@ void OBSBasic::OpenSceneFilters()
|
||||
#define VIRTUAL_CAM_STOP \
|
||||
"==== Virtual Camera Stop ==========================================="
|
||||
|
||||
void OBSBasic::DisplayStreamStartError()
|
||||
{
|
||||
QString message = !outputHandler->lastError.empty()
|
||||
? QTStr(outputHandler->lastError.c_str())
|
||||
: QTStr("Output.StartFailedGeneric");
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(false);
|
||||
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setText(ui->streamButton->text());
|
||||
sysTrayStream->setEnabled(true);
|
||||
}
|
||||
|
||||
QMessageBox::critical(this, QTStr("Output.StartStreamFailed"), message);
|
||||
}
|
||||
|
||||
void OBSBasic::StartStreaming()
|
||||
{
|
||||
if (outputHandler->StreamingActive())
|
||||
@@ -5503,6 +5520,11 @@ void OBSBasic::StartStreaming()
|
||||
if (disableOutputsRef)
|
||||
return;
|
||||
|
||||
if (!outputHandler->SetupStreaming(service)) {
|
||||
DisplayStreamStartError();
|
||||
return;
|
||||
}
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STARTING);
|
||||
|
||||
@@ -5518,21 +5540,7 @@ void OBSBasic::StartStreaming()
|
||||
}
|
||||
|
||||
if (!outputHandler->StartStreaming(service)) {
|
||||
QString message =
|
||||
!outputHandler->lastError.empty()
|
||||
? QTStr(outputHandler->lastError.c_str())
|
||||
: QTStr("Output.StartFailedGeneric");
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(false);
|
||||
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setText(ui->streamButton->text());
|
||||
sysTrayStream->setEnabled(true);
|
||||
}
|
||||
|
||||
QMessageBox::critical(this, QTStr("Output.StartStreamFailed"),
|
||||
message);
|
||||
DisplayStreamStartError();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user