Commit graph

533 commits

Author SHA1 Message Date
gxalpha a1e0626c14 libobs: Add global source filter add/remove signals
Adds global signals for when a filter is added to or removed from a
source. These will be helpful for listening for changes to a sources
filters without having to attach and detach a signal handler, which
would be annoying in the context of for example context menus which
change sources rapidly.
2024-05-25 17:08:42 -07:00
Norihiro Kamae b4a061dcd8 libobs: Remove unused variable in obs_source 2024-04-20 16:07:37 -07:00
derrod 2963959e71 libobs: Replace circlebuf with deque 2024-01-16 16:45:09 +01:00
Lain 2fb7063e1a libobs: Defer media controls to video thread
To prevent sources from having to take too much extra consideration into
threading, defer the media control functions that directly affect
functionality to the video thread. Getters will still have to take
threading into account, but this should make things much more trivial
for media controls thread-wise.

(Lain note: Context: I noticed that things such as the slide show
require mutexes due to their media controls, and I felt that it was
largely unnecessary and that libobs should mitigate the threading issue
itself and keep it all in the video thread like it should be. Again, the
getters are still going to require *some* consideration into threading
but in terms of threading, for the type of stuff we're doing, querying
state is far more trivial to take into consideration.)
2024-01-07 15:59:09 -06:00
Lain 9c9a50643a libobs: Do not allow controllable media without flag
The OBS_SOURCE_CONTROLLABLE_MEDIA flag is required for controllable
media callbacks to be usable. These checks are being added so we can
defer most controllable media callbacks to the video thread.
2024-01-07 15:59:09 -06:00
derrod 62500b5129 libobs: Do not skip async frames unless one has been selected 2023-09-16 22:19:07 -07:00
Ryan Foster 64139a6bbd CI: Update to clang-format 16
This commit also modifies UI, libobs, and plugins.
2023-08-10 16:07:25 -04:00
jpark37 7669da1ea8 libobs: Add VIDEO_FORMAT_R10L
Support 10-bit packed format that DeckLink uses.
2023-07-29 16:41:31 -07:00
CodeYan01 a494cf5ce4 libobs: Add obs_source_info.filter_add
If there is filter_remove, it is reasonable to expect that there is also
filter_add. filter_add also enables filters to attach signal handlers
on the parent, and disconnect them in filter_remove.
2023-07-29 16:15:21 -07:00
cg2121 cb8b5ba9cd libobs: Change return type for getting filter index
This changes the return type for getting the filter index from a
size_t to an int. This makes it easier for developers to use,
as an invalid index just returns a -1.
2023-07-20 13:21:14 -07:00
Sergo 9eea0d8921 libobs: Add pause callback support for sources 2023-07-06 15:24:12 +02:00
cg2121 243d4d42e9 libobs: Add functions to get/set the index of filters 2023-06-21 15:33:48 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
derrod 3bb101d7a2 libobs: Finalise source creation before firing signal
Fixes a possible crash when renaming a source during the source_create
signal callback as it has not been added to the hash table yet.
2023-04-22 16:13:17 -07:00
jpark37 97843dd7d7 libobs: Add VIDEO_FORMAT_V210
Support 10-bit packed format that DeckLink uses.
2023-03-26 01:52:44 -07:00
derrod a73e13eeeb libobs: Keep mixer data for placeholder sources
Placeholder sources are created when a plugin providing a source type is
unavailable. Since they're not marked as having audio any audio track
settings for them get lost. With this change we retain mixer information
if the source owns its id to avoid that.
2023-03-24 12:16:32 -04:00
derrod c68eeaef1d libobs: Use uthash for source objects
All sources are part of a hash table that allows a lookup by UUID.
Public sources additionally are in a hash table allowing lookup by name.
2023-03-18 10:47:49 +01:00
derrod 30519768ad libobs: Add UUIDs to obs_source objects 2023-03-12 01:11:38 +01:00
Richard Stanway 2468268569 libobs: Hold async mutex when calling set_async_texture_size
Calling set_async_texture_size without holding async_mutex is dangerous
as cur_async_frame could be changed / freed by another thread.
2023-03-04 16:10:19 -08:00
PatTheMav 76732846d7 libobs: Fix non-exhaustive switch statements
New video formats introduced for ProRes 4444 encoding have not been
implemented in function calls used for video decoding, which makes the
switch statements non-exhaustive.

This does not functionally change the status quo (decoding ProRes 4444
files could still be broken because libobs does not explicitly handle
the colour format).
2023-02-23 20:32:52 +01:00
jpark37 0efaf88caf libobs: Add PQ/HLG support for I210/I412 formats
Seen when playing back ProRes files.
2023-02-21 18:48:44 +01:00
PatTheMav fb7a9edadc libobs: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08:00
jpark37 792f8473ee libobs: Fix SDR async video on non-SDR targets
Bug was seen when projecting SDR video capture on WCG displays.
2023-01-24 19:39:42 -08:00
tytan652 7de0bd350f libobs,plugins: Remove one-case switches 2023-01-16 11:43:47 +01:00
jpark37 3d36ba5579 libobs: Fix SRGB to SCRGB async video rendering
SDR source projectors are no longer blown out on HDR displays.
2022-11-17 02:16:48 -08:00
jpark37 6306c8de74 libobs: Move async filtering from render to tick
Fixes frame/texture size mismatch crash that can happen at render time.
2022-11-08 05:37:47 -08:00
gxalpha 5658bf6732 libobs: Add "source_update" signal
Adds a source signal that gets triggered when a source's settings are
updated.
2022-11-05 18:06:53 -07:00
jpark37 080095786f libobs: Force SRGB conversion for tonemapped video
Fixes case where video capture is darkened when both luma wipe and scale
filtering are set.
2022-10-31 14:05:04 -07:00
jpark37 e119a7024d libobs: Sample video at default chroma location
Expect left for 4:2:0 SDR and 4:2:2, and top-left for 4:2:0 HDR.

MJPEG will be a half-pixel off, but we'll live with that for now.
2022-10-09 16:15:16 -07:00
jpark37 bb02620169 libobs: Add support for reading NV12/YUY2 PQ/HLG
8-bit HDR shouldn't exist, but OBS looks broken, so just support it.
2022-09-17 16:36:31 -07:00
jpark37 1a7e5babc2 libobs: Add support for reading I420 HLG
Sony cameras can create 8-bit HLG videos for some reason.
2022-09-16 03:04:23 -07:00
jp9000 6abf89af21 Revert "libobs: Correctly set texture size"
This reverts commit 90a409fe58.

Reverts #7077 for now. This really shouldn't be done so close to
release. This crash technically only happens under very niche scenarios,
and the fix seems to have some other potential issues. Prematurely
merged by Jim.
2022-08-18 11:04:11 -07:00
tududweb 90a409fe58 libobs: Correctly set texture size
Correctly set texture size according to the frame to be rendered this time.
Fixes the mismatch between frame and texture when async-delay-filter on.
2022-08-18 03:43:22 -07:00
jpark37 64ef93a29d libobs: Fix filter color space passthrough
Need to chain against target instead of parent.
2022-08-13 01:32:42 -07:00
Norihiro Kamae 8a4b765c9c libobs: Fix rendering null sprite
When rendering an async-source that does not have a frame yet, massive
error `A sprite cannot be drawn without a width/height` was logged.
2022-05-28 16:05:29 -07:00
jpark37 11da542a0d libobs: Add max_luminance to obs_source_frame
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
tt2468 a8c481a80e libobs: Only warn when releasing non-NULL source
Only warn when the pointer provided to obs_source_release() is
non-NULL. In some custom usages of libobs, libobs may be freed before
OBS* smart pointers (like OBSSource) are destructed, leading to a
misleading warning if the pointers have already been cleared with
nullptr.

Previous behavior is basically:
- Clear OBS* pointers with nullptr
- Unload libobs
- Those smart pointers that were cleared will still call
obs_source_release() on destruct
- Warning appears
2022-05-21 15:33:39 -07:00
jpark37 d233065d60 libobs: Default 10-bit video to sRGB instead of PQ
Matches how VLC operates. HDR is only in effect with proper metadata.
2022-05-17 02:46:52 -07:00
jpark37 8909e44870 libobs: Cap HLG video at 1000 nits 2022-05-14 16:41:03 -07:00
jpark37 2a0d8d1c9c libobs: Add support for reading I420 PQ
Not normally a valid combination, but Xbox writes 8-bit HDR videos.
2022-05-08 14:12:41 -07: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
Norihiro Kamae 34e570c5bc Fix indent on multiline comments 2022-04-30 16:06:23 -07:00
mvji d3a8ef7128 libobs: Add support for YUV422P10LE, YUV444P12LE, YUVA444P12LE 2022-04-19 19:37:07 +02:00
Norihiro Kamae 7b8793f6c3 libobs: Log audio timestamp exceeding TS_SMOOTHING_THRESHOLD
Timestamp of some of audio sources desync over the time and audio glitch
is suspected to be caused when the difference between `timestamp` and
`next_audio_ts_min` exceeds TS_SMOOTHING_THRESHOLD.
When such condition happens, leave a log message to investigate the
glitch of the audio.
2022-04-18 07:51:07 -07:00
jpark37 74daf5cbaf libobs: Fix color space auto-convert blending
Need premultiplied alpha for this, not straight alpha.
2022-04-18 05:23:34 -07:00
jpark37 338608bd67 libobs,UI: Support HLG nominal peak level
HLG output uses MovieLabs-recommended procedure.

- If peak luminance is greater than 1000, use maxRGB EETF to 1000.
- Otherwise, don't tonemap.
- Then use normal HLG conversion procedure with gamma 1.2 (1000 nits).
2022-04-14 09:36:44 -07:00
jpark37 72224f0fae libobs: Remove redundant async_color_format member 2022-04-13 06:23:35 -07:00
jpark37 06111d5b10 libobs: Add high-precision sRGB support 2022-04-08 17:19:23 -07:00
jpark37 d72d2552ee libobs: Clear image on color convert
Avoid redrawing potentially stale image from previous frame.
2022-04-07 01:50:27 -07:00
jpark37 0ed0f2cdb4 libobs: Add I010/P010 support, TRC enum 2022-04-03 00:01:25 -07:00