Commit Graph

503 Commits

Author SHA1 Message Date
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
jpark37
a8866fe3fa libobs-d3d11: Remove new/delete replacements
MSVC noticed inline is not allowed, and new/delete replacments also
don't belong in a header file. We're also just leaning on
__STDCPP_DEFAULT_NEW_ALIGNMENT__ being 16 for MSVC x64 now.
2024-01-11 04:02:31 -06:00
Lain
ae469d23e1 libobs/util: Fix function declaration
C functions that have no parameters should use (void) to signify that
they have no parameters, otherwise legacy C handling for parameters will
apply.
2024-01-07 15:59:09 -06:00
Lain
42bda5fb67 libobs/util: Add da_pop_front()
Doesn't really make sense that it was missing, so just add it.
2024-01-07 15:59:09 -06:00
PatTheMav
c83f76db11 libobs: Fix disk space reporting for attached network drives on macOS
While the NSURLVolumeAvailableCapacityForOpportunisticUsageKey resource
correctly reports available disk space for local volumes (regardless
of actual file system used), it does not report actual values for
attached network drives.

The NSURLVolumeAvailableCapacityKey resource will still report
available disk space as expected, so use this value for non-local
volumes instead.
2023-12-16 17:13:29 -06:00
derrod
2385a3f0f8 libobs/util: Remove unused struct member from text-lookup 2023-11-25 17:09:47 -06:00
Norihiro Kamae
2c4d54dd1b libobs/util: Fix link error including header files from C++ 2023-11-25 17:04:47 -06:00
PatTheMav
4a765d3bf0 libobs: Use macOS specific APIs to report free disk space 2023-11-18 17:16:16 -06:00
PatTheMav
aaca2b6e73 libobs: Fix duplicate symbol resolution for obs plugins
By default duplicate non-static symbols loaded by dynamic libraries are
de-duplicated by the dynamic library loader. This can lead to issues
with statically linked libraries inside obs plugins if the symbols
share their signature: Whichever plugin is loaded first gets to "set"
the symbol (which can become problematic especially for C++ template
functions).

Using RTLD_LOCAL ensures that all symbols are hidden and can only be
explicitly loaded using dlsym() which avoids this issue.

Unfortunately due to the way scripting works in obs-studio, Python
still needs to be loaded with RTLD_GLOBAL, hence the branch in the fix.
2023-09-23 16:31:14 -07:00
Neal Gompa
491d7c0e98 libobs: Add license declaration files 2023-09-19 13:35:49 -04:00
PatTheMav
87dd366448 libobs: Remove old macOS guards for NSProcessInfo
With the lowest deployment target being macOS 11.0, there is no need
to check for the availability of the selectors on the NSProcessInfo
class anymore.
2023-09-05 14:39:00 -04:00
PatTheMav
7f8a55d0bb libobs: Fix warnings about implicit integer downcasts in macOS code 2023-08-31 17:52:08 -04:00
Richard Stanway
fef92a8a43 libobs: Log if CreateProcessW fails on Windows
This is used by the test programs as well as ffmpeg-mux. If a process
fails to start it's quite bad so we would like to know why.
2023-08-26 16:44:53 -07:00
Ryan Foster
64139a6bbd CI: Update to clang-format 16
This commit also modifies UI, libobs, and plugins.
2023-08-10 16:07:25 -04:00