Commit Graph

326 Commits (master)

Author SHA1 Message Date
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
Scratch a78558b46a obs-scripting: add transition duration functions 2021-10-15 16:50:59 -07:00
Eric Lindvall ef34a5f765 deps/media-playback: Handle discontinuities to fix video stalls
If there is a PTS discontinuity in the playback stream that causes the PTS to
reset, it is likely that new audio frames will come in while there are still
video frames waiting to be dequeued. This will cause the audio frames to be
played while the video frames wait for the PTS to get back up to where they
were before the discontinuity.
2021-09-11 22:28:53 -07:00
jpark37 bc7ecd4527 deps/obs-scripting: Fix pthread mutex leaks 2021-08-23 22:30:55 -07:00
jp9000 1d44ace7d0 deps/media-playback: Fix trailing whitespace 2021-08-15 10:59:03 -07:00
wangshaohui decd3c2678 deps/media-playback: Fix bug about audio without best_effort_timestamp 2021-08-15 06:11:03 -07:00
jpark37 976d76dfbd deps/media-playback: Less accurate sleep
Avoid busy-wait for media sources by not caring about sleep precision.

Reduces CPU usage in status bar from 1.1% to 0.8% on my machine.
2021-08-15 00:12:14 -07:00
jpark37 c021338ceb libobs,deps/media-playback: Avoid bitfields
Use unused padding of obs_source_frame/obs_source_frame2 instead.
2021-06-11 07:02:37 -07:00
jpark37 ce6f233e2d deps/media-playback: Plumb linear alpha flag 2021-06-04 19:04:08 -07:00
Eric Lindvall 3c76fc4ddb obs-ffmpeg: Enable macOS hardware decoding for media source
Reverts  c7395b05ec
2021-03-30 03:45:06 -07:00
Georges Basile Stavracas Neto b26073c5b2 deps-glad: Add DMA-BUF EGL extensions
Import the DMA-BUF importing extensions from GLAD.
2021-02-13 19:42:01 -03:00
Georges Basile Stavracas Neto 59744e95c3 deps/glad: Make X11 required as well
To keep consistency with the EGL line
2021-02-01 19:03:14 -03:00
Georges Basile Stavracas Neto 7801b3301a deps-glad: Add EGL
The code is generated by https://glad.dav1d.de/
2021-02-01 19:03:14 -03:00
jpark37 5753c25cba libcaption: Fix static keyword placement 2021-01-29 23:59:23 -08:00
Kurt Kartaltepe 5efb10a5e2 libobs: Fix leaking obs-internal.h
Removes prior attempt to expose libcaption headers which really shouldnt
have public. This instead moves the obs-internal include out of the
public obs-scene.h and into it's implementation.
2021-01-28 23:59:02 -08:00
Kurt Kartaltepe bde5d11100 libcaption: Fix header missing in install
libobs directly depends on libcaption headers. So ensure they are
installed with obs' headers.

fixes #3925
2021-01-28 12:55:11 -08:00
PatTheMav ecdc81ba0f obs-scripting: Add Py 3.8+ C-API changes
Closes obsproject/obs-studio#3689
2021-01-27 11:33:34 -08:00
Ryan Foster 81c2dac75e deps: Update cmake_minimum_required to 2.8.12 2021-01-18 01:37:45 -08:00
jp9000 0ab2b038e8 deps/json11: Update to most recent version 2020-12-09 22:23:03 -08:00
Scratch 842ad1781b obs-scripting: Fix removing signal handlers in lua 2020-12-07 15:44:00 +11:00
jp9000 f8cc3bfe01 deps/media-playback: Fix audio segment duration calc
With certain audio encoders, gaps can be introduced into the audio
packets, causing the audio duration to be miscalculated because it
calculated audio duration based upon the PTS of the current packet to
the last packet. However, this audio encoder also did not store
timestamps for most of its audio packets, causing PTS values to be
calculated based upon duration values. So those two things combined
caused audio timestamps to go all out of whack when playing back certain
videos with the media source. This is particularly prevalent with WMV
files using Microsoft codecs.

So to fix it, when the duration needs to be calculated, just calculate
the duration based upon the sample count of the audio packet. This fixes
the issue with the video in question that caused problems, and likely
fixes issues in a lot of videos that may have been floating out there
for some time. Basically this is a fix for a potential long-standing
issue.

Closes obsproject/obs-studio#3683
2020-11-15 04:57:41 -08:00
Colin Edwards 7b0d7c6357 Remove BUILD_CAPTIONS build flag 2020-11-02 22:46:55 -06:00
Exeldro 1c774008b4 deps/media-playback: Fix time at non-standard speeds 2020-09-24 01:15:57 -07:00
Per Heed 318779be7a obs-scripting: Fix script_path() python mem corruption
Returning PyObject with borrowed reference will result in double free
and/or use after free issue.  Issue seen as crash when running Python
script calling script_path().
2020-09-13 16:20:56 -07:00
Richard Stanway 5889e2905e CMake: Set PIC for all library targets
Fixes https://github.com/obsproject/obs-studio/issues/3436
2020-09-09 01:55:50 +02:00
nkmerrill a5656d12b4 deps/media-playback: Fix fast-forward after reset
Fixes #3341 by ensuring timestamps are reset after pausing.
2020-09-07 19:50:40 -06:00
Jim 86147d9719
Merge pull request #3415 from jpark37/default-color-space
Unify color space settings as 709
2020-09-07 13:29:44 -07:00
jp9000 2ac1ad5290 deps/media-playback: Fix pause continually running loop
Fixes an issue where when paused, the thread loop would continue to
repeat endlessly until unpaused.
2020-09-07 12:36:40 -07:00
jpark37 b6afaceeae Update VIDEO_CS_DEFAULT to mean 709 instead of 601
Consistent with modified default UI setting.
2020-09-06 20:51:28 -07:00
Scratch e4b81c2b1b obs-scripting: Fix removing signal handlers in python
Closes #3218
2020-08-16 00:26:32 +10:00
Jim bfdf5dc947
Merge pull request #2356 from jpark37/sycc-color-space
Color space refinements
2020-08-05 08:58:21 -07:00
jp9000 bff7ae89ad deps/media-playback: Add seek callback
Allows setting the current frame directly when seeking. If not set, will
just use preload if avaialble.
2020-07-29 13:59:49 -07:00
jp9000 83913e1d31 deps/media-playback: Don't EOF while paused and seeking
Fixes a bug where playback would completely stop when manually seeking
to the end of the file. Playback should not officially stop until
playback has unpaused.
2020-07-21 16:40:33 -07:00
Exeldro 7a33167769 deps/media-playback: Preload video when seeking paused 2020-07-20 14:23:13 -07:00
jpark37 f8cae4639e deps/media-playback: Remove unused #define 2020-07-18 23:33:21 -07:00
jpark37 2e7fee8e53 deps/libff: Remove very old version check 2020-07-18 23:32:15 -07:00
jpark37 24e18c73f5 media-playback: Leverage VIDEO_CS_SRGB
Doesn't change much now, but may someday.
2020-07-18 19:44:13 -07:00
jp9000 56e56cd265 deps/media-playback: Reset TS when seeking
If seeking occurs too close to the previous time value, it could cause
the playback to delay an abnormal amount of time, or if the time value
is under the previous value, then it would cause an assert.  So instead,
reset the next timestamp value to be instant in both cases if a seek
occurs to ensure timely playback.
2020-07-16 19:00:01 -07:00
yoho 0a4b1d622c obs-ffmpeg: Add auto reconnect to remote media sources
(Note: This commit also modifies deps/media-playback)

Co-authored-by: Eric Lindvall <eric@5stops.com>
Co-authored-by: Ryan Foster <RytoEX@gmail.com>
Co-authored-by: Jim <obs.jim@gmail.com>
2020-07-05 08:31:05 -07:00
Jim 3b11e170b7
Merge pull request #2836 from jpark37/yuv-image-fix
Fix FFmpeg YUV to RGB conversion by adding extra destination padding to line sizes
2020-06-26 06:13:45 -07:00
jpark37 2123b306f3 libobs: Fix right edge of some videos
FFmpeg YUV to RGB conversions require extra destination padding.

The Mantis issue might have been fixed when some YUV format conversions
were moved to the GPU, but this may fix other YUV formats.

Fixes https://obsproject.com/mantis/view.php?id=1177
2020-06-14 20:00:58 -07:00
jpark37 218a3d36a3 deps/media-playback: Use SWS_POINT instead of SWS_FAST_BILINEAR
There is no resize happening in this code, so bilinear doesn't make
sense. Fixes artifacts caused by SWS_FAST_BILINEAR approximation.
2020-06-11 10:49:04 -07:00
jpark37 89532e59fc deps/media-playback: Use OBS YUV(A)444P to RGB conversion
swscale with SWS_FAST_BILINEAR produces artifacts.
2020-06-11 10:49:00 -07:00
Jim 9607a9f46e
Merge pull request #2384 from LiamCoal/allow-no-buffering
media-playback: Unbuffered Media Source
2020-05-21 17:40:08 -07:00
jp9000 7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
Jimi Huotari c7f84f8fc4
deps/glad: Fix build with GCC-10
GCC-10 defaults to '-fno-common' [1], which triggers issues with
defining global variables multiple times.  To fix the build, use
'extern' to turn the first definition of 'gladGetProcAddressPtr'
into a declaration.

1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678

Closes https://github.com/obsproject/obs-studio/issues/2828
2020-05-04 11:02:49 +03:00
Clayton Groeneveld a149b1df88 obs-scripting: Expose platform functions to scripts 2020-04-27 09:33:43 -05:00
Colin Edwards 55e2985026
Merge pull request #1944 from WizardCM/windows-rc-definition
CMake: Build Windows modules with file descriptors
2020-04-18 18:27:22 -05:00
Ed Maste f4e7bd31ab deps: lzma: also use .note.GNU-stack on FreeBSD
FreeBSD uses the same .note.GNU-stack section to indicate that the
stack should not be executable.
2020-04-07 13:25:43 -04:00
Richard Stanway 49bd76755b Make cert revocation check fails non-fatal on Win
Instead of erroring out completely when it can't determine if the
certificate is valid, proceed anyway.  This matches how web browsers
treat failed cert revocation checks.  schannel just has somewhat
paranoid defaults.
2020-03-13 07:48:47 -07:00
comex 849d5462ad obs-scripting: Add missing Python imports
Add PyDict_New and PyTuple_New to obs-scripting-python-import.[ch];
these functions are used by SWIG's generated code when I build OBS on
macOS with SWIG 4.0.1.
2020-03-08 18:35:35 -07:00
jp9000 c2e055c901 deps/media-playback: Fix formatting
Apparently CI did not catch this.
2020-02-24 04:17:03 -08:00
Clayton Groeneveld e0df5e8868 deps/media-playback: Fix buffering/sync issues 2020-02-13 05:14:34 -06:00
Clayton Groeneveld 9730b270a7 deps/media-playback: Simplify seek/time code 2020-02-10 23:03:04 -06:00
LiamCoal 2b7f4dfa6b media-playback: Unbuffered Media Source
When using an IP camera on a local network, we wanted to minimize
delay. In order to achieve minimum delay, we allowed Media Source to
set BufferingMB to 0, and when it is 0, also enable AVFMT_FLAG_NOBUFFER
in the AVFormatContext flags.
2020-02-07 20:38:06 -08:00
jp9000 65d38864b6 deps/media-playback: Fix formatting 2020-02-01 21:51:20 -08:00
Jim 4cae7c55a1
Merge pull request #2300 from cg2121/media-pause-seek
media-playback: Add functions to pause/seek media source
2020-01-30 18:30:36 -08:00
Jiaxun Yang 6366f6ab59 libobs: Build SIMDE on platforms without SSE2
SIMDE was introduced for aarch64 support, however, the library itself
supports non-SIMD fallback, which allows us provide support to other
platforms without code changes.

There is another world beyond x86. So we can simply enable SIMDE for
processors without SSE2 support.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
2020-01-22 15:41:15 +08:00
jp9000 345e933d9f deps/obs-scripting: Fix incorrect parameter type 2020-01-21 02:43:21 -08:00
Clayton Groeneveld f24c1004c1 media-playback: Add functions to pause/seek media source 2020-01-12 01:08:01 -06:00
Jim 8870676667
Merge pull request #2287 from pkubaj/patch-1
CMake: Fix build on ppc64
2020-01-04 03:37:25 -08:00
pkubaj 03ab727495 CMake: Fix build on ppc64
ppc64le was fixed before, but ppc64 (big-endian) was still failing.
2020-01-04 02:19:38 -08:00
Scratch 41fcb9ae08 obs-scripting: Add Python functions for frontend events 2020-01-03 12:07:17 +11:00
Rat 83fdf41e3f deps/obs-scripting: Expose matrix3 & 4 to scripting
Various functions available in the scripting API aren't usable
currently since you can't create the matrix3 and matrix4 needed
for their arguments.
2019-12-25 00:37:31 +01:00
Jim 2a6baf9886
Merge pull request #2069 from pgwipeout/aarch64
Enable Aarch64 support via SIMDe
2019-11-25 23:56:43 -08:00
jp9000 9826528c31 deps/media-playback: Don't use interrupt cb for local files
This fixes an issue where local files were using the avformat interrupt
callback, which is only supposed to be use to prevent blocking on
network calls.
2019-11-25 23:04:06 -08:00
jp9000 2fae85ab4a deps/media-playback: Don't exit thread on AVERROR_EXIT
The interrupt callback is designed to prevent the media source from
blocking; FFmpeg will internally call it periodically to prevent FFmpeg
function calls from blocking too long, and allow the caller to determine
whether blocking should stop.

The problem with this however is that AVERROR_EXIT causes the thread to
completely exit.  This fixes it so that it treats it as an EOF rather
than as an abnormal error.
2019-11-25 23:04:06 -08:00
Peter Geis 64d0b7fcb4 libobs: Enable compilation on aarch64
Add arch checks to enable aarch-compat layer on aarch64, retain normal
gcc intrinsics on x86 and ppc64.
2019-11-25 13:04:21 -05:00
Jim 654508de7c
Merge pull request #2183 from ratwithacompiler/macos-python-fix-2
obs-scripting: Fix Python in new MacOS .app bundles
2019-11-18 19:46:09 -08:00
jp9000 6ab6fdffd1 deps/obs-scripting: Fix formatting 2019-11-17 18:06:56 -08:00
Rat a19fef2248 obs-scripting: Fix Python in new MacOS .app bundles
The current scripting directory path given to Python on OSX is
`../data/obs-scripting`. This works when bin/ and data/ are in the same
folder like rundir after a compile and in the old .app bundles but the
new normal .app bundle structure is different.

For bundles move obspython.py and _obspython.so to the binary folder,
just like the Lua one, and pass that bin path to the Python interpreter
so it can find it.

The current working dir isn't guaranteed to be set with .app bundles
so look up binary path at runtime.
2019-11-17 22:11:44 +01:00
Jim 9bdb21205d
Merge pull request #2085 from ratwithacompiler/macos-python-fix
obs-scripting: Fix Python on MacOS
2019-11-14 20:38:53 -08:00
Jim def6fcb0ee
Merge pull request #2125 from DDRBoxman/appbundle
Fixes to make OBS work on Catalina
2019-11-13 12:21:13 -08:00
Colin Edwards 32690926b9 CI: Use custom macdylibbundler for OSX deps 2019-11-03 00:00:38 -05:00
jpark37 7336226774 obs-scripting: Quiet CMake SWIG warnings 2019-10-15 21:08:30 -07:00
Jim 7d34034ee2
Merge pull request #2099 from ioangogo/LinuxCaptionFix
cmake: Compile option to fix libcaption linking
2019-10-15 11:25:05 -07:00
Matt Gajownik 51be039cf8 CMake: Build Windows modules with file descriptors 2019-10-15 21:34:12 +11:00
luz.paz d124e6402c docs/sphinx: Fix various typos
(This modifies UI, libobs, deps/obs-scripting, various cmake files)

Found using:
`codespell -q 3 -S *.ini,./UI/data/locale,./deps/w32-pthreads -L aci,dur,iff,mut,numer,uint`
2019-10-14 17:19:38 -07:00
Ioan Loosley 5483de10ee cmake: Compile option to fix libcaption linking 2019-10-07 12:57:54 +01:00
Rat a44ff34ef0 obs-scripting: Link _obspython as dynamic_lookup on MacOS
_obspython.so currently links directly against python as @rpath/Python
and has 3 common python install paths set as rpaths so it would only
work if a user had python installed at one of those hardcoded paths.

Don't link _obspython against python at all but instead link it with
"-undefined dynamic_lookup" so when it is imported by python all it's
undefined python symbols get resolved at runtime against the user
supplied python instance loaded into the process earlier.

The rpaths aren't needed anymore this way.
2019-09-26 23:42:33 +02:00
Rat e7801e10ba obs-scripting: Fix python lib path on MacOS
The libpython .dylib files on MacOS are in the python_path/lib
subdir. The user supplied python_path still needs to be to the actual
python root and not lib/ as the root path get's used as python home dir
so just add lib/ when loading the dylib.
2019-09-26 23:37:00 +02:00
jp9000 86572935af deps/media-playback: Remove cuda for hardware decoding
Cuda appears to be a bit buggy and can result in corruption where as
it's not being seen with other hardware decoders.  Remove cuda for now
as a hardware decoder to prevent the possibility of corruption.
2019-08-29 12:06:55 -07:00
jp9000 43957286d7 deps/media-playback: Fix hw decode dropping last few frames
Fixes a bug where hardware frames would not transfer to RAM for the last
few frames of a video.  The 'ret' variable can be 0 even though there
are still frames ready.
2019-08-29 11:55:49 -07:00
VodBox c2a2bc5e40 deps/media-playback: Use hwaccel with non-alpha WebM files 2019-08-27 22:57:59 -07:00
jp9000 707f83f57d deps/media-playback: Fix memory leak
The hardware accelerated decoder context needs to be explicitly unrefed
when it's no longer in use, otherwise it and many resources associated
with it will leak.
2019-08-24 18:15:25 -07:00
jp9000 94581952b5 deps/media-playback: Fix hw accel decode crash
When hardware accelerated decoding is enabled, sometimes it can't
initialize for whatever reason, so it will fall back to software on its
own.  When this occurs, it will not use the hardware pixel format on the
frame; instead it will defer to a standard format on the frame.  So if
the frame format does not match the expected format, assume software
decoding.  (This was also what the hw-decode.c FFmpeg example did if the
format did not match the expected format)
2019-08-24 18:12:02 -07:00
Jim 5f7ff6fbcc
Merge pull request #1970 from cg2121/fix-warnings
various: Fix compiler/theme warnings
2019-08-17 08:22:03 -07:00