Commit graph

412 commits

Author SHA1 Message Date
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
tt2468 57e6053c81 deps/media-playback: Remove unnecessary log line
Every time a media player instance would be initialized, it would
create a new `Set FFmpeg options:` log message. With lots of looping
media sources, this gets incredibly spammy. It's already being logged
by the media source itself, so this line is pretty much unnecessary.
2023-04-02 17:41:34 -07:00
PatTheMav d5e894ebb3 deps: Fix lower version boundary for file-updater
Version 3.16 required for Linux compatibility.
2023-03-29 13:11:33 -04: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 35f037da47 deps/media-playback: Fix preloaded videos stopping prematurely
The incorrect variable was used in a comparison, causing playback to
stop prematurely depending on whether the audio data or video data ended
first.

Closes obs-project/obs-studio#8422
2023-03-25 22:51:55 -07:00
Ryan Foster 3fe241e95f obs-scripting: Enable Python 3.11 2023-03-26 10:27:52 +11:00
derrod 4f7a73d149 deps/libff: Add ff_format_codec_compatible 2023-03-25 16:12:36 -07:00
Jim 6eace37e06
Merge pull request #8229 from derrod/hashed-tables
Hashtable Adventures
2023-03-19 00:34:44 -07:00
gxalpha 283b6a4789 deps/file-updater: Use LOG_INFO log priority for info logging 2023-03-18 15:32:35 -07:00
derrod d0554e25c1 deps: Add uthash 2023-03-18 10:46:28 +01:00
derrod 198c2b9e86 media-playback: Fix libavutil version check 2023-03-10 08:15:54 +01:00
derrod 3eff81207e deps: Remove lzma 2023-03-07 15:34:27 -05:00
Ricardo Tavares 0516371823 deps/media-playback: Enable CUDA HW decoder 2023-03-03 21:47:40 +00: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
Jim 4bf14d09b4 obs-transitions: Add option to preload stinger video to RAM
Stingers -- and especially track matte stingers -- are currently subject
to real time decoding, which can be detrimental in a production
environment where a stinger video may not be able to decode in a timely
fashion.

To remedy this, this change adds an option to fully decode stingers
immediately and cache the decoded video/audio in RAM for playback to
greatly improve stinger performance.
2023-02-25 18:13:11 -08:00
PatTheMav cfa0dc573e media-playback: Fix non-exhaustive switch statement 2023-02-18 15:22:33 -08:00
PatTheMav 7035ca7964 libcaption: Fix missing newline at the end of file 2023-02-18 15:22:33 -08:00
PatTheMav 318db2842a obs-scripting: Add PyType_Modified import for Swig 4.1.1 compat 2023-02-04 15:26:38 -08:00
tytan652 918c0c0aeb deps/media-playback: Fix deprecation warning 2023-01-28 23:20:41 -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 2d7e854476 deps/jansson: Disable warnings on Clang and GCC 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
Chensiyy c97b5cf7ee libcaption: Fix invalid data at utf8_load_text_file 2022-12-03 15:35:11 -08: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
pkv ce2d1ffab7 obs-ffmpeg: Fix deprecation of channels member of several structs
This fixes deprecation warnings since the channels member of
AVCodecContext is marked as deprecated [1], as well as the channels
member of AVFrame [2].
In all instances where a warning appear, a switch to the new API is
done.
[1] lavc: switch to the new channel layout API
FFmpeg/FFmpeg@548aeb9
[2] Bump minor versions after the channel layout changes
FFmpeg/FFmpeg@cdba98bb80

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-10 19:37:07 -05: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 6adb973b6a w32-pthreads: Add pthread.h as public header
When exporting w32-pthreads, the public header file `pthread.h` needs
to be exported as well to expose the implemented functionality.
2022-09-17 16:35:20 -07:00
PatTheMav 76c782bcdc deps: Fix broken prefix for obspython binary module on Linux 2022-09-17 16:11:31 -07:00
derrod 9140c260ee UI: Add Whats New for macOS/Linux
- Requires MbedTLS on Linux
- Enabled by default on macOS and Flatpak
- Enabled on linux via ENABLE_WHATSNEW_LINUX
- Enables compilation of blake2 on Linux/macOS
- Makes header name check also work with lowercase header
- Changes WahtsNew to be only enabled when browser panels are available
2022-08-13 16:46:48 -07:00
Norihiro Kamae 0929a78e8c deps/w32-pthreads: Remove unnecessary UTF characters 2022-08-13 00:49:17 -07:00
PatTheMav 43a49dca47 cmake: Fix CMake package export templates for CMake 3.24
CMake 3.24 implemented changes that break dependency discovery of the
exported libraries built by OBS.
2022-08-09 19:48:03 -04: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
jpark37 d3bd511d4d media-playback: Fix crash on free
Need to call mp_decode_clear_packets before destroying orig_pkt in case
packet_pending is true.
2022-08-01 09:20:26 -07:00
jpark37 d8551e444b media-playback: Compute HDR colorspace
Figure out colorspace from TRC and primaries if necessary. AMF in
particular doesn't seem to provide full metadata.
2022-07-30 17:25:37 -07: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
tytan652 17ba8359e4 deps,libobs,plugins: Fix discarded-qualifiers warnings with FFmpeg 5 2022-07-22 08:50:36 -04: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
Jim 9025d92f7a
Merge pull request #6771 from tytan652/no_more_OBS_UNUSED
Remove OBS_UNUSED
2022-07-20 05:19:13 -07: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
Richard Stanway 009fc43bee
deps/opts-parser: Skip parsing of empty strings 2022-07-20 03:29:59 +02:00
mvji f0b3593349 deps/media-playback: Fix invalid seek at reset
When AVFormatContext->startime is set to AV_NO_PTS
mp_media_reset try to seek to INT64_MIN
use 0 instead.
Fix loop with aac file
2022-07-16 16:29:02 -07: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 62ca01e181 libcaption: Disable compiler warnings about non-exhaustive switch cases 2022-07-10 09:59:55 +10: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
jpark37 22fde5cdcd deps/media-playback: Fix metadata for hw_accel
av_hwframe_transfer_data doesn't seem to transfer metadata, so do it
manually.
2022-06-18 16:03:34 -07:00
Jim 1705edf8f9
Merge pull request #6475 from GeorgesStavracas/gbsneto/drop-glx
Au revoir, GLX
2022-05-28 17:04:17 -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
jpark37 54f09fe6a7 deps/media-playback: Use metadata for HDR EETF
Used in situations where source luminance is greater than HDR nominal
peak setting to avoid clipping by applying BT.2408 maxRGB EETF.
2022-05-27 14:56:47 -07:00
Georges Basile Stavracas Neto 55811c1cb9 deps/glad: Drop glad-glx
It is now unused
2022-05-24 14:31:51 -03:00
jpark37 226249e1c3 deps/media-playback: Fix video looping
Previous FFmpeg deprecation fix, and optimization attempt causes short
videos to loop badly. Keep deprecation fix, and fix the rest later.

Fixes d528f6cafa
2022-05-21 15:28:08 -07:00
jp9000 50c174df07 deps/opts-parser: Add missing c extern for cpp 2022-05-17 05:37:04 -07:00
stopforumspam 3215189c97 deps/media-playback: Add support for FFmpeg options for media playback 2022-05-16 15:17:13 -04:00
Kurt Kartaltepe f4a820a4ea deps/glad: update Glad for EGL with new extensions
This updates glad for EGL and adds in several extensions.

EGL_EXT_platform_base
EGL_EXT_platform_xcb
EGL_KHR_image_base
EGL_KHR_image_pixmap

The xcb platform extension is unused but good to include if we want to
try removing more Xlib dependencies. platform_base is included for good
measure as other platform extensions technically build on it. image_base
and image_pixmap are for upcoming xcomposite over EGL support.

It also drops the unused create_context_no_error extensions.
2022-05-15 09:08:53 -03: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
Jim 952988d9ec
Merge pull request #6231 from mvji/prores_pix_fmt
Add support for GPU conversion of YUV422P10LE, YUV444P12LE, YUVA444P12LE
2022-05-04 02:01:27 -07: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
tytan652 865a358a52 media-playback: Fix unused-parameter warning 2022-05-04 01:37:10 -07:00
mvji 93490da4c2 obs-ffmpeg: Use YVYU for FFmpeg pix fmt YVYU422
This commit also modifies deps/media-playback and libobs.
2022-04-19 19:39:22 +02:00
mvji 5f35e73d8b deps/media-playback: Use YUV422 for planar 422 pix fmt
Instead of UYVY422
2022-04-19 19:39:05 +02:00
mvji ae94c35152 obs-ffmpeg: Add support for YUV422P10LE, YUV444P12LE, YUVA444P12LE
This commit also modifies deps/media-playback
2022-04-19 19:38:28 +02:00
jpark37 05b673381f deps/media-playback: Add P010 to closest_format
Used by HDR media playback with hardware decode.
2022-04-18 05:23:13 -07:00
wangshaohui d2fb302e5c deps/media-playback: Use avcodec_free_context to free AVCodecContext 2022-04-16 16:23:58 -07:00
jpark37 59dbc3eb81 libobs: Rename Rec. 2020 to Rec. 2100
Rec. 2020 is really an SDR spec, but I think HDR10 made it okay to slap
PQ on it, call it an HDR spec. Rec. 2100 came along after and formally
allowed the use of PQ/HLG, so we should use 2100 instead.
2022-04-10 00:13:52 -07:00
jpark37 6ed2edde71 deps/media-playback: Fix AVColorSpace usages
More completeness and consistency.
2022-04-09 21:20:10 -07:00
jpark37 007ed2c355 deps/media-playback: Add more accurate TRC hints
Allows us to tell the difference between HDR and high-precision SDR.
2022-04-08 17:19:23 -07:00
jpark37 848e128435 libobs,plugins: Replace video matrix function
video_format_get_parameters_for_format provides a more accurate matrix
than video_format_get_parameters.
2022-04-07 19:28:51 -07:00
wangshaohui db8145e8a2 obs-ffmpeg, win-dshow, deps/media-playback: Use recommended API for AVCodecContext 2022-04-07 01:59:30 -07:00
jpark37 4ae3956010 deps/media-playback: Add I010/P010 support 2022-04-03 00:03:34 -07:00
mvji c62dc7ffee obs-ffmpeg : use I422 for YUV422P input format
Avoid conversion to UYVY422 for 422P video input files (like dnxhd or xdcam422)
2022-03-26 21:05:45 -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
Matt Gajownik 70924da18d CI: Don't ignore deps directory when formatting
Also add a .clang-format ignore file to the libff dependency.
2022-03-25 19:41:03 +11: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
Richard Stanway 85addc3dac UI, file-updater, rtmp-services: Enable curl ALPN support
In the years since this code was added, ALPN is now widely supported,
and NPN is being removed entirely in the latest version of nginx. It's
time to start using ALPN!
2022-03-24 17:10:01 -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
PatTheMav dba1041034
deps: Update CMakeLists.txt for dependencies 2022-03-16 23:11:07 +01:00
jpark37 d528f6cafa deps/media-playback: New AVPacket pattern
FFmpeg has deprecated stack-allocated AVPacket objects, so make a pool
and use the new pattern instead.
2022-03-08 12:39:04 -08: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
pkv 50aec9c2a0 media-playback: Fix rist demuxing
We currently pass a 'buffer_size' option to avformat in bytes.
Unfortunately, avformat/librist.c admits an option with the same name but in milliseconds.
The default values set in the UI (2 MB) go beyond the range admitted in ms (0-30 000)
so avformat issues errors.
This fix disables the option when rist protocol is detected.

Signed-off-by: pkv <pkv@obsproject.com>
2022-01-14 20:50:14 -08:00
Ryan Foster ce734366bc obs-ffmpeg: Respect AVFormatContext and AVOutputFormat constness
AVFormatContext::oformat was made const on April 27, 2021 [1]. If we
respect the constness of AVOutputFormat and do not cast results from
FFmpeg functions to non-const, we cannot modify the results after the
fact. Our choices are either to cast them to non-const (and presumably
have them implicitly casted back to const on later function calls), or
only try to modify the results in versions of FFmpeg where these are not
expected to be const.

Instead of relying on casts, we can set the encoder values in the
ffmpeg_cfg struct, which are later passed to new_stream.

Also modifies deps/media-playback. Removes compiler warnings.
Some avformat functions return const AV(In/Out)putFormat per [1], so
ifdef as needed.

[1]: 56450a0ee4
     lavf 59.0.100 avformat.h
     avformat: Constify the API wrt AV(In|Out)putFormat

     Also constify AVProbeData.
2021-11-23 12:10:25 -05:00
jpark37 6393c3f4cd ipc-util: Fix potential ready_event hang
There is an expectation that ready_event will signal/wake 1:1, so the
stray teardown signal may get lost. Add new stop_event for safety.
2021-11-21 01:38:36 -08:00
jp9000 6534bf5834 obs-x264: Move options parser to its own lib 2021-10-25 12:24:16 -07:00