mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-22 01:05:53 -05:00
add media state 'any'
This commit is contained in:
@@ -16,6 +16,7 @@ typedef enum {
|
||||
struct MediaSwitch : SceneSwitcherEntry {
|
||||
OBSWeakSource source = nullptr;
|
||||
obs_media_state state = OBS_MEDIA_STATE_NONE;
|
||||
bool anyState = false;
|
||||
time_restriction restriction = TIME_RESTRICTION_NONE;
|
||||
int64_t time = 0;
|
||||
|
||||
@@ -34,6 +35,7 @@ struct MediaSwitch : SceneSwitcherEntry {
|
||||
restriction(restriction_),
|
||||
time(time_)
|
||||
{
|
||||
anyState = state > 7;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -88,7 +88,8 @@ void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
||||
auto time = obs_source_media_get_time(source);
|
||||
obs_media_state state = obs_source_media_get_state(source);
|
||||
bool matched =
|
||||
state == mediaSwitch.state &&
|
||||
((state == mediaSwitch.state) ||
|
||||
mediaSwitch.anyState) &&
|
||||
(mediaSwitch.restriction == TIME_RESTRICTION_NONE ||
|
||||
(mediaSwitch.restriction == TIME_RESTRICTION_LONGER &&
|
||||
time > mediaSwitch.time) ||
|
||||
@@ -222,6 +223,7 @@ void populateMediaStates(QComboBox *list)
|
||||
list->addItem("Stopped");
|
||||
list->addItem("Ended");
|
||||
list->addItem("Error");
|
||||
list->addItem("Any");
|
||||
}
|
||||
|
||||
void populateTimeRestrictions(QComboBox *list)
|
||||
@@ -332,6 +334,7 @@ void MediaSwitchWidget::StateChanged(int index)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->state = (obs_media_state)index;
|
||||
switchData->anyState = switchData->state > 7;
|
||||
}
|
||||
|
||||
void MediaSwitchWidget::TimeRestrictionChanged(int index)
|
||||
|
||||
Reference in New Issue
Block a user