Commit graph

192 commits

Author SHA1 Message Date
tt2468 751dbdad10 libobs: Update video encoder group struct member names
Updates the struct member names of the video encoder group to be more
like what is commonly seen in OBS elsewhere.
2024-06-17 08:20:01 -07:00
derrod adf744e6f0 libobs: Ensure audio offsets are positive 2024-05-18 16:29:01 -07:00
JoHn BoWeRs 3ab71a9f90 libobs: Use bmalloc/bfree for caption data 2024-04-26 18:17:34 -07:00
John Bowers 5c8be1de22 libobs: Add caption support for AV1
Extract the itut_t35 caption data buffer from existing caption data
and repackage in a metadata OBU instead of an AVC/HEVC SEI.
2024-04-26 18:17:34 -07:00
JoHn BoWeRs 33eb95c274 libobs: Add caption support for HEVC
Add embedded caption support for HEVC by slightly modifying the H.264
SEI to be an HEVC SEI (2 byte SEI NAL header).
2024-04-26 18:17:34 -07:00
John Bowers f9bc9a8b12 libobs: Avoid adding captions on non H.264 streams
The existing caption insertion implementation is to add H.264 specific
SEI NALs, because of this we will skip caption insertion unless the
video stream is H.264. This prevents corruption of AV1/HEVC/etc.
2024-04-26 18:17:34 -07:00
John Bowers 849c1180ac libobs: Insert captions on all video tracks
We will now keep a per track list of caption data. When caption
insertion is triggered we will add that to the list for each actively
encoding video track. When doing interleaved send, we pull the data
from the caption data for the corresponding video. This ensures that
captions get copied to all video tracks.
2024-04-26 18:17:34 -07:00
Ruwen Hahn d966742a63 libobs: Fix highest_video_ts tracking
Calling `set_higher_ts` before offsets are known pollutes
`highest_video_ts` with timestamps that are out of range of actual
timestamps. They're generally somewhere high above 0 until an
offset for all streams is found, where they are then reset to 0 or
slightly below 0 in the presence of b-frames.

`highest_video_ts` also needs to start below 0 for the same reason.
Even with timestamps being reset to close to 0, b-frames will
cause initial DTS to drop below 0, thus we need a value that should
"always" be below any "real" timestamps observed.

`highest_video_ts` tracking now only starts once all input streams
are ready, and is computed based on all buffered packets at that
point.
2024-04-20 16:41:55 -07:00
Ruwen Hahn 5e1909d54f libobs: Track keyframe alignment for keyframe aligned encoder groups 2024-04-12 14:52:32 -07:00
derrod 2963959e71 libobs: Replace circlebuf with deque 2024-01-16 16:45:09 +01:00
Norihiro Kamae 0f9376f1cb libobs: Fix audio-only output did not receive raw_audio 2023-12-09 18:52:17 -06:00
derrod ca865f80cc libobs: Pair video encoder with all audio encoders 2023-12-05 15:36:37 -06:00
derrod b680700bba libobs: Remove unused wait_for_video flag 2023-12-05 15:36:37 -06:00
Rodney 3869cb83bc libobs: Fix rendering stats not being logged on output stop 2023-10-13 11:05:19 -05:00
Norihiro Kamae 2036de8ec3 libobs: Fix obs_output_video and obs_output_audio for encoded output
The API `obs_output_video` and `obs_output_audio` returned valid
pointers until the commit fb57eff21 and 645e31fa1.
The API `obs_output_video` is used by some plugins such as obs-websocket
and obs-midi to calculate the duration of streaming and recording.
To have a similar behavior, return the media (video and audio,
respectively) from the encoder.
2023-09-06 23:36:06 -07:00
Norihiro Kamae fa9b7b042f libobs: Remove starting_frame_count from obs_output_t
The member variable `starting_frame_count` was set but never read.
2023-08-15 16:00:21 -07:00
Norihiro Kamae fb57eff212 libobs: Fix holding possibly released pointer in obs_output_t
When `obs_output_t` is an encoded output, `obs_output_set_media` will
ignore the video and audio so that `obs_output_t` will keep holding the
`video_t` and `audio_t` pointer when the output was created.
By this commit, `video` and `audio` member variables in `obs_output_t`
will never set if it is an encoded output.
In the auto-configuration wizard, `video_t` is released and created to
have a different video size while `obs_output_t` is not released. This
resulted in accessing the released `video_t` pointer.
2023-08-15 16:00:21 -07:00
Ruwen Hahn 6cdfb0a8b9 libobs: Allow configuring frame rate divisor for encoders
This allows encoders/outputs to output at a frame rate that is lower
than the configured base frame rate
2023-07-03 09:35:06 -07:00
gxalpha f37876a941 libobs: Fix obs_output_get_height2 returning width 2023-06-25 16:06:49 -07:00
Ruwen Hahn 9b5ce9fcec
libobs: Fix null pointer access for video packets
Initialize arrays to 0, as otherwise these can get initialized with 
garbage data or potentially Visual Studio's default debug marker,
which is a problem if they're being checked against `NULL` later.
2023-06-14 19:52:05 +02:00
John Bradley 6ec0b2db11 libobs: Add support to obs-outputs for multi video encoders
This adds support in outputs to handle multiple video encoders
and their interleaving with the encoded audio.
2023-06-14 02:24:54 -07:00
gxalpha 79822a58c3 libobs,plugins: Remove new obs_output_*2 functions
Effectively reverting parts of d314d47, this commit removes the new
functions that got added to remove the flags parameter. Instead, it just
marks the parameter as unused and documents this. Having what is
effectively an API break just to remove a parameter is a bit overkill.
The other parts of d314d47 which cleaned up the usage of the flags
parameter are untouched here.
2023-06-10 16:13:05 -07:00
tt2468 a696470c9e
libobs: Remove warning log for raw outputs when starting data capture
#8873 accidentally used `log_flag_encoded()` instead of `flag_encoded()` in `obs_output_begin_data_capture()`, which was causing a warning to be logged when it shouldn't.
2023-05-27 13:18:41 -07:00
tt2468 d314d4725d libobs, plugins: Deprecate obs_output_t functions with flag parameters
This deprecates the following functions, replacing them with new
versions:
- `obs_output_can_begin_data_capture()` - now `*capture2()`
- `obs_output_initialize_encoders()` - now `*encoders2()`
- `obs_output_begin_data_capture()` - now `*capture2()`

The flags parameter was initially designed to support audio-only or
video-only operation of an output which had the `OBS_OUTPUT_AV` flag,
however, full support for that was never implemented, and there are
likely fundamental issues with an implementation, mainly that most
outputs are programmed assuming that there will always be at least one
audio and one video track. This requires new flags specifying support
for optional audio/video, among other things.

An implementation to allow audio/video to be optional is best done
using the flag technique above, with audio/video enablement specified
by whether media (raw, `video_t/audio_t`) or encoder (`obs_encoder_t`)
objects are specified.

Since every implementation I could find always specifies `flags` as 0,
I was able to safely conclude that immediately removing the parameter's
functionality is safe to do.
2023-05-20 16:41:55 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
tt2468 645e31fa15 libobs: Add sanity checks to some obs_output_t functions
Since OBS outputs can have any combination of flags for encoded,
video, audio, and service, there are a number of cases where it would
be a good idea to validate that we're not allowing output changes that
risk undefined behavior given the supported flags.

This also does a mild amount of code cleanup, adding inline functions
for checking the flags mentioned above.
2023-05-13 18:26:52 -07:00
Jim 0a9ed4569b
Merge pull request #7814 from jpark37/decklink-preview-rescale
decklink: Move preview output rescaling to GPU
2023-03-20 01:42:36 -07:00
tytan652 22ebed8d02 libobs,docs: Add connect infos check to the Services API
This new function allows to know if the service has all the info needed
to try to connect.
2023-03-19 17:38:02 +01:00
tytan652 48dc6dde68 libobs,docs: Add supported codecs functions with output id 2023-03-19 16:49:56 +01:00
tytan652 56411eda8e libobs,docs: Add protocol enumeration functions 2023-03-19 16:31:05 +01:00
tytan652 201bcda051 libobs,docs: Add protocol in Outputs API 2023-03-19 15:29:03 +01:00
Kurt Kartaltepe b7f29ca767 libobs: Reduce synchronization limit for multiple audio tracks
Since 65eb3c0815 we tried to get as close
a sync between audio and video tracks as we could before starting to
send frames to the output.

But in be717dbb2c when multi-track audio
was considered for synchronization it continued to try and line ALL
audio packets up with one video packet. While audio and video packets
are similar size this will work out. But once video packets duration is
smaller than 1/2 audio packet duration this may fail forever. In
practice with AAC's 20-23ms frame duration we can often get tracks
producing frames 5-10ms out of phase. For 60fps video this mostly fine
as 16ms frame duration will cover the gap, but for framerates as low as
100 its possible to fail to synchronize. In practice this is ~50%
for 6 audio tracks and 120fps video on my system, or 100% at 240fps.
2023-03-18 18:40:12 -07:00
derrod 30519768ad libobs: Add UUIDs to obs_source objects 2023-03-12 01:11:38 +01:00
jpark37 9ee97bba1a libobs: Add obs_output_get_video_conversion
Need post-convert size to avoid CPU rescale.
2023-02-19 11:46:20 -08:00
John Bradley 61284cf9ba libobs: Refactor obs-output encoded use of mixes
There was quite a bit of conflated usage of mixes (which refers
to raw audio) and encoder counts. This fully separates the two
and makes a distinct separation when iterating over mixes vs
encoders.
2023-01-18 11:54:20 -08:00
John Bradley d70171daa6 libobs: Make internal version of remove encoder 2023-01-18 11:54:20 -08:00
tt2468 78d31322b2 libobs: Remove extra space in output reconnect log message
It has been bothering me to no end.
2023-01-15 22:59:59 -08:00
jpark37 92d1ca41cc libobs: Fix warnings about type usage 2022-07-11 22:07:10 -07:00
tt2468 bb55cfbc05 libobs: Improve exponential backoff functionality
- Changes the default base exponent value to 1.5 from 2.0
- Applies a random skew of +-0.05 to the exponent to lessen the
"water hammer" effect caused by predictable backoff techniques
- Fixes the logging associated with exponential backoff to log the
true reconnect delay value
2022-06-25 17:06:00 -07:00
jp9000 edfd5ad604 libobs: Add obs_object abstraction and functions
With this, you can now cast normal obs objects (services, outputs,
sources, encoders) to an obs_object_t, and then use obs_object_*
functions to get references, release references, and similar for weak
object references as well. This allows the ability for the frontend to
use an object of any of those types interchangeably in certain
situations without having to handle each specific type individually.

This is useful because the properties view in particular doesn't care
what type of object it uses, it just needs to be able to hold weak
references to abstract OBS objects.
2022-02-02 22:35:56 -08:00
jp9000 a4146a685b libobs: Allow last encoder error for last output error
(This commit also modifies UI)

This makes it more trivial for encoder plugins to communicate to users
why specifically an encoder error might have occurred mid-stream.
2021-10-25 12:24:16 -07:00
Norihiro Kamae d65ca911dd libobs: Add casts to da_push_back_array arguments 2021-10-01 12:58:14 +09:00
jpark37 86ecaadffb libobs: Fix bad type and size mismatch 2020-11-04 04:45:07 -08:00
Colin Edwards 5b8f89d86e decklink: Clean up warnings introduced by caption code 2020-11-03 17:00:14 -08:00
Colin Edwards 7b0d7c6357 Remove BUILD_CAPTIONS build flag 2020-11-02 22:46:55 -06:00
Colin Edwards 923f06bfa6 decklink: Add ability to ingest/embed cea 708 captions
(This commit also modifies libobs, UI)
2020-11-01 22:28:49 -08:00
jp9000 e1447c22db libobs: Check if output active when setting encoders
This fixes an issue where someone might mistakenly try to change an
audio/video encoder before the output is complete.
2020-09-23 14:52:15 -07:00
jp9000 af09057395 libobs: Deprecate service multitrack check
This isn't particularly needed, as a service with multiple tracks won't
be using multiple tracks to begin with anyway.  This might change later,
but for now just mark it deprecated.
2020-09-07 13:38:38 -07:00
Jim 665180350d
Merge pull request #2657 from hselasky/improvement
libobs: Implement and use better scaling function for 64-bit integers
2020-05-21 18:07:53 -07:00
Richard Stanway 5dc9f989d6 libobs: Add support functions for encoder error handling
Similar to how outputs can pass errors, add the same functionality for
encoders so that if an output encoder has an error, it is made available
to the output and eventually the UI / user.
2020-04-12 17:05:19 +02:00