diff --git a/CMakeLists.txt b/CMakeLists.txt index 435ba77a..ac7c9baf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,14 +100,29 @@ if(BUILD_OUT_OF_TREE) find_package(CURL REQUIRED) include_directories("${CURL_INCLUDE_DIRS}") + + # Backwards compatability with older OBS versions + if(LibObs_VERSION_MAJOR GREATER_EQUAL 27) + add_definitions(-DVCAM_SUPPORTED) + else() + message( + WARNING + "OBS version ${LibObs_VERSION_MAJOR} found - disabling virtual camera functionality" + ) + endif() + if(LibObs_VERSION_MAJOR GREATER_EQUAL 26) + add_definitions(-DREPLAYBUFFER_SUPPORTED) + else() + message( + WARNING + "OBS version ${LibObs_VERSION_MAJOR} found - disabling replay buffer functionality" + ) + endif() else() find_package(Libcurl REQUIRED) include_directories("${LIBCURL_INCLUDE_DIRS}") -endif() - -# Backwards compatability with older OBS versions -if(LibObs_VERSION_MAJOR GREATER_EQUAL 27 OR NOT LibObs_VERSION_MAJOR) add_definitions(-DVCAM_SUPPORTED) + add_definitions(-DREPLAYBUFFER_SUPPORTED) endif() # Platform specific settings diff --git a/src/advanced-scene-switcher.cpp b/src/advanced-scene-switcher.cpp index f491f90b..84be78aa 100644 --- a/src/advanced-scene-switcher.cpp +++ b/src/advanced-scene-switcher.cpp @@ -579,9 +579,11 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher) case OBS_FRONTEND_EVENT_STREAMING_STOPPED: resetLiveTime(); break; +#ifdef REPLAYBUFFER_SUPPORTED case OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED: setReplayBufferSaved(); break; +#endif default: break; } diff --git a/src/headers/macro-action-replay-buffer.hpp b/src/headers/macro-action-replay-buffer.hpp index 91f1f75d..402003be 100644 --- a/src/headers/macro-action-replay-buffer.hpp +++ b/src/headers/macro-action-replay-buffer.hpp @@ -1,3 +1,5 @@ +#ifdef REPLAYBUFFER_SUPPORTED + #pragma once #include "macro-action-edit.hpp" #include "duration-control.hpp" @@ -65,3 +67,5 @@ private: QHBoxLayout *_mainLayout; bool _loading = true; }; + +#endif diff --git a/src/headers/macro-condition-replay-buffer.hpp b/src/headers/macro-condition-replay-buffer.hpp index 88702aae..1d0aa6ee 100644 --- a/src/headers/macro-condition-replay-buffer.hpp +++ b/src/headers/macro-condition-replay-buffer.hpp @@ -1,3 +1,5 @@ +#ifdef REPLAYBUFFER_SUPPORTED + #pragma once #include "macro.hpp" #include @@ -54,3 +56,5 @@ protected: private: bool _loading = true; }; + +#endif diff --git a/src/macro-action-replay-buffer.cpp b/src/macro-action-replay-buffer.cpp index d0351766..ab2e0968 100644 --- a/src/macro-action-replay-buffer.cpp +++ b/src/macro-action-replay-buffer.cpp @@ -1,3 +1,5 @@ +#ifdef REPLAYBUFFER_SUPPORTED + #include "headers/macro-action-replay-buffer.hpp" #include "headers/advanced-scene-switcher.hpp" #include "headers/utility.hpp" @@ -119,3 +121,5 @@ void MacroActionReplayBufferEdit::ActionChanged(int value) std::lock_guard lock(switcher->m); _entryData->_action = static_cast(value); } + +#endif diff --git a/src/macro-condition-replay-buffer.cpp b/src/macro-condition-replay-buffer.cpp index e5d39806..b1f29f1c 100644 --- a/src/macro-condition-replay-buffer.cpp +++ b/src/macro-condition-replay-buffer.cpp @@ -1,3 +1,5 @@ +#ifdef REPLAYBUFFER_SUPPORTED + #include "headers/macro-condition-edit.hpp" #include "headers/macro-condition-replay-buffer.hpp" #include "headers/utility.hpp" @@ -106,3 +108,5 @@ void MacroConditionReplayBufferEdit::UpdateEntryData() _state->setCurrentIndex(static_cast(_entryData->_state)); } + +#endif diff --git a/src/scene-trigger.cpp b/src/scene-trigger.cpp index 59351e0c..ab56fcba 100644 --- a/src/scene-trigger.cpp +++ b/src/scene-trigger.cpp @@ -185,18 +185,22 @@ void frontEndActionThread(sceneTriggerAction action, double delay) case sceneTriggerAction::STOP_STREAMING: obs_frontend_streaming_stop(); break; +#ifdef REPLAYBUFFER_SUPPORTED case sceneTriggerAction::START_REPLAY_BUFFER: obs_frontend_replay_buffer_start(); break; case sceneTriggerAction::STOP_REPLAY_BUFFER: obs_frontend_replay_buffer_stop(); break; +#endif +#ifdef VCAM_SUPPORTED 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(action));