Commit graph

12 commits

Author SHA1 Message Date
derrod 2963959e71 libobs: Replace circlebuf with deque 2024-01-16 16:45:09 +01: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 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
Richard Stanway 6c0d234385 libobs: Minor fixes / code cleanups
Fixes some warnings generated by code analysis tools, removing redundant
checks etc.
2021-03-04 19:29:33 +01:00
jp9000 f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
jp9000 7d6e6eee79 libobs: Use reference counting for encoder packets
Prevents reallocation of encoded packet data.

Deprecates:
obs_duplicate_encoder_packet
obs_free_encoder_packet

Replaces those functions with:
obs_encoder_packet_ref
obs_encoder_packet_release
2016-12-08 03:27:39 -08:00
jp9000 d7db0b8b01 (API Change) libobs: Fix output data cutoff on stop
(Note: This commit also modifies obs-ffmpeg and obs-outputs)

API Changed:
obs_output_info::void (*stop)(void *data);

To:
obs_output_info::void (*stop)(void *data, uint64_t ts);

This fixes the long-time design flaw where obs_output_stop and the
output 'stop' callback would just shut down the output without
considering the timing of when obs_output_stop was used, discarding any
possible buffering and causing the output to get cut off at an
unexpected timing.

The 'stop' callback of obs_output_info now takes a timestamp with the
expectation that the output will use that timestamp to stop output data
in accordance to that timing.  obs_output_stop now records the timestamp
at the time that the function is called and calls the 'stop' callback
with that timestamp.  If needed, obs_output_force_stop will still stop
the output immediately without buffering.
2016-06-22 14:10:39 -07:00
jp9000 ceb675f6df libobs: Use atomics for certain output boolean variables 2016-06-22 03:08:32 -07:00
jp9000 6f98bd9fed libobs: Use calldata with stack for simple signals
Makes signals use stack memory rather than allocate memory each time.
Most likely a completely insignificant and pointless optimization.
2016-01-26 11:49:56 -08:00
jp9000 0538865553 libobs: Add encoded output delay support
This feature allows a user to delay an output (as long as the output
itself supports it).  Needless to say this intended for live streams,
where users may want to delay their streams to prevent stream sniping,
cheating, and other such things.

The design this time was a bit more elaborate, but still simple in
design:  the user can now schedule stops/starts without having to wait
for the stream itself to stop before being able to take any action.
Optionally, they can also forcibly stop stream (and delay) in case
something happens which they might not want to be streamed.

Additionally, a new option was added to preserve stream cutoff point on
disconnections/reconnections, so that if you get disconnected while
streaming, when it reconnects, it will reconnect right at the point
where it left off.  This will probably be quite useful for a number of
applications in addition to regular delay, such as setting the delay to
1 second and then using this feature to minimize, for example, a
critical stream such as a tournament stream from getting any of its
stream data cut off.  However, using this feature will of course cause
the stream data to buffer and increase delay (and memory usage) while
it's in the process of reconnecting.
2015-09-10 12:13:37 -07:00