mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-17 15:21:39 -05:00
allow selection of target for auto stop of recoding or streaming
This commit is contained in:
parent
5156c66b26
commit
0950d93828
|
|
@ -27,7 +27,8 @@ AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo="Wechsle zu:"
|
|||
AdvSceneSwitcher.generalTab.generalBehavior.cooldown="Nach einem automatisierten Szenenwechsel wechsle nicht mehr für"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint="In diesem Zeitraum werden potentielle erfüllte Bedingungen ignoriert!"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="Ausführliches Logging"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop="Stoppe Streamen/Aufnehmen auf Szene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop1="Stoppe"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop2="auf Szene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="Deaktiviere UI Tipps"
|
||||
AdvSceneSwitcher.generalTab.priority="Priorität"
|
||||
AdvSceneSwitcher.generalTab.priority.description="Szenenwechselmethoden sortiert nach Priorität"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo="Switch to:"
|
|||
AdvSceneSwitcher.generalTab.generalBehavior.cooldown="After a match do not switch scenes for"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint="During this time potential matches will be ignored!"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="Enable verbose logging"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop="Automatically stop streaming/recording on scene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop1="Automatically stop"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop2="on scene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="Disable UI hints"
|
||||
AdvSceneSwitcher.generalTab.priority="Priority"
|
||||
AdvSceneSwitcher.generalTab.priority.description="Switching methods priority (Highest priority is at the top)"
|
||||
|
|
|
|||
|
|
@ -370,7 +370,17 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="autoStopSceneCheckBox">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop</string>
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="autoStopType"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -151,15 +151,25 @@ void AdvSceneSwitcher::on_autoStopSceneCheckBox_stateChanged(int state)
|
|||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
if (!state) {
|
||||
ui->autoStopScenes->setDisabled(true);
|
||||
ui->autoStopType->setDisabled(true);
|
||||
switcher->autoStopEnable = false;
|
||||
} else {
|
||||
ui->autoStopScenes->setDisabled(false);
|
||||
ui->autoStopType->setDisabled(false);
|
||||
switcher->autoStopEnable = true;
|
||||
if (!switcher->autoStopScene)
|
||||
UpdateAutoStopScene(ui->autoStopScenes->currentText());
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_autoStopType_currentIndexChanged(int index)
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->autoStopType = (AutoStartStopType)index;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::UpdateAutoStopScene(const QString &name)
|
||||
{
|
||||
obs_source_t *scene = obs_get_source_by_name(name.toUtf8().constData());
|
||||
|
|
@ -177,13 +187,17 @@ void SwitcherData::autoStopStreamAndRecording()
|
|||
obs_weak_source_t *ws = obs_source_get_weak_source(currentSource);
|
||||
|
||||
if (ws && autoStopScene == ws) {
|
||||
if (obs_frontend_streaming_active()) {
|
||||
if ((switcher->autoStopType == STREAMING ||
|
||||
switcher->autoStopType == RECORINDGSTREAMING) &&
|
||||
obs_frontend_streaming_active()) {
|
||||
blog(LOG_INFO,
|
||||
"Stopping stream because scene '%s' is active",
|
||||
obs_source_get_name(currentSource));
|
||||
obs_frontend_streaming_stop();
|
||||
}
|
||||
if (obs_frontend_recording_active()) {
|
||||
if ((switcher->autoStopType == RECORDING ||
|
||||
switcher->autoStopType == RECORINDGSTREAMING) &&
|
||||
obs_frontend_recording_active()) {
|
||||
blog(LOG_INFO,
|
||||
"Stopping record because scene '%s' is active",
|
||||
obs_source_get_name(currentSource));
|
||||
|
|
@ -199,7 +213,7 @@ void AdvSceneSwitcher::on_autoStartType_currentIndexChanged(int index)
|
|||
if (loading)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->autoStartType = (AutoStartType)index;
|
||||
switcher->autoStartType = (AutoStartStopType)index;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_autoStartScenes_currentTextChanged(const QString &text)
|
||||
|
|
@ -482,6 +496,7 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
|||
std::string autoStopSceneName =
|
||||
GetWeakSourceName(switcher->autoStopScene);
|
||||
obs_data_set_bool(obj, "autoStopEnable", switcher->autoStopEnable);
|
||||
obs_data_set_int(obj, "autoStopType", switcher->autoStopType);
|
||||
obs_data_set_string(obj, "autoStopSceneName",
|
||||
autoStopSceneName.c_str());
|
||||
|
||||
|
|
@ -566,13 +581,15 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
|
|||
std::string autoStopScene =
|
||||
obs_data_get_string(obj, "autoStopSceneName");
|
||||
switcher->autoStopEnable = obs_data_get_bool(obj, "autoStopEnable");
|
||||
switcher->autoStopType =
|
||||
(AutoStartStopType)obs_data_get_int(obj, "autoStopType");
|
||||
switcher->autoStopScene = GetWeakSourceByName(autoStopScene.c_str());
|
||||
|
||||
std::string autoStartScene =
|
||||
obs_data_get_string(obj, "autoStartSceneName");
|
||||
switcher->autoStartEnable = obs_data_get_bool(obj, "autoStartEnable");
|
||||
switcher->autoStartType =
|
||||
(AutoStartType)obs_data_get_int(obj, "autoStartType");
|
||||
(AutoStartStopType)obs_data_get_int(obj, "autoStartType");
|
||||
switcher->autoStartScene = GetWeakSourceByName(autoStartScene.c_str());
|
||||
|
||||
switcher->verbose = obs_data_get_bool(obj, "verbose");
|
||||
|
|
@ -707,6 +724,16 @@ void SwitcherData::checkSwitchCooldown(bool &match)
|
|||
blog(LOG_INFO, "cooldown active - ignoring match");
|
||||
}
|
||||
|
||||
void populateAutoStartStopTypeSelection(QComboBox *cb)
|
||||
{
|
||||
cb->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recording"));
|
||||
cb->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.streaming"));
|
||||
cb->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recordingAndStreaming"));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setupGeneralTab()
|
||||
{
|
||||
populateSceneSelection(ui->noMatchSwitchScene, false);
|
||||
|
|
@ -734,22 +761,22 @@ void AdvSceneSwitcher::setupGeneralTab()
|
|||
ui->cooldownTime->setToolTip(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint"));
|
||||
|
||||
populateAutoStartStopTypeSelection(ui->autoStopType);
|
||||
|
||||
ui->autoStopSceneCheckBox->setChecked(switcher->autoStopEnable);
|
||||
ui->autoStopScenes->setCurrentText(
|
||||
GetWeakSourceName(switcher->autoStopScene).c_str());
|
||||
ui->autoStopType->setCurrentIndex(switcher->autoStopType);
|
||||
|
||||
if (ui->autoStopSceneCheckBox->checkState()) {
|
||||
ui->autoStopScenes->setDisabled(false);
|
||||
ui->autoStopType->setDisabled(false);
|
||||
} else {
|
||||
ui->autoStopScenes->setDisabled(true);
|
||||
ui->autoStopType->setDisabled(true);
|
||||
}
|
||||
|
||||
ui->autoStartType->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recording"));
|
||||
ui->autoStartType->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.streaming"));
|
||||
ui->autoStartType->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recordingAndStreaming"));
|
||||
populateAutoStartStopTypeSelection(ui->autoStartType);
|
||||
|
||||
ui->autoStartSceneCheckBox->setChecked(switcher->autoStartEnable);
|
||||
ui->autoStartScenes->setCurrentText(
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ public slots:
|
|||
void on_sceneSequenceDown_clicked();
|
||||
|
||||
void on_autoStopSceneCheckBox_stateChanged(int state);
|
||||
void on_autoStopType_currentIndexChanged(int index);
|
||||
void on_autoStopScenes_currentTextChanged(const QString &text);
|
||||
|
||||
void on_autoStartSceneCheckBox_stateChanged(int state);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ typedef enum {
|
|||
RECORDING = 0,
|
||||
STREAMING = 1,
|
||||
RECORINDGSTREAMING = 2
|
||||
} AutoStartType;
|
||||
} AutoStartStopType;
|
||||
|
||||
typedef struct transitionData {
|
||||
std::string name = "";
|
||||
|
|
@ -92,10 +92,11 @@ struct SwitcherData {
|
|||
std::deque<ExecutableSwitch> executableSwitches;
|
||||
|
||||
bool autoStopEnable = false;
|
||||
AutoStartStopType autoStopType = RECORINDGSTREAMING;
|
||||
OBSWeakSource autoStopScene;
|
||||
|
||||
bool autoStartEnable = false;
|
||||
AutoStartType autoStartType = RECORDING;
|
||||
AutoStartStopType autoStartType = RECORDING;
|
||||
OBSWeakSource autoStartScene;
|
||||
bool autoStartedRecently = false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user