Commit Graph

516 Commits

Author SHA1 Message Date
Anton Kesy
380ff3fd58 libobs: Fix typos 2026-01-14 13:47:30 -05:00
Ryan Foster
1e281538a4 libobs: Raise out of memory exception manually when out of memory
The previous attempt to clarify an out of memory exception/crash
resulted in the compiler optimizing os_breakpoint() and os_oom() into
the same result, which meant that crash stacks in the wild were still
not specific enough to be helpful. Forcefully differentiating the
functions in Release configuration by having os_breakpoint() only call
__debugbreak() and having os_oom() call RaiseException() should give us
clearer crash stacks.

Amends 94a736f179.
2025-09-17 16:29:06 -04:00
Norihiro Kamae
139fd801ee libobs/util: Fix memory leak at failure condition 2025-09-12 13:46:58 -04:00
Ryan Foster
3afc2577d3 libobs: Remove Qt5 module check
Partial revert of a0eae6f33c.
Partial revert of 23c3ad4d02.
Partial revert of 97b34ebb76.

Keep all of the get_plugin_info stuff, remove the Qt5 checks.
2025-09-04 16:57:07 -04:00
Ryan Foster
2004ea6b16 Revert "libobs/util: Reject plugins linking Qt5 library for Linux"
This reverts commit 615728fa3b.

Includes partial revert of 62429135ba.
2025-09-04 16:57:07 -04:00
Ryan Foster
f31485939c Revert "libobs: Assume Qt 6, always warn about Qt 5 plugins"
This reverts commit 5ed0b8a0b8.
2025-09-04 16:57:07 -04:00
Ryan Foster
a7b5aef36a Revert "libobs/util: Prevent locking mutex in child process when checking Qt5"
This reverts commit 5c448452cf.
2025-09-04 16:57:07 -04:00
Sebastian Beckmann
62429135ba libobs: Use RTLD_NOW to load modules
RTLD_LAZY means that symbols will only be resolved when first used,
while RTLD_NOW tries to resolve them immediately. This means that if
there are missing symbols (e.g, because a function got removed from
libobs), dlopen with RTLD_LAZY will happily open that module but we get
a runtime crash when the module tries to use that symbol, while with
RTLD_NOW we instead get a (nicer) error on dlopen.
2025-09-03 16:01:57 -04:00
Sebastian Beckmann
609cf6168e libobs/util: Add PRAGMA_DISABLE_DEPRECATION macro
On MSVC, PRAGMA_WARN_DEPRECATION already does that, but on other
compilers it still throws a warning. PRAGMA_DISABLE_DEPRECATION is for
(rare) situations where it's intentional and correct that the deprecated
API is still used, such as to make sure some other API still works
internally.
2025-08-25 19:13:25 -04:00
tytan652
2bd23cd50d libobs,cmake: Replace vendored SIMD Everywhere by prefix/system install
SIMD Everywhere finder needs to be installed alongside libobs CMake
package since its headers depends on it.

C++ cmath header is included on Windows on ARM to ensure that all math
functions are correctly defined when included in C++ code.
https://github.com/simd-everywhere/simde/issues/1304

macOS intrinsics is included to make sure that no redefinition error
happens.
2025-08-21 15:22:08 -04:00
Ryan Foster
01e7b78929 libobs: Use os_oom() for out of memory crash
This change will make the crash stack clearer when OBS is crashing due
to "out of memory" rather than an explicit bmalloc/brealloc(0) call.
2025-08-20 19:06:11 -04:00
Ryan Foster
94a736f179 libobs: Duplicate os_breakpoint to os_oom
Create a specific "out of memory" variant of os_breakpoint to facilitate
troubleshooting and to differentiate an "out of memory" crash from a
more generic crash.
2025-08-20 19:06:11 -04:00
Sebastian Beckmann
be66c8a701 libobs: Remove circlebuf
Deprecated since a4b8e1a6a9 (30.1).
2025-08-20 18:05:15 -04:00
Norihiro Kamae
90d158cf17 libobs/util: Fix coprocess not having environment variables 2025-05-22 15:06:37 -04:00
derrod
56f75bd3e0 win-capture: Add SDL_app to list of generic classes 2025-05-19 19:25:56 -04:00
Ed Maste
6204c22853 libobs/util: Fix build on FreeBSD
FreeBSD already implemented os_get_free_size.  Move the new Linux
implementation into the existing not-__FreeBSD__ block.

Fixes: 935613816f ("libobs/util: Update `os_get_free_size()`")
2025-05-07 15:22:24 -04:00
Miha Frangež
1fc94ecde5 libobs/util: Fix os_process_pipe_create on Linux
This fixes a regression on Linux, introduced in commit 9bc3082.

According to the POSIX specification for the exec family of commands, 
"The first argument is the filename or pathname of the executable to 
be executed". This was done correctly before, but the above commit 
removed "sh" from the arguments, breaking the pipe function on Linux.
2025-05-05 16:54:12 -04:00
Norihiro Kamae
5c448452cf libobs/util: Prevent locking mutex in child process when checking Qt5
The frontend has set a log handler which locks the mutex in `LogString`.
If `os_dlopen` fails in the child process, it calls `blog` and attempted
to lock the mutex that may have already been locked by another thread
before `fork()`. This change prevents the child process from locking the
mutex, resolving the potential deadlock.
2025-04-25 19:10:34 -04:00
PatTheMav
96e4d67242 clang-format: Update source code files with clang-format 19.1.1 2025-04-17 18:16:33 +02:00
Alex Luccisano
935613816f libobs/util: Update os_get_free_size()
`os_get_free_size()` was simply returning 0. For Linux,
implement the free size calculation based on the `sysinfo()`
system call.
2025-04-01 23:18:15 -04:00
Norihiro Kamae
099bc26bd6 libobs/util: Fix tv_nsec becoming 1000000000 in os_event_timedwait 2025-01-24 15:28:57 -05:00
tytan652
e845729dfd libobs/util: Improve inhibit portal detection on Linux
Check for a property of the inhibit portal rather than just the portal
D-Bus name that does not indicate if the specific portal is available.
2024-12-09 18:05:17 -05:00
Ed Maste
c928fac339 libobs: Remove non-USE_XDG code
That is, leave only the code that was under USE_XDG.  Previously the
Linux CMake build defined USE_XDG unconditionally, while it was not set
by the FreeBSD build.

The non-USE_XDG code was broken, and FreeBSD should follow the XDG
convention anyway (in particular, storing config files typically under
$HOME/.config/obs-studio).  Defining USE_XDG in the os-freebsd.cmake
files would leave the non-USE_XDG code unused anywhere, so instead just
remove it.
2024-10-18 18:19:19 -04:00
gxalpha
a251e17557 libobs/util: Crash on bmalloc(0)
As outlined in c5965c8605, bmalloc(0) is
pretty much always a mistake, possibly hiding other bugs.
It's been two years since that commit introduced a warning announcing
that this will crash in a future version of OBS, let's make that happen.
2024-10-07 13:52:22 -04:00
Lain
089ba29961 libobs/util: Prevent null pointer deref with dstr_cmp
This makes it prevent any null pointer dereferences, and makes it
consistent with the other dstr compare functions.
2024-10-05 16:49:23 -07:00
Ryan Foster
a1fbf1015f clang-format: Increase column limit from 80 to 120 2024-10-04 18:19:27 -04:00
tytan652
f4c4f09075 libobs/util: Improve inhibit functions on Linux
Avoid creating the screensaver inhibitor thread when another method has
been applied.

Make inhibition unavailable in a Flatpak if portal is not available.
2024-10-04 16:38:03 -04:00
Exeldro
de2f1fc3a3 libobs: Fix source profiling inactive sources 2024-09-26 18:09:14 -04:00
Ruwen Hahn
26b7b4511c libobs/util: Add os_nstime_to_timespec 2024-09-05 16:38:58 -04:00
derrod
03fbe28717 libobs: Remove base_set_allocator()
Deprecated in 28.0.
2024-08-28 19:10:27 -04:00
qhy040404
32b3517ef1 libobs: Also determine WinUI 3 Window 2024-08-17 17:16:06 -07:00
Rodney
198581a475 libobs: Add source profiler 2024-08-10 23:51:39 -07:00
Norihiro Kamae
4837a3417f libobs/util: Remove unused static-inline function
The commit 862f16285f commented the function out and the function became
unused.
2024-08-07 17:27:49 -04:00
derrod
95a753b9d8 libobs: Fix buffer overrun in os_wcs_to_utf8() 2024-08-06 08:34:24 -07:00
Florian Zwoch
e36352dadd libobs/util: Fix potential memory error in text parser
Fixes memory access when parsing '#' comment tokens when the file
immediately was EOF after this token.
2024-08-06 07:20:32 -07:00
jcm
bd36daa395 UI: Address logging buffer size discrepancies 2024-06-07 17:38:06 +02:00
derrod
89c7a9608b libobs/util: Add buffered file serializer
Adapted from 898256d416

Co-authored-by: Richard Stanway <r1ch@r1ch.net>
2024-05-18 16:15:41 -07:00
derrod
dc4cba7427 libobs/util: Add seeking support to array serializer 2024-05-18 16:10:42 -07:00
derrod
9bc3082402 libobs: Add os_process_pipe_create2
This new API uses the os_process_args_t object rather than a string for
more safe and sane command line argument handling.
2024-04-20 18:30:46 -07:00
derrod
e885d25f5b libobs: Add os_process_args_t and associated functions 2024-04-20 18:30:46 -07:00
Exeldro
65295eaf93 libobs/util: Prevent leaking pipe file descriptors to subprocesses 2024-04-20 16:57:01 -07:00
tytan652
e032c2d0c9 deps,libobs: Replace uthash with prefix/system install 2024-04-07 10:01:25 +10:00
PatTheMav
f4733ec6a2 Update source code formatting with clang-format 17.0.3
Added SCDisplayRef type alias to fix a quirk of this specific
clang-format version with ObjC block syntax.
2024-03-11 15:55:30 -04:00
jcm
3f1a868e05 libobs: Use 'important' usage key for macOS disk space calculations 2024-02-10 17:10:25 -06:00
Patrick Heyer
32ec6c17b5 libobs: Fix free disk space calculation on macOS (#10187)
New space availability keys seem to have very specific file system
requirements not documented anywhere. Using the opportunistic free
space key opportunistically (and falling back on the legacy value
otherwise) should always yield a "good-enough" free disk space value.
2024-02-03 17:35:09 -06:00
Ryan Foster
3fb529c0ee libobs: Use std _Pragma with MSVC
Instead of using the Microsoft-specific __pragma keyword, use the
standard _Pragma directive, which is now supported in C11 and C++11
/std modes.
2024-01-26 15:33:28 -05:00
derrod
a4b8e1a6a9 libobs/util,docs: Deprecate circlebuf 2024-01-16 16:45:10 +01:00
derrod
2963959e71 libobs: Replace circlebuf with deque 2024-01-16 16:45:09 +01:00
derrod
1938d65c9f libobs/util: Add deque 2024-01-16 16:44:12 +01:00
Eric Lindvall
71d963a755 libobs/util: Implement error reader for ffmpeg posix pipe
Transition from using popen() to using fork()/dup2()/execl() to provide
a way to read stderr from ffmpeg.

Co-Authored by: PatTheMav <PatTheMav@users.noreply.github.com>
2024-01-13 18:20:26 -06:00