0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00
Commit Graph

2965 Commits

Author SHA1 Message Date
Kurt Kartaltepe
8c71b0b586 libobs: Fix plane heights for odd values 2024-07-03 02:11:48 -07:00
tt2468
8892edde05 libobs: Merge obs_encoder_stop() and ..._stop_internal()
There is no longer any need for them to be separate functions. This is
just code cleanup.
2024-06-26 16:42:05 -04:00
tt2468
06291c7201 libobs: Fix race when to-be-destroyed encoder group finishes stopping
Fixes a crash when the following steps occur:
- Encoder group created and then started with encoders, only the group
owning encoder refs
- Encoder group destroy called: group has `destroy_on_stop` set
without actual destroy
- Outputs holding encoders from stopping are stopped
- `remove_connection()` function destroys encoder group, releasing
encoders and causing the currently processed encoder to be destroyed
early
- parent scopes try to access destroyed encoder pointer and crash

This change moves some logic around to improve the release/destruct
order of `obs_encoder_stop()` to fix the race above.

Note: Cases of encoder errors will not destruct the group if it has
`destroy_on_stop` set, as the encoder is also not destroyed if it also
is set to destroy on stop. This part of the code should be revisited
at a later date and fixed up to prevent memory leaks.
2024-06-26 16:42:05 -04:00
tt2468
fb5bbc8575 libobs: Set encoder initialized call closer to shutdown
This is mainly code cleanup.
2024-06-26 16:42:05 -04:00
gxalpha
92352f18b8 cmake: Add obs-config.h to libobs headers
Adds the header to make it findable in IDEs
2024-06-19 13:08:30 -04:00
tt2468
e215502b62 libobs, UI: Normalize encoder group API
Modifies the encoder group API added previously to better follow the
existing libobs API naming paradigms. This also produces much more
readable code, and allows a few small benefits like only needing to
hold a reference to the encoder group, instead of every encoder.
2024-06-17 08:20:01 -07:00
tt2468
751dbdad10 libobs: Update video encoder group struct member names
Updates the struct member names of the video encoder group to be more
like what is commonly seen in OBS elsewhere.
2024-06-17 08:20:01 -07:00
Ryan Foster
5ef97920c3 libobs: Update version to 30.2.0 2024-06-07 17:55:37 -04:00
jcm
bd36daa395 UI: Address logging buffer size discrepancies 2024-06-07 17:38:06 +02:00
derrod
efd0e6d0bd libobs: Add buffered file serializer to legacy cmake 2024-06-05 19:25:14 -04:00
Warchamp7
52ae5fc4bd UI: Update volume meter appearance 2024-06-03 17:20:21 -04:00
derrod
94d158c425 libobs: Add functions to serialize JSON with default values 2024-05-25 17:29:28 -07:00
derrod
79632f96dd libobs: Fix buffer overrun in video_frame_init 2024-05-25 17:12:34 -07:00
gxalpha
a1e0626c14 libobs: Add global source filter add/remove signals
Adds global signals for when a filter is added to or removed from a
source. These will be helpful for listening for changes to a sources
filters without having to attach and detach a signal handler, which
would be annoying in the context of for example context menus which
change sources rapidly.
2024-05-25 17:08:42 -07:00
derrod
72924ac1f3 libobs: Deduplicate audio for nested scenes/groups if not transitioning 2024-05-18 16:44:45 -07:00
derrod
8a38e3375b libobs: Mix audio of each source in a scene only once 2024-05-18 16:44:45 -07:00
derrod
adf744e6f0 libobs: Ensure audio offsets are positive 2024-05-18 16:29:01 -07: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
279e9424c0 libobs: Fix obs_parse_avc_header missing high profile parameters 2024-05-10 18:14:27 -04:00
pkv
5b2e2a9c68 libobs/media-io: Fix media-remux channel layout for 5 channels
FFmpeg has 5.0 as default layout for 5 channels.
But obs-studio uses 4.1. This is a fix when remuxing.

Signed-off-by: pkv <pkv@obsproject.com>
2024-05-09 10:27:20 -04:00
tt2468
fa482b6b49 libobs: Fix I40A plane height calculation for fourth plane
The commit 2fc13540 introduced a typo bug causing the defined height of
the fourth plane in I40A to be 0, instead of the original frame height.

This changes a 0 to a 3, in order to populate that value correctly.
2024-05-03 21:05:13 -07:00
tt2468
d584aed501 libobs: Add obs_encoder_parent_video() method
Allows parent video object of an encoder with an FPS divisor to be
fetched.
2024-05-03 10:33:46 -07:00
Norihiro Kamae
d81dd24f38 libobs/media-io: Fix copying different line-size video frame
The commit 2fc13540f implemented to copy a video frame into a different
line-size video frame.
However, when the line-size was different, the frame was not correctly
copied.
2024-04-28 09:58:40 -07:00
JoHn BoWeRs
3ab71a9f90 libobs: Use bmalloc/bfree for caption data 2024-04-26 18:17:34 -07:00
John Bowers
5c8be1de22 libobs: Add caption support for AV1
Extract the itut_t35 caption data buffer from existing caption data
and repackage in a metadata OBU instead of an AVC/HEVC SEI.
2024-04-26 18:17:34 -07:00
JoHn BoWeRs
33eb95c274 libobs: Add caption support for HEVC
Add embedded caption support for HEVC by slightly modifying the H.264
SEI to be an HEVC SEI (2 byte SEI NAL header).
2024-04-26 18:17:34 -07:00
John Bowers
f9bc9a8b12 libobs: Avoid adding captions on non H.264 streams
The existing caption insertion implementation is to add H.264 specific
SEI NALs, because of this we will skip caption insertion unless the
video stream is H.264. This prevents corruption of AV1/HEVC/etc.
2024-04-26 18:17:34 -07:00
John Bowers
849c1180ac libobs: Insert captions on all video tracks
We will now keep a per track list of caption data. When caption
insertion is triggered we will add that to the list for each actively
encoding video track. When doing interleaved send, we pull the data
from the caption data for the corresponding video. This ensures that
captions get copied to all video tracks.
2024-04-26 18:17:34 -07:00
tt2468
2fc13540f0 libobs: Rewrite video-frame
Rewrites the `struct video_frame` implementation, resolving a few
hidden bugs, and improving memory alignment reliability. Should also
make it much easier to implement and maintain texture formats in this
part of the codebase.
2024-04-26 08:25:26 -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
Ruwen Hahn
2edc555af7 libobs: Fix grouped encoders never starting again after disconnect
(based on <340c205ce2>)
2024-04-20 16:54:26 -07:00
Ruwen Hahn
d966742a63 libobs: Fix highest_video_ts tracking
Calling `set_higher_ts` before offsets are known pollutes
`highest_video_ts` with timestamps that are out of range of actual
timestamps. They're generally somewhere high above 0 until an
offset for all streams is found, where they are then reset to 0 or
slightly below 0 in the presence of b-frames.

`highest_video_ts` also needs to start below 0 for the same reason.
Even with timestamps being reset to close to 0, b-frames will
cause initial DTS to drop below 0, thus we need a value that should
"always" be below any "real" timestamps observed.

`highest_video_ts` tracking now only starts once all input streams
are ready, and is computed based on all buffered packets at that
point.
2024-04-20 16:41:55 -07:00
Norihiro Kamae
b4a061dcd8 libobs: Remove unused variable in obs_source 2024-04-20 16:07:37 -07:00
Kurt Kartaltepe
10bfa99365 libobs: Export NV12/P010 functions
NV12 and P010 device functions were not exported on all platforms.
Windows was exporting from C files instead. After CMake 3.0 we started
hiding symbols and resolution failed.
2024-04-19 15:23:56 -04:00
PatTheMav
cb1a4c1c61 libobs: Fix relocatable Linux builds using legacy portable build flag 2024-04-16 12:46:51 -04:00
PatTheMav
0af0de26eb libobs: Add changes for CMake build framework 3.0
New code path only taken if OBS_CMAKE_VERSION is set to 3.0.0 or
greater, old functionality remains unchanged.
2024-04-13 23:48:38 -04:00
Ruwen Hahn
5e1909d54f libobs: Track keyframe alignment for keyframe aligned encoder groups 2024-04-12 14:52:32 -07:00
Ruwen Hahn
c288d42cfd libobs: Add obs_encoder_group_keyframe_aligned_encoders
Ensures grouped encoders start on the same input frame
2024-04-12 14:52:32 -07:00
tytan652
e032c2d0c9 deps,libobs: Replace uthash with prefix/system install 2024-04-07 10:01:25 +10:00
Ryan Foster
01610d8c06 libobs: Update version to 30.1.2 2024-04-05 15:32:10 -04:00
Ryan Foster
69e7eb2c7d libobs: Update version to 30.1.1 2024-03-21 17:58:44 -04:00
derrod
567e35ac69 libobs: Set channel layout for remux output 2024-03-18 19:41:46 -04: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
Patrick Heyer
e0f0c1147a
libobs: Fix missing w32-pthreads dependency when building without UI (#10360)
w32-pthreads is not correctly added to the generated CMake project
if the UI subdirectory is not also included, which leads to builds
configured without UI to fail.
2024-03-11 15:29:33 -04:00
Lain
4b138f674f libobs: Deprecate scene item transform API
In order to support crop_to_bounds, deprecates:
obs_sceneitem_set_info
obs_sceneitem_get_info

In favor of:
obs_sceneitem_set_info2
obs_sceneitem_get_info2
2024-02-20 21:46:13 -06:00
Exeldro
806c72fc66 libobs: Save crop to bounds when saving transform states
(Lain note: Splitting parent commit. This was probably unintentionally
not taken into account in the origin crop_to_bounds PR.)
2024-02-20 21:18:51 -06:00
Exeldro
f275080abb libobs: Fix crop to bounds ABI break 2024-02-20 21:18:51 -06: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
Lain
89288f1cf5 libobs: Update version to 30.1.0 2024-02-01 09:57:22 -06:00
Kurt Kartaltepe
ccfcbc2699 libobs: Copy both converted textures on stall for OpenGL
As the comment mentions this only occurs during an encoder stall on the
first frame. On D3D both gs_texture_t's are actually a single D3D
texture object and both planes are copied during gs_copy_texture, for
everyone else we need to copy the textures separately as they are
independent OpenGL textures.
2024-01-30 22:15:41 -06:00
derrod
20d8779d30 libobs: Prevent encoder reconfiguration after initialization 2024-01-29 17:35:11 -05:00
Kurt Kartaltepe
3e49e89611 libobs,libobs-opengl,libobs-d3d11: Add opengl gs_enum_adapters
This adds gs_enum_adapters and gs_get_adapter_count to the opengl
backend and promotes these to multiplatform graphics functions.

However we need to make an internal device change, device_enum_adapters
must pass in the current device on opengl to ensure that adapter #0 is
the display adapter. We do this to avoid changes to plugins already
checking against obs_video_info.adapter which is always 0 and expected
to be the device OBS was initialized on.

The actual implementation reports the dri render node (or /Software).
This allows plugins to query non-video features of the adapters like
VA-API/NVENC/etc or other cross device functionality. `/Software` is
chosen to avoid opening random files in the current directory if its
passed along as a file path like the regular dri render nodes.
2024-01-27 17:51:33 -06:00
Kurt Kartaltepe
02c90207fc libobs,libobs-opengl: enable GPU encoding for OpenGL
Enable all of the previously Windows only paths for OpenGL backends that
support encode_texture2

Co-authored-by: Torge Matthies <openglfreak@googlemail.com>
2024-01-26 20:01:58 -05:00
Torge Matthies
f81ed52ec7 libobs: Add encode_texture2 function to struct obs_encoder_info
And use it if non-NULL instead of encode_texture.
2024-01-26 20:01:58 -05: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
aa730bcd4c libobs: Fix audio doubling with multiple main view mixes 2024-01-25 14:57:03 -05:00
Exeldro
c4c2f5b382 libobs: Fix GPU scaling using the main mix 2024-01-25 14:10:00 -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
Lain
1e09f5a543
Merge pull request #10039 from derrod/roi-libobs
libobs/plugins: Add region of interest (ROI) encoder feature
2024-01-13 18:30:31 -06: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
Rodney
d96ad4ac98 libobs: Add encoder ROI functions 2024-01-11 13:36:35 +01: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
2fb7063e1a libobs: Defer media controls to video thread
To prevent sources from having to take too much extra consideration into
threading, defer the media control functions that directly affect
functionality to the video thread. Getters will still have to take
threading into account, but this should make things much more trivial
for media controls thread-wise.

(Lain note: Context: I noticed that things such as the slide show
require mutexes due to their media controls, and I felt that it was
largely unnecessary and that libobs should mitigate the threading issue
itself and keep it all in the video thread like it should be. Again, the
getters are still going to require *some* consideration into threading
but in terms of threading, for the type of stuff we're doing, querying
state is far more trivial to take into consideration.)
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
Lain
9c9a50643a libobs: Do not allow controllable media without flag
The OBS_SOURCE_CONTROLLABLE_MEDIA flag is required for controllable
media callbacks to be usable. These checks are being added so we can
defer most controllable media callbacks to the video thread.
2024-01-07 15:59:09 -06:00
Lain
1151bc9dea libobs: Add a couple missing comments
(Lain note: This is mostly so more (yes more) can be added to this
god-forsaken structure without it getting too messy. In terms of actual
code, I need to be better about writing actual code comments. ...Meaning
that I actually need to start writing code comments.)
2024-01-07 15:59:09 -06:00
derrod
6fea91067f libobs: Pass parent pointer into signal_item_remove
With aaf8d8b38f changing the order
item->parent would be NULL thus resulting in a crash.
2024-01-07 02:28:53 +01:00
derrod
aaf8d8b38f libobs: Send item_remove signal after detaching item 2024-01-06 17:48:37 -06:00
jcm
78b6cf16c3 libobs: Use aligned memory allocator in Cocoa logging 2024-01-05 15:38:06 -05:00
jcm
2b38069709 libobs: Log Mac model identifier 2024-01-05 15:38:06 -05:00
derrod
f6c8fe7b64 libobs: Fix crop to bounding box not being duplicated with item 2024-01-03 22:03:16 +01:00
Robert Wittams
73e9561633 mac-capture: Allow selection of channels on core audio devices 2023-12-19 18:33:53 -05:00
PatTheMav
e065f2a839 libobs: Update CMake target source lists with alphabetic sorting 2023-12-19 17:59:44 -05:00
PatTheMav
9ae47a7937 cmake: Update FFmpeg find package to use explicit version 2023-12-19 17:59:44 -05:00
PatTheMav
8135085a23 cmake: Replace custom Qt discovery function with CMake default
find_qt was necessary during the transitional period between Qt5 and
Qt6. With Qt6 being the only supported Qt version (for open source) for
the time being, code complexity can be reduced for easier maintenance.
2023-12-19 17:59:44 -05:00
gxalpha
92ea7cb145 libobs: Remove obs-ui from public headers
This file got removed in 5177a593af and
as such should no longer be declared as a public header.
2023-12-17 22:13:47 +01:00
derrod
7e456d9dea libobs: Add automatic cropping to bounds for scene items 2023-12-16 18:00:11 -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
Lain
e958964bee libobs: Update version to 30.0.2 2023-12-10 14:04:03 -06:00
Exeldro
b05a401728 libobs: Render audio for all views 2023-12-10 03:35:11 -06:00
Norihiro Kamae
0f9376f1cb libobs: Fix audio-only output did not receive raw_audio 2023-12-09 18:52:17 -06:00
Lain
646adafc73 libobs: Update version to 30.0.1 2023-12-09 14:21:57 -06:00
sora-blue
8fc0489e4a
libobs: Fix scene_enum_sources skipping some active sources
If an item's show/hide transition was active the underlying source
would not previously not be enumerated, resulting in reference leaks by
the UI or other components waiting for the source to be deactivated to
release it.
2023-12-08 14:10:12 +01:00
derrod
ca865f80cc libobs: Pair video encoder with all audio encoders 2023-12-05 15:36:37 -06:00
derrod
b680700bba libobs: Remove unused wait_for_video flag 2023-12-05 15:36:37 -06:00
derrod
5177a593af libobs: Remove module UI functions 2023-12-02 18:09:20 -06:00
derrod
fc891295b6 libobs: Deprecate obs_view_get_video_info 2023-12-02 18:05:55 -06:00
derrod
5ea9fcc951 libobs: Add obs_view_enum_video_info 2023-12-02 18:05:55 -06:00
derrod
7c36257cc0 libobs: Fix obs_view_remove only resetting the first matching mix 2023-12-02 18:03:11 -06:00
derrod
49e796c6fc libobs: Fix GPU scaling always using the main mix 2023-12-02 17:47:33 -06:00
Stephen Seo
cd784644f5 libobs: Fence off unnecessary code due to FFmpeg v6.1 changes
Fixes for using FFmpeg 6.1 due to deprecations. Uses `#if` macros to
allow builds for using older versions of FFmpeg.

This commit prevents obs from using the "fenced" code if using FFmpeg
6.1, since in FFmpeg commit [1] the "side_data" is added to
`AVCodecParameters`, and therefore the existing/following
`avcodec_parameters_copy(...)` will account for the metadata.

[1]: avcodec/codec_par: add side data to AVCodecParameters
21d7cc6fa9
2023-12-02 17:43:18 -06:00
derrod
f5b7c98d2d libobs: Reuse matching mix's render texture if possible
Avoids re-rendering a view if a previous mix with identical settings
has already rendered it
2023-12-02 17:36:48 -06:00
tt2468
05d52ee3a7 libobs: Fix PTS incrementation when FPS divisor is enabled
When using a PTS divisor, OBS would still increment the PTS by only the
original `fps_den` value, not considering that PTS values should be
multiplied by the divisor.

For example, `60/1` increases like `0,1,2,3`. `60000/1001` increases
like `0,1001,2002,3003`.

Without this fix, `60/1` main OBS framerate with a divisor of `2`
produces `0,1,2,3`, while the correct pattern would be `0,2,4,6`
2023-11-29 16:23:24 +01:00