0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

104 Commits

Author SHA1 Message Date
Ryan Foster
41a915db9e deps: Update CMake minimum to 3.22
Since Ubuntu 22.04 is now our minimum supported Ubuntu version, and it
has CMake 3.22, let's make CMake 3.22 the minimum CMake version.
2023-08-05 16:45:46 -07:00
Penwywern
a542d51e59 obs-scripting: Fix python save callback Py_BuildValue
Py_BuildValue doesn't directly accept C bools.
This fixes the callback by passing instead a Py_Bool object built from
the C bool.
2023-06-29 06:02:22 -07:00
Exeldro
90c55e03fe obs-scripting: Add config file functions 2023-06-22 00:54:47 -07:00
PatTheMav
04f8039b3e obs-scripting: Silence clang warnings about unreachable code
Source code is generated by Swig, so we just silence the warning.
2023-06-16 14:12:58 -04:00
Ilya Chernikov
a609cfb2f0 deps/obs-scripting: Fix crash removing callbacks in script_unload
Signed-off-by: Ilya Chernikov <chernikov.i123@gmail.com>
2023-06-10 14:38:14 -07:00
Lain
106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
PatTheMav
69a0cd2910 obs-scripting: Replace macro with plain C code
Instead of using a non-debuggable macro function, keep function
references and desired function names in a static array that can then
be iterated over to add desired functions.

This allows for proper debugging as well as makes the combination of
function and function name more explicit.
2023-05-13 17:00:30 -07:00
derrod
82137de0bb deps/obs-scripting: Set file/chunk name when loading lua scripts 2023-05-13 16:45:47 -07:00
Exeldro
f75fa626d8 obs-scripting: Fix loading lua utf8 path 2023-04-22 16:22:33 -07:00
PatTheMav
6e07b86729 cmake: Remove EXCLUDE_FROM_ALL directive from interface libraries 2023-04-04 17:27:54 +00: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
Ryan Foster
3fe241e95f obs-scripting: Enable Python 3.11 2023-03-26 10:27:52 +11:00
PatTheMav
318db2842a obs-scripting: Add PyType_Modified import for Swig 4.1.1 compat 2023-02-04 15:26:38 -08:00
tytan652
e13e0937a2 obs-scripting: Fix compilation warnings on Clang and GCC
* Fix unused-parameter when Python is disabled
* Calm PySys_SetArgv deprecation since Python 3.11
2023-01-28 23:20:41 -08:00
tytan652
f147be2d68 obslua: Ignore maybe-unitialized warning with SWIG and GCC
Only with SWIG version earlier than 4.1 because it is fixed upstream.
fa2f9dc5da
2023-01-19 13:08:46 -05:00
tytan652
c6a8b03719 obs-scripting: Fix compilation warnings on Clang and GCC
- Fix Python deprecation warnings
- Fix maybe uninitialized warning (GCC only)
2023-01-19 13:08:46 -05:00
PatTheMav
bd12a3e919
deps: Replace invocations of sprintf with snprintf
Fixes deprecation warnings in Xcode 14/clang on macOS and reduces
chance of buffer overflows.
2022-11-11 19:51:27 +01:00
PatTheMav
d9f89be35a obs-scripting: Add obs_sceneitem_group_enum_items function call
Adds function call to enumerate over items contained in a source group.
2022-10-11 15:19:41 +02:00
Patrick Heyer
49b4ba8ed9 obs-scripting: Fix block comment formatting
Co-authored-by: Norihiro Kamae <norihiro@nagater.net>
2022-10-10 02:07:02 +02:00
PatTheMav
0af8bdb350 obs-scripting: Fix script state variable being reset by tick callback
When loading a new Python script, the GIL might be released while
importing the module, allowing the tick to run and change and reset the
cur_python_script state variable. Use the busy_script variable to save
and restore the value if not null.
2022-10-10 02:07:02 +02:00
Matt Gajownik
77d810148d obs-scripting: Enable Python autodoc
This provides more useful information in auto-complete, complete with
parameter summaries.

Example:

"""
    obs_properties_add_path(props, name, description, type, filter, default_path) -> obs_property_t *

    Parameters
    ----------
    props: obs_properties_t *
    name: char const *
    description: char const *
    type: enum enum obs_path_type
    filter: char const *
    default_path: char const *

"""
2022-10-01 16:16:45 -07:00
Matt Gajownik
0c7abb7fca obs-scripting: Re-enable Python annotations
The default for this setting was changed in SWIG 4.
For more info see https://github.com/swig/swig/commit/2072ae19c
2022-10-01 16:16:45 -07:00
Exeldro
ddff584b46 obs-scripting: Fix compile when python is not found 2022-10-01 05:26:21 -07:00
Matt Gajownik
1b2fc73021 frontend-tools: Display Python version in UI 2022-09-23 12:08:11 +10:00
PatTheMav
76c782bcdc deps: Fix broken prefix for obspython binary module on Linux 2022-09-17 16:11:31 -07:00
tytan652
1272209710 obs-scripting: Fix SWIG flags for non-macOS POSIX 2022-08-08 15:00:09 +02:00
PatTheMav
24a123119a obs-scripting: Fix issues between runtime and compile-time versions
Calling `PyEval_InitThreads` has been deprecated in Python 3.7 and the
function itself will be removed in Python 3.11. The current check
guards this function behind a version check that only happens at compile
time.

This in turn leads to crashes when run on Python 3.6, as the necessary
initialization for `PyEval_ReleaseThread` did not take place.

This commit ensures the manual initialization takes place based on the
runtime version of Python and avoids loading the associated symbols
on Python 3.9 or later.
2022-08-02 19:36:50 -04:00
gxalpha
ca470b2d53 deps/obs-scripting: Ignore base_set_crash_handler 2022-07-27 12:05:16 -04:00
Kurt Kartaltepe
57c9844f15 v4l2,scripting: Add more thread names
This sets some thread names for the scripting backend's defer thread and
the v4l2 udev thread.
2022-07-24 09:21:58 +10:00
PatTheMav
ab21c7e5b0 obs-scripting: Add support for multiple Python 3 versions
This changes the way obs-scripting looks for and loads an available
Python 3 library. It tries to find a best possible version (starting
with Python 3.10) down to and including Python 3.6 by existing file
naming conventions and loads the most recent variant it can find.

User specified search path is either a Python installation directory
(Windows), or a Framework directory containing `Python.framework`
(macOS). The dll or dylib names are composed automatically.
The Python home path is also composed automatically on macOS (where
it has to point inside the Framework directory).
2022-07-21 12:16:36 -04:00
PatTheMav
47b3ff5e64 obs-scripting: Switch swig to stable ABI usage 2022-07-21 12:16:36 -04:00
tytan652
ba6f9f3f46 obs-scripting: Replace OBS_UNUSED with UNUSED_PARAMETER
OBS_UNUSED is not portable to MSVC.
2022-07-20 08:22:08 +02:00
PatTheMav
e27f90fa5a obs-scripting: Fix crashes introduced by Swig update to 4.1.0
Fixes issues introduced by https://github.com/swig/swig/pull/2238. As
obs-scripting is not compatible with the SWIGPYTHON_BUILTIN, obspython
needs to disable this feature.
2022-07-13 16:50:09 -04:00
jpark37
5e3c824801 obs-scripting: Suppress long volatile warning 2022-07-11 22:07:10 -07:00
PatTheMav
64efcd155d obs-scripting: Fix swig runtime header generation for macOS
Due to swig using a hardcoded swig library path in self-compiled
variants, we need to pass our custom swig library path with every
invocation of swig on macOS.

CMake's `add_custom_command` function does _not_ inherit the environment
variables used during configuration, hence why it needs to be passed
explicitly on invocation.

Usage of CMake's "-E env" command module should allow for cross-platform
compatible invocation.
2022-07-07 14:19:23 -04:00
gxalpha
e1776d872a deps/obs-scripting: Log script load/unload 2022-07-02 16:35:20 -07:00
PatTheMav
29759ef8fb obs-scripting: Fix missing frontend bindings for Python
The obspython.i file requires `ENABLE_UI` to be defined for the swig
compiler to pull in the actual obs-frontend-api header. If this is not
the case, swig will not discover the required methods and ENUMs and
in turn will not make those available in the scripting environment.
2022-05-28 16:23:14 -07:00
PatTheMav
893d3ce218 obs-scripting: Fix missing frontend bindings for Lua
The obslua.i file requires `ENABLE_UI` to be defined for the swig
compiler to pull in the actual obs-frontend-api header. If this is not
the case, swig will not discover the required methods and ENUMs and
in turn will not make those available in the scripting environment.
2022-05-28 16:23:14 -07:00
PatTheMav
8d0131c519 obs-scripting: Fix macro redefinition warning
In Python 3.9+, `PyCFunction_New` and `PyCFunction_NewEx` are themselves
macros around `PyMethod_New`. To fix the warning, both macros need to
be untouched for those Python versions, instead the actual function
`PyMethod_New` needs to be imported and aliased.

This commit:

- Adds the import of the `PyCMethod_New` symbol
- Adds the function definition for `Import_PyCMethod_New`
- Adds the `PyCMethod_New` function alias
2022-05-14 16:10:11 -07:00
PatTheMav
a0923c9b6e obs-scripting: Fix loading of scripting libraries with runtime lookup
macOS uses runtime lookup for symbols in obs-scripting. While this guard
fixes a compiler warning, it also leads to the `_PyCMethod_New` symbol
being undefined.

In turn any library linking with obs-scripting will then fail to load
because of that undefined symbol. Removing this guard fixes that issue.
2022-05-14 16:10:11 -07:00
PatTheMav
4c1687901e obs-scripting: Fix compiler warnings 2022-05-04 12:09:04 -04:00
tytan652
c98617849a obs-scripting: Fix compiler warnings
* obs-scripting: Fix unused 'varargs' warning

* obs-scripting: Fix PyEval deprecation warnings
Remove PyEval_InitThreads() and PyEval_ThreadsInitialized() call for
Python 3.7 and later as Python calls it automatically now.

This removes deprecation warnings when using Python 3.9 or later.

https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
2022-05-04 01:37:10 -07:00
PatTheMav
aae3a6a466 cmake: Fix diverging prefix padding for OBS status outputs
Status output related to OBS configuration is prefixed with the string
"OBS" and added padding for enabled and disabled features. This padding
was not aligned between platforms.

By moving the padding and prefix decoration into its own function,
both elements are controlled in a single place. CMake scripts were
changed to use this new function `obs_status` instead of using CMake's
`message` function directly.
2022-03-26 09:44:23 -04:00
jp9000
5e2c757cd1 libobs/util: Remove deprecation visibility from swig 2022-03-24 22:32:19 -07:00
jp9000
601187d0f6 deps/obs-scripting: Fix code formatting
Somehow this was incorrectly formatted at some point.
2022-03-24 22:30:52 -07:00
derrod
178ec005bd obs-scripting: Add Resources to python path on macOS
Also changes indentation of this block back to tabs to be consistent
with the rest of the file

Co-authored-by: PatTheMav <patthemav+github@gmail.com>
2022-03-23 14:56:55 +01:00
PatTheMav
dbdf5c7f7a
obs-scripting: Update CMakeLists.txt for scripting modules 2022-03-16 23:11:08 +01:00
jp9000
6d3b1998ef obs-scripting: Make callback "removed" variable atomic
Makes the callback variable "removed" atomic, and on script unload,
first sets all callbacks to removed before actually unloading the script
out of a safety precaution. (See note at the bottom for further details)

This minimizes the possibility of a race condition where the script
callback could be called while those callbacks were being removed.

Big note for this change, this change should eventually be replaced with
a reference counting ownership method where script callbacks can hold a
reference and share ownership of the script if it's still alive while
the script callback is being called. That way the script callbacks can
safely execute. May require a fair amount of reworking of the script
object.
2022-03-01 03:04:37 -08:00
Jim
03d9bda387 libobs: Deprecate obs object addref functions
Deprecates:
obs_source_addref()
obs_output_addref()
obs_encoder_addref()
obs_service_addref()
obs_scene_addref()

These functions should be considered unsafe and not used. Instead, use:
obs_source_get_ref()
obs_output_get_ref()
obs_encoder_get_ref()
obs_service_get_ref()
obs_scene_get_ref()

These functions return a pointer to the incremented object only if the
object is still valid, otherwise they will return null, indicating that
the object is no longer valid or is unsafe to use.

The reason why this is being done is because certain third party plugins
seem to be using addref, and are somehow managing to call addref on
sources that have already been fully released. For the sake of safety,
almost all usage of these functions within OBS have also been replaced
as well.
2022-01-25 05:20:03 -08:00
Scratch
a78558b46a obs-scripting: add transition duration functions 2021-10-15 16:50:59 -07:00