mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-26 03:45:24 -05:00
Remove delay before saving replay buffer
This commit is contained in:
parent
20767630c0
commit
003a1aa696
|
|
@ -352,6 +352,7 @@ AdvSceneSwitcher.action.recording.type.unpause="Unpause recording"
|
|||
AdvSceneSwitcher.action.recording.pause.hint="Note that depending on your recording settings you might not be able to pause recording"
|
||||
AdvSceneSwitcher.action.recording.entry="{{actions}}{{pauseHint}}"
|
||||
AdvSceneSwitcher.action.replay="Replay buffer"
|
||||
AdvSceneSwitcher.action.replay.saveWarn="Warning: Saving too frequently might result in the replay buffer not actually being saved!"
|
||||
AdvSceneSwitcher.action.replay.type.stop="Stop replay buffer"
|
||||
AdvSceneSwitcher.action.replay.type.start="Start replay buffer"
|
||||
AdvSceneSwitcher.action.replay.type.save="Save replay buffer"
|
||||
|
|
|
|||
|
|
@ -28,14 +28,6 @@ public:
|
|||
ReplayBufferAction _action = ReplayBufferAction::STOP;
|
||||
|
||||
private:
|
||||
// Add artifical delay before trying to save the replay buffer again.
|
||||
//
|
||||
// Continiously calling obs_frontend_replay_buffer_save() does not
|
||||
// result in any output actually being written.
|
||||
// OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED also seems to be sent before
|
||||
// any data is written.
|
||||
Duration _duration;
|
||||
|
||||
static bool _registered;
|
||||
static const std::string id;
|
||||
};
|
||||
|
|
@ -62,10 +54,10 @@ private slots:
|
|||
|
||||
protected:
|
||||
QComboBox *_actions;
|
||||
QLabel *_saveWarning;
|
||||
std::shared_ptr<MacroActionReplayBuffer> _entryData;
|
||||
|
||||
private:
|
||||
QHBoxLayout *_mainLayout;
|
||||
bool _loading = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,13 +32,8 @@ bool MacroActionReplayBuffer::PerformAction()
|
|||
}
|
||||
break;
|
||||
case ReplayBufferAction::SAVE:
|
||||
if (obs_frontend_replay_buffer_active() &&
|
||||
_duration.DurationReached()) {
|
||||
if (obs_frontend_replay_buffer_active()) {
|
||||
obs_frontend_replay_buffer_save();
|
||||
// Default buffer size is 20s so waiting for 10s before
|
||||
// trying to save again seems reasonable
|
||||
_duration.seconds = 10;
|
||||
_duration.Reset();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -82,21 +77,25 @@ static inline void populateActionSelection(QComboBox *list)
|
|||
|
||||
MacroActionReplayBufferEdit::MacroActionReplayBufferEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroActionReplayBuffer> entryData)
|
||||
: QWidget(parent)
|
||||
: QWidget(parent),
|
||||
_actions(new QComboBox()),
|
||||
_saveWarning(new QLabel(
|
||||
obs_module_text("AdvSceneSwitcher.action.replay.saveWarn")))
|
||||
{
|
||||
_actions = new QComboBox();
|
||||
|
||||
populateActionSelection(_actions);
|
||||
|
||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(ActionChanged(int)));
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{actions}}", _actions},
|
||||
};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.action.replay.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
layout, widgetPlaceholders);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(layout);
|
||||
mainLayout->addWidget(_saveWarning);
|
||||
setLayout(mainLayout);
|
||||
|
||||
_entryData = entryData;
|
||||
|
|
@ -110,6 +109,8 @@ void MacroActionReplayBufferEdit::UpdateEntryData()
|
|||
return;
|
||||
}
|
||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||
_saveWarning->setVisible(_entryData->_action ==
|
||||
ReplayBufferAction::SAVE);
|
||||
}
|
||||
|
||||
void MacroActionReplayBufferEdit::ActionChanged(int value)
|
||||
|
|
@ -120,6 +121,9 @@ void MacroActionReplayBufferEdit::ActionChanged(int value)
|
|||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_action = static_cast<ReplayBufferAction>(value);
|
||||
_saveWarning->setVisible(_entryData->_action ==
|
||||
ReplayBufferAction::SAVE);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user