Commit graph

381 commits

Author SHA1 Message Date
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
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