Commit Graph

3000 Commits

Author SHA1 Message Date
gxalpha
ba84bea46d libobs: Rewrite macOS Hotkeys to use CGEventTap
Using CGEventTapCreate instead of addGlobalMonitorForEventsMatchingMask
to listen to global hotkeys has the advantage of tighter control over
what permissions we need. Since we only listen to and do not modify the
event, it is enough to have "Input Monitoring" instead of the full
"Accessibility" (which would allow modifying the event after catching
it).
2025-02-05 14:33:06 -05:00
Dennis Sädtler
2de0037e40 libobs: Support format/space/range conversion in encoder GPU scaling 2025-01-29 15:01:19 -05:00
Dennis Sädtler
0d6cf088ef libobs: Deprecate obs_(nv12|p010)_tex_active() 2025-01-29 15:01:19 -05:00
Dennis Sädtler
3b1a66f632 libobs: Add obs_encoder_video_tex_active() 2025-01-29 15:01:19 -05:00
Alex Luccisano
c67ea47406 libos: Add obs_get_audio_info2()
The `obs_audio_info2` struct is used in libobs
for resetting audio, however there is a need for
obtaining the additional fields present in the struct
beyond `obs_audio_info`.
2025-01-29 14:37:19 -05:00
jpark37
689c0094b8 libobs: plugins: Use MAD for sRGB functions
Also fix stray comment about pow behavior.
2025-01-29 14:11:34 -05:00
derrod
6b449c3a0b libobs: Only modify raw_active counter if (dis-)connection succeeded 2025-01-28 17:36:51 -05:00
derrod
eda882dd0a libobs: Add video_output_disconnect2() 2025-01-28 17:36:51 -05:00
Norihiro Kamae
099bc26bd6 libobs/util: Fix tv_nsec becoming 1000000000 in os_event_timedwait 2025-01-24 15:28:57 -05:00
Ryan Foster
0014f9fa18 libobs: Update version to 31.0.1 2025-01-17 18:40:47 -05:00
Kurt Kartaltepe
22f222600a libobs: Fix underlinking by adding libx11
We directly depend on libx11 for various operations in obs-nix-x11.c,
not just xcb. So be sure to link it in too.

fixes #11667
2025-01-16 15:43:48 -05:00
izwb003
48dad45ed5 libobs: Fix deadlock on macOS input method change 2025-01-04 12:23:21 +01: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
derrod
10dc43b3cd libobs: Remove relative positioning functions
Revert "docs: Add new relative positioning scene functions"

This partially reverts commit 366cfdb963.

The addition of obs_sceneitem_(get/set)_info2 was not removed as that is
still valid.
2024-12-04 14:41:03 -05:00
derrod
e9c6105f99 libobs: Fix scale calculation when applying new group transform 2024-12-03 15:33:36 -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
derrod
e97d7c10c2 libobs: Fix items in groups using wrong scale reference 2024-10-16 12:24:18 -04:00
derrod
bece05bbc6 libobs: Fix ungrouped transfom calculation in relative mode 2024-10-16 12:24:18 -04:00
Exeldro
88cd7b70db libobs: Add source profiler to public headers 2024-10-10 17:19:45 -04:00
Norihiro Kamae
b082e1be33 libobs/graphics: Remove unused source file graphics-magick.c 2024-10-08 13:25:05 -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
5fdc6d216f libobs: Update version to 31.0.0 2024-10-04 18:39:41 -04:00
Ryan Foster
a1fbf1015f clang-format: Increase column limit from 80 to 120 2024-10-04 18:19:27 -04:00
Ryan Foster
5aaac2f0f9 libobs: Update version to 30.2.3 2024-10-04 16:38:29 -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
gxalpha
71775e3619 libobs: Assure large enough buffer in dstr_from_cfstring
Per the documentation of CFStringGetCString, the buffer provided must be
large enough not just for the string itself, but also for a NUL
terminator. This space for the NUL terminator is currently ignored, and
we just get lucky that CFStringGetMaximumSizeForEncoding often
dramatically overestimates the space required. However, it is possible
to actually hit the maximum with the string itself (for example by using
strings that contain exclusively Chinese characters such as "我"), in
which case the conversion fails. Adding the extra byte for the NUL
terminator fixes this.
At this point, we can also safely assert that our max_size is larger
than zero, silencing a clang analyzer warning that now is no longer
valid.
2024-10-04 13:36:09 -04:00
gxalpha
4420594729 libobs: Remove unused is_in_bundle() method 2024-10-03 17:09:54 -04:00
Dennis Sädtler
a4bda61015 libobs: Do not attempt to reconnect if stop event is set 2024-10-03 16:11:20 -04:00
gxalpha
4dd3cf6758 libobs: Deprecate obs_scene_sceneitem_from_source
obs_scene_sceneitem_from_source is problematic because there can be
multiple items of the same source in a scene, which the function doesn't
account for. In such a case, it would return the first item it finds,
which often might not be what a developer expects.

It was originally added for the undo/redo-operation of "Add New Source"
where the UI guarantees that the item is unique, but for a general case
it's not suitable.
2024-09-27 17:22:44 -04:00
Norihiro Kamae
1dc87caea4 libobs: Fix sending unclamped audio to output handler
The variable `input.conversion.allow_clipping` was left uninitialized.
This could result in randomly sending unclamped audio to the output
handlers that did not request the conversion.
2024-09-26 19:12:34 -04:00
Exeldro
de2f1fc3a3 libobs: Fix source profiling inactive sources 2024-09-26 18:09:14 -04:00
derrod
92a38bcd40 libobs: Disable transform debug logging by default 2024-09-26 17:46:47 -04:00
derrod
5fea7d325e libobs: Fix crop values for new nested scene sources being incorrect 2024-09-26 16:08:42 -04:00
Dennis Sädtler
a0edc5e8bc libobs: Do not allow reconnect if stop code is OBS_OUTPUT_INVALID_STREAM 2024-09-26 15:14:26 -04:00
gxalpha
16b8e9c3fe libobs: Deselect scene item before removing
Makes sure that a scene item that gets removed is in the "not selected"
state, no matter whether it was selected before. This causes the
"item_deselect" signal to be sent if the item is selected while being
removed.
2024-09-16 18:10:12 -04:00
Norihiro Kamae
61d74fb4ab libobs: Remove obs_output_signal_delay
The function is never called, documented or exported.
2024-09-16 16:29:27 -04:00
PatTheMav
6c590805e8 cmake: Update supported CMake version range to 3.28 and 3.30 2024-09-13 14:42:32 -04:00
Exeldro
5b79b4b74d libobs: Add obs_encoder_get_mixer_index 2024-09-12 18:07:19 -04:00
PatTheMav
4dac84999d libobs: Update macOS platform implementation
Cleans up the source code by sorting functions by topic and also
removes macros for hotkey implementation, removing the need to disable
compiler warnings.

Key codes and descriptions are now contained in arrays which either
use the OBS key code or the macOS key code as lookup keys with all
necessary context information directly associated with the key.

The implementation also uses the zero-initialization rule for arrays
of structs in such a way that the struct's "is_valid" boolean is
"false" by default so that only values explicitly initialized with a
key are ever "valid".
2024-09-12 16:44:39 -04:00
tytan652
31385006d5 Remove legacy_check CMake macro
The macro was not removed in 72428ccd97
waiting for submodules to be be updated to a commit where their legacy
code path is removed.
2024-09-11 13:24:39 -04:00
Alex Luccisano
07d504e5c7 shared/bpm: Add BPM (Broadcast Performance Metrics)
Introduce support for delivering BPM (Broadcast
Performance Metrics) over SEI (for AVC/H.264 and
HEVC/H.265) and OBU (for AV1) unregistered messages.
Metrics being sent are the session frame counters,
per-rendition frame counters, and RFC3339-based
timestamping information to support end-to-end
latency measurement.

SEI/OBU messages are generated and sent with each IDR
frame, and the frame counters are diff-based, meaning
the counts reflect the diff between IDRs, not the running
totals.

BPM documentation is available at [1].

BPM relies on the recently introduced encoder packet timing
support and the packet callback mechanism.

BPM injection is enabled for an output by registering
the `bpm_inject()` callback via `obs_output_add_packet_callback()`
function. The callback must be unregistered using
`obs_output_remove_packet_callback()` and `bpm_destroy()`
must be used by the caller to release the BPM structures.

It is important to measure the number of frames successfully
encoded by the obs_encoder_t instances, particularly for
renditions where the encoded frame rate differs from the
canvas frame rate. The encoded_frames counter and
`obs_encoder_get_encoded_frames()` API is introduced
to measure and report this in the encoded rendition
metrics message.

[1] https://d50yg09cghihd.cloudfront.net/other/20240718-MultitrackVideoIntegrationGuide.pdf
2024-09-05 16:38:58 -04:00
Alex Luccisano
0a36ed1164 libobs: Add a packet callback mechanism
Packet callbacks are invoked in `send_interleaved()` and
are useful for any plugin to extend functionality at the
packet processing level without needing to modify code in
libobs. Closed caption support is one candidate that is
suitable for migration to a packet callback.

The packet callback also supports the new encoder packet
timing feature. This means a registered callback will have
access to both the compressed encoder packet and the associated
encoder packet timing information.
2024-09-05 16:38:58 -04:00
Alex Luccisano
6a53b8928f libobs: Add encoder packet timing support
Introduce support for the `encoder_packet_time` struct
to capture timing information for each frame, starting
from the composition of each frame, through the encoder,
to the queueing of the frame data to each output_t.

Timestamps for each of the following events are based on
`os_gettime_ns()`:

CTS: Composition time stamp (in the encoder render threads)
FER: Frame encode request
FERC: Frame encoder request completely
PIR: Packet interleave request (`send_interleaved()`)

Frame times are forwarded through encoder callbacks in the
context that runs on the relevant encoder thread, ensuring
no race conditions with accessing per encoder array happen.
All per-output processing happens on data that is owned by
the output.

Co-authored-by: Ruwen Hahn <haruwenz@twitch.tv>
2024-09-05 16:38:58 -04:00
Ruwen Hahn
26b7b4511c libobs/util: Add os_nstime_to_timespec 2024-09-05 16:38:58 -04:00
derrod
c521b23619 libobs: Always set initial scene item pos to top-left corner
In relative mode (0, 0) is the center of the screen, so in order to
maintain previous behaviour we need to convert the value here.
2024-09-02 20:39:18 +02:00
derrod
22fc29c5b4 docs,libobs: Remove deprecated service APIs
Deprecated in 29.1
2024-08-28 19:10:27 -04:00
derrod
b7553b5883 docs,libobs: Remove master volume functions
Never implemented, deprecated in 29.0.
2024-08-28 19:10:27 -04:00
derrod
8729cebce7 docs,libobs: Remove deprecated scene item transition functions
Deprecated in 28.0, documentation erroneously states 27.2.

The following functions were erroneously not marked as deprecated in
the header:
- obs_sceneitem_set_show_transition()
- obs_sceneitem_set_show_transition_duration()
2024-08-28 19:10:27 -04:00
derrod
75cde08e8d libobs: Rename OBS_NIX_PLATFORM_X11_GLX to OBS_NIX_PLATFORM_INVALID
Deprecated in 28.0.
Renamed so that the values of non-deprecated members stay the same.
2024-08-28 19:10:27 -04:00