Commit graph

412 commits

Author SHA1 Message Date
tt2468 4eef796f80 deps/media-playback: Fix init of swscale with hw decode
Checking the format of the AVCodecContext will result in using the
format of the hardware-side frames, not the software-side frames. This
uses the software frame parameters itself to initialize the swscale
context.
2024-06-16 02:47:06 +02:00
derrod 2d489fc54e deps/blake2: Add static blake2 library for Windows updater 2024-06-14 18:10:04 -04:00
tytan652 508f9c2e3c obs-scripting: Refactor Lua C paths 2024-06-14 17:34:14 -04:00
moocowsheep c9f7a3c325 deps/media-playback: Prioritize CUDA decoder 2024-05-11 20:29:43 -07:00
tytan652 9fa23c8cca obs-scripting: Remove Python version upper limit on Linux
Also removes it for FreeBSD and OpenBSD
2024-05-03 15:31:20 -04:00
PatTheMav e87a5c3691 obs-scripting: Update Linux slice for CMake build framework 3.0 2024-04-13 23:48:38 -04:00
PatTheMav 4d6e17c547 deps: Suppress acknowledged compile-time warnings for json11 2024-04-13 23:48:38 -04:00
tytan652 e032c2d0c9 deps,libobs: Replace uthash with prefix/system install 2024-04-07 10:01:25 +10:00
tt2468 8fd61c2049 deps/media-playback: Detect+handle video res changes with hwaccel 2024-03-19 16:58:20 -07:00
pkv 41f07913e5 deps/media-playback: Fix hardware decoding of streams
Fixes issue #10369.
Since the update to FFmpeg 6.1, streams to a Media Source are broken
if hardware decoding is enabled (both RTMP or SRT have been reported).
The video is black although the audio is decoded fine.
The manual copy of metadata introduced in commit [1] does not work any
more for some unfathomable reasons.
As a fix we call instead the av_frame_copy_props function used in FFmpeg
app in a similar context (hardware decoding) [2].
The metadata are copied without issues.
There is no need to guard the use of that function since it was
introduced 9 years ago in avutil/frame.c.

[1] 22fde5cdcd
[2] https://github.com/FFmpeg/FFmpeg/master/fftools/ffmpeg_dec.c

Signed-off-by: pkv <pkv@obsproject.com>
2024-03-18 14:13:55 -04:00
Exeldro a0e666d8e3 deps/obs-scripting: Fix lua tick crash 2024-02-03 17:08:53 -06:00
Kurt Kartaltepe 477c3be050 deps/glad: Add EGL_EXT_device_base related extensions 2024-01-27 17:51:33 -06:00
derrod 538ea46e5a deps/obs-scripting: Replace circlebuf with deque 2024-01-16 16:45:09 +01:00
derrod a029d2ac01 deps/media-playback: Replace circlebuf with deque 2024-01-16 16:45:09 +01:00
rvalue c96a2a64fc libcaption: Optimize branch conditons
The optimization silences the warning about type limits on platforms
with `char` type as `unsigned char`.

The original condition is semantically identical to the optimized one
because the signed-to-unsigned cast is well-defined in C standard.
2024-01-03 18:20:38 -05:00
PatTheMav aa137f0766 deps: Update CMake target source lists with alphabetic sorting
Also manually updates some CMake script files to make code more
readable.
2023-12-19 17:59:44 -05:00
PatTheMav c665308fbf obs-scripting: Disable Python 3.11 support on Windows
Inlined functions in Python's header files result in unresolvable
symbols at link time when building in Debug config on Windows.

This downgrades the upper limit on Windows to 3.10 again until a proper
fix can be found.

macOS is unaffected because it can link binaries with dynamic runtime
lookup.
2023-12-09 19:37:18 +01:00
PatTheMav 6164184b4a obs-scripting: Add missing function import for PyType_IsSubtype 2023-12-09 19:37:18 +01:00
PatTheMav cab950c23b obs-scripting: Fix Python version detection on Windows
Prior code would not only iterate over possible versioned python DLL
names, but also replace possible named subdirectories contained in the
path string.

This commit changes the same code to only change the filename and leave
the path prefix intact.
2023-12-09 19:37:18 +01:00
Stephen Seo 6e080a6806 deps/media-playback: In check for key-frame, use new FFmpeg 6.1 API
Fixes for using FFmpeg 6.1 due to deprecations. Uses `#if` macros to
allow builds for using older versions of FFmpeg.

AVFrame.key_frame was replaced with a flag in AVFrame.flags. The commit
adding the flag is [1] in FFmpeg's repository, and the deprecation is in
commit [2].

In summary of the "key_frame" change, AVFrame.key_frame is deprecated,
and AVFrame.flags indicates with a bit flag if it is a key frame (with
the enum/defined AV_FRAME_FLAG_KEY).

[1]: avutil/frame: add a keyframe flag to AVFrame
cc11191fda

[2]: avutil/frame: deprecate key_frame
3e06f6f040
2023-12-02 17:43:18 -06:00
Stephen Seo 4b5be75c7e deps/media-playback: Use new (nb_)coded_side_data FFmpeg 6.1 API
Fixes for using FFmpeg 6.1 due to deprecations. Uses `#if` macros to
allow builds for using older versions of FFmpeg.

The change in deps/media-playback/media-playback/decode.c is due to
FFmpeg moving "side_data" into AVCodecParameters which is mentioned in
commit [1] in FFmpeg's repository.

In summary of the "side_data" change, AVStream.side_data is deprecated
and replaced with AVStream.codecpar->coded_side_data, and
AVStream.nb_side_data is replaced with
AVStream.codecpar->nb_coded_side_data.

[1]: avcodec/codec_par: add side data to AVCodecParameters
21d7cc6fa9
2023-12-02 17:43:18 -06:00
PatTheMav 95cab7178e obs-scripting: Add Python 3.11 support for Windows and macOS 2023-11-11 17:45:55 -06:00
PatTheMav 24073568e5 obs-scripting: Fix Sparkle delta updates by disabling bytecode caching
Python automatically creates bytecode caches which end up inside the
application bundle of OBS Studio on macOS. These directories will lead
to a hash mismatch when Sparkle attempts to apply a delta update (to
ensure that the patch can be applied).

As the added directories will make the hash check fail, having a valid
Python framework configured in OBS Studio (even without any script
added) will thus prevent Sparkle from using delta updates.
2023-11-04 18:26:50 -05:00
Smartkin e0bc8a8c9c obs-scripting: Search native libraries in Lua script's location 2023-10-14 19:04:00 -05:00
Neal Gompa bc14a25b15 deps: Add license declaration files 2023-09-19 13:35:49 -04:00
PatTheMav 1c8e046256 json11: Suppress warnings about unqualified std::move calls
Vendored dependency cannot be updated.
2023-08-31 17:52:08 -04:00
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
derrod a0ae12981c deps: Remove libff 2023-07-30 15:58:21 -07:00
derrod 5569139c43 deps/libff: Remove unused code and header files 2023-07-29 17:08:20 -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
James Hurley 19e29500d8 deps: Add Happy Eyeballs (RFC 6555)
This commit adds a utility to connect to a TCP endpoint that may
be dual-stack IPv4/IPv6 using fast fallback. It will attempt the
prefered address family first, followed by the other 200ms later.
The first to connect will be the socket that is handed back
to the caller.
2023-07-24 16:33:31 -07:00
derrod 7731f98d87 deps/media-playback: Remove legacy FFmpeg compatibility 2023-07-12 15:57:43 -04:00
derrod aeaf720247 deps/libff: Remove legacy FFmpeg compatibility 2023-07-12 15:57:43 -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
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
CodeYan01 d1a7070d10 obs-ffmpeg: Prevent media source restart
Some options do not require a media source restart. Saving source
unchanged source settings should also not trigger a restart.

I tried to also make it so speed changes do not require a restart by
manipulating the elapsed timestamp  for the source, but it sometimes
causes the first few milliseconds after saving settings to be rough or
slightly distorted. I am also unsure whether a/v frame buffers should be
cleared on a speed change (and how to) so I made it so restarts are
required for speed changes. Chiyo also mentioned that successive quick
speed changes will cause maximum audio buffering (which I was able to
reproduce once).

Nonlocal file playback is unaffected, and will cause the media source to
restart because I am not aware of the possible consequences and because
there's no restart button for it.

Changing "Apply alpha in linear space" is only visible after a few
milliseconds (when mp_media_next_video is called for new frames).

If `is_stinger` and `full_decode` are toggled during runtime, even
though it shouldn't be possible as they are not accessible in the UI,
a media restart will be triggered.
2023-06-23 04:39:52 -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
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
derrod d53ed7daed deps/libff: Add ff_supports_pcm_in_mp4() 2023-06-10 17:10:30 -07: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 192d33ce86 deps/media-playback: Just null the first frame pointer on decode
memset is a little excessive considering we only check the first
pointer.
2023-05-25 18:34:27 -07:00
Lain 40ce466f4d deps/media-playback: Check is_active when frame preloading
Adds a check to make sure that delayed preload is ignored if the stinger
is restarted/interrupted. Just adds this check to the previous commit to
make sure that it doesn't redundantly try to preload a frame when
playback is restarted.
2023-05-25 18:09:46 -07:00
Lain a12d5812af deps/media-playback: Fix crash when interrupting stingers
The `mp_media::obsframe` varaible is a variable used to store the
current frame, or the first frame on stop. However, it's never cleared,
and while decoding a frame, it's invalid. The variable was added for
delayed preloading of the first frame for stingers.

Now, for more context, when media sources stop, it stores the first
frame of the video so it can set the source's current async texture to
that frame, effectively preloading the first frame into the backend,
making it so that when you play back that media, it's able to start
playback instantly without having to wait for the thread to play back
that frame, causing seamless playback.

Normally, preload happens right when first frame is finished decoding,
thus it wasn't a problem before these variables and delayed preloading
was added. However, with stingers, I delayed that preload further
because stingers are kind of a special case because the stinger does not
clear itself right away on stop. Because of that, it was causing it to
flash the first frame at the end of the stinger. This is why `obsframe`
and `request_preload` were added: it's a way of signaling the media
source to preload the first frame when the stinger itself is fully
completed. It was added to fix that stinger bug.

However, if the user interrupts playback of the stinger (e.g. swaps to
another scene while in the middle of the transition), that
`request_preload` might still be queued and happen while the media
source is still decoding, and thus, while `obsframe` is invalid.

I realize that we should probably refactor and clean up the
media-playback lib.
2023-05-25 18:01:17 -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
Richard Stanway b9ef64d4eb deps/media-playback: Check if frame can be played before using it
It's possible that frame_ready is false when this function is called,
which implies that the mp_decode frame field is not valid. However we
dereference the frame by counting the number of audio channels before
checking the value of frame_ready, causing a crash.
2023-04-30 16:23:16 -07:00
Richard Stanway 7ceb39bd56 deps/media-playback: Initialize mutex earlier for cached media
mp_cache_stop / mp_cache_free both try to use the mutex so we need to
make sure it's initialized before calling functions that may fail.
2023-04-29 11:30:01 -07:00
tytan652 c53a1b4fb0 media-playback: Add missing license headers 2023-04-24 03:50:40 -07:00