mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add backwards compatability to at least OBS 26.1.2
Required for Debian Stable
This commit is contained in:
parent
106be642aa
commit
a8953f23f4
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.21)
|
||||
cmake_minimum_required(VERSION 3.16.3)
|
||||
|
||||
project(advanced-scene-switcher VERSION 1.0.0)
|
||||
set(LIB_NAME "${PROJECT_NAME}-lib")
|
||||
|
|
@ -267,22 +267,18 @@ target_sources(
|
|||
|
||||
# --- End of section ---
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIB_NAME})
|
||||
|
||||
if(BUILD_OUT_OF_TREE)
|
||||
find_package(libobs REQUIRED)
|
||||
find_package(obs-frontend-api REQUIRED)
|
||||
include(cmake/ObsPluginHelpers.cmake)
|
||||
target_link_libraries(${LIB_NAME} PUBLIC OBS::libobs OBS::obs-frontend-api)
|
||||
else()
|
||||
target_link_libraries(${LIB_NAME} PUBLIC OBS::libobs OBS::frontend-api)
|
||||
endif()
|
||||
include(cmake/AdvSSHelpers.cmake)
|
||||
setup_obs_lib_dependency(${LIB_NAME})
|
||||
setup_obs_lib_dependency(${PROJECT_NAME})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIB_NAME})
|
||||
|
||||
find_qt(COMPONENTS Widgets Core)
|
||||
target_link_libraries(${LIB_NAME} PUBLIC Qt::Core Qt::Widgets)
|
||||
|
||||
include(cmake/AdvSSHelpers.cmake)
|
||||
|
||||
# --- Platform-independent build settings ---
|
||||
|
||||
target_include_directories(
|
||||
|
|
|
|||
|
|
@ -205,14 +205,50 @@ else()
|
|||
endif()
|
||||
|
||||
# --- End of section ---
|
||||
|
||||
function(setup_advss_plugin target)
|
||||
function(setup_obs_lib_dependency target)
|
||||
if(BUILD_OUT_OF_TREE)
|
||||
target_link_libraries(${target} PUBLIC OBS::libobs OBS::obs-frontend-api)
|
||||
find_package(libobs)
|
||||
if(libobs_FOUND)
|
||||
target_link_libraries(${target} PUBLIC OBS::libobs)
|
||||
else()
|
||||
if(NOT LIBOBS_LIB)
|
||||
message(FATAL_ERROR "obs library not found - please set LIBOBS_LIB")
|
||||
endif()
|
||||
target_link_libraries(${target} PUBLIC ${LIBOBS_LIB})
|
||||
if(NOT LIBOBS_INCLUDE_DIR)
|
||||
message(
|
||||
FATAL_ERROR "obs.hpp header not found - please set LIBOBS_INCLUDE_DIR"
|
||||
)
|
||||
endif()
|
||||
target_include_directories(${target} PRIVATE ${LIBOBS_INCLUDE_DIR})
|
||||
endif()
|
||||
find_package(obs-frontend-api)
|
||||
if(obs-frontend-api_FOUND)
|
||||
target_link_libraries(${target} PUBLIC OBS::obs-frontend-api)
|
||||
else()
|
||||
if(NOT LIBOBS_FRONTEND_API_LIB)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"libobs frontend-api library not found - please set LIBOBS_FRONTEND_API_LIB"
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(${target} PUBLIC ${LIBOBS_FRONTEND_API_LIB})
|
||||
if(NOT LIBOBS_FRONTEND_INCLUDE_DIR)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" obs-frontend-api.h not found - please set LIBOBS_FRONTEND_INCLUDE_DIR"
|
||||
)
|
||||
endif()
|
||||
target_include_directories(${target}
|
||||
PRIVATE ${LIBOBS_FRONTEND_INCLUDE_DIR})
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(${target} PUBLIC OBS::libobs OBS::frontend-api)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(setup_advss_plugin target)
|
||||
setup_obs_lib_dependency(${target})
|
||||
find_qt(COMPONENTS Widgets Core)
|
||||
target_link_libraries(${target} PRIVATE Qt::Core Qt::Widgets)
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user