0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
Commit Graph

1738 Commits

Author SHA1 Message Date
Richard Stanway
3ddfc55e46 libobs: Fix missing mutex unlock from 26dbe54 2019-02-18 23:42:01 +01:00
Richard Stanway
26dbe54896 libobs: Check fwrite return value for extra safety 2019-02-18 17:49:33 +01:00
jp9000
b63e7fbcb5 libobs: Fix indent 2019-02-12 19:33:13 -08:00
jp9000
573197af5b libobs: Fix race conditions
Uses obs_source_get_ref on the sources enumerated in the tick_sources
function in obs-video.c to ensure a reference has been incremented
before calling that source's video_tick, and replaces an
obs_source_addref with obs_source_get_ref in the push_audio_tree
function in obs-audio.c to ensure that it cannot increment a source that
has already decremented its reference to 0.
2019-02-12 19:23:24 -08:00
jp9000
131fb7b460 libobs: Fix potential race condition on shutdown
If the remove_connection call of obs_encoder_stop_internal took too
long, obs_encoder_destroy could get called before that function
completed, causing a race condition.
2019-02-12 16:07:14 -08:00
jp9000
d416f781fd libobs: Fix crash starting raw encoder before gpu encoder
Fixes a crash when starting a raw encoder before a GPU encoder.
2019-02-10 22:22:31 -08:00
jp9000
b029453d30 libobs: Fix texture-based encoder decklock
Ensures that there are no textures being encoded before attempting to
shut down a texture-based encoder.
2019-02-10 21:53:24 -08:00
jp9000
2a92555f58 libobs: Make sure to destroy effect
This actually isn't necessary because the graphics subsystem technically
automatically frees effects, but that could change, so call this just to
be safe.
2019-02-10 18:12:37 -08:00
VodBox
f095cb2d0e UI: Add scene item canvas overflow to preview 2019-02-08 20:38:53 +13:00
jp9000
93ba6e7128 libobs: Add texture-based encoding support
Allows the ability to encode by passing NV12 textures.  This uses a
separate thread for texture-based encoders with a small queue of
textures.  An output texture with a keyed mutex shared texture is locked
between OBS and each encoder.  A new encoder callback and capability
flag is used to encode with textures.
2019-02-07 17:00:46 -08:00
jp9000
cd1607ca6e libobs: Split do_encode in to two funcs
This splits the "do_encode" function in to "do_encode" and
"send_off_encoder_packet", the latter of which allows the ability for
texture-based encoders to manage their own encoding and just simply send
off a packet to the outputs.
2019-02-07 17:00:46 -08:00
jp9000
36ffa65b68 libobs/media-io: Add frame funcs for separate GPU thread
Normally, the total and skipped frame count for the encoder is performed
in the video-io thread.  However, because a new thread is being
introduced for texture-based encoding, the frontend has no way of being
able to query that.  So, instead of making the frontend query that data
separately, just make the texture encoder thread increment the values of
video-io.  That way, the frontend doesn't need to change any code, and
can continue using the same functions for determining the total/skipped
frame count.

This can cause the frame count to be doubled if both a texture-based
encoder and a raw data encoder is active at the same time, but it's an
acceptable alternative.
2019-02-07 17:00:46 -08:00
jp9000
8134b8afda libobs/util: Fix bug with get_winver
get_winver is supposed to return a 16bit value in a format equivalent to
0xMMmm (Major minor).  It was returning 0xMM00mm incorrectly instead.
2019-02-07 17:00:46 -08:00
jp9000
e6c719a1dd libobs/util: Fix bug with circlebuf_data
If the index specified is equal to the size of the data, return NULL.
2019-02-07 17:00:46 -08:00
jp9000
9b8bc22ffa libobs: Add ability to reroute encoders
Allows the ability for one encoder to defer to another in case of
failure or unsupported feature.  Okay, fine, it's mostly a hack so the
new NVENC encoder can fall back to the FFmpeg encoder if NV12 textures
aren't in use, that way it does not have to implement raw fallback
support itself.  The settings and properties are pretty much the same,
so there's no reason not to utilize it in order to save time that could
otherwise be spent more productively.
2019-02-07 17:00:46 -08:00
jp9000
2e1a19456a libobs/util: Add get_win_ver_int() func (windows)
Returns the current version number of windows.  The lowest byte is the
minor version number, then the next lowest byte is the major version
number.  E.g. 0x601 for Windows 7, 0x602 for Windows 8, 0x603 for
Windows 8.1, and 0xA00 for Windows 10.
2019-02-07 17:00:46 -08:00
jp9000
28d0cc8b97 libobs: Use NV12 textures when available 2019-02-07 17:00:46 -08:00
jp9000
82848d513e libobs: Add obs_video_active() function
(This commit also modifies UI)

Adds a universal function for determining whether video output is
currently active, rather than having to use video_output_active() on the
value returned by obs_get_video().
2019-02-07 17:00:46 -08:00
jp9000
93fc61fa82 libobs/graphics: Add NV12 texture support 2019-02-07 17:00:46 -08:00
jp9000
b64d7d71d0 libobs/graphics: Add texture sharing functions 2019-02-07 17:00:46 -08:00
Dmitry-Me
8df42cda8a libobs: Fix scanf type specifiers 2019-02-04 16:02:49 +03:00
Matthew Orlando
09d77878fd libobs: Initialize service before starting output
This fixes the case where initialize is not called on a service if the
output is not encoded.
2019-02-02 15:16:27 -08:00
jp9000
8f106dc3c1 libobs, UI: Do not log redundant warnings
Reduces log file clutter by not logging certain warning messages that
were already safe/normal/expected failures.
2019-01-12 16:50:55 -08:00
Jim
6a0b9517db
Merge pull request #1596 from computerquip/const-correct-cmdline2
libobs: Allow const argument in obs_set_cmdline_args
2019-01-05 06:51:25 -08:00
Jim
194f344727
Merge pull request #1590 from OsirisNL/game_mode_fix
libobs: Fix Windows Game Mode detection on newer Windows 10 versions
2019-01-05 06:49:23 -08:00
Jim
3d401b7068
Merge pull request #1582 from justinlynn/port-to-ppc64
Build on PPC64LE using x86 Intrinsic Compat Shims
2019-01-04 16:19:01 -08:00
Colin Edwards
2e4bcf5dc0
Merge pull request #1576 from DDRBoxman/rebasedkeyer
Decklink: Keyer Support
2019-01-04 17:34:50 -06:00
Colin Edwards
19bc92d267 Decklink: Keyer support 2019-01-04 17:34:00 -06:00
Jim
1e6bfa2eb1
Merge pull request #1572 from craftwar/utf8-fix
libobs: Fix utf-8 bom is not properly skipped
2019-01-04 14:55:57 -08:00
Michael Fabian 'Xaymar' Dirks
93549ea17c libobs: Add get_defaults2 and get_properties2 for encoders
Adds optional alternate functions to allow passing the encoder type_data
to reduce code duplication.

Closes obsproject/obs-studio#1541
2019-01-04 12:23:46 -08:00
Jim
62935bfef9
Merge pull request #1521 from Andersama/patch-31
libobs: Fix crash when pixel or vertex shader are missing
2019-01-04 06:37:53 -08:00
Zachary Lund
fe3f7539a3 libobs: Allow const argument in obs_set_cmdline_args
obs_set_cmdline_args copies the arguments passed to it. This means that
the array passed will never require it to be modified.
2018-12-30 00:02:00 -06:00
Exeldro
a0a0ca73c1 libobs: Fix circlebuf_pop_back returning front 2018-12-27 09:28:49 +01:00
Michel Snippe
7fd8743633 libobs: Fix Windows Game Mode detection on newer Windows 10 versions 2018-12-26 23:13:37 +01:00
J Lynn
36a6629e6b Add support for building on PPC64LE using x86 Intrinsic Compat Shim 2018-12-17 05:33:16 +11:00
craftwar
0a6dc398b7 libobs: Fix utf-8 bom is not properly skipped 2018-12-10 07:57:32 +08:00
Jim
875e13baf9
Merge pull request #1545 from pkviet/syncfix
libobs: Fix audio offset not reset for all tracks
2018-12-05 18:04:29 -08:00
Alex Anderson
fc97512f71 libobs: Fix crash when pixel or vertex shader are missing
Checks that the token is not null while looping. Logs errors when pixel
or vertex shader are missing.
2018-12-03 15:02:20 -08:00
pkviet
1002f9b695 libobs: Log audio source when buffering is added
Closes obsproject/obs-studio#1521
2018-12-03 09:23:38 -08:00
jp9000
4fa30c619c libobs: Fix starting timestamp for preloaded frames
If audio monitoring is enabled and set to output only, the
obs_source_show_preloaded_video function would still incorrectly set the
current source audio output timestamp to the current system time, which
would cause audio to use an incorrect starting point from long ago for
the first starting audio segment if audio monitoring is then turned off
some time after having started the source.

Instead, the starting timestamp should be set to 0 if audio monitoring
is enabled with no output to stream, so that if/when audio monitoring is
disabled, it recalculates the starting timestamp of the first audio
packet on the spot again.

Closes obsproject/obs-studio#1522
2018-12-03 08:44:55 -08:00
jp9000
8cb80e1394 libobs/util: Make default val INVALID_HANDLE_VALUE
Certain windows functions may allow 0 as a valid handle value, therefore
INVALID_HANDLE_VALUE is a more appropriate initialization value.

Closes obsproject/obs-studio#1519
2018-12-03 04:32:20 -08:00
jp9000
03cca9d95a libobs: Background color of 0 should not be gray
When calling obs_display_set_background_color, the value set in the
'color' parameter should always be used as-is.  0 should not indicate a
color other than black.  To do anything otherwise is silly and confusing
for users of the API.

Closes obsproject/obs-studio#1516
2018-12-03 04:09:30 -08:00
Abelardo E. Mendoza
e345b00120 libobs: memset() the correct buff size 2018-11-25 22:45:11 -06:00
jp9000
0951039322 libobs: Do not process panning if panning centered
Fixes a bug where audio panning would always be processed even if
panning was centered (and thus inactive).
2018-11-23 03:24:11 -08:00
pkviet
9b252b1268 libobs: Fix audio offset not reset for all tracks
Track 1 offset is reset but not the offset for other tracks.
This caused sync issues in between tracks (with track 1 and others).
(bug found by EposVox)
2018-11-16 03:56:49 +01:00
jp9000
b8a3ae1b10 libobs: Add multi-track support to non-encoded outputs 2018-10-04 20:32:35 -07:00
Michael Fabian 'Xaymar' Dirks
e55579e63d libobs: Add obs_enum_scenes for enumerating scenes
Closes obsproject/obs-studio#1507
2018-10-01 10:24:42 -07:00
Steve Wills
2f51abf994 libobs: Add pkgconfig support
Based on:

http://dailycommit.blogspot.com/2016/10/how-to-generate-pkg-config-file-with.html
https://people.freedesktop.org/~dbn/pkg-config-guide.html

Should allow third party plugins to find and use libobs more easily.

Closes obsproject/obs-studio#1467
2018-09-24 14:25:41 -07:00
Luke Yelavich
5fe5027630 libobs: Truncate thread names on Linux
The pthread_setname_np manpage states:

The thread name is a meaningful C language string, whose length is
restricted to 16 characters, including the terminating null byte ('\0').
2018-09-21 08:44:30 +10:00
Jim
31561b3231
Merge pull request #1428 from pantherrui/master
fix heap corruption when video capture thread release the frame before it push into source->async_frames.
2018-09-17 05:19:58 -07:00
wangrui05
26d3f42b89 libobs: Fix heap corruption in obs_source_output_video 2018-09-17 18:46:47 +08:00
Marvin Scholz
649fa7651b libobs/audio-monitoring: Use libobs CFString utils 2018-09-16 22:41:01 +02:00
Marvin Scholz
31f143e449 libobs: Add CFString utils 2018-09-16 22:41:01 +02:00
jp9000
f1aa71bef1 libobs: Don't call width/height funcs if context invalid
Don't allow calling a source's custom get_width or get_height callbacks
unless the context is valid.  Fixes a bug where a null pointer could be
passed to those functions.
2018-09-13 06:54:58 -07:00
Jim
118dbf9e67
Merge pull request #1481 from Andersama/patch-26
libobs: Export image-file to c
2018-09-12 02:05:26 -07:00
Jim
e615dffce5
Merge pull request #1323 from Andersama/effect-annotation-parsing
libobs: Add HLSL annotation parsing
2018-09-12 01:16:21 -07:00
Alex Anderson
b30c843622
libobs: Export image-file to c
Wraps image-file.h in extern "C" like rest of libobs api.

Prevents unresolved external errors when using in c++.
2018-09-11 13:31:45 -07:00
cg2121
0ae8a7c0ac UI: Add ability to style preview background color 2018-09-10 04:55:15 -05:00
Alex Anderson
e0cd45be9b libobs: Add additional gs_effect_get_ functions
Adds api functions to extract gs_eparam_t values, including
gs_effect_get_val(), gs_effect_get_val_size(),
gs_effect_get_default_val() and gs_effect_get_default_val_size()
2018-09-08 05:22:12 -07:00
Alex Anderson
af67086912 libobs: Add HLSL annotation parsing
Gives the ability to retrieve param annotations. Blocks wrapped in <>
following a parameter.

For example:
float slider < float max_value = 10.0; float min_value = 0.0; >;

These blocks are not for shading purposes but to help describe the
shader's gui as in the example above.

Adds graphics api functions for retrieving annotations:
size_t gs_param_get_num_annotations(const gs_eparam_t *param);

gs_eparam_t *gs_param_get_annotation_by_idx(const gs_eparam_t *param,
		size_t annotation);

gs_eparam_t *gs_param_get_annotation_by_name(const gs_eparam_t *param,
		const char *name);
2018-09-08 05:22:12 -07:00
Jim
78d940e0f4
Merge pull request #1346 from dtcooper/master
libobs/UI: Allow Access To argc/argv
2018-09-08 01:29:43 -07:00
Jim
413e8e6a7b
Merge pull request #1442 from cg2121/stereo-audio-balancing
UI: Implement stereo balancing
2018-09-07 21:28:56 -07:00
jp9000
e8eec22d15 libobs/util: Fix undefined behavior and optimize util_mul64_64
Shifting an integer larger than its bit width can have undefined
behavior.  This not only fixes that issue, but also optimizes the
shift functions.
2018-09-07 17:28:15 -07:00
cg2121
a4a7deeed6 UI: Implement stereo balancing 2018-09-07 09:27:14 -05:00
Shaolin
226d4cadf5 libobs: Remove VLA in pulse monitoring backend 2018-09-03 17:39:49 -03:00
jp9000
928ccab231 libobs: Update version to 22.0.3 2018-09-02 15:35:29 -07:00
jp9000
bfa568b750 libobs: Update version to 22.0.2 2018-08-29 09:49:34 -07:00
jp9000
deba492a2d libobs: Blacklist old obs-browser version on macOS
On macOS, the older version of the browser plugin used to reside in a
different directory.  This would cause two versions of obs-browser to
load if you installed the new version of OBS over the old version of
OBS.  This fixes that bug with an slightly unsightly hack by
blacklisting that older module if it tries to load an obs-module that
resides in that specific older directory.
2018-08-27 19:36:39 -07:00
jp9000
df75feb74a libobs: Update version to 22.0.1 2018-08-20 09:06:34 -07:00
jp9000
d180f19a5f libobs: Update to version 22.0.0 2018-08-19 19:52:48 -07:00
jp9000
2647da568f libobs: Revert version update to 22.0.0 (instead, do RC2)
This reverts commit 3d4b277a60.

Reverting temporarily for the sake of completeness and confirming
testing results.
2018-08-18 04:56:42 -07:00
Ryan Foster
044aaee2e7 libobs: Fix typo in function names
Correct "regsiter" to "register" in a couple function names. These
functions are currently unused. Let's correct these names before they
start getting used.
2018-08-17 23:57:13 -04:00
jp9000
3d4b277a60 libobs: Update version to 22.0.0 2018-08-17 16:12:45 -07:00
jp9000
e6dd009386 libobs: Add function to force a sceneitem transform update
Useful when you need to modify transform properties of group sub-items
and have the transform available immediately (group sub-items always
automatically defer their transform update to the next frame).
2018-08-16 08:42:19 -07:00
jp9000
7afe99188e libobs: Fix applying group transform of flipped sources
Fixes a bug where sources that are flipped vertically and/or
horizontally would not maintain their flipped state.
2018-08-15 10:02:05 -07:00
jp9000
caceb62328 libobs: Initialize hotkey pair ID variable properly
The value of 0 can represent a valid hotkey ID, so make sure that when
we initialize a hotkey variable, that we use OBS_INVALID_HOTKEY_ID or
OBS_INVALID_HOTKEY_PAIR_ID and not 0.

This fixes a bug where scene item hotkey pair IDs would be initialized
to 0, and it would unregister valid unrelated hotkeys.  Particularly,
the start/stop streaming hotkey pair ID, which would commonly be the
first hotkey pair created, thus having the hotkey pair ID of 0.  The
start/streaming hotkey pair would unintentionally be unregistered via
code in obs-scene.c.
2018-08-14 13:06:05 -07:00
jp9000
e3c2202791 cmake: Add release candidate versions/cmake variables
Allows specifying a release candidate version, and outputs release
candidate version variables to libobs/obs-config.h.  Useful for using
cmake to specify a release candidate version.
2018-08-13 01:19:23 -07:00
Richard Stanway
41b7f85332
libobs/media-io: Prevent overwriting of remux input 2018-08-12 17:06:39 +02:00
jp9000
a2bc0f2e4f libobs: Update version from latest tag
Originally, the build numbers 21.1.1 and  21.1.2 weren't added to the
master branch -- only to the two bugfix tag branches.  This is being
added again in order to build some test builds that don't prompt for
update.
2018-08-11 07:09:49 -07:00
Richard Stanway
750f0f2ea4
libobs: Remove unnecessary null check 2018-08-11 01:56:08 +02:00
jp9000
fc37cbcca4 libobs: Add functions to get/set global private data
Allows the ability to set custom global OBS context private data for
allowing the frontend to communicate variables with plugins in an
indirect way.
2018-08-10 06:09:23 -07:00
jp9000
c43702e335 libobs: Move function declarations to correct spot
These function declarations were in the wrong section.
2018-08-10 06:09:23 -07:00
jp9000
8e5a618f03 libobs: When ungrouping groups, duplicate items
Because groups can now be used in multiple scenes at once, it's
important that if the user wishes to ungroup a group, that they must be
able to keep the group intact if it exists in other scenes.  This
requires duplicating all scene items (as well as their hotkey/private
data) instead of just reparenting the subitems.

This fixes an issue where if the user had the group referenced in
multiple scenes, the group would become empty in other scenes.
2018-08-05 04:21:42 -07:00
jp9000
ef40100c64 libobs: Add internal function to dup. scene item data
Adds an internal function to duplicate scene item data.
2018-08-05 04:21:42 -07:00
jp9000
ba4692622e libobs: Add function to save hotkey pair data 2018-08-05 04:21:42 -07:00
Ryan Foster
6c76e9a736 libobs: Log libobs bitness in crash logs 2018-07-31 11:49:35 -04:00
Jim
3fd33478f8
Merge pull request #1345 from TheMuso/fix-input-output-mac-audio-devices
libobs: Rework code for checking Mac audio device capabilities for mo…
2018-07-31 00:33:14 -07:00
jp9000
d13bbe6e59 libobs: Always try to update transform in current thread
Due to the recent change in which scene items now only update their
transforms during the next frame's tick, snapping sources would
sometimes jitter and have incorrect snapping.  This fixes that issue by
reverting to the behavior of updating the transform immediately rather
than deferring the update to the next frame tick, but only on non-group
items.

This should not be done on items that are sub-items of groups because we
rely on the obs_scene_item::update_transform variable to update the
parent group's transform in addition.
2018-07-24 02:41:31 -07:00
jp9000
593345a3b1 libobs: Only update scene item texture on frame tick
Instead of updating the scene item texture any time
update_item_transform() is called, only update it when
obs_scene_item::update_transform is called.  Prevents having to lock the
graphics mutex needlessly.
2018-07-24 02:41:31 -07:00
jp9000
8741bfcb8f libobs: Don't assign variables before if/return 2018-07-24 02:41:31 -07:00
Luke Yelavich
f29a4a8145 libobs: Copy the device uid string for mac audio monitor 2018-07-21 09:14:12 +10:00
Luke Yelavich
5c066ed48f libobs: Pass address of cf_uid rather than the contents of cf_uid 2018-07-21 09:14:12 +10:00
Luke Yelavich
ddc32aaf1c libobs: Fix setting of audio monitor device on Mac 2018-07-21 09:14:12 +10:00
Luke Yelavich
002696e795 libobs: Rework checking Mac audio device capabilities
As of commit 2eb5a22, CoreAudio devices that use one device handle for
both input and output can no longer be used for audio monitoring. This
commit fixes that.

Tested with the built-in output, a Magewell XI100DUSB-HDMI which is
input only, and a MOTU UltraLite audio interface, which shows as
output/input capable.
2018-07-21 09:14:12 +10:00
jp9000
621c519cc5 libobs: Add function to get encoder object's defaults
Rather than relying on the encoder's type identifier, additionally allow
the ability to get defaults via an encoder object.
2018-07-20 01:49:32 -07:00
jp9000
d11b05a83d libobs: Defer update of scene item texture
If the scene item crop/filtering is updated, instead of
creating/destroying the item texture on the spot, update it in the
graphics thread to prevent potential race conditions (especially when
the crop function for example could be called from within
obs_scene_enum_items in some situations, which would lock the graphics
and scene mutexes in the wrong order).
2018-07-19 00:53:30 -07:00
jp9000
1aeb87ac52 libobs/util: Don't use assert for darray_push_back_array
Instead, just check to see whether array and num are valid, and if they
are not, safely return.
2018-07-18 18:47:44 -07:00
David Cooper
16e879ca51 libobs/UI: Allow Access To argc/argv
This paves the way for plugins to have access to the argc/argv used
when spawning OBS. Notably, this will allow a patch to obs-browser that
passes through command line arguments on macOS to CEF.
2018-07-18 10:39:39 -07:00
jp9000
5dfab20a46 libobs: Allow group duplication 2018-07-16 19:03:34 -07:00
jp9000
5993834815 libobs: Change groups to actual public types
(This commit also modifies UI)

Changes groups to their own independent type, "group".  This allows them
to be used like other regular types, and allows the ability to reference
groups in multiple scenes.  Before, a group would always be linked to
the scene it was in.  This made it cumbersome for users to modify groups
if they had a similar group in multiple scenes (they would have to
modify each group in each scene).  Making groups like other source types
makes more sense to solve this issue so they can be referenced in
multiple scenes at once.  This also removes a significant amount of
group-specific handling code required for implementing groups in the
front-end.

One limitation however: due to the way sub-items of groups are
seamlessly modifiable and sortable as part of the whole scene, the user
cannot have multiple references to the same group within one scene.
2018-07-16 19:01:51 -07:00