mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-08 01:26:04 -05:00
Add backwards compatability to at least OBS 26.1.2
Required for Debian Stable
This commit is contained in:
@@ -629,9 +629,11 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
||||
case OBS_FRONTEND_EVENT_STREAMING_STOPPED:
|
||||
resetLiveTime();
|
||||
break;
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(26, 0, 0)
|
||||
case OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED:
|
||||
setReplayBufferSaved();
|
||||
break;
|
||||
#endif
|
||||
case OBS_FRONTEND_EVENT_TRANSITION_STOPPED:
|
||||
setTranstionEnd();
|
||||
break;
|
||||
|
||||
@@ -185,18 +185,22 @@ void frontEndActionThread(sceneTriggerAction action, double delay)
|
||||
case sceneTriggerAction::STOP_STREAMING:
|
||||
obs_frontend_streaming_stop();
|
||||
break;
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(26, 0, 0)
|
||||
case sceneTriggerAction::START_REPLAY_BUFFER:
|
||||
obs_frontend_replay_buffer_start();
|
||||
break;
|
||||
case sceneTriggerAction::STOP_REPLAY_BUFFER:
|
||||
obs_frontend_replay_buffer_stop();
|
||||
break;
|
||||
#endif
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(27, 0, 0)
|
||||
case sceneTriggerAction::START_VCAM:
|
||||
obs_frontend_start_virtualcam();
|
||||
break;
|
||||
case sceneTriggerAction::STOP_VCAM:
|
||||
obs_frontend_stop_virtualcam();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
blog(LOG_WARNING, "ignoring unexpected frontend action '%d'",
|
||||
static_cast<int>(action));
|
||||
|
||||
@@ -43,9 +43,11 @@ bool MacroActionRecord::PerformAction()
|
||||
obs_frontend_recording_pause(false);
|
||||
}
|
||||
break;
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(28, 0, 0)
|
||||
case RecordAction::SPLIT:
|
||||
obs_frontend_recording_split_file();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ bool MacroActionScreenshot::_registered = MacroActionFactory::Register(
|
||||
|
||||
void MacroActionScreenshot::FrontendScreenshot()
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(26, 0, 0)
|
||||
if (_source) {
|
||||
auto s = obs_weak_source_get_source(_source);
|
||||
obs_frontend_take_source_screenshot(s);
|
||||
@@ -18,6 +19,7 @@ void MacroActionScreenshot::FrontendScreenshot()
|
||||
} else {
|
||||
obs_frontend_take_screenshot();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MacroActionScreenshot::CustomScreenshot()
|
||||
|
||||
@@ -49,8 +49,32 @@ void MacroActionTransition::SetTransitionOverride()
|
||||
obs_source_release(scene);
|
||||
}
|
||||
|
||||
#if (LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(27, 0, 0)) && \
|
||||
(LIBOBS_API_VER < MAKE_SEMANTIC_VERSION(28, 0, 0))
|
||||
void obs_sceneitem_set_transition(obs_sceneitem_t *item, bool show,
|
||||
obs_source_t *transition)
|
||||
{
|
||||
if (show) {
|
||||
obs_sceneitem_set_show_transition(item, transition);
|
||||
} else {
|
||||
obs_sceneitem_set_hide_transition(item, transition);
|
||||
}
|
||||
}
|
||||
|
||||
void obs_sceneitem_set_transition_duration(obs_sceneitem_t *item, bool show,
|
||||
uint32_t duration_ms)
|
||||
{
|
||||
if (show) {
|
||||
obs_sceneitem_set_show_transition_duration(item, duration_ms);
|
||||
} else {
|
||||
obs_sceneitem_set_hide_transition_duration(item, duration_ms);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void MacroActionTransition::SetSourceTransition(bool show)
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(27, 0, 0)
|
||||
auto transition =
|
||||
obs_weak_source_get_source(_transition.GetTransition());
|
||||
obs_data_t *settings = obs_source_get_settings(transition);
|
||||
@@ -73,6 +97,7 @@ void MacroActionTransition::SetSourceTransition(bool show)
|
||||
}
|
||||
|
||||
obs_source_release(t);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MacroActionTransition::PerformAction()
|
||||
|
||||
@@ -16,6 +16,7 @@ const static std::map<VCamAction, std::string> actionTypes = {
|
||||
|
||||
bool MacroActionVCam::PerformAction()
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(27, 0, 0)
|
||||
switch (_action) {
|
||||
case VCamAction::STOP:
|
||||
if (obs_frontend_virtualcam_active()) {
|
||||
@@ -30,6 +31,7 @@ bool MacroActionVCam::PerformAction()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ static std::map<VCamState, std::string> VCamStates = {
|
||||
bool MacroConditionVCam::CheckCondition()
|
||||
{
|
||||
bool stateMatch = false;
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(27, 0, 0)
|
||||
switch (_state) {
|
||||
case VCamState::STOP:
|
||||
stateMatch = !obs_frontend_virtualcam_active();
|
||||
@@ -30,6 +31,7 @@ bool MacroConditionVCam::CheckCondition()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return stateMatch;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include <obs-module.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user