From 0e08c15675afadcf21a5922108ec40a05a1a96c0 Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Wed, 4 Sep 2024 13:38:38 -0700 Subject: [PATCH 01/11] update browser fix excessive logging ffmpeg binaries install ffmpeg binaries install ffmpeg binaries install ffmpeg binaries install fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix lib path fix paths script update fix ndi update ndi plugin update ndi plugin obs ndi update update obs-ndi obs ndi update fix sentry debug upload some debug output for sentry upload script some debug output for sentry upload script some debug output for sentry upload script some debug output for sentry upload script fix source fail to create crash capture source crash capture source crash capture source crash more logging for capture error more logging for capture error more logging for capture error more logging for capture error --- .github/workflows/main.yml | 6 + CI/macos/fix_deps_paths.sh | 72 ++++++ cmake/macos/helpers.cmake | 155 +++++++++---- dependencies/obs-ndi.dll.txt | 1 - libobs/obs.c | 15 +- plugins/CMakeLists.txt | 1 + plugins/coreaudio-encoder/encoder.cpp | 8 +- plugins/mac-capture/mac-screen-capture.m | 274 ++++++++++++++--------- plugins/obs-browser | 2 +- plugins/obs-ndi | 2 +- slobs_CI/sentry-osx.py | 55 ++++- 11 files changed, 422 insertions(+), 169 deletions(-) create mode 100755 CI/macos/fix_deps_paths.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7809d34fa1ef09..0576b00aa097c2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -243,6 +243,12 @@ jobs: name: 'obs-studio-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}' path: ${{env.PACKAGE_NAME}}-macos-release-${{ steps.setup.outputs.commitHash }}-${{ matrix.arch }}.tar.gz + - name: 'Upload debug files to Sentry' + if: startsWith(github.ref, 'refs/tags/') + run: 'python ./slobs_CI/sentry-osx.py' + env: + SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}} + BUILDCONFIG: RelWithDebInfo linux_build: name: '02 - Linux' diff --git a/CI/macos/fix_deps_paths.sh b/CI/macos/fix_deps_paths.sh new file mode 100755 index 00000000000000..28a5036aeea53d --- /dev/null +++ b/CI/macos/fix_deps_paths.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Check if a file path is passed as an argument +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +BINARY_PATH=$1 + +# Use otool to get the list of linked libraries +LIB_PATHS=$(otool -L "$BINARY_PATH" | grep "obs-deps" | awk '{print $1}') + +# Check if any obs-deps libraries were found +if [ -z "$LIB_PATHS" ]; then + echo "No obs-deps libraries found in $BINARY_PATH." +else + # Loop through each library path and change it to @loader_path, removing version from the name + for OLD_PATH in $LIB_PATHS; do + # Extract the base library name without version + LIB_NAME=$(basename "$OLD_PATH" | sed -E 's/\.[0-9]+\.dylib$/.dylib/') + + # Construct the new path using @loader_path + NEW_PATH="@loader_path/$LIB_NAME" + + # Print what we are changing for logging + echo "Changing $OLD_PATH to $NEW_PATH" + + # Run the install_name_tool command to make the change + install_name_tool -change "$OLD_PATH" "$NEW_PATH" "$BINARY_PATH" + done + + echo "All obs-deps libraries have been updated to use @loader_path and version-less names in $BINARY_PATH." +fi + +# Additional libraries that use @rpath should be converted to @loader_path +OTHER_LIBS=$(otool -L "$BINARY_PATH" | grep "@rpath" | awk '{print $1}') + +if [ -n "$OTHER_LIBS" ]; then + for OLD_PATH in $OTHER_LIBS; do + # Extract the base library name without version + LIB_NAME=$(basename "$OLD_PATH" | sed -E 's/\.[0-9]+\.dylib$/.dylib/') + + # Construct the new path using @loader_path + NEW_PATH="@loader_path/$LIB_NAME" + + # Print what we are changing for logging + echo "Changing $OLD_PATH to $NEW_PATH" + + # Run the install_name_tool command to make the change + install_name_tool -change "$OLD_PATH" "$NEW_PATH" "$BINARY_PATH" + done + + echo "All @rpath libraries have been updated to use @loader_path in $BINARY_PATH." +else + echo "No @rpath libraries found." +fi + +# Add @executable_path/../Frameworks to rpath as a fallback +echo "Adding @executable_path/../Frameworks as an rpath fallback" +install_name_tool -add_rpath "@executable_path/../Frameworks" "$BINARY_PATH" + +# Check if the binary is signed (for macOS app distribution) +CODESIGN_STATUS=$(codesign -vv "$BINARY_PATH" 2>&1) + +if [[ "$CODESIGN_STATUS" == *"not signed"* ]]; then + echo "Binary is not signed. Please sign it for distribution if necessary." +else + echo "Binary is already signed." +fi + +echo "All modifications are done." diff --git a/cmake/macos/helpers.cmake b/cmake/macos/helpers.cmake index 2faac1d7f5b69f..a8bdb1a8839494 100644 --- a/cmake/macos/helpers.cmake +++ b/cmake/macos/helpers.cmake @@ -11,7 +11,7 @@ include(helpers_common) # set_target_properties_obs: Set target properties for use in obs-studio function(set_target_properties_obs target) -message(STATUS "[set_target_properties_obs] Setting target properties for ${target}...") + message(STATUS "[set_target_properties_obs] Setting target properties for ${target}...") set(options "") set(oneValueArgs "") set(multiValueArgs PROPERTIES) @@ -23,6 +23,7 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ list(POP_FRONT _STPO_PROPERTIES key value) set_property(TARGET ${target} PROPERTY ${key} "${value}") endwhile() + get_target_property(target_type ${target} TYPE) # Target is a GUI or CLI application @@ -32,19 +33,19 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ set_target_properties( ${target} PROPERTIES OUTPUT_NAME OBS - MACOSX_BUNDLE TRUE - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.obs-studio - XCODE_ATTRIBUTE_PRODUCT_NAME OBS - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon - XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY YES - XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY YES - XCODE_EMBED_PLUGINS_REMOVE_HEADERS_ON_COPY YES - XCODE_EMBED_PLUGINS_CODE_SIGN_ON_COPY YES - XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO - XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES - XCODE_ATTRIBUTE_SKIP_INSTALL NO - XCODE_ATTRIBUTE_INSTALL_PATH "$(LOCAL_APPS_DIR)") + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.obs-studio + XCODE_ATTRIBUTE_PRODUCT_NAME OBS + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon + XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY YES + XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY YES + XCODE_EMBED_PLUGINS_REMOVE_HEADERS_ON_COPY YES + XCODE_EMBED_PLUGINS_CODE_SIGN_ON_COPY YES + XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO + XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES + XCODE_ATTRIBUTE_SKIP_INSTALL NO + XCODE_ATTRIBUTE_INSTALL_PATH "$(LOCAL_APPS_DIR)") get_property(obs_dependencies GLOBAL PROPERTY _OBS_DEPENDENCIES) add_dependencies(${target} ${obs_dependencies}) @@ -68,15 +69,16 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ get_property(obs_executables GLOBAL PROPERTY _OBS_EXECUTABLES) add_dependencies(${target} ${obs_executables}) + foreach(executable IN LISTS obs_executables) set_property( TARGET ${executable} PROPERTY XCODE_ATTRIBUTE_INSTALL_PATH - "$(LOCAL_APPS_DIR)/$/Contents/MacOS") + "$(LOCAL_APPS_DIR)/$/Contents/MacOS") add_custom_command( TARGET ${target} POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$" - "$/MacOS/" + "$/MacOS/" COMMENT "Copy ${executable} to application bundle") endforeach() @@ -87,12 +89,12 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ TARGET ${target} POST_BUILD COMMAND - /usr/bin/sed -i '' 's/font-size: 10pt\;/font-size: 12pt\;/' - "$/Resources/themes/Acri.qss" - "$/Resources/themes/Grey.qss" - "$/Resources/themes/Light.qss" - "$/Resources/themes/Rachni.qss" - "$/Resources/themes/Yami.qss" + /usr/bin/sed -i '' 's/font-size: 10pt\;/font-size: 12pt\;/' + "$/Resources/themes/Acri.qss" + "$/Resources/themes/Grey.qss" + "$/Resources/themes/Light.qss" + "$/Resources/themes/Rachni.qss" + "$/Resources/themes/Yami.qss" COMMENT "Patch Qt stylesheets to use larger default font size on macOS") add_custom_command( @@ -114,7 +116,7 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ TARGET ${target} POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "$" - "$/Resources/$" + "$/Resources/$" COMMENT "Add OBS DAL plugin to application bundle") endif() @@ -123,7 +125,7 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ TARGET ${target} POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$/obspython.py" - "$/Resources" + "$/Resources" COMMENT "Add OBS::python import module") endif() @@ -141,25 +143,26 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ set_target_properties( ${target} PROPERTIES NO_SONAME TRUE - MACHO_COMPATIBILITY_VERSION 1.0 - MACHO_CURRENT_VERSION ${OBS_VERSION_MAJOR} - SOVERSION 0 - VERSION 0 - XCODE_ATTRIBUTE_DYLIB_COMPATIBILITY_VERSION 1.0 - XCODE_ATTRIBUTE_DYLIB_CURRENT_VERSION ${OBS_VERSION_MAJOR} - XCODE_ATTRIBUTE_PRODUCT_NAME ${target} - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target} - XCODE_ATTRIBUTE_SKIP_INSTALL YES) + MACHO_COMPATIBILITY_VERSION 1.0 + MACHO_CURRENT_VERSION ${OBS_VERSION_MAJOR} + SOVERSION 0 + VERSION 0 + XCODE_ATTRIBUTE_DYLIB_COMPATIBILITY_VERSION 1.0 + XCODE_ATTRIBUTE_DYLIB_CURRENT_VERSION ${OBS_VERSION_MAJOR} + XCODE_ATTRIBUTE_PRODUCT_NAME ${target} + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target} + XCODE_ATTRIBUTE_SKIP_INSTALL YES) get_target_property(is_framework ${target} FRAMEWORK) + if(is_framework) _check_info_plist() set_target_properties( ${target} PROPERTIES FRAMEWORK_VERSION A - MACOSX_FRAMEWORK_IDENTIFIER com.obsproject.${target} - MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" - XCODE_ATTRIBUTE_SKIP_INSTALL YES) + MACOSX_FRAMEWORK_IDENTIFIER com.obsproject.${target} + MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" + XCODE_ATTRIBUTE_SKIP_INSTALL YES) endif() _add_entitlements() @@ -169,10 +172,10 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ elseif(target_type STREQUAL MODULE_LIBRARY) if(target STREQUAL obspython) set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_PRODUCT_NAME ${target} - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target}) + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target}) elseif(target STREQUAL obslua) set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_PRODUCT_NAME ${target} - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target}) + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target}) elseif(target STREQUAL obs-dal-plugin) set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) set_property(GLOBAL APPEND PROPERTY _OBS_DEPENDENCIES ${target}) @@ -182,15 +185,16 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ set_target_properties( ${target} PROPERTIES BUNDLE TRUE - BUNDLE_EXTENSION plugin - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" - XCODE_ATTRIBUTE_PRODUCT_NAME ${target} - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target}) + BUNDLE_EXTENSION plugin + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" + XCODE_ATTRIBUTE_PRODUCT_NAME ${target} + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.${target}) if(target STREQUAL obs-browser) # Good-enough for now as there are no other variants - in _theory_ we should only add the appropriate variant, # but that is only known at project generation and not build system configuration. get_target_property(imported_location CEF::Library IMPORTED_LOCATION_RELEASE) + if(imported_location) list(APPEND cef_items "${imported_location}") endif() @@ -211,6 +215,7 @@ message(STATUS "[set_target_properties_obs] Setting target properties for ${targ endif() target_install_resources(${target}) + target_install_ffmpeg_and_ffprobe(${target}) get_target_property(target_sources ${target} SOURCES) set(target_ui_files ${target_sources}) @@ -255,14 +260,14 @@ endmacro() macro(_add_entitlements) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/entitlements.plist") set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/entitlements.plist") + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/entitlements.plist") endif() endmacro() # target_export: Helper function to export target as CMake package function(target_export target) # Exclude CMake package from 'ALL' target - #set(exclude_variant EXCLUDE_FROM_ALL) + # set(exclude_variant EXCLUDE_FROM_ALL) set(exclude_variant "") _target_export(${target}) endfunction() @@ -270,11 +275,13 @@ endfunction() # target_install_resources: Helper function to add resources into bundle function(target_install_resources target) message(DEBUG "Installing resources for target ${target}...") + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/data") file(GLOB_RECURSE data_files "${CMAKE_CURRENT_SOURCE_DIR}/data/*") + foreach(data_file IN LISTS data_files) cmake_path(RELATIVE_PATH data_file BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/" OUTPUT_VARIABLE - relative_path) + relative_path) cmake_path(GET relative_path PARENT_PATH relative_path) target_sources(${target} PRIVATE "${data_file}") set_property(SOURCE "${data_file}" PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${relative_path}") @@ -282,6 +289,55 @@ function(target_install_resources target) endforeach() endif() endfunction() +# Function to install ffmpeg and ffprobe binaries +function(target_install_ffmpeg_and_ffprobe target) + if(TARGET OBS::ffmpeg) + # Adjust the path relative to FFmpeg_INCLUDE_DIRS + get_filename_component(ffmpeg_bin_dir "${FFmpeg_INCLUDE_DIRS}/../bin" REALPATH) + set(ffmpeg_path "${ffmpeg_bin_dir}/ffmpeg") + set(ffprobe_path "${ffmpeg_bin_dir}/ffprobe") + set(destination "${CMAKE_INSTALL_PREFIX}/OBS.app/Contents/Frameworks") + set(FINAL_FFMPEG_PATH "${destination}/ffmpeg") + set(FINAL_FFPROBE_PATH "${destination}/ffprobe") + + # Install ffmpeg + if(EXISTS "${ffmpeg_path}") + message(STATUS "Found ffmpeg at ${ffmpeg_path}") + install( + FILES "${ffmpeg_path}" + DESTINATION "${destination}" + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + + # Run the fix_deps_paths.sh script at install time with the full absolute path + install(CODE " + message(\"Running fix_deps_paths.sh on ${FINAL_FFMPEG_PATH}\") + execute_process(COMMAND bash \"${CMAKE_SOURCE_DIR}/CI/macos/fix_deps_paths.sh\" \"${FINAL_FFMPEG_PATH}\") + ") + else() + message(WARNING "ffmpeg not found at ${ffmpeg_path}") + endif() + + # Install ffprobe + if(EXISTS "${ffprobe_path}") + message(STATUS "Found ffprobe at ${ffprobe_path}") + install( + FILES "${ffprobe_path}" + DESTINATION "${destination}" + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + + # Run the fix_deps_paths.sh script for ffprobe with the full absolute path + install(CODE " + message(\"Running fix_deps_paths.sh on ${FINAL_FFPROBE_PATH}\") + execute_process(COMMAND bash \"${CMAKE_SOURCE_DIR}/CI/macos/fix_deps_paths.sh\" \"${FINAL_FFPROBE_PATH}\") + ") + else() + message(WARNING "ffprobe not found at ${ffprobe_path}") + endif() + endif() +endfunction() + # target_add_resource: Helper function to add a specific resource to a bundle function(target_add_resource target resource) @@ -299,12 +355,14 @@ function(_bundle_dependencies target) get_property(obs_module_list GLOBAL PROPERTY OBS_MODULES_ENABLED) list(LENGTH obs_module_list num_modules) + if(num_modules GREATER 0) add_dependencies(${target} ${obs_module_list}) set_property( TARGET ${target} APPEND PROPERTY XCODE_EMBED_PLUGINS ${obs_module_list}) + foreach(module IN LISTS obs_module_list) find_dependencies(TARGET ${module} FOUND_VAR found_dependencies) endforeach() @@ -324,6 +382,7 @@ function(_bundle_dependencies target) if(is_imported) get_target_property(imported_location ${library} LOCATION) + if(NOT imported_location) continue() endif() @@ -335,8 +394,10 @@ function(_bundle_dependencies target) if(is_xcode_framework) break() endif() + cmake_path(IS_PREFIX sdk_library_path "${imported_location}" is_xcode_framework) endforeach() + cmake_path(IS_PREFIX system_library_path "${imported_location}" is_system_framework) if(is_system_framework OR is_xcode_framework) @@ -356,6 +417,7 @@ function(_bundle_dependencies target) if(library MATCHES "Qt[56]?::.+") find_qt_plugins(COMPONENT ${library} TARGET ${target} FOUND_VAR plugins_list) endif() + list(APPEND library_paths ${library_location}) elseif(NOT imported AND library_type STREQUAL "SHARED_LIBRARY") message(TRACE "${library} is a project target") @@ -364,6 +426,7 @@ function(_bundle_dependencies target) endforeach() list(REMOVE_DUPLICATES plugins_list) + foreach(plugin IN LISTS plugins_list) cmake_path(GET plugin PARENT_PATH plugin_path) set(plugin_base_dir "${plugin_path}/../") @@ -371,7 +434,7 @@ function(_bundle_dependencies target) cmake_path(RELATIVE_PATH plugin_path BASE_DIRECTORY "${plugin_stem_dir}" OUTPUT_VARIABLE plugin_file_name) target_sources(${target} PRIVATE "${plugin}") set_source_files_properties("${plugin}" PROPERTIES MACOSX_PACKAGE_LOCATION "plugins/${plugin_file_name}" - XCODE_FILE_ATTRIBUTES "CodeSignOnCopy") + XCODE_FILE_ATTRIBUTES "CodeSignOnCopy") source_group("Qt plugins" FILES "${plugin}") endforeach() diff --git a/dependencies/obs-ndi.dll.txt b/dependencies/obs-ndi.dll.txt index c5d817e9f6c958..915672f21d3d78 100644 --- a/dependencies/obs-ndi.dll.txt +++ b/dependencies/obs-ndi.dll.txt @@ -10,7 +10,6 @@ VCRUNTIME140.dll VCRUNTIME140_1.dll api-ms-win-crt-runtime-l1-1-0.dll - api-ms-win-crt-convert-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll > Summary diff --git a/libobs/obs.c b/libobs/obs.c index 626c69d6387b55..d2ad0bd48e7848 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -3267,6 +3267,7 @@ obs_context_data_init_wrap(struct obs_context_data *context, context->name = dup_name(name, private); context->settings = obs_data_newref(settings); context->hotkey_data = obs_data_newref(hotkey_data); + context->mutex = &obs->data.sources_mutex; return true; } @@ -3433,8 +3434,12 @@ void obs_context_data_remove_name(struct obs_context_data *context, void *phead) if (!context) return; + struct obs_context_data *item = NULL; pthread_mutex_lock(context->mutex); - HASH_DELETE(hh, *head, context); + HASH_FIND_STR(*head, context->name, item); + if (item) { + HASH_DELETE(hh, *head, context); + } pthread_mutex_unlock(context->mutex); } @@ -3448,8 +3453,14 @@ void obs_context_data_remove_uuid(struct obs_context_data *context, if (!context || !context->uuid || !uuid_head) return; + struct obs_context_data *item = NULL; + pthread_mutex_lock(context->mutex); - HASH_DELETE(hh_uuid, *uuid_head, context); + HASH_FIND_UUID(*uuid_head, context->uuid, item); + if (item) { + HASH_DELETE(hh_uuid, *uuid_head, context); + } + pthread_mutex_unlock(context->mutex); } diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 924171496193ea..d563d8cf1fd38b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -86,6 +86,7 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) OR OS_MACOS OR OS_LINUX) add_subdirectory(vlc-video) + add_subdirectory(obs-ndi) endif() if(OS_WINDOWS) add_subdirectory(win-capture) diff --git a/plugins/coreaudio-encoder/encoder.cpp b/plugins/coreaudio-encoder/encoder.cpp index 689be6a0dcac97..fdb401531056cf 100644 --- a/plugins/coreaudio-encoder/encoder.cpp +++ b/plugins/coreaudio-encoder/encoder.cpp @@ -1255,11 +1255,11 @@ static vector get_bitrates(DStr &log, ca_encoder *ca, auto handle_bitrate = [&](UInt32 bitrate) { if (find(begin(bitrates), end(bitrates), bitrate) == end(bitrates)) { - log_to_dstr(log, ca, "Adding bitrate %u\n", + log_to_dstr(log, ca, "Add %u, ", static_cast(bitrate)); bitrates.push_back(bitrate); } else { - log_to_dstr(log, ca, "Bitrate %u already added\n", + log_to_dstr(log, ca, "Has %u, ", static_cast(bitrate)); } }; @@ -1270,7 +1270,7 @@ static vector get_bitrates(DStr &log, ca_encoder *ca, if (min_ == max_) return; - log_to_dstr(log, ca, "Got actual bitrate range: %u<->%u\n", + log_to_dstr(log, ca, "Range %u<->%u, ", static_cast(min_), static_cast(max_)); @@ -1281,7 +1281,7 @@ static vector get_bitrates(DStr &log, ca_encoder *ca, return bitrates; for (UInt32 format_id : (ca ? *ca->allowed_formats : aac_formats)) { - log_to_dstr(log, ca, "Trying %s (0x%x) at %g" NBSP "hz\n", + log_to_dstr(log, ca, "Try %s (0x%x) at %g" NBSP "hz, ", format_id_to_str(format_id), static_cast(format_id), samplerate); diff --git a/plugins/mac-capture/mac-screen-capture.m b/plugins/mac-capture/mac-screen-capture.m index c92bfa79980394..7d9159b7ff5e14 100644 --- a/plugins/mac-capture/mac-screen-capture.m +++ b/plugins/mac-capture/mac-screen-capture.m @@ -23,6 +23,7 @@ bool is_screen_capture_available(void) #include #include #include +#include #define MACCAP_LOG(level, msg, ...) \ blog(level, "[ mac-screencapture ]: " msg, ##__VA_ARGS__) @@ -337,28 +338,65 @@ static inline void screen_stream_audio_update(struct screen_capture *sc, obs_source_output_audio(sc->source, &audio_data); } +static bool hasScreenRecordingPermission() +{ + if (@available(macOS 10.15, *)) { + return CGPreflightScreenCaptureAccess(); + } else { + return YES; // On earlier versions, no permission is required + } +} + +static void requestScreenRecordingPermission() +{ + if (@available(macOS 10.15, *)) { + dispatch_semaphore_t sema = dispatch_semaphore_create(0); + CGRequestScreenCaptureAccess(); + dispatch_semaphore_signal(sema); + } +} + static bool init_screen_stream(struct screen_capture *sc) { - SCContentFilter *content_filter; + MACCAP_LOG(LOG_WARNING, "Entering init_screen_stream"); + + if (!hasScreenRecordingPermission()) { + MACCAP_ERR("Screen recording permission not granted"); + dispatch_async(dispatch_get_main_queue(), ^{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText:@"Screen Recording Permission Required"]; + [alert setInformativeText:@"Please grant Screen Recording permission in System Preferences > Security & Privacy > Privacy > Screen Recording, then restart the application."]; + [alert addButtonWithTitle:@"OK"]; + [alert runModal]; + [alert release]; + + NSURL *url = [NSURL fileURLWithPath:@"/System/Library/PreferencePanes/Security.prefPane"]; + [[NSWorkspace sharedWorkspace] openURL:url]; + }); + + return false; + } + MACCAP_LOG(LOG_WARNING, "Initializing stream configuration"); + SCContentFilter *content_filter = nil; sc->frame = CGRectZero; sc->stream_properties = [[SCStreamConfiguration alloc] init]; + MACCAP_LOG(LOG_WARNING, "Waiting for shareable content"); os_sem_wait(sc->shareable_content_available); SCDisplay * (^get_target_display)() = ^SCDisplay *() { __block SCDisplay *target_display = nil; - [sc->shareable_content.displays - indexOfObjectPassingTest:^BOOL( - SCDisplay *_Nonnull display, NSUInteger idx, - BOOL *_Nonnull stop) { - if (display.displayID == sc->display) { - target_display = sc->shareable_content - .displays[idx]; - *stop = TRUE; - } - return *stop; - }]; + [sc->shareable_content.displays indexOfObjectPassingTest:^BOOL(SCDisplay *_Nonnull display, NSUInteger idx, BOOL *_Nonnull stop) { + if (display.displayID == sc->display) { + target_display = sc->shareable_content.displays[idx]; + *stop = TRUE; + } + return *stop; + }]; + if (!target_display) { + MACCAP_LOG(LOG_WARNING, "Target display not found. Display ID: %d", sc->display); + } return target_display; }; @@ -374,173 +412,193 @@ static bool init_screen_stream(struct screen_capture *sc) CGDisplayModeRelease(display_mode); }; + MACCAP_LOG(LOG_WARNING, "Capture type: %d", sc->capture_type); switch (sc->capture_type) { case ScreenCaptureDisplayStream: { + MACCAP_LOG(LOG_WARNING, "Initializing display stream capture"); SCDisplay *target_display = get_target_display(); + if (!target_display) { + MACCAP_ERR("Target display not found"); + os_sem_post(sc->shareable_content_available); + return false; + } + MACCAP_LOG(LOG_WARNING, "Creating content filter for display ID: %d", target_display.displayID); NSArray *empty = [[NSArray alloc] init]; - content_filter = [[SCContentFilter alloc] - initWithDisplay:target_display - excludingWindows:empty]; + content_filter = [[SCContentFilter alloc] initWithDisplay:target_display excludingWindows:empty]; [empty release]; set_display_mode(sc, target_display); } break; + case ScreenCaptureWindowStream: { + MACCAP_LOG(LOG_WARNING, "Initializing window stream capture"); __block SCWindow *target_window = nil; - if (sc->window != 0) { - [sc->shareable_content.windows - indexOfObjectPassingTest:^BOOL( - SCWindow *_Nonnull window, - NSUInteger idx, BOOL *_Nonnull stop) { - if (window.windowID == sc->window) { - target_window = - sc->shareable_content - .windows[idx]; - *stop = TRUE; - } - return *stop; - }]; - } else { - target_window = - [sc->shareable_content.windows objectAtIndex:0]; + [sc->shareable_content.windows indexOfObjectPassingTest:^BOOL(SCWindow *_Nonnull window, NSUInteger idx, BOOL *_Nonnull stop) { + if (window.windowID == sc->window) { + target_window = sc->shareable_content.windows[idx]; + *stop = TRUE; + } + return *stop; + }]; + + MACCAP_LOG(LOG_WARNING, "Window count: %lu", (unsigned long)[sc->shareable_content.windows count]); + if (!target_window && [sc->shareable_content.windows count] > 0) { + target_window = [sc->shareable_content.windows objectAtIndex:0]; sc->window = target_window.windowID; + MACCAP_LOG(LOG_WARNING, "Using fallback window. Window ID: %d", sc->window); } - content_filter = [[SCContentFilter alloc] - initWithDesktopIndependentWindow:target_window]; - if (target_window) { - [sc->stream_properties - setWidth:(size_t)target_window.frame.size.width]; - [sc->stream_properties - setHeight:(size_t)target_window.frame.size - .height]; + if (!target_window) { + MACCAP_ERR("Target window not found. Window ID: %d", sc->window); + os_sem_post(sc->shareable_content_available); + return false; } + MACCAP_LOG(LOG_WARNING, "Creating content filter for window ID: %d", target_window.windowID); + content_filter = [[SCContentFilter alloc] initWithDesktopIndependentWindow:target_window]; + + [sc->stream_properties setWidth:(size_t)target_window.frame.size.width]; + [sc->stream_properties setHeight:(size_t)target_window.frame.size.height]; + MACCAP_LOG(LOG_WARNING, "Window dimensions set to: %zux%zu", (size_t)target_window.frame.size.width, (size_t)target_window.frame.size.height); } break; + case ScreenCaptureApplicationStream: { + MACCAP_LOG(LOG_WARNING, "Initializing application stream capture"); SCDisplay *target_display = get_target_display(); + if (!target_display) { + MACCAP_ERR("Target display not found for application capture"); + os_sem_post(sc->shareable_content_available); + return false; + } + + MACCAP_LOG(LOG_WARNING, "Searching for application with bundle ID: %s", [sc->application_id UTF8String]); __block SCRunningApplication *target_application = nil; - { - [sc->shareable_content.applications - indexOfObjectPassingTest:^BOOL( - SCRunningApplication - *_Nonnull application, - NSUInteger idx, BOOL *_Nonnull stop) { - if ([application.bundleIdentifier - isEqualToString: - sc-> - application_id]) { - target_application = - sc->shareable_content - .applications - [idx]; - *stop = TRUE; - } - return *stop; - }]; + [sc->shareable_content.applications indexOfObjectPassingTest:^BOOL(SCRunningApplication *_Nonnull application, NSUInteger idx, BOOL *_Nonnull stop) { + if ([application.bundleIdentifier isEqualToString:sc->application_id]) { + target_application = sc->shareable_content.applications[idx]; + *stop = TRUE; + } + return *stop; + }]; + + if (!target_application) { + MACCAP_ERR("Target application not found with bundle ID: %s", [sc->application_id UTF8String]); + os_sem_post(sc->shareable_content_available); + return false; } - NSArray *target_application_array = [[NSArray alloc] - initWithObjects:target_application, nil]; + MACCAP_LOG(LOG_WARNING, "Creating content filter for application"); + NSArray *target_application_array = [[NSArray alloc] initWithObjects:target_application, nil]; NSArray *empty_array = [[NSArray alloc] init]; - content_filter = [[SCContentFilter alloc] - initWithDisplay:target_display - includingApplications:target_application_array - exceptingWindows:empty_array]; + + content_filter = [[SCContentFilter alloc] initWithDisplay:target_display includingApplications:target_application_array exceptingWindows:empty_array]; + [target_application_array release]; [empty_array release]; set_display_mode(sc, target_display); } break; } + os_sem_post(sc->shareable_content_available); + MACCAP_LOG(LOG_WARNING, "Configuring stream properties"); CGColorRef background = CGColorGetConstantColor(kCGColorClear); [sc->stream_properties setQueueDepth:8]; [sc->stream_properties setShowsCursor:!sc->hide_cursor]; [sc->stream_properties setColorSpaceName:kCGColorSpaceDisplayP3]; [sc->stream_properties setBackgroundColor:background]; - FourCharCode l10r_type = 0; - l10r_type = ('l' << 24) | ('1' << 16) | ('0' << 8) | 'r'; + + FourCharCode l10r_type = ('l' << 24) | ('1' << 16) | ('0' << 8) | 'r'; [sc->stream_properties setPixelFormat:l10r_type]; if (@available(macOS 13.0, *)) { + MACCAP_LOG(LOG_WARNING, "Configuring audio properties for macOS 13+"); #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 [sc->stream_properties setCapturesAudio:TRUE]; [sc->stream_properties setExcludesCurrentProcessAudio:TRUE]; [sc->stream_properties setChannelCount:2]; #endif - } else { - if (sc->capture_type != ScreenCaptureWindowStream) { - sc->disp = NULL; - [content_filter release]; - os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); - os_event_init(&sc->stream_start_completed, - OS_EVENT_TYPE_MANUAL); - return true; - } + } else if (sc->capture_type != ScreenCaptureWindowStream) { + MACCAP_LOG(LOG_WARNING, "Legacy OS path: initializing without audio"); + sc->disp = NULL; + [content_filter release]; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } - sc->disp = [[SCStream alloc] initWithFilter:content_filter - configuration:sc->stream_properties - delegate:nil]; - + MACCAP_LOG(LOG_WARNING, "Initializing SCStream"); + sc->disp = [[SCStream alloc] initWithFilter:content_filter configuration:sc->stream_properties delegate:nil]; [content_filter release]; NSError *addStreamOutputError = nil; - BOOL did_add_output = [sc->disp addStreamOutput:sc->capture_delegate - type:SCStreamOutputTypeScreen - sampleHandlerQueue:nil - error:&addStreamOutputError]; + MACCAP_LOG(LOG_WARNING, "Adding stream output"); + BOOL did_add_output = [sc->disp addStreamOutput:sc->capture_delegate type:SCStreamOutputTypeScreen sampleHandlerQueue:nil error:&addStreamOutputError]; + if (!did_add_output) { - MACCAP_ERR( - "init_screen_stream: Failed to add stream output with error %s\n", - [[addStreamOutputError localizedFailureReason] - cStringUsingEncoding:NSUTF8StringEncoding]); + NSString *errorDescription = addStreamOutputError ? [addStreamOutputError localizedDescription] : @"Unknown error"; + MACCAP_ERR("Failed to add stream output with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); [addStreamOutputError release]; - return !did_add_output; + return false; } #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 if (@available(macOS 13.0, *)) { - did_add_output = [sc->disp - addStreamOutput:sc->capture_delegate - type:SCStreamOutputTypeAudio - sampleHandlerQueue:nil - error:&addStreamOutputError]; + MACCAP_LOG(LOG_WARNING, "Adding audio stream output"); + did_add_output = [sc->disp addStreamOutput:sc->capture_delegate type:SCStreamOutputTypeAudio sampleHandlerQueue:nil error:&addStreamOutputError]; + if (!did_add_output) { - MACCAP_ERR( - "init_screen_stream: Failed to add audio stream output with error %s\n", - [[addStreamOutputError localizedFailureReason] - cStringUsingEncoding: - NSUTF8StringEncoding]); + NSString *errorDescription = addStreamOutputError ? [addStreamOutputError localizedDescription] : @"Unknown error"; + MACCAP_ERR("Failed to add audio stream output with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); [addStreamOutputError release]; - return !did_add_output; + return false; } } #endif + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + MACCAP_LOG(LOG_WARNING, "Starting capture"); __block BOOL did_stream_start = false; - [sc->disp startCaptureWithCompletionHandler:^( - NSError *_Nullable error) { - did_stream_start = (BOOL)(error == nil); + [sc->disp startCaptureWithCompletionHandler:^(NSError *_Nullable error) { + did_stream_start = (error == nil); if (!did_stream_start) { - MACCAP_ERR( - "init_screen_stream: Failed to start capture with error %s\n", - [[error localizedFailureReason] - cStringUsingEncoding: - NSUTF8StringEncoding]); - // Clean up disp so it isn't stopped + NSString *errorDescription = error ? [error localizedDescription] : @"Unknown error"; + MACCAP_ERR("Failed to start capture with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); + + if ([error.domain isEqualToString:@"com.apple.ScreenCaptureKit.ErrorDomain"]) { + MACCAP_LOG(LOG_WARNING, "ScreenCaptureKit error domain detected, code: %ld", (long)error.code); + NSInteger permissionDeniedErrorCode = -3801; + if (error.code == permissionDeniedErrorCode) { + MACCAP_ERR("Permission denied error detected"); + dispatch_async(dispatch_get_main_queue(), ^{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText:@"Screen Recording Permission Denied"]; + [alert setInformativeText:@"Please grant Screen Recording permission in System Preferences > Security & Privacy > Privacy > Screen Recording, then restart the application."]; + [alert addButtonWithTitle:@"OK"]; + [alert runModal]; + [alert release]; + + NSURL *url = [NSURL fileURLWithPath:@"/System/Library/PreferencePanes/Security.prefPane"]; + [[NSWorkspace sharedWorkspace] openURL:url]; + }); + } + } + [sc->disp release]; sc->disp = NULL; + } else { + MACCAP_LOG(LOG_WARNING, "Capture started successfully"); } os_event_signal(sc->stream_start_completed); }]; - os_event_wait(sc->stream_start_completed); + MACCAP_LOG(LOG_WARNING, "Waiting for stream start completion"); + os_event_wait(sc->stream_start_completed); + MACCAP_LOG(LOG_WARNING, "Stream initialization %s", did_stream_start ? "succeeded" : "failed"); return did_stream_start; } diff --git a/plugins/obs-browser b/plugins/obs-browser index 630848ac1f484f..33ec6b80fcb387 160000 --- a/plugins/obs-browser +++ b/plugins/obs-browser @@ -1 +1 @@ -Subproject commit 630848ac1f484fcdab1160f00be11cbc7fd8227d +Subproject commit 33ec6b80fcb38754276bd3e8b84d0e6e42bdd03c diff --git a/plugins/obs-ndi b/plugins/obs-ndi index c9cb15ec683769..4c05702128c6b5 160000 --- a/plugins/obs-ndi +++ b/plugins/obs-ndi @@ -1 +1 @@ -Subproject commit c9cb15ec6837690ea94fcbe275c8323ad1652899 +Subproject commit 4c05702128c6b5d2f25096edc578e63e1b8ef600 diff --git a/slobs_CI/sentry-osx.py b/slobs_CI/sentry-osx.py index 1861a25417cbe5..c86630dfe0317a 100644 --- a/slobs_CI/sentry-osx.py +++ b/slobs_CI/sentry-osx.py @@ -1,15 +1,58 @@ import os -os.system('curl -sL https://sentry.io/get-cli/ | bash') +import subprocess + +def run_command(command): + print(f"Running command: {command}") + result = subprocess.run(command, shell=True, capture_output=True, text=True) + if result.stdout: + print(f"Output: {result.stdout}") + if result.stderr: + print(f"Error: {result.stderr}") + return result + +# Print all environment variables +print("Environment Variables:") +for key, value in os.environ.items(): + print(f"{key}={value}") + +# Run the command to install the Sentry CLI +run_command('curl -sL https://sentry.io/get-cli/ | bash') def process_sentry(directory): + print(f"Processing directory: {directory}") + if not os.path.exists(directory): + print(f"Error: Directory {directory} does not exist!") + return + + # List the contents of the directory + print(f"Listing contents of directory: {directory}") + run_command(f'ls -la {directory}') + for root, dirs, files in os.walk(directory): + print(f"Current directory: {root}") + print(f"Subdirectories: {dirs}") + print(f"Files: {files}") for file in files: if '.so' in file or '.dylib' in file or '.' not in file: path = os.path.join(root, file) - os.system("dsymutil " + path) - os.system("sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} upload-dif --org streamlabs-desktop --project obs-server " + path + ".dSYM/Contents/Resources/DWARF/" + file) - os.system("dsymutil " + path) - os.system("sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} upload-dif --org streamlabs-desktop --project obs-server-preview " + path + ".dSYM/Contents/Resources/DWARF/" + file) + print(f"Processing file: {path}") + + # Run dsymutil on the file + run_command(f"dsymutil {path}") + + # Upload the debug file to Sentry + sentry_command = f"sentry-cli --auth-token {os.environ.get('SENTRY_AUTH_TOKEN', '')} upload-dif --org streamlabs-desktop --project obs-server {path}.dSYM/Contents/Resources/DWARF/{file}" + run_command(sentry_command) + + # Repeat the upload for the second project + sentry_command_preview = f"sentry-cli --auth-token {os.environ.get('SENTRY_AUTH_TOKEN', '')} upload-dif --org streamlabs-desktop --project obs-server-preview {path}.dSYM/Contents/Resources/DWARF/{file}" + run_command(sentry_command_preview) + +# Check if the required environment variables are set +required_env_vars = ['PWD', 'InstallPath', 'SENTRY_AUTH_TOKEN'] +for var in required_env_vars: + if var not in os.environ: + print(f"Warning: Environment variable {var} is not set!") # Upload obs debug files -process_sentry(os.path.join(os.environ['PWD'], os.environ['InstallPath'])) \ No newline at end of file +process_sentry(os.path.join(os.environ.get('PWD', ''), "build" , os.environ.get('InstallPath', ''))) From 6237859dbffade4c5ccdff1bc43160fbae6e9dd8 Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Thu, 31 Oct 2024 15:41:06 -0700 Subject: [PATCH 02/11] handle failure to create display --- plugins/mac-capture/mac-screen-capture.m | 140 ++++++++++++++++------- 1 file changed, 99 insertions(+), 41 deletions(-) diff --git a/plugins/mac-capture/mac-screen-capture.m b/plugins/mac-capture/mac-screen-capture.m index 7d9159b7ff5e14..8facf71f2fc1e8 100644 --- a/plugins/mac-capture/mac-screen-capture.m +++ b/plugins/mac-capture/mac-screen-capture.m @@ -374,7 +374,11 @@ static bool init_screen_stream(struct screen_capture *sc) [[NSWorkspace sharedWorkspace] openURL:url]; }); - return false; + // Initialize sc even if permission is not granted + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } MACCAP_LOG(LOG_WARNING, "Initializing stream configuration"); @@ -420,7 +424,12 @@ static bool init_screen_stream(struct screen_capture *sc) if (!target_display) { MACCAP_ERR("Target display not found"); os_sem_post(sc->shareable_content_available); - return false; + + // Initialize sc even if target display is not found + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } MACCAP_LOG(LOG_WARNING, "Creating content filter for display ID: %d", target_display.displayID); @@ -452,7 +461,12 @@ static bool init_screen_stream(struct screen_capture *sc) if (!target_window) { MACCAP_ERR("Target window not found. Window ID: %d", sc->window); os_sem_post(sc->shareable_content_available); - return false; + + // Initialize sc even if target window is not found + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } MACCAP_LOG(LOG_WARNING, "Creating content filter for window ID: %d", target_window.windowID); @@ -469,7 +483,12 @@ static bool init_screen_stream(struct screen_capture *sc) if (!target_display) { MACCAP_ERR("Target display not found for application capture"); os_sem_post(sc->shareable_content_available); - return false; + + // Initialize sc even if target display is not found + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } MACCAP_LOG(LOG_WARNING, "Searching for application with bundle ID: %s", [sc->application_id UTF8String]); @@ -485,7 +504,12 @@ static bool init_screen_stream(struct screen_capture *sc) if (!target_application) { MACCAP_ERR("Target application not found with bundle ID: %s", [sc->application_id UTF8String]); os_sem_post(sc->shareable_content_available); - return false; + + // Initialize sc even if target application is not found + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } MACCAP_LOG(LOG_WARNING, "Creating content filter for application"); @@ -529,10 +553,26 @@ static bool init_screen_stream(struct screen_capture *sc) return true; } + // Check if content_filter is initialized + if (!content_filter) { + MACCAP_ERR("Content filter is not initialized"); + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; + } + MACCAP_LOG(LOG_WARNING, "Initializing SCStream"); sc->disp = [[SCStream alloc] initWithFilter:content_filter configuration:sc->stream_properties delegate:nil]; [content_filter release]; + if (!sc->disp) { + MACCAP_ERR("Failed to initialize SCStream"); + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; + } + NSError *addStreamOutputError = nil; MACCAP_LOG(LOG_WARNING, "Adding stream output"); BOOL did_add_output = [sc->disp addStreamOutput:sc->capture_delegate type:SCStreamOutputTypeScreen sampleHandlerQueue:nil error:&addStreamOutputError]; @@ -541,7 +581,13 @@ static bool init_screen_stream(struct screen_capture *sc) NSString *errorDescription = addStreamOutputError ? [addStreamOutputError localizedDescription] : @"Unknown error"; MACCAP_ERR("Failed to add stream output with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); [addStreamOutputError release]; - return false; + + // Release sc->disp and set to NULL + [sc->disp release]; + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 @@ -553,7 +599,13 @@ static bool init_screen_stream(struct screen_capture *sc) NSString *errorDescription = addStreamOutputError ? [addStreamOutputError localizedDescription] : @"Unknown error"; MACCAP_ERR("Failed to add audio stream output with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); [addStreamOutputError release]; - return false; + + // Release sc->disp and set to NULL + [sc->disp release]; + sc->disp = NULL; + os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); + os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); + return true; } } #endif @@ -561,45 +613,51 @@ static bool init_screen_stream(struct screen_capture *sc) os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); - MACCAP_LOG(LOG_WARNING, "Starting capture"); - __block BOOL did_stream_start = false; - [sc->disp startCaptureWithCompletionHandler:^(NSError *_Nullable error) { - did_stream_start = (error == nil); - if (!did_stream_start) { - NSString *errorDescription = error ? [error localizedDescription] : @"Unknown error"; - MACCAP_ERR("Failed to start capture with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); - - if ([error.domain isEqualToString:@"com.apple.ScreenCaptureKit.ErrorDomain"]) { - MACCAP_LOG(LOG_WARNING, "ScreenCaptureKit error domain detected, code: %ld", (long)error.code); - NSInteger permissionDeniedErrorCode = -3801; - if (error.code == permissionDeniedErrorCode) { - MACCAP_ERR("Permission denied error detected"); - dispatch_async(dispatch_get_main_queue(), ^{ - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:@"Screen Recording Permission Denied"]; - [alert setInformativeText:@"Please grant Screen Recording permission in System Preferences > Security & Privacy > Privacy > Screen Recording, then restart the application."]; - [alert addButtonWithTitle:@"OK"]; - [alert runModal]; - [alert release]; - - NSURL *url = [NSURL fileURLWithPath:@"/System/Library/PreferencePanes/Security.prefPane"]; - [[NSWorkspace sharedWorkspace] openURL:url]; - }); + if (sc->disp) { + MACCAP_LOG(LOG_WARNING, "Starting capture"); + __block BOOL did_stream_start = false; + [sc->disp startCaptureWithCompletionHandler:^(NSError *_Nullable error) { + did_stream_start = (error == nil); + if (!did_stream_start) { + NSString *errorDescription = error ? [error localizedDescription] : @"Unknown error"; + MACCAP_ERR("Failed to start capture with error: %s", [errorDescription cStringUsingEncoding:NSUTF8StringEncoding]); + + if ([error.domain isEqualToString:@"com.apple.ScreenCaptureKit.ErrorDomain"]) { + MACCAP_LOG(LOG_WARNING, "ScreenCaptureKit error domain detected, code: %ld", (long)error.code); + NSInteger permissionDeniedErrorCode = -3801; + if (error.code == permissionDeniedErrorCode) { + MACCAP_ERR("Permission denied error detected"); + dispatch_async(dispatch_get_main_queue(), ^{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText:@"Screen Recording Permission Denied"]; + [alert setInformativeText:@"Please grant Screen Recording permission in System Preferences > Security & Privacy > Privacy > Screen Recording, then restart the application."]; + [alert addButtonWithTitle:@"OK"]; + [alert runModal]; + [alert release]; + + NSURL *url = [NSURL fileURLWithPath:@"/System/Library/PreferencePanes/Security.prefPane"]; + [[NSWorkspace sharedWorkspace] openURL:url]; + }); + } } + + [sc->disp release]; + sc->disp = NULL; + } else { + MACCAP_LOG(LOG_WARNING, "Capture started successfully"); } + os_event_signal(sc->stream_start_completed); + }]; - [sc->disp release]; - sc->disp = NULL; - } else { - MACCAP_LOG(LOG_WARNING, "Capture started successfully"); - } + MACCAP_LOG(LOG_WARNING, "Waiting for stream start completion"); + os_event_wait(sc->stream_start_completed); + MACCAP_LOG(LOG_WARNING, "Stream initialization %s", did_stream_start ? "succeeded" : "failed"); + } else { + MACCAP_ERR("SCStream is not initialized, skipping capture start"); os_event_signal(sc->stream_start_completed); - }]; + } - MACCAP_LOG(LOG_WARNING, "Waiting for stream start completion"); - os_event_wait(sc->stream_start_completed); - MACCAP_LOG(LOG_WARNING, "Stream initialization %s", did_stream_start ? "succeeded" : "failed"); - return did_stream_start; + return true; } static void screen_capture_build_content_list(struct screen_capture *sc, From 6bc34d8e0b05c91c2cbc5a86f1862f04a1eb4ab6 Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Mon, 16 Dec 2024 20:07:26 -0800 Subject: [PATCH 03/11] merge fixes --- CMakeLists.txt | 4 +- CMakePresets.json | 106 ++++++++++++++---- buildspec.json | 34 ++++-- cmake/common/buildspec_common.cmake | 96 ++++++++++++++-- cmake/macos/buildspec.cmake | 5 +- cmake/windows/buildspec.cmake | 14 ++- cmake/windows/defaults.cmake | 2 + cmake/windows/helpers.cmake | 6 + libobs/CMakeLists.txt | 18 +-- libobs/cmake/legacy.cmake | 6 +- libobs/cmake/os-windows.cmake | 13 +-- libobs/obs-scene.c | 4 +- libobs/obs-view.c | 2 +- plugins/image-source/obs-slideshow.c | 2 +- plugins/mediasoup-connector | 2 +- plugins/motion-effect | 2 +- plugins/obs-browser | 2 +- plugins/obs-ndi | 2 +- plugins/obs-openvr | 2 +- plugins/obs-outputs/mp4-output.c | 2 +- plugins/obs-websocket | 2 +- plugins/sl-vst | 2 +- plugins/vlc-video/vlc-video-plugin.h | 16 +-- .../win-capture/duplicator-monitor-capture.c | 6 +- plugins/win-capture/game-capture.c | 4 +- .../get-graphics-offsets/CMakeLists.txt | 2 + .../win-capture/graphics-hook/CMakeLists.txt | 2 + .../win-capture/inject-helper/CMakeLists.txt | 2 + plugins/win-capture/screen-capture.c | 4 +- plugins/win-dshow/cmake/libdshowcapture.cmake | 2 + plugins/win-dshow/libdshowcapture | 2 +- .../virtualcam-module/CMakeLists.txt | 4 + plugins/win-spout | 2 +- plugins/win-wasapi/CMakeLists.txt | 2 +- 34 files changed, 284 insertions(+), 92 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20bf61cdf114c9..e1f62ff4fee1e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,7 +158,8 @@ if(WIN32) -P "${CMAKE_SOURCE_DIR}/slobs_CI/check_libraries.cmake" ) endif() -#Configure 32-bit projects +if(ENABLE_32_TARGETS) + #Configure 32-bit projects if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") #message(FATAL_ERROR "CURL_INCLUDE_DIR: ${CURL_INCLUDE_DIR}, CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}, PREFIX_PATH_X86: ${PREFIX_PATH_X86}, OBS_VERSION: ${OBS_VERSION}, OBS_VERSION_OVERRIDE: ${OBS_VERSION_OVERRIDE}") if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -193,3 +194,4 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") RESULT_VARIABLE _process_result COMMAND_ERROR_IS_FATAL ANY) endif() endif() +endif() diff --git a/CMakePresets.json b/CMakePresets.json index 7a2a47cbdb84f6..0f0b5b840bcc09 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,5 +1,5 @@ { - "version": 3, + "version": 5, "cmakeMinimumRequired": { "major": 3, "minor": 22, @@ -10,10 +10,10 @@ "name": "environmentVars", "hidden": true, "cacheVariables": { - "RESTREAM_CLIENTID": {"type": "STRING", "value": "$penv{RESTREAM_CLIENTID}"}, - "RESTREAM_HASH": {"type": "STRING", "value": "$penv{RESTREAM_HASH}"}, "TWITCH_CLIENTID": {"type": "STRING", "value": "$penv{TWITCH_CLIENTID}"}, "TWITCH_HASH": {"type": "STRING", "value": "$penv{TWITCH_HASH}"}, + "RESTREAM_CLIENTID": {"type": "STRING", "value": "$penv{RESTREAM_CLIENTID}"}, + "RESTREAM_HASH": {"type": "STRING", "value": "$penv{RESTREAM_HASH}"}, "YOUTUBE_CLIENTID": {"type": "STRING", "value": "$penv{YOUTUBE_CLIENTID}"}, "YOUTUBE_CLIENTID_HASH": {"type": "STRING", "value": "$penv{YOUTUBE_CLIENTID_HASH}"}, "YOUTUBE_SECRET": {"type": "STRING", "value": "$penv{YOUTUBE_SECRET}"}, @@ -33,8 +33,16 @@ "generator": "Xcode", "binaryDir": "${sourceDir}/build_macos", "cacheVariables": { + "ENABLE_BROWSER": true, "CMAKE_OSX_DEPLOYMENT_TARGET": {"type": "STRING", "value": "11.0"}, - "ENABLE_BROWSER": true + "OBS_CODESIGN_TEAM": {"type": "STRING", "value": "$penv{CODESIGN_TEAM}"}, + "OBS_CODESIGN_IDENTITY": {"type": "STRING", "value": "$penv{CODESIGN_IDENT}"}, + "OBS_PROVISIONING_PROFILE": {"type": "STRING", "value": "$penv{PROVISIONING_PROFILE}"}, + "VIRTUALCAM_DEVICE_UUID": {"type": "STRING", "value": ""}, + "VIRTUALCAM_SOURCE_UUID": {"type": "STRING", "value": ""}, + "VIRTUALCAM_SINK_UUID": {"type": "STRING", "value": ""}, + "SPARKLE_APPCAST_URL": {"type": "STRING", "value": ""}, + "SPARKLE_PUBLIC_KEY": {"type": "STRING", "value": ""} } }, { @@ -48,35 +56,75 @@ } }, { - "name": "ubuntu", - "displayName": "Ubuntu", - "description": "obs-studio for Ubuntu", + "name": "linux-aarch64", + "displayName": "Linux aarch64", + "description": "obs-studio for Linux (aarch64)", "inherits": ["environmentVars"], "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" }, - "binaryDir": "${sourceDir}/build_ubuntu", + "binaryDir": "${sourceDir}/build_aarch64", "generator": "Ninja", "warnings": {"dev": true, "deprecated": true}, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_INSTALL_LIBDIR": "lib/CMAKE_SYSTEM_PROCESSOR-linux-gnu", - "OBS_CMAKE_VERSION": {"type": "STRING", "value": "3.0.0"}, - "ENABLE_AJA": false, - "ENABLE_NATIVE_NVENC": false, + "ENABLE_WAYLAND": true, "ENABLE_VLC": true, + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "linux-ci-aarch64", + "inherits": ["linux-aarch64"], + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + }, + { + "name": "linux-release-aarch64", + "displayName": "Linux aarch64 (Release)", + "description": "obs-studio for Linux (aarch64) - Release Configuration", + "inherits": "linux-aarch64", + "cacheVariables": { + "ENABLE_RELEASE_BUILD": true + } + }, + { + "name": "linux-x86_64", + "displayName": "Linux x86_64", + "description": "obs-studio for Linux (x86_64)", + "inherits": ["environmentVars"], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "binaryDir": "${sourceDir}/build_x86_64", + "generator": "Ninja", + "warnings": {"dev": true, "deprecated": true}, + "cacheVariables": { "ENABLE_WAYLAND": true, - "ENABLE_WEBRTC": false + "ENABLE_VLC": true, + "CMAKE_BUILD_TYPE": {"type": "STRING", "value": "Debug"} } }, { - "name": "ubuntu-ci", - "inherits": ["ubuntu"], + "name": "linux-ci-x86_64", + "inherits": ["linux-x86_64"], "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_COMPILE_WARNING_AS_ERROR": true + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + }, + { + "name": "linux-release-x86_64", + "displayName": "Linux x86_64 (Release)", + "description": "obs-studio for Linux (x86_64) - Release Configuration", + "inherits": "linux-x86_64", + "cacheVariables": { + "ENABLE_RELEASE_BUILD": true, + "ENABLE_BROWSER": true } }, { @@ -94,10 +142,12 @@ "generator": "Visual Studio 17 2022", "cacheVariables": { "OBS_CMAKE_VERSION": {"type": "STRING", "value": "3.0.0"}, - "GPU_PRIORITY_VAL": {"type": "STRING", "value": "$penv{GPU_PRIORITY_VAL}"}, - "VIRTUALCAM_GUID": {"type": "STRING", "value": "A3FCE0F5-3493-419F-958A-ABA1250EC20B"}, "ENABLE_BROWSER": true, - "ENABLE_CCACHE": false + "VIRTUALCAM_GUID": {"type": "STRING", "value": "A3FCE0F5-3493-419F-958A-ABA1250EC20B"}, + "GPU_PRIORITY_VAL": {"type": "STRING", "value": "$penv{GPU_PRIORITY_VAL}"}, + "ENABLE_CCACHE": false, + "ENABLE_32_TARGETS": false, + "ENABLE_UI": false } }, { @@ -113,6 +163,20 @@ } ], "buildPresets": [ + { + "name": "linux-aarch64", + "configurePreset": "linux-aarch64", + "displayName": "Linux aarch64", + "description": "Linux build for aarch64 (aka arm64)", + "configuration": "RelWithDebInfo" + }, + { + "name": "linux-x86_64", + "configurePreset": "linux-x86_64", + "displayName": "Linux x86_64", + "description": "Linux build for x86_64 (aka amd64)", + "configuration": "RelWithDebInfo" + }, { "name": "windows-x64", "configurePreset": "windows-x64", diff --git a/buildspec.json b/buildspec.json index e7299f609f0ea2..3af28c8ccf018e 100644 --- a/buildspec.json +++ b/buildspec.json @@ -12,7 +12,7 @@ } }, "qt6": { - "version": "2023-08-31sl1", + "version": "2024-09-10v4", "baseUrl": "https://obs-studio-deployment.s3-us-west-2.amazonaws.com", "label": "Pre-Built Qt6", "hashes": { @@ -27,18 +27,19 @@ }, "cef": { "version": "5060", - "baseUrl": "https://cdn-fastly.obsproject.com/downloads", + "baseUrl": "https://streamlabs-cef-dist.s3.us-west-2.amazonaws.com", "label": "Chromium Embedded Framework", "hashes": { "macos-x86_64": "7ef71717ff2e4ff4212274c33f0993729f47c109c464e499544fd3f63586a069", "macos-arm64": "a9da8909202aefc8f35509d03eff9a7c837b5d3b2ed3afb39b67121cb16d457b", "linux-x86_64": "bf4aa9388bab7e94fa945cc3bba16b6da63b6a30f9c0342d42235468b39d84bf", "linux-aarch64": "68d915c9ba2639cba762a54cd3430fce2527aa6355d831d3cfcb6157664206b0", - "windows-x64": "c1b47beb7ee42e98f1a41b6d694c26842a4a3d452e44bdf6f758c9785696533d" + "windows-x64": "7480e9ed5688e09919db67237d130eef9a4c24df32ba2a7b8a5587de45ff8e69" }, "revision": { - "macos-x86_64": 2, - "macos-arm64": 2 + "macos-x86_64": 3, + "macos-arm64": 3, + "windows-x64": 3 } }, "vlc": { @@ -49,13 +50,22 @@ "windows-x64": "91f589ef69fce51645a3ecbb215b405c98db7b891479474ec3b5ed3b63c25e4a" } }, + "openssl": { + "version": "1.1.1c", + "baseUrl": "https://streamlabs-obs-updater-deps.s3.us-west-2.amazonaws.com", + "label": "openssl", + "hashes": { + "windows-x64": "801CE178E86CB13A1485878DE053B6089C32941800CFD2440F33158117A58860" + } + }, "libmediasoupclient": { "version": "3.4.3", "baseUrl": "https://obs-studio-deployment.s3-us-west-2.amazonaws.com", "label": "libmediasoupclient", "hashes": { "macos-x86_64": "D06CF8593EBFA2DAE3AB6A59EA889A931C1EE77586D76EB890AF93DB936D18C5", - "macos-arm64": "DC4424D32A86306172C57E9D8D7EDD2CB3897C364A56F46318DEE5395B68474B" + "macos-arm64": "DC4424D32A86306172C57E9D8D7EDD2CB3897C364A56F46318DEE5395B68474B", + "windows-x64": "03E25130EDF6B49009404B6FE4B75D5DDC92885F1DAD2DF3ED0FB3068D98C682" } }, "webrtc": { @@ -64,8 +74,18 @@ "label": "webrtc", "hashes": { "macos-x86_64": "5FAD4805BC81256BD3B7E06EE75FFF9BD2A8983DCCD5F31C1F500A214A3B08B2", - "macos-arm64": "5D9FA128386DA4ADA0FF0AD2D092C2F9DD2B93A93FD85A50EE04358855680473" + "macos-arm64": "5D9FA128386DA4ADA0FF0AD2D092C2F9DD2B93A93FD85A50EE04358855680473", + "windows-x64": "0FCE7305A5C1D2A026157B2BEFFFABA25A4202CE403614F6A98965CECA15E2B0" } + }, + "grpc": { + "version": "v1.47.0", + "baseUrl": "https://obs-studio-deployment.s3-us-west-2.amazonaws.com", + "label": "gRPC", + "hashes": { + "windows-x64": "C83815ACCCAE80F07E545B569582E548EE6E4575B2E329B7B739509BD49D811C" + }, + "distPath": "grpc_dist" } }, "platformConfig": { diff --git a/cmake/common/buildspec_common.cmake b/cmake/common/buildspec_common.cmake index 5b4c34d4c45490..39dd50616d3436 100644 --- a/cmake/common/buildspec_common.cmake +++ b/cmake/common/buildspec_common.cmake @@ -9,6 +9,36 @@ include_guard(GLOBAL) +function(extract_archive file destination) + # Check if the file exists + if(NOT EXISTS "${file}") + message(FATAL_ERROR "File not found: ${file}") + endif() + + # Determine the file extension + get_filename_component(extension "${file}" EXT) + + # If it's a .7z file, use 7z to extract + if("${extension}" STREQUAL ".7z") + message(STATUS "Extracting .7z archive: ${file}") + execute_process( + COMMAND 7z x "${file}" -o"${destination}" -y + RESULT_VARIABLE _result + OUTPUT_QUIET + ERROR_QUIET + ) + if(NOT _result EQUAL 0) + message(FATAL_ERROR "Failed to extract .7z archive: ${file}") + endif() + else() + # For other archive types, use file(ARCHIVE_EXTRACT) + message(STATUS "Extracting archive using CMake: ${file}") + file(ARCHIVE_EXTRACT INPUT "${file}" DESTINATION "${destination}") + endif() + + message(STATUS "Extraction complete: ${file} -> ${destination}") +endfunction() + # _check_deps_version: Checks for obs-deps VERSION file in prefix paths function(_check_deps_version version) set(found @@ -102,7 +132,7 @@ function(_check_dependencies) endif() set(skip FALSE) - message(STATUS "Version var before _check_deps_version ${version}") + message(STATUS "Working on dependency and version ${dependency} ${version}") if(dependency STREQUAL prebuilt OR dependency STREQUAL qt6) if(OBS_DEPENDENCY_${dependency}_${arch}_HASH STREQUAL ${hash}) _check_deps_version(${version}) @@ -118,7 +148,7 @@ function(_check_dependencies) set(skip TRUE) endif() endif() - message(STATUS "Version var after _check_deps_version ${version}") + if(skip) message(STATUS "Setting up ${label} (${arch}) - skipped") continue() @@ -130,9 +160,17 @@ function(_check_dependencies) set(url ${url}/${file}) elseif(dependency STREQUAL webrtc) set(url ${url}/${file}) + elseif(dependency STREQUAL grpc) + set(file "grpc-release-${version}.7z") + set(url ${url}/${file}) + elseif(dependency STREQUAL openssl) + set(file "${dependency}-${version}-${arch}.7z") + set(url ${url}/${file}) else() set(url ${url}/${version}/${file}) endif() + + message(STATUS "Working on url ${url}, file ${file}") if(NOT EXISTS "${dependencies_dir}/${file}") message(STATUS "Downloading ${url}") @@ -183,30 +221,64 @@ function(_check_dependencies) "${dependencies_dir}/${destination}" CACHE PATH "CEF root directory" FORCE) elseif(dependency STREQUAL libmediasoupclient) - set(libmediasoupclient_subdir "libmediasoupclient-VERSION-osx-ARCH") - string(REPLACE "VERSION" "${version}" libmediasoupclient_subdir "${libmediasoupclient_subdir}") - string(REPLACE "ARCH" "${arch}" libmediasoupclient_subdir "${libmediasoupclient_subdir}") + set(libmediasoupclient_subdir "libmediasoupclient_dist") set(LIBMEDIASOUPCLIENT_PATH "${dependencies_dir}/${libmediasoupclient_subdir}" CACHE PATH "libmediasoupclient directory" FORCE) - set(MEDIASOUP_INCLUDE_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/include/mediasoupclient/" CACHE PATH "libmediasoupclient include directory" FORCE) - set(MEDIASOUP_LIB_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/lib/libmediasoupclient.a" CACHE PATH "libmediasoupclient lib directory" FORCE) - set(MEDIASOUP_SDP_LIB_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/lib/libsdptransform.a" CACHE PATH "libmediasoupclient sdp lib directory" FORCE) + + set(MEDIASOUP_INCLUDE_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/include/mediasoupclient/" CACHE PATH "libmediasoupclient include directory" FORCE) + set(MEDIASOUP_LIB_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/lib/mediasoupclient.lib" CACHE PATH "libmediasoupclient lib directory" FORCE) + set(MEDIASOUP_SDP_INCLUDE_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/include/sdptransform" CACHE PATH "libmediasoupclient sdp include directory" FORCE) + set(MEDIASOUP_SDP_LIB_PATH "${dependencies_dir}/${libmediasoupclient_subdir}/lib/sdptransform.lib" CACHE PATH "libmediasoupclient sdp lib directory" FORCE) list(APPEND CMAKE_PREFIX_PATH "${dependencies_dir}/${libmediasoupclient_subdir}") elseif(dependency STREQUAL webrtc) - set(webrtc_subdir "webrtc-VERSION-osx-ARCH") - string(REPLACE "VERSION" "${version}" webrtc_subdir "${webrtc_subdir}") - string(REPLACE "ARCH" "${arch}" webrtc_subdir "${webrtc_subdir}") + set(webrtc_subdir "webrtc_dist") set(WEBRTC_PATH "${dependencies_dir}/${webrtc_subdir}" CACHE PATH "webrtc directory" FORCE) set(WEBRTC_INCLUDE_PATH "${dependencies_dir}/${webrtc_subdir}" CACHE PATH "webrtc include directory" FORCE) - set(WEBRTC_LIB_PATH "${dependencies_dir}/${webrtc_subdir}/libwebrtc.a" CACHE PATH "webrtc lib path" FORCE) + set(WEBRTC_LIB_PATH "${dependencies_dir}/${webrtc_subdir}/webrtc.lib" CACHE PATH "webrtc lib path" FORCE) list(APPEND CMAKE_PREFIX_PATH "${dependencies_dir}/${webrtc_subdir}") + elseif(dependency STREQUAL grpc) + set(grpc_subdir "grpc-release-${version}") + set(Protobuf_DIR "${dependencies_dir}/${grpc_subdir}/cmake" CACHE PATH "Protobuf directory" FORCE) + set(GRPC_PATH "${dependencies_dir}/${grpc_subdir}" CACHE PATH "GRPC directory" FORCE) + + list(APPEND CMAKE_PREFIX_PATH "${GRPC_PATH}") + + message(STATUS "Setting up GRPC_PATH ${GRPC_PATH}") + message(STATUS "Setting up Protobuf_DIR ${Protobuf_DIR}") + message(STATUS "Setting up CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}") + elseif(dependency STREQUAL openssl) + set(openssl_subdir "openssl-VERSION-ARCH") + string(REPLACE "VERSION" "${version}" openssl_subdir "${openssl_subdir}") + string(REPLACE "ARCH" "${arch}" openssl_subdir "${openssl_subdir}") + + set(OPENSSL_PATH + "${dependencies_dir}/${openssl_subdir}" + CACHE PATH "openssl directory" FORCE) + + set(OPENSSL_INCLUDE_PATH "${OPENSSL_PATH}/include" CACHE PATH "openssl include directory" FORCE) + set(OPENSSL_LIB_PATH "${OPENSSL_PATH}/lib/libssl.a" CACHE PATH "openssl SSL library path" FORCE) + set(OPENSSL_CRYPTO_LIB_PATH "${OPENSSL_PATH}/lib/libcrypto.a" CACHE PATH "openssl Crypto library path" FORCE) + + # Explicitly set CMake variables for OpenSSL + set(OPENSSL_ROOT_DIR "${OPENSSL_PATH}" CACHE PATH "OpenSSL root directory" FORCE) + set(OPENSSL_INCLUDE_DIR "${OPENSSL_INCLUDE_PATH}" CACHE PATH "OpenSSL include directory" FORCE) + set(OPENSSL_LIBRARIES "${OPENSSL_LIB_PATH};${OPENSSL_CRYPTO_LIB_PATH}" CACHE PATH "OpenSSL libraries" FORCE) + + list(APPEND CMAKE_PREFIX_PATH "${OPENSSL_PATH}") + + message(STATUS "Setting up OPENSSL_PATH ${OPENSSL_PATH}") + message(STATUS "Setting up OPENSSL_INCLUDE_PATH ${OPENSSL_INCLUDE_PATH}") + message(STATUS "Setting up OPENSSL_LIB_PATH ${OPENSSL_LIB_PATH}") + message(STATUS "Setting up OPENSSL_CRYPTO_LIB_PATH ${OPENSSL_CRYPTO_LIB_PATH}") + message(STATUS "Setting up OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR}") + message(STATUS "Setting up OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES}") endif() message(STATUS "Finished with file and destination ${file} ${destination}") diff --git a/cmake/macos/buildspec.cmake b/cmake/macos/buildspec.cmake index 698c908dd7f506..e11ac3920ecba2 100644 --- a/cmake/macos/buildspec.cmake +++ b/cmake/macos/buildspec.cmake @@ -23,7 +23,10 @@ function(_check_dependencies_macos) set(webrtc_filename "webrtc-VERSION-osx-ARCH.zip") set(webrtc_destination "webrtc-VERSION-osx-ARCH") set(dependencies_list prebuilt qt6 cef libmediasoupclient webrtc) - +# add critical error message for debug + + message(FATAL_ERROR "need to make similar changes to the windows buildspec.cmake file") + _check_dependencies() execute_process(COMMAND "xattr" -r -d com.apple.quarantine "${dependencies_dir}/${destination}" diff --git a/cmake/windows/buildspec.cmake b/cmake/windows/buildspec.cmake index 72a2e0c6d614f7..76992e4c099717 100644 --- a/cmake/windows/buildspec.cmake +++ b/cmake/windows/buildspec.cmake @@ -14,12 +14,24 @@ function(_check_dependencies_windows) set(cef_filename "cef_binary_VERSION_windows_ARCH_REVISION.zip") set(cef_destination "cef_binary_VERSION_windows_ARCH") + set(webrtc_filename "webrtc-VERSION-win-ARCH.7z") + set(webrtc_destination "webrtc_dist") + + set(libmediasoupclient_filename "libmediasoupclient-VERSION-win-ARCH.7z") + set(libmediasoupclient_destination "libmediasoupclient_dist") + + set(grpc_filename "grpc-release-VERSION.7z") + set(grpc_destination "grpc-release-VERSION") + + set(openssl_filename "openssl-VERSION-ARCH.7z") + set(openssl_destination "openssl-VERSION-ARCH") + if(CMAKE_GENERATOR_PLATFORM STREQUAL Win32) set(arch x86) set(dependencies_list prebuilt) else() set(arch ${CMAKE_GENERATOR_PLATFORM}) - set(dependencies_list prebuilt qt6 cef) + set(dependencies_list prebuilt qt6 cef webrtc libmediasoupclient grpc openssl) endif() set(platform windows-${arch}) diff --git a/cmake/windows/defaults.cmake b/cmake/windows/defaults.cmake index ff0dae7b310867..34a484ee174c7f 100644 --- a/cmake/windows/defaults.cmake +++ b/cmake/windows/defaults.cmake @@ -24,6 +24,7 @@ set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE) include(buildspec) include(cpackconfig) +if(ENABLE_32_TARGETS) if(CMAKE_SIZEOF_VOID_P EQUAL 8) execute_process( COMMAND @@ -33,3 +34,4 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) -DENABLE_CCACHE=${ENABLE_CCACHE} RESULT_VARIABLE _process_result COMMAND_ERROR_IS_FATAL ANY) endif() +endif() diff --git a/cmake/windows/helpers.cmake b/cmake/windows/helpers.cmake index a8cb6b41c3383f..7d0944313e87d6 100644 --- a/cmake/windows/helpers.cmake +++ b/cmake/windows/helpers.cmake @@ -33,7 +33,9 @@ function(set_target_properties_obs target) set(OBS_EXECUTABLE_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture") # cmake-format: off + if(ENABLE_32_TARGETS) _target_install_obs(${target} DESTINATION ${OBS_EXECUTABLE_DESTINATION} 32BIT) + endif() # cmake-format: on endif() @@ -79,13 +81,17 @@ function(set_target_properties_obs target) target_add_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" "${target_destination}") # cmake-format: off + if(ENABLE_32_TARGETS) _target_install_obs(${target} DESTINATION ${target_destination} 32BIT) + endif() # cmake-format: on elseif(target STREQUAL obs-virtualcam-module) set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow") # cmake-format: off + if(ENABLE_32_TARGETS) _target_install_obs(${target} DESTINATION ${target_destination} 32BIT) + endif() # cmake-format: on else() set(target_destination "${OBS_PLUGIN_DESTINATION}") diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt index fe9445f0f7670a..f24aff8a5ad8f7 100644 --- a/libobs/CMakeLists.txt +++ b/libobs/CMakeLists.txt @@ -382,15 +382,15 @@ if(OS_WINDOWS) list( APPEND public_headers - util/threading-windows.h - util/windows/ComPtr.hpp - util/windows/CoTaskMemPtr.hpp - util/windows/device-enum.h - util/windows/HRError.hpp - util/windows/win-registry.h - util/windows/win-version.h - util/windows/window-helpers.h - util/windows/WinHandle.hpp) + ${CMAKE_CURRENT_SOURCE_DIR}/util/threading-windows.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/ComPtr.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/CoTaskMemPtr.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/device-enum.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/HRError.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/win-registry.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/win-version.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/window-helpers.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/WinHandle.hpp) elseif(OS_MACOS) list(APPEND public_headers util/apple/cfstring-utils.h) endif() diff --git a/libobs/cmake/legacy.cmake b/libobs/cmake/legacy.cmake index 9ecaf7a843ac03..850777d93dfa2f 100644 --- a/libobs/cmake/legacy.cmake +++ b/libobs/cmake/legacy.cmake @@ -305,9 +305,9 @@ if(OS_WINDOWS) util/windows/window-helpers.c util/windows/window-helpers.h util/windows/ComPtr.hpp - util/windows/CoTaskMemPtr.hpp - util/windows/HRError.hpp - util/windows/WinHandle.hpp + # util/windows/CoTaskMemPtr.hpp + # util/windows/HRError.hpp + # util/windows/WinHandle.hpp libobs.rc audio-monitoring/win32/wasapi-output.c audio-monitoring/win32/wasapi-enum-devices.c diff --git a/libobs/cmake/os-windows.cmake b/libobs/cmake/os-windows.cmake index 2edbb304e000a5..362d935a4ad694 100644 --- a/libobs/cmake/os-windows.cmake +++ b/libobs/cmake/os-windows.cmake @@ -11,12 +11,12 @@ target_include_directories(obs-obfuscate INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" add_library(obs-comutils INTERFACE) add_library(OBS::COMutils ALIAS obs-comutils) -target_sources(obs-comutils INTERFACE util/windows/ComPtr.hpp) +target_sources(obs-comutils INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/ComPtr.hpp) target_include_directories(obs-comutils INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") add_library(obs-winhandle INTERFACE) add_library(OBS::winhandle ALIAS obs-winhandle) -target_sources(obs-winhandle INTERFACE util/windows/WinHandle.hpp) +target_sources(obs-winhandle INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/WinHandle.hpp) target_include_directories(obs-winhandle INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") target_sources( @@ -33,7 +33,6 @@ target_sources( util/platform-windows.c util/threading-windows.c util/threading-windows.h - util/windows/CoTaskMemPtr.hpp util/windows/device-enum.c util/windows/device-enum.h util/windows/HRError.hpp @@ -44,11 +43,11 @@ target_sources( util/windows/window-helpers.c util/windows/window-helpers.h) -target_sources( +target_include_directories( libobs - PUBLIC util/windows/CoTaskMemPtr.hpp - util/windows/HRError.hpp - util/windows/WinHandle.hpp + PUBLIC + $ + $ ) target_compile_options(libobs PRIVATE $<$:/EHc->) diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 86ca413f347c99..236d602887291d 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -3261,8 +3261,8 @@ void obs_sceneitem_get_pos(const obs_sceneitem_t *item, struct vec2 *pos) void obs_sceneitem_get_size(const obs_sceneitem_t *item, struct vec2 *size) { if (item) { - size->x = item->last_width; - size->y = item->last_height; + size->x = (float)item->last_width; + size->y = (float)item->last_height; } } diff --git a/libobs/obs-view.c b/libobs/obs-view.c index 8c6968edabc95c..c3a35abbc511d4 100644 --- a/libobs/obs-view.c +++ b/libobs/obs-view.c @@ -252,7 +252,7 @@ void obs_view_enum_video_info(obs_view_t *view, struct obs_core_video_mix *mix = obs->video.mixes.array[i]; if (mix->view != view) continue; - if (!enum_proc(param, &mix->ovi)) + if (!enum_proc(param, mix->ovi)) break; } diff --git a/plugins/image-source/obs-slideshow.c b/plugins/image-source/obs-slideshow.c index 1c20182c4dc7e1..6860f970b1624a 100644 --- a/plugins/image-source/obs-slideshow.c +++ b/plugins/image-source/obs-slideshow.c @@ -669,7 +669,7 @@ static void ss_destroy(void *data) obs_source_release(ss->transition); } - free_files(&ss->files.da); + free_files(&ss->files); pthread_mutex_destroy(&ss->mutex); calldata_free(&ss->cd); bfree(ss); diff --git a/plugins/mediasoup-connector b/plugins/mediasoup-connector index 73628284204aeb..6f9688cf61bb1e 160000 --- a/plugins/mediasoup-connector +++ b/plugins/mediasoup-connector @@ -1 +1 @@ -Subproject commit 73628284204aeb07fdad0bbae51b301acbd4f86e +Subproject commit 6f9688cf61bb1efbf75e18d99f7d76ddb2190f4b diff --git a/plugins/motion-effect b/plugins/motion-effect index 76ae57a3c3056b..5e83933a2454ed 160000 --- a/plugins/motion-effect +++ b/plugins/motion-effect @@ -1 +1 @@ -Subproject commit 76ae57a3c3056b20291ae826f9efe99d4d826356 +Subproject commit 5e83933a2454ed74b601c03575f5edc2e9938f10 diff --git a/plugins/obs-browser b/plugins/obs-browser index 33ec6b80fcb387..9a307be457ed42 160000 --- a/plugins/obs-browser +++ b/plugins/obs-browser @@ -1 +1 @@ -Subproject commit 33ec6b80fcb38754276bd3e8b84d0e6e42bdd03c +Subproject commit 9a307be457ed429c0ad8535f9234f47cf928f098 diff --git a/plugins/obs-ndi b/plugins/obs-ndi index 4c05702128c6b5..cb4d3776f81f58 160000 --- a/plugins/obs-ndi +++ b/plugins/obs-ndi @@ -1 +1 @@ -Subproject commit 4c05702128c6b5d2f25096edc578e63e1b8ef600 +Subproject commit cb4d3776f81f58a99fc327f56261e2813b2ee902 diff --git a/plugins/obs-openvr b/plugins/obs-openvr index 51f9704e7404b2..d14a35ab694f05 160000 --- a/plugins/obs-openvr +++ b/plugins/obs-openvr @@ -1 +1 @@ -Subproject commit 51f9704e7404b265a4eb03c3a18bb7ef0e9c8f6b +Subproject commit d14a35ab694f05aeb5bf37763e309f64b9b1d630 diff --git a/plugins/obs-outputs/mp4-output.c b/plugins/obs-outputs/mp4-output.c index 8ccb45a5077a31..7ad52c8b18172f 100644 --- a/plugins/obs-outputs/mp4-output.c +++ b/plugins/obs-outputs/mp4-output.c @@ -355,7 +355,7 @@ static void generate_filename(struct mp4_output *out, struct dstr *dst, bool space = obs_data_get_bool(settings, "allow_spaces"); struct obs_video_info ovi; - obs_get_video_info_for_output(out, &ovi, 0); + obs_get_video_info_for_output(out->output, &ovi, 0); char *filename = os_generate_formatted_filename(ext, space, fmt, &ovi); dstr_copy(dst, dir); diff --git a/plugins/obs-websocket b/plugins/obs-websocket index 6fd18a7ef1ecb1..56865bb928f92d 160000 --- a/plugins/obs-websocket +++ b/plugins/obs-websocket @@ -1 +1 @@ -Subproject commit 6fd18a7ef1ecb149e8444154af1daab61d4241a9 +Subproject commit 56865bb928f92dc7c85dee9772b06e03f5e38bec diff --git a/plugins/sl-vst b/plugins/sl-vst index 962b4f658d110b..8824c9ab839f5b 160000 --- a/plugins/sl-vst +++ b/plugins/sl-vst @@ -1 +1 @@ -Subproject commit 962b4f658d110b55298057d91c413e7a1015d20b +Subproject commit 8824c9ab839f5b6dc96f625161b1f21789251864 diff --git a/plugins/vlc-video/vlc-video-plugin.h b/plugins/vlc-video/vlc-video-plugin.h index cf5ac40f254b01..256e640644098d 100644 --- a/plugins/vlc-video/vlc-video-plugin.h +++ b/plugins/vlc-video/vlc-video-plugin.h @@ -1,19 +1,19 @@ #include -// TODO: Here in below in OBS 30 includes were modified to be like this: vlc/libvlc.h -#include + +#include #ifdef _MSC_VER #include typedef SSIZE_T ssize_t; #endif -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -extern libvlc_instance_t *libvlc; +extern libvlc_instance_t *libvlc; extern uint64_t time_start; extern bool load_libvlc(void); diff --git a/plugins/win-capture/duplicator-monitor-capture.c b/plugins/win-capture/duplicator-monitor-capture.c index ee09a3a9b137f8..7d926803186b46 100644 --- a/plugins/win-capture/duplicator-monitor-capture.c +++ b/plugins/win-capture/duplicator-monitor-capture.c @@ -106,7 +106,7 @@ struct duplicator_monitor_info { char id[128]; char alt_id[128]; char name[128]; - int idx; + long long idx; RECT rect; HMONITOR handle; }; @@ -356,7 +356,7 @@ static struct duplicator_monitor_info find_monitor(const char *monitor_id) return monitor; } -static struct duplicator_monitor_info find_monitor_by_idx(int monitor_idx) +static struct duplicator_monitor_info find_monitor_by_idx(long long monitor_idx) { struct duplicator_monitor_info monitor = {0}; monitor.idx = monitor_idx; @@ -375,7 +375,7 @@ static inline void update_settings(struct duplicator_capture *capture, pthread_mutex_lock(&capture->update_mutex); struct duplicator_monitor_info monitor; - int monitor_idx = obs_data_get_int(settings, "monitor_idx"); + long long monitor_idx = obs_data_get_int(settings, "monitor_idx"); if (monitor_idx < 0) monitor = find_monitor( obs_data_get_string(settings, "monitor_id")); diff --git a/plugins/win-capture/game-capture.c b/plugins/win-capture/game-capture.c index b491cc2a21d5bf..fb637c222d8bfb 100644 --- a/plugins/win-capture/game-capture.c +++ b/plugins/win-capture/game-capture.c @@ -609,9 +609,9 @@ static inline void get_config(struct game_capture_config *cfg, "2100pq") == 0; cfg->capture_audio = obs_data_get_bool(settings, SETTING_CAPTURE_AUDIO); - cfg->base_width = + cfg->base_width = (int) obs_data_get_int(settings, SETTING_WINDOW_DEFAULT_WIDTH); - cfg->base_height = + cfg->base_height = (int) obs_data_get_int(settings, SETTING_WINDOW_DEFAULT_HEIGHT); if (cfg->base_width < 1 || cfg->base_height < 1) { struct obs_video_info ovi; diff --git a/plugins/win-capture/get-graphics-offsets/CMakeLists.txt b/plugins/win-capture/get-graphics-offsets/CMakeLists.txt index 1e4ee466817929..2b978665334f28 100644 --- a/plugins/win-capture/get-graphics-offsets/CMakeLists.txt +++ b/plugins/win-capture/get-graphics-offsets/CMakeLists.txt @@ -11,7 +11,9 @@ legacy_check() add_executable(get-graphics-offsets) target_link_libraries(get-graphics-offsets PRIVATE _get-graphics-offsets) +if(ENABLE_32_TARGETS) include(cmake/32bit.cmake) +endif() # cmake-format: off set_target_properties_obs(get-graphics-offsets PROPERTIES FOLDER plugins/win-capture OUTPUT_NAME get-graphics-offsets64 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") diff --git a/plugins/win-capture/graphics-hook/CMakeLists.txt b/plugins/win-capture/graphics-hook/CMakeLists.txt index 91378ba9cbe68f..ce12a5b11b2096 100644 --- a/plugins/win-capture/graphics-hook/CMakeLists.txt +++ b/plugins/win-capture/graphics-hook/CMakeLists.txt @@ -49,7 +49,9 @@ add_library(OBS::graphics-hook ALIAS graphics-hook) target_link_libraries(graphics-hook PRIVATE _graphics-hook) +if(ENABLE_32_TARGETS) include(cmake/32bit.cmake) +endif() # cmake-format: off set_target_properties_obs(graphics-hook PROPERTIES FOLDER "plugins/win-capture" OUTPUT_NAME graphics-hook64 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") diff --git a/plugins/win-capture/inject-helper/CMakeLists.txt b/plugins/win-capture/inject-helper/CMakeLists.txt index 6f1c9417b66316..4f9d6cbf23568a 100644 --- a/plugins/win-capture/inject-helper/CMakeLists.txt +++ b/plugins/win-capture/inject-helper/CMakeLists.txt @@ -15,7 +15,9 @@ legacy_check() add_executable(inject-helper) target_link_libraries(inject-helper PRIVATE _inject-helper) +if(ENABLE_32_TARGETS) include(cmake/32bit.cmake) +endif() # cmake-format: off set_target_properties_obs(inject-helper PROPERTIES FOLDER plugins/win-capture OUTPUT_NAME inject-helper64 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") diff --git a/plugins/win-capture/screen-capture.c b/plugins/win-capture/screen-capture.c index 3c410680efd962..c9cd7ab6cb5359 100644 --- a/plugins/win-capture/screen-capture.c +++ b/plugins/win-capture/screen-capture.c @@ -459,9 +459,9 @@ static bool capture_source_update(struct screen_capture *context, return false; } - context->base_width = + context->base_width = (int) obs_data_get_int(settings, SETTING_WINDOW_DEFAULT_WIDTH); - context->base_height = + context->base_height = (int) obs_data_get_int(settings, SETTING_WINDOW_DEFAULT_HEIGHT); if (dstr_cmp(&context->prev_line, capture_source_string) == 0) { diff --git a/plugins/win-dshow/cmake/libdshowcapture.cmake b/plugins/win-dshow/cmake/libdshowcapture.cmake index 2cc78e64089f90..2e7ac47e1e9493 100644 --- a/plugins/win-dshow/cmake/libdshowcapture.cmake +++ b/plugins/win-dshow/cmake/libdshowcapture.cmake @@ -23,6 +23,8 @@ target_sources( libdshowcapture/source/dshow-media-type.hpp libdshowcapture/source/dshowcapture.cpp libdshowcapture/source/dshowencode.cpp + libdshowcapture/source/dshow-dialogbox.cpp + libdshowcapture/source/dshow-dialogbox.hpp libdshowcapture/source/encoder.cpp libdshowcapture/source/encoder.hpp libdshowcapture/source/external/IVideoCaptureFilter.h diff --git a/plugins/win-dshow/libdshowcapture b/plugins/win-dshow/libdshowcapture index ae9e4f4b553f47..7d3f7873d9b6e8 160000 --- a/plugins/win-dshow/libdshowcapture +++ b/plugins/win-dshow/libdshowcapture @@ -1 +1 @@ -Subproject commit ae9e4f4b553f47a1d47d37cc7f5aab0b10c955bf +Subproject commit 7d3f7873d9b6e8c9fe72ed9d5a1f0ee529b3e93d diff --git a/plugins/win-dshow/virtualcam-module/CMakeLists.txt b/plugins/win-dshow/virtualcam-module/CMakeLists.txt index 1273a235b66455..e5612042dc21a4 100644 --- a/plugins/win-dshow/virtualcam-module/CMakeLists.txt +++ b/plugins/win-dshow/virtualcam-module/CMakeLists.txt @@ -99,12 +99,15 @@ configure_file(virtualcam-uninstall.bat.in virtualcam-uninstall.bat) target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat" "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow") +if(ENABLE_32_TARGETS) include(cmake/32bit.cmake) +endif() # cmake-format: off set_target_properties_obs(obs-virtualcam-module PROPERTIES FOLDER plugins/win-dshow OUTPUT_NAME obs-virtualcam-module64) # cmake-format: on +if(ENABLE_32_TARGETS) if(CMAKE_SIZEOF_VOID_P EQUAL 8) add_custom_command( TARGET obs-virtualcam-module @@ -112,3 +115,4 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $ -t obs-virtualcam-module COMMENT "Build 32-bit obs-virtualcam") endif() +endif() \ No newline at end of file diff --git a/plugins/win-spout b/plugins/win-spout index 8f0615857d461a..09c4f7fea9194e 160000 --- a/plugins/win-spout +++ b/plugins/win-spout @@ -1 +1 @@ -Subproject commit 8f0615857d461ac34f2c47e79bd8592d13131b58 +Subproject commit 09c4f7fea9194eae51cc64eac3a2eecc4bf97a22 diff --git a/plugins/win-wasapi/CMakeLists.txt b/plugins/win-wasapi/CMakeLists.txt index 72a2696e66ab3d..b32ea551575e18 100644 --- a/plugins/win-wasapi/CMakeLists.txt +++ b/plugins/win-wasapi/CMakeLists.txt @@ -11,7 +11,7 @@ target_sources(win-wasapi PRIVATE win-wasapi.cpp wasapi-notify.cpp wasapi-notify configure_file(cmake/windows/obs-module.rc.in win-wasapi.rc) target_sources(win-wasapi PRIVATE win-wasapi.rc) -target_link_libraries(win-wasapi PRIVATE OBS::libobs Avrt Jansson::Jansson) +target_link_libraries(win-wasapi PRIVATE OBS::libobs Avrt jansson::jansson) # cmake-format: off set_target_properties_obs(win-wasapi PROPERTIES FOLDER plugins PREFIX "") From 6ad067a26a9adaf1ed2c05b4562420d4e664cf5b Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Tue, 17 Dec 2024 20:29:53 -0800 Subject: [PATCH 04/11] fixing yaml --- .github/workflows/pr-pull.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-pull.yaml b/.github/workflows/pr-pull.yaml index 854d24cdfdb8db..539149d89efb86 100644 --- a/.github/workflows/pr-pull.yaml +++ b/.github/workflows/pr-pull.yaml @@ -5,7 +5,7 @@ on: pull_request: paths-ignore: - '**.md' - branches: [master] + branches: [streamlabs] types: [ opened, synchronize, reopened ] permissions: contents: read @@ -28,7 +28,7 @@ jobs: compatibility-validation: name: Validate Compatibility 🕵️ - if: github.base_ref == 'master' + if: github.base_ref == 'streamlabs' runs-on: ubuntu-22.04 permissions: checks: write @@ -50,7 +50,7 @@ jobs: services-validation: name: Validate Services 🕵️ - if: github.base_ref == 'master' + if: github.base_ref == 'streamlabs' runs-on: ubuntu-22.04 permissions: checks: write From fa8479064d9dd62d5a41169bf6239be581450751 Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Tue, 17 Dec 2024 20:44:57 -0800 Subject: [PATCH 05/11] fixing openvr cmake race condition --- plugins/obs-openvr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/obs-openvr b/plugins/obs-openvr index d14a35ab694f05..830a9f003db04e 160000 --- a/plugins/obs-openvr +++ b/plugins/obs-openvr @@ -1 +1 @@ -Subproject commit d14a35ab694f05aeb5bf37763e309f64b9b1d630 +Subproject commit 830a9f003db04eeb8d8459613ee748f15320691a From 6e04c455e2d16ff8510d731bac3da7d19244cd62 Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Tue, 17 Dec 2024 20:47:19 -0800 Subject: [PATCH 06/11] disable old github actions scripts --- .github/workflows/clang-format.yml | 4 ++-- .github/workflows/main-streamlabs.yml | 4 ++-- .github/workflows/main.yml | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 98474fd7d789de..1079d09b3eefed 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -3,10 +3,10 @@ name: Clang Format Check on: push: paths-ignore: ['**.md'] - branches-ignore: [streamlabs] + branches-ignore: [skippy] pull_request: paths-ignore: ['**.md'] - branches-ignore: [streamlabs] + branches-ignore: [skippy] jobs: clang-format-check: diff --git a/.github/workflows/main-streamlabs.yml b/.github/workflows/main-streamlabs.yml index ccb1163e858e25..17ecc9359f381b 100644 --- a/.github/workflows/main-streamlabs.yml +++ b/.github/workflows/main-streamlabs.yml @@ -4,13 +4,13 @@ on: push: paths-ignore: - '**.md' - branches: [ "streamlabs" ] + branches: [ "skippy" ] tags: - '*' pull_request: paths-ignore: - '**.md' - branches: [ "streamlabs" ] + branches: [ "skippy" ] env: InstallPath: "packed_build" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4743a48d39c1bb..febdcb6f16579e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,14 +4,13 @@ on: push: paths-ignore: ['**.md'] branches: - - "streamlabs" - - 'release/**' + - "skippy" tags: ['*'] pull_request: paths-ignore: ['**.md'] - branches: ['streamlabs'] + branches: ['skippy'] merge_group: - branches: ['streamlabs'] + branches: ['skippy'] env: InstallPath: "packed_build" From 3394ad3448c6dd5d8752f06de243955208333c1b Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Tue, 17 Dec 2024 21:02:55 -0800 Subject: [PATCH 07/11] fix libdshow --- .github/actions/run-clang-format/action.yaml | 9 ++++++++- .github/workflows/clang-format.yml | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/actions/run-clang-format/action.yaml b/.github/actions/run-clang-format/action.yaml index 94dea0840a6478..bf14c3f772e62c 100644 --- a/.github/actions/run-clang-format/action.yaml +++ b/.github/actions/run-clang-format/action.yaml @@ -56,5 +56,12 @@ runs: print ::group::Run clang-format-17 local -a changes=(${(s:,:)CHANGED_FILES//[\[\]\'\"]/}) - ./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check ${changes} + local issues + issues=$(./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check ${changes} || true) + + if [[ -n "$issues" ]]; then + echo "::error::clang-format issues found:\n$issues" + else + echo "No formatting issues detected." + fi print ::endgroup:: diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 1079d09b3eefed..cfd9b8d036a272 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -3,10 +3,12 @@ name: Clang Format Check on: push: paths-ignore: ['**.md'] - branches-ignore: [skippy] + branches-ignore: [streamlabs] + branches: [skippy] pull_request: paths-ignore: ['**.md'] - branches-ignore: [skippy] + branches-ignore: [streamlabs] + branches: [skippy] jobs: clang-format-check: From 83389f3cf33055a482f73bd3af70d51cf59d89b3 Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Tue, 17 Dec 2024 21:22:47 -0800 Subject: [PATCH 08/11] fix libdshow --- plugins/win-dshow/libdshowcapture | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/win-dshow/libdshowcapture b/plugins/win-dshow/libdshowcapture index 7d3f7873d9b6e8..209c93569f2553 160000 --- a/plugins/win-dshow/libdshowcapture +++ b/plugins/win-dshow/libdshowcapture @@ -1 +1 @@ -Subproject commit 7d3f7873d9b6e8c9fe72ed9d5a1f0ee529b3e93d +Subproject commit 209c93569f25531a65d389f61c14fd9f69613db9 From f6278198e418f359543ea95be470520795774b7a Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Tue, 17 Dec 2024 21:34:14 -0800 Subject: [PATCH 09/11] fix libdshow --- .github/workflows/build-project.yaml | 2 ++ plugins/win-dshow/libdshowcapture | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index 2ccb337e0d91f6..e8f818b2897e31 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -170,6 +170,7 @@ jobs: ubuntu-build: name: Ubuntu 🐧 + if: github.repository == 'obsproject/obs-studio' strategy: matrix: os: [ubuntu-22.04, ubuntu-24.04] @@ -241,6 +242,7 @@ jobs: flatpak-build: name: Flatpak 📦 + if: github.repository == 'obsproject/obs-studio' runs-on: ubuntu-22.04 needs: check-event defaults: diff --git a/plugins/win-dshow/libdshowcapture b/plugins/win-dshow/libdshowcapture index 209c93569f2553..792892659bdc55 160000 --- a/plugins/win-dshow/libdshowcapture +++ b/plugins/win-dshow/libdshowcapture @@ -1 +1 @@ -Subproject commit 209c93569f25531a65d389f61c14fd9f69613db9 +Subproject commit 792892659bdc55eaca85aad1c87ef484d737e7af From 47b9e1c9da31b2d3655cddba99b7c656b7c905dc Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Wed, 18 Dec 2024 15:24:46 -0800 Subject: [PATCH 10/11] merge fix obs browser --- cmake/windows/helpers.cmake | 3 +++ plugins/obs-browser | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/windows/helpers.cmake b/cmake/windows/helpers.cmake index 7d0944313e87d6..cfbe75ddb0f009 100644 --- a/cmake/windows/helpers.cmake +++ b/cmake/windows/helpers.cmake @@ -53,6 +53,9 @@ function(set_target_properties_obs target) elseif(target STREQUAL obs-browser-helper) set_property(GLOBAL APPEND PROPERTY _OBS_EXECUTABLES ${target}) return() + elseif(target STREQUAL obs-browser-page) + set_property(GLOBAL APPEND PROPERTY _OBS_EXECUTABLES ${target}) + return() else() set_property(GLOBAL APPEND PROPERTY _OBS_EXECUTABLES ${target}) endif() diff --git a/plugins/obs-browser b/plugins/obs-browser index 9a307be457ed42..1d5600e5b8f7ff 160000 --- a/plugins/obs-browser +++ b/plugins/obs-browser @@ -1 +1 @@ -Subproject commit 9a307be457ed429c0ad8535f9234f47cf928f098 +Subproject commit 1d5600e5b8f7ff3df043d9737ffd6cb3062d28ba From c77bf3b4b49a9e7c9e4e9b4db9d5a8e2c06a675d Mon Sep 17 00:00:00 2001 From: Vladimir Sumarov Date: Thu, 19 Dec 2024 15:48:45 -0800 Subject: [PATCH 11/11] browser merge fix --- cmake/Modules/ObsHelpers_Windows.cmake | 4 ++-- cmake/windows/helpers.cmake | 3 --- plugins/obs-browser | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmake/Modules/ObsHelpers_Windows.cmake b/cmake/Modules/ObsHelpers_Windows.cmake index 77d4fb0804384c..821459f70bb0d4 100644 --- a/cmake/Modules/ObsHelpers_Windows.cmake +++ b/cmake/Modules/ObsHelpers_Windows.cmake @@ -189,12 +189,12 @@ function(setup_obs_app target) if(MSVC) target_compile_options(obs-browser PRIVATE $,/MTd,/MT>) - target_compile_options(obs-browser-page PRIVATE $,/MTd,/MT>) + target_compile_options(obs-browser-helper PRIVATE $,/MTd,/MT>) endif() target_link_options(obs-browser PRIVATE "LINKER:/IGNORE:4099") - target_link_options(obs-browser-page PRIVATE "LINKER:/IGNORE:4099" "LINKER:/SUBSYSTEM:WINDOWS") + target_link_options(obs-browser-helper PRIVATE "LINKER:/IGNORE:4099" "LINKER:/SUBSYSTEM:WINDOWS") endif() _setup_obs_app(${ARGV}) diff --git a/cmake/windows/helpers.cmake b/cmake/windows/helpers.cmake index cfbe75ddb0f009..7d0944313e87d6 100644 --- a/cmake/windows/helpers.cmake +++ b/cmake/windows/helpers.cmake @@ -53,9 +53,6 @@ function(set_target_properties_obs target) elseif(target STREQUAL obs-browser-helper) set_property(GLOBAL APPEND PROPERTY _OBS_EXECUTABLES ${target}) return() - elseif(target STREQUAL obs-browser-page) - set_property(GLOBAL APPEND PROPERTY _OBS_EXECUTABLES ${target}) - return() else() set_property(GLOBAL APPEND PROPERTY _OBS_EXECUTABLES ${target}) endif() diff --git a/plugins/obs-browser b/plugins/obs-browser index 1d5600e5b8f7ff..800a9830601cbc 160000 --- a/plugins/obs-browser +++ b/plugins/obs-browser @@ -1 +1 @@ -Subproject commit 1d5600e5b8f7ff3df043d9737ffd6cb3062d28ba +Subproject commit 800a9830601cbcd0f90493f3d876eaf1e0117f7a