Commit Graph

96 Commits (master)

Author SHA1 Message Date
tytan652 5490e4f44c libobs,docs: Improve failed module loading logging
- Avoid putting libs (like CEF) in the plugins load failure message.
- Consider obsolete macOS obs-browser plugin fail as a hardcoded skip.
2022-07-30 16:55:03 -07:00
gxalpha de01cfc063 libobs: Include plugin path in log error message 2022-07-29 03:29:13 +02:00
jp9000 23c3ad4d02 libobs: Add obs_load_all_modules2 and obs_find_modules2
obs_find_modules2 allows the ability to get the module name in the
callback, and the change to obs_find_modules2 also adds the ability to
find out whether any modules failed to load or not.
2022-07-28 16:36:01 -07:00
PatTheMav 1fd7770548
libobs: Update CMakeLists.txt for libobs and associated libraries
Also updates libobs-opengl, libobs-d3d11, libobs-winrt
2022-03-16 23:11:08 +01:00
derrod 269d48f681 libobs: Adjust path for legacy browser source block
The current path would prevent the browser source from loading if OBS
itself is in the "Application Support" folder, where it might end up
when being installed via certain distribution platforms.
This adjusts the existing hack to specifically check for the obs-studio
subfolder where the old browser source library would reside.
2022-02-19 15:45:36 -08:00
Richard Stanway 4cc419e3c9 libobs: Free module if obs_module_load callback returns false
Currently if a module fails its load callback, it remains loaded and OBS
continues to call additional exports such as obs_module_post_load. This
goes against the documented behavior, which states that a module that
fails its load callback is unloaded.

This commit releases locale resources and frees the module's
information, preventing further callbacks from libobs. The module itself
(the DLL) is not yet unloaded from memory as os_dlclose is commented out
for causing unspecified issues - this should be revisited in the future.
2022-01-28 19:14:00 -08:00
wangshaohui 00e6f6e023 libobs: Fix missing return when loading non-OBS DLL 2021-12-06 14:30:26 +01:00
Norihiro Kamae 5e44e6412a libobs: Fix memory overrun if libobs version mismatches
When size of source_info_t is larger then current structure, memcpy
overruns. Size check is moved before the memcpy.

HANDLE_ERROR macro copies info to data but data is not used. When
calling free_type_data and type_data, the member of data should be used
to ensure the free_type_data is not out of bounds.
2021-07-04 08:49:42 -07:00
Clayton Groeneveld 99d10c2607 libobs: Add function to get module lib
This adds a function find module library.

Co-authored-by: Stéphane Lepin <stephane.lepin@gmail.com>
2021-01-26 03:31:31 -08:00
Richard Stanway 900b5341eb libobs: Add os_is_obs_plugin function
This function determines if something is an OBS plugin before attempting
to load it. On Windows, many plugins ship their dependent DLLs alongside
the plugin DLL, so OBS would load things like libcef.dll on startup only
to immediately free it. For other platforms, this is less of a concern
so this function is a no-op for now.

This improves startup time and reduces risk from dependent DLLs
potentially running code with unwanted side effects in DllMain.
2021-01-18 19:05:41 -08:00
jp9000 d45017370b libobs: Add functions to get locale text from modules
Useful for sharing translated text from modules with the frontend.  This
is technically already done via properties, but it would be nice to just
be able to explicitly look up locale text directly rather than have to
go through properties.
2020-08-10 12:24:01 -07:00
jp9000 de2e89d972 libobs: Add function to get module pointer
Useful for getting getting locale text associated with a specific module
2020-08-10 12:24:01 -07:00
jp9000 b2302902a3 libobs: Fix source type versioning system
(This also modifies image-source, obs-text, text-freetype2, and UI)

This improves source definition versioning.  To do this, it now stores
two identifier names.  One "unversioned" which is the original name, and
one "versioned" with the version number appended.

This fixes both backward compatibility with older OBS versions, and
fixes the inability to use "add existing" in OBS itself on sources
created from older version definitions.
2020-03-09 06:12:22 -07:00
jp9000 73704f20db libobs: Add audio lines
Adds the "audio_line" internal source type as a bare source type for the
sole purpose of outputting audio, and the obs_source_info::audio_mix
callback which allows mixing of those audio lines, which is then treated
as normal audio for the source.  Audio line objects should be added as
sub-sources when multiple audio lines from a single source are needed,
then mixed together with the audio_mix callback.

The difference between the new obs_source_info::audio_mix callback and
obs_source_info::audio_render is that obs_source_info::audio_mix (along
with the audio_line source) are only one track, and it outputs audio to
the source automatically via obs_source_output_audio() when the call
completes.  This allows the mixed audio to be treated like a normal
source's audio, in that you can filter it, change its volume, or monitor
it.

This change was necessary because the CEF (used with the browser source)
outputs multiple audio streams at once to a single browser source, so
it's the program's responsibility to mix those streams together itself.
2019-08-21 15:19:19 -07: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 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 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
jp9000 b8a3ae1b10 libobs: Add multi-track support to non-encoded outputs 2018-10-04 20:32:35 -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
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
SuslikV 70bc2581b7
libobs: Fix log message
Refines warning message to make it clear for the end-user.

Module may fail to load by different reasons.
2018-01-13 12:26:34 +02:00
SammyJames 4fd66d4d1e libobs: Add post-load module callback
This allows the ability for certain types of modules (particularly
scripting-related modules) to initialize extra data when all other
modules have loaded.  Because front-ends may wish to have custom
handling for loading modules, the front-end must manually call
obs_post_load_modules after it has completed loading all plug-in
modules.

Closes jp9000/obs-studio#965
2017-07-21 08:27:31 -07:00
jp9000 b9d67cbf4b libobs: Add function to log currently loaded modules 2016-08-05 18:59:33 -07:00
jp9000 526d390adb libobs: Reduce unnecessary logging (info -> debug)
(Note: This commit also modifies coreaudio-encoder, win-capture, and
win-mf modules)

This reduces logging to the user's log file.  Most of the things
specified are not useful for examining log files, and make reading log
files more painful.

The things that are useful to log should be up to the front-end to
implement.  The core and core plugins should have minimal mandatory
logging.
2016-08-05 18:59:32 -07:00
jp9000 da2f9f732e libobs: Do not require get_width/height for filters/transitions 2016-01-26 11:49:43 -08:00
jp9000 03df6b2ceb libobs: Warn/ignore if transitions use get_width/get_height
These functions aren't used with transition sources, and will be
ignored.
2016-01-26 11:49:43 -08:00
jp9000 c28cfa556b libobs: Mark transitions as video/custom draw 2016-01-26 11:49:42 -08:00
jp9000 2a4ac3dc21 libobs: Improve module register warnings
Fixes some typos and specifies the function that's being called
2016-01-26 11:49:42 -08:00
jp9000 6f053b89bd libobs: Mark transition sources as composite
Transition sources are always considered composite sources, as they have
child sources.
2016-01-26 11:49:39 -08:00
jp9000 e68331e988 libobs: Add source type OBS_SOURCE_TYPE_SCENE
Helps identify a scene without having to compare its type name to
"scene".
2016-01-26 11:49:38 -08:00
jp9000 b0104fcee0 (API Change) libobs: Remove source_type param from functions
(Note: test and UI are also modified by this commit)

API Changed (removed "enum obs_source_type type" parameter):
-------------------------
obs_source_get_display_name
obs_source_create
obs_get_source_output_flags
obs_get_source_defaults
obs_get_source_properties

Removes the "type" parameter from these functions.  The "type" parameter
really doesn't serve much of a purpose being a parameter in any of these
cases, the type is just to indicate what it's used for.
2016-01-26 11:49:37 -08:00
jp9000 ddfd89a673 libobs: Implement composite sources (skip)
(Note: This commit breaks libobs compilation.  Skip if bisecting)

Adds a "composite" source type which is used for sources that composite
one or more sub-sources.  The audio_render callback is called for
composite sources to allow those types of sources to do custom
processing of the audio of its sub-sources.
2016-01-26 11:49:33 -08:00
jp9000 b038ed8d1d libobs: Profile win32 symbol update call 2015-10-04 21:16:30 -07:00
jp9000 7a15068d96 libobs: Only update symbols after plugins loaded
Reloading symbols after each plugin is causing the load times to
increase a fair bit on some computers, so do it after all plugins are
loaded instead.
2015-10-04 21:16:29 -07:00
jp9000 f3986afcb4 libobs: Add pdb paths for all plugin dirs (win32)
Use SymSetSearchPath to include plugin directories in pdb search paths.
This is important for generating proper crash data and crash logs on
windows.
2015-09-21 18:53:04 -07:00
jp9000 57edd5fb32 libobs: Make minor adjustment to module logging 2015-09-21 18:49:24 -07:00
jp9000 7920668e56 libobs: Add private data to definition structures
This is useful for allowing the ability to have private data associated
with the object type definition structures.  This private data can be
useful for things like plugin wrappers for other languages, or providing
dynamically generated object types.
2015-09-16 09:17:13 -07:00
jp9000 3620dbb59f libobs: Fix warning
Should have used size_t here instead of int.
2015-08-28 15:00:22 -07:00
jp9000 0d30d1229f libobs: Add API func to get module config path
Allows the ability to get a module-specific configuration file/path
2015-08-19 12:16:21 -07:00
jp9000 6bd4f27fe9 libobs: Fix issue with getting the module data dir
When getting a blank module data file (indicating you want to get the
path to the module data directory itself), on certain operating systems
(windows) it will fail if you end the path with '/' or '\'.  So simply
make sure that if a blank module sub-path is used, don't try to append a
slash.
2015-08-16 13:40:37 -07:00
Palana bf2df49d71 libobs: Prevent registering (potentially) unsupported plugins
The rationale for rejecting these register calls is that these functions
may be required for the plugin to work properly, which can't be
guaranteed when libobs doesn't know about them.

This behavior may be revisited once the plugin manager is implemented,
to e.g. make it configurable (potentially per plugin) to allow loading
newer plugins in case they are known to work with the older libobs
2015-08-13 16:31:03 +02:00
Palana a26afbb9ae libobs: Prevent out of bound reads in obs_register_*
Previously adding new required functions would cause libobs to read out
of bounds in plugins not built with the new additions
2015-08-13 16:12:56 +02:00
Palana 5eb330276c libobs: Reformat required function error message 2015-08-13 15:24:41 +02:00
Palana cf6b75e067 libobs: Add profiler calls 2015-08-12 15:30:29 +02:00
jp9000 7bd5147074 libobs: Fix module search to ignore . and ..
When globbing for modules, the intent was to ignore the . and ..
directories that might also be included in the glob search.  It was
mistakenly doing a string compare on the 'path' variable which contains
the full path, rather than the 'file' variable which just contains the
found file itself, so the string compare always failed.
2015-07-16 01:32:15 -07:00
jp9000 e5ccac0c5c libobs: Log when module file is loaded 2015-07-06 17:03:36 -07:00
jp9000 b33d95999f libobs: Mark audio filters as async
Async filters and effect filters are really two different classes of
filters, so it's important that audio filters be marked as async.
2015-03-25 10:03:20 -07:00
jp9000 7e3efa86e5 libobs: Don't search '.' and '..' dirs for modules
On windows doing os_glob will also include '.' and '..', exclude these
when searching for modules.
2015-02-08 00:54:07 -08:00
jp9000 c9df41c1e2 (API Change) Remove pointers from all typedefs
Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
2014-09-25 21:48:11 -07:00
jp9000 2446f62180 Do not call dlclose on modules
This apparently can cause issues with certain modules (as noted by
faruton with his browser plugin)
2014-09-12 20:36:35 -07:00