Commit Graph

2985 Commits

Author SHA1 Message Date
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
derrod
84d462c31c libobs: Remove obs_hotkey_enable_strict_modifiers()
Deprecated in 28.0.
2024-08-28 19:10:27 -04:00
derrod
03fbe28717 libobs: Remove base_set_allocator()
Deprecated in 28.0.
2024-08-28 19:10:27 -04:00
derrod
71d49b0ef2 docs,libobs: Remove/internalize deprecated addref functions
These have been deprecated for external users since 27.2 (early 2022)
and only two are still in use internally.
2024-08-28 19:10:27 -04:00
derrod
78bc3300c0 libobs: Remove obs_volmeter_{get,set}_update_interval()
Deprecated in 27.2.
2024-08-28 19:10:27 -04:00
derrod
a4f5a33b14 libobs: Remove obs_proprety_text_type()
Typoed function name, deprecated in 21.1.
2024-08-28 19:10:27 -04:00
derrod
bda463932e docs,libobs: Remove obs_render_main_view()
Deprecated since 21.0
2024-08-28 19:10:27 -04:00
derrod
07aa98ab34 libobs: Remove obs_get_default_rect_effect()
Originally removed in 0.12.1 but "temporarily" brought
back, then never removed.
2024-08-28 19:10:27 -04:00
derrod
1703361dba libobs: Remove obs_{duplicate,free}_encoder_packet
Deprecated in 0.2.4(!) over 10 years(!!) ago.
2024-08-28 19:10:27 -04:00
Ryan Foster
f0d619521b libobs: Fix Windows x86 CMake when using reduced obs-deps package
A recent obs-deps change removed all non-essential x86 deps. This caused
the x86 subproject(s) on Windows to fail to configure due to being
unable to find x86 dependencies that do not exist.

Co-authored-by: PatTheMav <PatTheMav@users.noreply.github.com>
2024-08-28 18:26:47 -04:00
tytan652
72428ccd97 Remove CMake legacy code path
Except submodules and legacy_check macro since the former depend on it.
2024-08-28 13:53:25 -04:00
derrod
ddd586ae03 libobs: Allow scene items to use legacy absolute mode
This is to keep old collections running in relative mode until they
can be migrated.
2024-08-27 23:58:51 +02:00
derrod
1565ca8eb1 libobs: Change scene items to using relative coordinates 2024-08-27 23:58:51 +02:00
derrod
a50320464a libobs: Force sceneitem transform update if scene dimensions change 2024-08-27 23:58:51 +02:00
tt2468
16f0bb68ae libobs: Add OBS_ENCODER_CAP_SCALING
Adds a new encoder cap which tells libobs that rather than scaling
video frames in software, the encoder is capable of scaling them via
its own (presumably more efficient) means.

An encoder may implement this cap by comparing the VOI of its assigned
`video_t` and the results of `obs_encoder_get_width/height()`. If the
width/height values differ, then the encoder is being asked by libobs
to self-scale, and the resolution in VOI will be the raw frame size,
with the `...get_width/height()` being the intended output resolution
of the encoder.

It is important to note that GPU rescaling mode will take priority
over self-scaling. If GPU rescaling is enabled, the encoder will never
be asked to self-scale.

This is useful for discrete hardware encoders, where they might have
fixed-function video scaling logic that is highly efficient and fast.
Additionally, this feature allows a hardware device which is encoding
a full ABR ladder of tracks to be smart and only copy a video frame
from GPU -> Host -> Device once for the entire ladder, rather than
once for every track.
2024-08-23 14:20:53 -04:00
tt2468
92b5643081 libobs: Remove broken rescale modification logic
This logic would previously have written any changed scale resolution
set by the encoder in the `.get_video_info` callback back to the
encoder, however this functionality was "broken" by
20d8779d30. In reality, this would have
never worked with texture encoders or with GPU rescaling enabled, and
probably would have had odd side effects for CPU rescaling, too. It's
best just to remove this functionality.
2024-08-23 14:20:53 -04:00