Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced broadcasting support for Twitch #1509

Merged
merged 3 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
IF(CLANG_ANALYZE_CONFIG)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fexceptions -Xclang -fcxx-exceptions")
ENDIF()

Expand Down Expand Up @@ -97,7 +97,7 @@ if (WIN32)
FetchContent_GetProperties(stackwalker)
if(NOT stackwalker_POPULATED)
FetchContent_Populate(stackwalker)
add_subdirectory(${stackwalker_SOURCE_DIR} ${stackwalker_BINARY_DIR})
add_subdirectory(${stackwalker_SOURCE_DIR} ${stackwalker_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()

Expand All @@ -113,6 +113,19 @@ if(NOT nlohmannjson_POPULATED)
FetchContent_Populate(nlohmannjson)
endif()

FetchContent_Declare(
libcurl
URL https://curl.se/download/curl-7.88.1.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP true
OVERRIDE_FIND_PACKAGE
)

FetchContent_GetProperties(libcurl)
if(NOT libcurl_POPULATED)
FetchContent_Populate(libcurl)
add_subdirectory(${libcurl_SOURCE_DIR} ${libcurl_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

add_subdirectory(lib-streamlabs-ipc)
add_subdirectory(obs-studio-client)
add_subdirectory(obs-studio-server)
Expand Down
29 changes: 29 additions & 0 deletions obs-studio-client/source/nodeobs_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,33 @@ Napi::Value settings::OBS_settings_getVideoDevices(const Napi::CallbackInfo &inf
return devices_to_js(info, response);
}

Napi::Value settings::OBS_settings_isEnhancedBroadcasting(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return info.Env().Undefined();

std::vector<ipc::value> response = conn->call_synchronous_helper("Settings", "OBS_settings_isEnhancedBroadcasting", {});

if (!ValidateResponse(info, response))
return info.Env().Undefined();

return Napi::Boolean::New(info.Env(), response[1].value_union.ui32);
}

void settings::OBS_settings_setEnhancedBroadcasting(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return;

const bool enable = info[0].ToBoolean().Value();
std::vector<ipc::value> response = conn->call_synchronous_helper("Settings", "OBS_settings_setEnhancedBroadcasting", {ipc::value(uint32_t(enable))});

if (!ValidateResponse(info, response))
return;
}

void settings::Init(Napi::Env env, Napi::Object exports)
{
exports.Set(Napi::String::New(env, "OBS_settings_getSettings"), Napi::Function::New(env, settings::OBS_settings_getSettings));
Expand All @@ -499,4 +526,6 @@ void settings::Init(Napi::Env env, Napi::Object exports)
exports.Set(Napi::String::New(env, "OBS_settings_getInputAudioDevices"), Napi::Function::New(env, settings::OBS_settings_getInputAudioDevices));
exports.Set(Napi::String::New(env, "OBS_settings_getOutputAudioDevices"), Napi::Function::New(env, settings::OBS_settings_getOutputAudioDevices));
exports.Set(Napi::String::New(env, "OBS_settings_getVideoDevices"), Napi::Function::New(env, settings::OBS_settings_getVideoDevices));
exports.Set(Napi::String::New(env, "OBS_settings_isEnhancedBroadcasting"), Napi::Function::New(env, settings::OBS_settings_isEnhancedBroadcasting));
exports.Set(Napi::String::New(env, "OBS_settings_setEnhancedBroadcasting"), Napi::Function::New(env, settings::OBS_settings_setEnhancedBroadcasting));
}
3 changes: 3 additions & 0 deletions obs-studio-client/source/nodeobs_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,8 @@ Napi::Value OBS_settings_getInputAudioDevices(const Napi::CallbackInfo &info);
Napi::Value OBS_settings_getOutputAudioDevices(const Napi::CallbackInfo &info);
Napi::Value OBS_settings_getVideoDevices(const Napi::CallbackInfo &info);

Napi::Value OBS_settings_isEnhancedBroadcasting(const Napi::CallbackInfo &info);
void OBS_settings_setEnhancedBroadcasting(const Napi::CallbackInfo &info);

static std::vector<std::string> getListCategories(void);
}
22 changes: 21 additions & 1 deletion obs-studio-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ if (WIN32)
lib-streamlabs-ipc
OBS::libobs
dwmapi.lib
dxgi.lib
)
set(PROJECT_INCLUDE_PATHS
"${CMAKE_SOURCE_DIR}/source"
Expand Down Expand Up @@ -286,6 +287,15 @@ SET(osn-server_SOURCES
"${PROJECT_SOURCE_DIR}/source/osn-input.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-module.cpp"
"${PROJECT_SOURCE_DIR}/source/osn-module.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-configuration.cpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-configuration.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-data-model.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-output.cpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-output.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-audio-bitrate.cpp"
"${PROJECT_SOURCE_DIR}/source/osn-audio-bitrate.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-system-info.cpp"
"${PROJECT_SOURCE_DIR}/source/osn-multitrack-video-system-info.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-output.cpp"
"${PROJECT_SOURCE_DIR}/source/osn-output.hpp"
"${PROJECT_SOURCE_DIR}/source/osn-properties.cpp"
Expand Down Expand Up @@ -366,12 +376,15 @@ SET(osn-server_SOURCES
"${PROJECT_SOURCE_DIR}/source/util-memory.cpp"
"${PROJECT_SOURCE_DIR}/source/util-memory.h"

###### json utlities ######
"${PROJECT_SOURCE_DIR}/source/util-json.h"

###### crash-manager ######
"${PROJECT_SOURCE_DIR}/source/util-crashmanager.cpp"
"${PROJECT_SOURCE_DIR}/source/util-crashmanager.h"
"${PROJECT_SOURCE_DIR}/source/util-metricsprovider.cpp"
"${PROJECT_SOURCE_DIR}/source/util-metricsprovider.h"

###### callback-manager ######
"${PROJECT_SOURCE_DIR}/source/callback-manager.cpp"
"${PROJECT_SOURCE_DIR}/source/callback-manager.h"
Expand Down Expand Up @@ -409,6 +422,9 @@ if(WIN32)
target_sources(${PROJECT_NAME} PUBLIC "${PROJECT_BINARY_DIR}/version.rc")
endif()

#target_link_libraries(${PROJECT_NAME} CURL::libcurl)
target_link_libraries(${PROJECT_NAME} libcurl)

if(WIN32)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_INCLUDE_PATHS})
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBRARIES} optimized crashpad strmiids)
Expand All @@ -417,6 +433,10 @@ else()
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBRARIES} crashpad ${COREFOUNDATION} ${COCOA} ${IOSURF} ${GLKIT} ${AVFOUNDATION} ${IOKit} ${SECURITY_LIBRARY} ${BSM_LIBRARY})
endif()

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
endif()

#Define the OSN_VERSION
add_compile_definitions(OSN_VERSION=\"$ENV{tagartifact}\")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "obs${BITS}")
Expand Down
Binary file modified obs-studio-server/dependencies/obs64.exe.txt
Binary file not shown.
Loading