Commit graph

2914 commits

Author SHA1 Message Date
jpark37 7669da1ea8 libobs: Add VIDEO_FORMAT_R10L
Support 10-bit packed format that DeckLink uses.
2023-07-29 16:41:31 -07:00
tytan652 c6ce50c9a3 deps,libobs,plugins: Remove in-tree Jansson
Jansson is provided by other means on any supported platform.
2023-07-29 16:37:14 -07:00
Ryan Foster f7d3ba7b1b libobs: Check if adapter can safely fast clear 2023-07-29 16:34:47 -07:00
Ryan Foster e5d5df879c libobs: Add function to check fast clear capability 2023-07-29 16:34:47 -07:00
CodeYan01 a494cf5ce4 libobs: Add obs_source_info.filter_add
If there is filter_remove, it is reasonable to expect that there is also
filter_add. filter_add also enables filters to attach signal handlers
on the parent, and disconnect them in filter_remove.
2023-07-29 16:15:21 -07:00
Ruwen Hahn ac8ccf4027 libobs: Fix GPU scaled video encoder media not being cleared
During encoder shutdown `maybe_clear_encoder_core_video_mix` is
called to clear created mixes that are no longer needed; at that
time `obs_encoder_set_video` rejects changes to `media` since
the encoder is still active, so we bypass those checks

This is an issue e.g. when a rtmp stream disconnects (and thus
all encoders are cleared) and subsequently reconnects
2023-07-26 05:03:12 -07:00
Penwywern 23ca4cf704 libobs: Fix flip calculations in bounding box
This fixes flipping behaviour when positional alignement inside the
bounding box is other than centered, bringing it in line with the
behaviour when centered, i.e. flip the item in-place in the bounding
box.
2023-07-25 16:01:04 -07:00
derrod d90bfc5e0b libobs: Add obs_add_safe_module() 2023-07-21 23:22:07 +02:00
cg2121 cb8b5ba9cd libobs: Change return type for getting filter index
This changes the return type for getting the filter index from a
size_t to an int. This makes it easier for developers to use,
as an invalid index just returns a -1.
2023-07-20 13:21:14 -07:00
gxalpha 5ed0b8a0b8 libobs: Assume Qt 6, always warn about Qt 5 plugins 2023-07-19 11:56:54 -04:00
Chensiyy 41e2791f27 libobs: Fix PROPVARIANT variable has not be freed
The PropVariantClear function frees all elements that can be freed in a given PROPVARIANT structure.
2023-07-15 16:38:24 -07:00
Richard Stanway 4118fa7ac1 libobs: Don't defer encoder updates if not necessary
When #5169 implemented deferred encoder updates, it did not account for
the case when the encoder hadn't started yet. This means the encoder would
start and then immediately call update with the same settings it was
started with, which in the case of some hardware encoders would trigger
a reconfiguration request to the driver.
2023-07-15 16:31:19 -07:00
gxalpha 55237ab2ef libobs: Export more libobs/util headers 2023-07-15 16:17:42 -07:00
derrod dcc07cfe4e clang-format: Set AllowAllConstructorInitializersOnNextLine to false 2023-07-15 16:14:55 -07:00
derrod 1739272c44 clang-format: Set AllowAllArgumentsOnNextLine to false 2023-07-15 16:14:55 -07:00
Clayton Groeneveld e121ac1587 UI, libobs: Add RAII wrappers for faders/volume meters
They can now be automatically deleted.
2023-07-15 16:06:36 -07:00
Ryan Foster 80864197fb libobs: Fix back-to-back GPU encoder sessions breaking
Reset frame_rate_divisor_counter to 0 on encoder shutdown.

After starting and stopping a GPU encoder session, obs_encoder_shutdown
would set frame_rate_divisor_counter to 1. When the next GPU encoder
session was started, in libobs/obs-video-gpu-encode.c, gpu_encode_thread
would set skip to this value (1), and increment
frame_rate_divisor_counter to 2. This causes the next check to fail, as
frame_rate_divisor is 1 by default (2 == 1 is false), so
frame_rate_divisor_counter retains its value. Since skip is non-zero,
the next check, if(skip), passes, and skip to the next loop iteration.

This will continue forever, because frame_rate_divisor_counter will
continue to increment, so it will never hold the same value as
frame_rate_divisor. This means that send_off_encoder_packet is never
called, so the muxer never receives encoded packets.

To the end-user, this manifests as their second encoder session being
impossible to stop. They then have to force quit OBS and the
obs-ffmpeg-mux process. This change prevents that from occurring and
allows multiple back-to-back GPU encoder sessions to be completed.
2023-07-14 11:56:28 -04:00
derrod c939525f77 libobs: Remove legacy FFmpeg compatibility 2023-07-12 15:57:43 -04:00
Norihiro Kamae bc6cfab615 libobs/util: Remove outdated comment 2023-07-12 13:54:50 -04:00
Penwywern 8789c43959 libobs: Fix flip not working with stretch to bounds 2023-07-08 16:42:15 -07:00
Sergo e4a3f80f9f libobs: Add use of pause callbacks to CoreAudio monitoring 2023-07-06 15:24:12 +02:00
Sergo 9eea0d8921 libobs: Add pause callback support for sources 2023-07-06 15:24:12 +02:00
Ruwen Hahn 6cdfb0a8b9 libobs: Allow configuring frame rate divisor for encoders
This allows encoders/outputs to output at a frame rate that is lower
than the configured base frame rate
2023-07-03 09:35:06 -07:00
Norihiro Kamae 8169188f89 libobs: Define DARRAY macro types
To avoid passing `struct darray *` type, which cannot hold the type
information, this commit defines array types and uses that types on the
function parameters.
2023-07-01 00:39:13 -07:00
Norihiro Kamae c8e3794a35 libobs/graphics: Remove undefined function declarations
These functions were declared but never defined. Let's just remove them.
- effect_upload_shader_params
- ep_param_writevar
- effect_upload_params
2023-07-01 00:39:13 -07:00
Norihiro Kamae fa02582db6 libobs/graphics: Define DARRAY macro types used in effect 2023-07-01 00:39:13 -07:00
Norihiro Kamae a4ddaf528a libobs/util: Use defined array types on function parameter lists
To avoid passing `struct darray *` type, which cannot hold the type
information of the array element, use defined array types on the
function parameter lists.
2023-07-01 00:39:13 -07:00
Norihiro Kamae 03b679d68e libobs/util: Remove unnecessary parentheses
The previous commit added parentheses inside the macros so that the
parentheses is unnecessary when using the macros.
2023-07-01 00:39:13 -07:00
Norihiro Kamae 6425d53ff0 libobs/util: Fix operator precedence in dyamic array macros
Passing DARRAY with an operator such as dereference (`*`) sometimes
caused a compile error. To avoid the error, introduced parentheses
inside the macros.
2023-07-01 00:39:13 -07:00
PatTheMav 89625715fc cmake: Fix configuration errors with Windows legacy path
By default Windows builds use the legacy CMake code paths, which ideally
work as-is with existing build directories.
2023-06-30 11:56:57 -04:00
PatTheMav db895092ed cmake: 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.
2023-06-29 10:11:32 -04:00
derrod 0cb812251c libobs: Add scene uuid to transform state data 2023-06-28 11:04:56 -07:00
Ruwen Hahn 03fa9acc7f libobs: Add obs_encoder_enable_gpu_scaling
Allows rescaling resolution for GPU encoders and allows moving
rescaling for CPU encoders from CPU to GPU

Rescaling is implemented via core video mixes; encoders create
their own core mix with matching width/height/format/colorspace/
range when gpu scaling is enabled and no matching core video
mix exists
2023-06-26 13:32:25 +02:00
gxalpha f37876a941 libobs: Fix obs_output_get_height2 returning width 2023-06-25 16:06:49 -07:00
Richard Stanway 896cd4adb2 libobs: Detect and log presence of Lenovo Vantage on Windows
This software seems to be pre-installed on many Lenovo systems and has a
"Network Boost" feature that restricts data usage of background apps,
causing throughput issues when streaming with OBS.
2023-06-24 16:31:21 -07:00
cg2121 243d4d42e9 libobs: Add functions to get/set the index of filters 2023-06-21 15:33:48 -07:00
PatTheMav 59904a66a3 cmake: Update Framework link definition for macOS builds 2023-06-17 12:23:33 -04:00
PatTheMav 50a4e83251 cmake: Remove Info.plist template files for macOS builds
Creation of Info.plist files through Xcode is more canonical and
future-proof, as it will automatically pick up changes/updates
introduced by Apple. Non-standard keys can still be added via a
template file, which will then be extended by Xcode with the default
keys.
2023-06-17 12:23:33 -04:00
Lain 1bbb3fa773 libobs: Update version to 29.1.3 2023-06-17 00:44:00 -07:00
PatTheMav 3ca56fee84 libobs: Silence clang warnings for empty prototypes without void
clang expects an empty prototype to explicitly use `void`.

Also silences the warning in `libobs-opengl`, `obsglad`, `caption`,
`mac-syphon` and `obs-x264-test`.
2023-06-16 14:12:58 -04:00
John Bradley 8981afe5b4 libobs: Set video thread qos class to user interactive on macOS 2023-06-15 15:25:47 +02:00
Ruwen Hahn 9b5ce9fcec
libobs: Fix null pointer access for video packets
Initialize arrays to 0, as otherwise these can get initialized with 
garbage data or potentially Visual Studio's default debug marker,
which is a problem if they're being checked against `NULL` later.
2023-06-14 19:52:05 +02:00
John Bradley 6ec0b2db11 libobs: Add support to obs-outputs for multi video encoders
This adds support in outputs to handle multiple video encoders
and their interleaving with the encoded audio.
2023-06-14 02:24:54 -07:00
PatTheMav f8e00d6071 clang-format: Update formatting of all ObjC and ObjC++ files 2023-06-11 14:56:45 +02:00
derrod 263781c6c6 libobs: Fix crash when properties are deleted in callback
(cherry picked from commit 447710ab2c)
2023-06-11 02:18:17 +02:00
gxalpha 79822a58c3 libobs,plugins: Remove new obs_output_*2 functions
Effectively reverting parts of d314d47, this commit removes the new
functions that got added to remove the flags parameter. Instead, it just
marks the parameter as unused and documents this. Having what is
effectively an API break just to remove a parameter is a bit overkill.
The other parts of d314d47 which cleaned up the usage of the flags
parameter are untouched here.
2023-06-10 16:13:05 -07:00
Lain 1aed7ed114 libobs: Use da_clear() to clear obs_core_data::sources_to_tick
Makes it a bit more clear what's going on
2023-06-10 14:30:44 -07:00
Lain 85ca5a25be libobs/util: Add da_clear()
Adds a bit more of an explicit function for clearing dynamic arrays
2023-06-10 14:29:33 -07:00
Exeldro a77789b266 libobs: Don't keep the sources mutex in tick_sources
Allow other threads to use sources while the graphics thread does
video_tick, update, activate and deactivate on sources
2023-06-10 14:20:13 -07:00
Lain 9178ec6a8d libobs/util: Actually fix use-after-free in da_insert_new
d040de51bb was prematurely merged, this
should actually do the job as requested.
2023-06-10 12:31:41 -07:00
Norihiro Kamae d040de51bb libobs/util: Fix use-after-free in darray_insert_new
After the array is allocated in `darray_ensure_capacity`, the pointer
`item` is invalid.
2023-06-10 11:54:27 -07:00
Sean DuBois ed577a05aa libobs: Add bearer token to obs_service_connect_info
This adds a new OBS_SERVICE_CONNECT_INFO_BEARER_TOKEN which is needed for WHIP output.

Signed-off-by: pkv <pkv@obsproject.com>
2023-06-09 20:20:49 -05:00
Florian Zwoch dd6841143d libobs/util: Do not include SIMDe for MinGW targets
MinGW comes with it's own intrinsics macros as regular MSVC does.
On MinGW the inclusion of SIMDe would cause multiple definitions
of the same macro names.

Since sse-intrin.h leaks into the public header space this
will cause 3rd party plugins build with MinGW tool-chains emit
redeclaration warnings when including obs-module.h.
2023-06-09 04:48:54 -07:00
kyle 40ed16637c libobs: Remove duplicate debug symbol paths in Windows 2023-06-08 00:25:27 -07:00
PatTheMav 2966c4030e libobs: Use static library for version string information
Switching to a static library that contains version information as
const char strings has multiple benefits:

* The version information provided externally via compiler definitions
  will fail compilation early if malformed
* An updated version string (which will happen with every commit) will
  not invalidate existing compilation units, because only the static
  library is affected by the change
* An update of the version change just requires a recompilation of the
  static library and a linker update
* An update of the version will _not_ infect the rest of the codebase
  (as it does currently, because everything includes obsconfig.h one
  way or another)
* Other modules which used the macro definition directly have been
  updated as much as possible to use the proper getter method from
  `libobs` instead (some Windows-specific modules use preprocessor
  string composition, the value has been added as a compiler definition
  directly in those cases)
* Because the impact of a version change due to a commit hash change
  is limited to the static library, ccache hit rates should be
  improved considerably
2023-05-27 16:48:24 -07:00
Lain 8bbc959a03 libobs: Update version to 29.1.2 2023-05-27 14:49:56 -07:00
tt2468 a696470c9e
libobs: Remove warning log for raw outputs when starting data capture
#8873 accidentally used `log_flag_encoded()` instead of `flag_encoded()` in `obs_output_begin_data_capture()`, which was causing a warning to be logged when it shouldn't.
2023-05-27 13:18:41 -07:00
gxalpha ad9fd6c6f0 libobs,UI: Add properties radio button list 2023-05-20 16:48:23 -07:00
gxalpha f049962bb2 libobs: Add properties list boolean format 2023-05-20 16:48:23 -07:00
tt2468 d314d4725d libobs, plugins: Deprecate obs_output_t functions with flag parameters
This deprecates the following functions, replacing them with new
versions:
- `obs_output_can_begin_data_capture()` - now `*capture2()`
- `obs_output_initialize_encoders()` - now `*encoders2()`
- `obs_output_begin_data_capture()` - now `*capture2()`

The flags parameter was initially designed to support audio-only or
video-only operation of an output which had the `OBS_OUTPUT_AV` flag,
however, full support for that was never implemented, and there are
likely fundamental issues with an implementation, mainly that most
outputs are programmed assuming that there will always be at least one
audio and one video track. This requires new flags specifying support
for optional audio/video, among other things.

An implementation to allow audio/video to be optional is best done
using the flag technique above, with audio/video enablement specified
by whether media (raw, `video_t/audio_t`) or encoder (`obs_encoder_t`)
objects are specified.

Since every implementation I could find always specifies `flags` as 0,
I was able to safely conclude that immediately removing the parameter's
functionality is safe to do.
2023-05-20 16:41:55 -07:00
PatTheMav e400d3f1bc libobs: Fix struct type usage before actual include
In its current form `struct dstr` is used in functions declarations
in the header file before the actual type is included (as `dstr.h` is
included after in `window-helpers.c`.

`clang-cl` is unable to compile this code because the function signature
 defined in the header will not match the implementation in the source 
 code due to the implicit forward-declaration of `struct dstr` before 
 the type is included in the actual header.
2023-05-20 16:37:19 -07:00
derrod 1ca72bcc54 libobs: Remove registry-based HAGS logging 2023-05-20 16:24:58 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
Jim 38e5411490 libobs: Prevent setting invalid scene item scale values
Fixes obsproject/obs-studio#7962
2023-05-19 17:31:14 -07:00
Jonathan Bennett caa80c2a41 libobs: Rework logic for detecting monitoring feedback in PulseAudio
The option of default device or specified device for audio input
and monitoring device made for a matrix of four possible combinations.
Not all combinations were properly detecting feedback potential.
This reworks the logic so we properly detect in all four cases.
2023-05-19 15:18:37 -04:00
Jonathan Bennett 4052775399 libobs: Fix PulseAudio monitoring when device is set to default
When the monitoring device is set to default, this bit of code was
appending the no-longer-needed ".monitor" to the device name.

Fixes #8877
2023-05-19 15:18:37 -04:00
PatTheMav e52256184a libobs: Adds obs.hpp to exported header files
Required for plugins built using C++ linking against libobs.
2023-05-17 11:47:08 -04:00
tt2468 645e31fa15 libobs: Add sanity checks to some obs_output_t functions
Since OBS outputs can have any combination of flags for encoded,
video, audio, and service, there are a number of cases where it would
be a good idea to validate that we're not allowing output changes that
risk undefined behavior given the supported flags.

This also does a mild amount of code cleanup, adding inline functions
for checking the flags mentioned above.
2023-05-13 18:26:52 -07:00
PatTheMav 9581ebe7fd libobs: Remove support for deprecated MACH task info struct 2023-05-13 16:56:11 -07:00
PatTheMav ee1ec26de3 libobs: Use native ObjectiveC methods to generate data and module paths 2023-05-13 16:56:11 -07:00
jp9000 c289efd84a libobs: Update version to 29.1.1 2023-05-08 22:31:35 -07:00
jpark37 7ff5dd63b9 libobs: Fix luma sampling for packed 4:2:2 sources 2023-05-06 16:31:06 -07:00
jp9000 34e3d64158 libobs: Update version to 29.1.0 2023-05-02 01:54:35 -07:00
jpark37 901986cbf4 libobs,obs-filters: Align HDR to SDR disparity
Adjust colors from BT.1886 to sRGB.
2023-04-23 23:43:09 -07:00
Kasin Sparks b645ea6c5f libobs: Fix mouse button push to talk for linux
Fixes issue with mouse buttons 4 and 5 not working for push to talk
when using linux
2023-04-23 23:41:41 -07:00
tt2468 681093616a libobs: Check for extension validity in os_generate_formatted_filename
In some cases (ffmpeg_mux), the extension and format values are a
direct passthrough from arbitrary data. Instead of always postfixing
a `.` at the end of a generated path if the extension is invalid,
don't postfix the `.` at all.

Before: `my_formatted_string.`
After: `my_formatted_string`
2023-04-22 16:29:30 -07:00
derrod 3bb101d7a2 libobs: Finalise source creation before firing signal
Fixes a possible crash when renaming a source during the source_create
signal callback as it has not been added to the hash table yet.
2023-04-22 16:13:17 -07:00
Ryan Foster ba263ee4fa Revert "libobs: Improve util_mul_div64 outside MSVC"
This reverts commit c977417747.

Reverted due to a regression.
2023-04-16 20:29:47 -04:00
jpark37 c977417747 libobs: Improve util_mul_div64 outside MSVC
Use inline assembly for x86_64 speed/accuracy.

Sacrifice speed for accuracy on other processors.

Continue to use original implementation for ARM on Windows.
2023-04-15 17:08:04 -07:00
Norihiro Kamae 593fb3d12d libobs: Remove newly introduced PRAGMA_WARN_STRINGOP_OVERFLOW macro
The macro PRAGMA_WARN_STRINGOP_OVERFLOW was introduced to suppress a
warning -Wstringop-overflow caused by a macro da_push_back_new calling
darray_push_back_new.
Extract the function in the macro to avoid the warning.
This will also enables checking the type check of the returned pointer.
2023-04-15 16:03:10 -07:00
PatTheMav b2e66bb401 libobs: Add missing headers for framework export 2023-04-12 17:17:00 +00:00
derrod b3cf98f230 libobs: Fix compiling in ISO C17 mode 2023-04-08 19:30:12 -04:00
cg2121 6254e031d9 libobs: Fix transition lookup by uuid
The obs_get_transition_by_uuid function would return a valid source
even if it wasn't a transition.
2023-04-05 16:52:46 -07:00
jpark37 5a46c1e513 libobs: Fix v210 display name 2023-04-05 21:54:25 +02:00
jpark37 504cc76e93 libobs: Ensure v210 preserves precision 2023-04-05 21:54:25 +02:00
PatTheMav 6e07b86729 cmake: Remove EXCLUDE_FROM_ALL directive from interface libraries 2023-04-04 17:27:54 +00:00
gxalpha caccd86092 cmake: Sort libobs target_sources alphabetically 2023-04-01 16:15:41 -07:00
Simon Rost a144a736f9 libobs: Remove dependency on Visual Studio 2019+
In util_uint64.h the intrinsic function _udiv128 is used.
The implementation is only available in Visual Studio 2019+
2023-03-30 19:51:08 -04:00
Ryan Foster bfb8fba066 Revert "libobs: Enable fast clear on Windows always"
This reverts commit c2afa58125.
2023-03-27 15:24:52 -04:00
Norihiro Kamae 050d2e69b3 libobs: Log when libobs data file is not found
When an effect file is not found while initializing graphics, only one
line error below is logged. To clarify the reason why the initialization
was failed, also log when the file was not found.
Failed to initialize video. Your GPU may not be supported, or your
graphics drivers may need to be updated.
2023-03-27 15:20:56 -04:00
Norihiro Kamae e4eeecf3df cmake: Fix OBS_INSTALL_PREFIX
Before 349372b3b3, OBS_INSTALL_PREFIX contained trailing slash so that
it can concatinate with further paths.
2023-03-27 15:30:05 +02:00
Kurt Kartaltepe 36409f01cf libobs/media-io: Use inputs_mutex during close
This code assumed that no one would be racing after we stopped the input
thread, however the obs output thread also races and can free the inputs
during disconnect before we finish closing the video mix.

Instead keep the locks around after stop and use them during close to
avoid races.

Fixes crashes when stopping virtual webcam on linux.

Co-authored-by: Norihiro Kamae <norihiro@nagater.net>
2023-03-27 01:14:32 -07:00
PatTheMav 349372b3b3 cmake: 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.
2023-03-26 18:20:38 -04:00
Jim e233931dff
Merge pull request #8522 from nquah/enhanced-rtmp
Enable AV1, HEVC via RTMP to YouTube
2023-03-26 14:07:37 -07:00
PatTheMav 90f46a9d4d libobs: Add missing VIDEO_FORMAT_V210 handling in switch statements
Format was added to enum but not handled in all switch statement
handling the enum.
2023-03-26 13:48:01 -04:00
Yuriy Chumak 7dbc829c15 libobs,UI: Add output failure code for HDR being unsupported 2023-03-26 16:37:31 +02:00
Yuriy Chumak 31ba0973e5 libobs: Export HEVC NAL type enum 2023-03-26 14:47:22 +02:00
Norihiro Kamae 94bf325dd9 libobs: Fix VIDEO_FORMAT_V210 shader for GLSL 2023-03-26 05:13:00 -07:00
jpark37 97843dd7d7 libobs: Add VIDEO_FORMAT_V210
Support 10-bit packed format that DeckLink uses.
2023-03-26 01:52:44 -07:00
cg2121 d291830d23 libobs: Copy private scene item data when duplicating scenes
For example, this makes sure scene item colors are copied when
duplicating a scene. This also removed the now redundant private data
variable.
2023-03-25 18:30:31 -07:00
Jim 7a30d535aa
Merge pull request #8289 from derrod/more-audio-codecs
libobs,obs-ffmpeg: Add option for recording lossless audio
2023-03-25 16:52:49 -07:00
cg2121 1ac609f1ff UI, libobs: Fix not handled in switch warnings
These warnings were being spit out by GCC on Linux.
2023-03-26 10:47:01 +11:00
jpark37 8f3bf0a0e3 libobs: Keep output as premultiplied alpha
Simplify code until someone needs straight alpha.
2023-03-25 03:19:26 -07:00
derrod dcee4fc61a libobs: Allow encoders to request unclamped audio mix
This is useful for formats such as 32-bit float PCM which providers
greater flexibility in editing by retaining information that would
otherwise be clipped.
2023-03-25 10:38:18 +01:00
jpark37 e32c2c1427 libobs: Add callback for main texture rendered
Useful for redirecting main texture to DeckLink output for example.
2023-03-24 15:18:45 -07:00
derrod a73e13eeeb libobs: Keep mixer data for placeholder sources
Placeholder sources are created when a plugin providing a source type is
unavailable. Since they're not marked as having audio any audio track
settings for them get lost. With this change we retain mixer information
if the source owns its id to avoid that.
2023-03-24 12:16:32 -04:00
Jim e9ef38e3d3
Merge pull request #7978 from jpark37/dxgi-display-sdr-on-hdr
libobs-d3d11,win-capture: Add Force SDR for DXGI duplicator
2023-03-20 01:43:14 -07:00
Jim 0a9ed4569b
Merge pull request #7814 from jpark37/decklink-preview-rescale
decklink: Move preview output rescaling to GPU
2023-03-20 01:42:36 -07:00
jpark37 c2afa58125 libobs: Enable fast clear on Windows always
NVIDIA driver 527.37 fixes flickering when multiple GPUs are installed.
2023-03-20 01:41:47 -07:00
tytan652 22ebed8d02 libobs,docs: Add connect infos check to the Services API
This new function allows to know if the service has all the info needed
to try to connect.
2023-03-19 17:38:02 +01:00
tytan652 ea4ac2d08d libobs,docs: Add connect infos to the Services API
This replace and deprecate url, key, username and password functions.
2023-03-19 17:38:02 +01:00
tytan652 aeab6b8fc4 libobs,docs,rtmps-services: Add supported audio codecs
Also remove Opus-only "supported audio codecs" in the services JSON.
2023-03-19 17:27:42 +01:00
tytan652 1e0f4a6ebf libobs,docs: Add preferred output type to Service API 2023-03-19 17:16:13 +01:00
tytan652 48dc6dde68 libobs,docs: Add supported codecs functions with output id 2023-03-19 16:49:56 +01:00
tytan652 56411eda8e libobs,docs: Add protocol enumeration functions 2023-03-19 16:31:05 +01:00
tytan652 813b3b2763 libobs,docs: Add protocol to Services API 2023-03-19 15:29:44 +01:00
tytan652 201bcda051 libobs,docs: Add protocol in Outputs API 2023-03-19 15:29:03 +01:00
Jim 6eace37e06
Merge pull request #8229 from derrod/hashed-tables
Hashtable Adventures
2023-03-19 00:34:44 -07:00
Kurt Kartaltepe b7f29ca767 libobs: Reduce synchronization limit for multiple audio tracks
Since 65eb3c0815 we tried to get as close
a sync between audio and video tracks as we could before starting to
send frames to the output.

But in be717dbb2c when multi-track audio
was considered for synchronization it continued to try and line ALL
audio packets up with one video packet. While audio and video packets
are similar size this will work out. But once video packets duration is
smaller than 1/2 audio packet duration this may fail forever. In
practice with AAC's 20-23ms frame duration we can often get tracks
producing frames 5-10ms out of phase. For 60fps video this mostly fine
as 16ms frame duration will cover the gap, but for framerates as low as
100 its possible to fail to synchronize. In practice this is ~50%
for 6 audio tracks and 120fps video on my system, or 100% at 240fps.
2023-03-18 18:40:12 -07:00
Exeldro a5e9c94e4b libobs: Add obs_view_get_video_info 2023-03-18 15:54:38 -07:00
Jonathan Bennett 73dea7c475 libobs: Fix Pulseaudio audio monitoring listing sources
The Pulseaudio implementation of audio monitoring was actually listing audio sources.
This change corrects that, so all possible outputs are available.
2023-03-18 15:45:36 -07:00
Norihiro Kamae 4ea0b69974 libobs/util: Simplify implementation of os_get_path_extension
To avoid a false use-after-free warning from GCC's -Wuse-after-free
option, revise the implementation without using memory allocation.
2023-03-18 15:36:41 -07:00
Norihiro Kamae 434bdc1768 libobs: Fix possible use-after-free of obs_scene_t
When creating a group, a newly allocated group `sub_scene` is released
just after calling `obs_scene_add_internal`.
If another thread released the scene-item, which is the sub_scene,
use-after-free might happen.
2023-03-18 15:34:47 -07:00
derrod a41c616b21 libobs: Do not send hotkey_bindings_changed if nothing changed 2023-03-18 10:47:50 +01:00
derrod e6a7cff034 libobs: Use uthash for hotkeys and hotkey pairs 2023-03-18 10:47:50 +01:00
derrod 78aa4e03dc libobs: Use uthash for properties 2023-03-18 10:47:49 +01:00
derrod eff3cf134c libobs: Use uthash for hotkey name map 2023-03-18 10:47:49 +01:00
derrod c68eeaef1d libobs: Use uthash for source objects
All sources are part of a hash table that allows a lookup by UUID.
Public sources additionally are in a hash table allowing lookup by name.
2023-03-18 10:47:49 +01:00
derrod 183fa8c06c libobs: Use uthash for translation lookup 2023-03-18 10:47:49 +01:00
derrod e720bb4c09 libobs: Use uthash for config 2023-03-18 10:47:49 +01:00
Jim f4a8814998 libobs: Use uthash for obs data objects
Co-authored-by: Rodney <dennis@obsproject.com>
2023-03-18 10:47:49 +01:00
derrod 2986d36d9b libobs/util: Add uthash
Adds a header including uthash and redefining some of its options for
use withint libobs and plugins (potentially).
2023-03-18 10:47:49 +01:00
jp9000 619edf5e7d libobs: Add pointer to obs_data_item name
Rather than have to look up the string each time, just add a pointer to
the string. Still all stored in the same memory though.
2023-03-18 10:46:28 +01:00
derrod 1fd50a9324 libobs: Add obs_reset_source_uuids 2023-03-12 01:11:38 +01:00
derrod 29db52ad27 libobs: Save/Load source UUID in scene item data 2023-03-12 01:11:38 +01:00
derrod 30519768ad libobs: Add UUIDs to obs_source objects 2023-03-12 01:11:38 +01:00
derrod f72cc4498f libobs: Add os_generate_uuid() to platform utils 2023-03-12 01:11:38 +01:00
derrod 4b062a7147 libobs: Add functions for getting/saving pretty JSON 2023-03-10 23:55:42 +01:00
derrod 75693a6682 libobs: Write default values to config 2023-03-07 17:44:19 -05:00
pkv a0a23e8a18 libobs: Fix leak with empty path in stats
If the recording path is left empty in Settings, a leak can occur in
window-basic-stats.cpp because a bmalloc is called for a size 1.
This fixes the leak by checking against the path in the
os_get_free_disk_space function.

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-04 16:23:07 -08:00
Richard Stanway 2468268569 libobs: Hold async mutex when calling set_async_texture_size
Calling set_async_texture_size without holding async_mutex is dangerous
as cur_async_frame could be changed / freed by another thread.
2023-03-04 16:10:19 -08:00
Richard Stanway 01786a3f11 libobs: Disable encoder scaling request if it matches output size
It was possible to set the encoder to scale the video to the same size
as the output, resulting in unnecessary passes through swscale and
skipping hardware encoders. This was a common user error in Advanced
Output mode where they would tick the rescale box but leave it at the
same resolution as their main output.
2023-03-04 15:14:42 -08:00
Chris (Flaeri) 0eb496e8cf libobs/media-io: Add color range and space to conversion
By adding the range data we can get successful handling of full range
color via custom FFmpeg output. Previously it would always default to 0
which would yield partial/limited output. Without the colorspace info
the output file is correctly tagged, but not undergone the actual
conversion.
2023-03-03 21:48:09 +00:00
Richard Stanway 5b193bca55
libobs/util: Fix typo in curl revocation support check 2023-03-02 19:36:31 +01:00
derrod f9cce334d2 libobs: Add copy constructor for ComQIPtr 2023-03-01 20:39:53 +01:00
pkv 2e79d4c902 obs-ffmpeg: Fix for FFmpeg 6 deprecating a flag
Also modifies libobs & deps/media-playback.
AV_CODEC_CAP_TRUNCATED was removed in avcodec 60 [1].
We ifdef the code depending on it to allow compilation.

[1] avcodec: remove FF_API_FLAG_TRUNCATED
3ceffe7839

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-01 13:23:51 -05:00
PatTheMav e23455dc74 libobs: Fix device functions not marked as EXPORT
As clang and gcc use "default" visibility (as in "not hidden") when
no visibility is specified, all functions are implicitly exported.

When changing default visibility to "hidden", the corresponding symbols
are not exposed anymore and linking fails. This PR updates all
functions signatures that were added in recent commits but not set to
be EXPORTed.

Also makes required OpenGL imports for texture sharing on macOS
mandatory.
2023-03-01 12:02:33 -05:00
derrod a9d3b9cbd1 libobs: Clarify memalign ToDo item 2023-03-01 11:18:47 -05:00
derrod a5468cfee0 libobs: Make wcs<->utf8 conversion consistent
On Windows NULL characters would be included in the output if insize is
non-zero, but on *nix it would abort on the first NULL.
2023-02-28 18:36:18 -08:00
Frank 20a3ec4a2f libobs: Fix scene_audio_render() incorrectly mixing audio
When the `pos` variable is non-zero, audio does not get mixed correctly.
This is due to the fact that the `pos` variable was erroneously being
applied to the input rather than the output.
2023-02-25 19:25:15 -08:00
CodeYan01 d2dd917721 docs: Fix layout and typos 2023-02-26 10:31:02 +11:00
Kurt Kartaltepe bc9eee922e libobs: Fix pulseaudio monitoring, once and for all
This makes multiple changes to resolve issues with monitoring. We have
added a number of things over time to resolve various issues due to our
misunderstanding of the pulse api and the explicitly wrong pulse api
documentation.

First is removing the prior stream write tracking. Write tracking
was incorrect as pulse sends you the total number of bytes it wants
written at that time and not a incremental, but also this write tracking
is unhelpful since we can just let begin_write signal when we should
stop writing.

Second removing underflow tracking, this sort of worked to detect high
latency sources like vlc which buffer ~1s of data before writing audio
data. It worked because it would grow the buffer in PA until we could
write enough data into it, but it didn't allow us to leverage that
larger buffer because we never paused the PA stream.

To solve the buffering/high latency issue instead start the PA stream
corked and only uncork it once we have enough data to reach the targeted
latency. We also check how much data we recieve from the source and if
it appears to be high latency providing us with much more data than our
target latency we increase the latency to match the source. Fixing the
VLC source issue and resulting in a smooth start to audio instead of
underruns while we play and increase latency.

Finally add some handling for pulses incorrectly documented API. Notably
that begin_write may request more or less data from you so handle both
cases. And stop attempting to use attr.maxlength which is not updated
after set_buffer_attr calls and was always -1, and tlength is just more
appropriate.

old mantis resulting in some changes, still fixed. https://obsproject.com/mantis/view.php?id=1076
fixes #7574
2023-02-25 15:13:08 -08:00
PatTheMav 76732846d7 libobs: Fix non-exhaustive switch statements
New video formats introduced for ProRes 4444 encoding have not been
implemented in function calls used for video decoding, which makes the
switch statements non-exhaustive.

This does not functionally change the status quo (decoding ProRes 4444
files could still be broken because libobs does not explicitly handle
the colour format).
2023-02-23 20:32:52 +01:00
jpark37 463bf0dff5 libobs,UI: Add P216/P416 pixel formats
Will be useful for ProRes.
2023-02-21 18:48:44 +01:00
jpark37 0efaf88caf libobs: Add PQ/HLG support for I210/I412 formats
Seen when playing back ProRes files.
2023-02-21 18:48:44 +01:00
jpark37 9ee97bba1a libobs: Add obs_output_get_video_conversion
Need post-convert size to avoid CPU rescale.
2023-02-19 11:46:20 -08:00
jpark37 7bfde66578 libobs-d3d11: Support color spaces for duplicator
Need this plumbing to make decisions about duplicator colors.
2023-02-19 11:40:32 -08:00
PatTheMav db3a01db6b libobs: Remove unused variables 2023-02-18 15:22:33 -08:00
PatTheMav fb7a9edadc libobs: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08:00
Richard Stanway c57a291316 libobs: Convert security product name to UTF-8 for logging
Co-Authored-By: gkvjwa <285794886@qq.com>
2023-02-15 15:36:13 -05:00
Richard Stanway 7178124da9 libobs: Fix typo in function name 2023-02-15 13:40:13 -05:00
tuduweb e36163ce89 libobs/media-io: Correctly check codec tag compatibility for out stream 2023-02-15 18:21:09 +01:00
tytan652 cb6b5cc249 libobs: Add desktop environment to Linux log 2023-02-11 16:19:12 -08:00
tytan652 eacc246584 libobs: Add Flatpak info logging 2023-02-11 16:19:12 -08:00
Norihiro Kamae ee6ddeeaed libobs: Avoid position underflow when mixing audio sources
When a variable `pos` became larger than `AUDIO_OUTPUT_FRAMES`, `count`
will get overflowed number. To avoid the overflow, continue the loop
when `AUDIO_OUTPUT_FRAMES - pos` is not positive.
2023-02-11 15:22:17 -08:00
Jim 1f469e4f7c libobs/media-io: Add get_total_audio_size()
get_audio_size() gets the size of individual planes.
get_total_audio_size() gets the size if you include all planes.
2023-02-05 02:55:24 -08:00
jp9000 2ff210acfd libobs: Update version to 29.0.2 2023-02-04 02:17:49 -08:00
Jim 5d3943ab48 libobs: Update version to 29.0.1 2023-01-31 22:58:37 -08:00
Norihiro Kamae 2b4bc03b4c libobs/graphics: Remove unused macros for inputs 2023-01-28 19:03:55 -08:00
Norihiro Kamae d18a6f1039 libobs/graphics: Remove unused macros
The macros BOUNDS_MAX_X, BOUNDS_MAX_Y, and BOUNDS_MAX_Z are never used
and they are never defined how to use.
2023-01-28 19:03:55 -08:00
Barnabás Pőcze 5810571e53 libobs: Close display when destroying X11 hotkey platform
Currently, the X11 display is leaked when the X11 hotkey
platform is destroyed. Fix that by calling XCloseDisplay()
to free it.

Fixes: bcb04bb800 ("libobs: Open a separate X11 connection for hotkeys")
2023-01-25 13:56:50 -05:00
jpark37 792f8473ee libobs: Fix SDR async video on non-SDR targets
Bug was seen when projecting SDR video capture on WCG displays.
2023-01-24 19:39:42 -08:00
Jan Beich c082c4a74d libobs/graphics: Enable DMABUF on FreeBSD and DragonFly
Required under Wayland (wlrobs) on FreeBSD and DragonFly. DMABUF was
already partially exposed after c50c625555.
2023-01-24 11:50:13 -05:00
tt2468 018ce16703 libobs: Fix loading of custom_size for empty scenes
Previously, `custom_size` was checked at the end of the `scene_load`
function. If the scene contained no "items" array, the `custom_scene`
loading code would never be run.

This moves the `custom_size` code above the return statement.
2023-01-22 10:26:47 +11:00
tytan652 678b0287e6 libobs: Calm stringop-overflow warning on GCC
Those warnings appeared with GCC 12 with -O2, those are potentially
created by regression from GCC.
2023-01-19 13:08:46 -05:00
tytan652 c648222332 libobs,libobs-opengl,obs-ffmpeg-mux: Calm deprecation warnings on *nix
Calm libobs-opengl deprecation warnings on macOS.

Calm FFmpeg deprecation warning with LIBAVFORMAT_VERSION_MAJOR < 59.
2023-01-19 13:08:46 -05:00
tytan652 ca896dbce7 media-io: Fix FF_API_BUFFER_SIZE_T not being defined on Ubuntu 20.04 2023-01-19 13:08:46 -05:00
tytan652 b0c1c9c86c libobs,plugins: Remove individual -Wno-switch 2023-01-19 13:08:46 -05:00
John Bradley 61284cf9ba libobs: Refactor obs-output encoded use of mixes
There was quite a bit of conflated usage of mixes (which refers
to raw audio) and encoder counts. This fully separates the two
and makes a distinct separation when iterating over mixes vs
encoders.
2023-01-18 11:54:20 -08:00
John Bradley d70171daa6 libobs: Make internal version of remove encoder 2023-01-18 11:54:20 -08:00
tt2468 25df3e183e libobs: Fix logging of remaining views
OBS has been logging `1 views remain at shutdown` when in reality there
are not technically any views remaining. When views are removed, the
view itself is destroyed immediately, but the mix remains, to be
garbage collected by the graphics thread.

In this case, the view has already been removed, but the graphics
thread has not run an interation and cleaned up the mix, so this
log message appears.

Fixes the issue by checking if a mix actually has an assigned view,
instead of blindly logging existing mixes.
2023-01-18 12:17:35 -06:00
tt2468 c69e40734d libobs: Prevent encoders from initializing/starting if no media is set
This fixes a case of undefined behavior, where encoders can try to init
or start without actually having any video_t or audio_t object
assigned.
2023-01-18 12:17:35 -06:00
tt2468 7e30d3f8a2 libobs: Remove unused internal encoder util function
Was previously introduced in a0f679bc40,
but has since been made unused.
2023-01-18 12:17:35 -06:00
tt2468 eb0d9dc5d2 libobs: Allow sending NULL to obs_encoder_set_video/audio()
There is currently no way to clear a video_t or audio_t object from an
encoder once applied. `audio_t`/`video_t` objects can be destructed at
any time, and it is dangerous to prevent these object references from
even being cleared.

This does not fix the issue where destroying an audio/video object does
not clear the reference from all subscribed encoders.
2023-01-18 12:17:35 -06:00
tt2468 dfc20bbb31 libobs: Protect some encoder functions from being used while active
Protect `obs_encoder_set_video()` and `obs_encoder_set_audio()` from
being used if the encoder is active. Changing these values while active
is undefined behavior.
2023-01-18 12:17:35 -06:00
tt2468 f6d0c63b1e
Merge pull request #6960 from tytan652/fix_switches
Switch clean up (remove one-case switch and switch warning workaround)
2023-01-16 03:55:48 -08:00
tytan652 cf5c68b773 UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
2023-01-16 11:52:26 +01:00
tytan652 9cde3c302c libobs: Fix all-except-one switches 2023-01-16 11:52:17 +01:00
tytan652 7de0bd350f libobs,plugins: Remove one-case switches 2023-01-16 11:43:47 +01:00
tt2468 78d31322b2 libobs: Remove extra space in output reconnect log message
It has been bothering me to no end.
2023-01-15 22:59:59 -08:00
Exeldro eb35b07f44 libobs: Fix stopping transitions that are not active 2023-01-14 15:54:48 -08:00
Norihiro Kamae 1805712f46 libobs/util: Fix text-lookup not always case-insensitive
Convert `lookup` to upper-case before creating the tree so that later
code does not need to consider the case-insensitivity.
When converting to upper-case, use `toupper` instead of adding 0x20 so
that the behavior is consistent with `astrcmpi_n`.
2023-01-14 15:09:25 -08:00
jp9000 301fb48449 libobs: Update version to 29.0.0 2023-01-06 09:42:38 -08:00
Ryan Foster 19abcbcd3c Revert "libobs-d3d11: Make sure libobs knows the new adapter index"
This reverts commit e62759a3fa.
2022-12-30 21:14:15 -08:00
Ryan Foster 8dde4bab1e Revert "libobs: Fix adapter index not getting applied to resets"
This reverts commit 02d20e9f36.
2022-12-30 21:14:15 -08:00
jp9000 78f3389d17 libobs: Add funcs to get windows video adapter LUIDs
Useful for providing adapter order to encoder test subprocesses
2022-12-19 11:59:44 -08:00
Sergo Pogosyan 5582503d4f libobs: Duplicate URL string for OBS_BUTTON_URL
WidgetInfo::ButtonClicked() is aborting because URL string is not
allocated and eventually free-d by Python. This fix is allocating
a new string to store the URL passed to the Python function
obs_property_button_set_url().

Free button URL

Repace spaces with tabs

Typo
2022-12-10 15:31:13 -08:00
Antti Tapaninen 44fe366fb0 libobs: Override fps ovi for aux views 2022-12-03 15:15:50 -08:00
Ryan Foster 9f31a9d7a5 libobs: Suppress LNK4098
Suppress LNK4098 to allow building against pre-built Jansson for now.
2022-11-22 00:14:16 -05:00
Jim 02d20e9f36 libobs: Fix adapter index not getting applied to resets 2022-11-21 17:56:45 -08:00