Commit graph

1022 commits

Author SHA1 Message Date
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 8a0a28bf27 libobs/util: Add get_dll_ver function (windows)
Used to get the version of a dynamic link library on windows.
2015-10-04 21:16:28 -07:00
jp9000 48550b9691 libobs/util: Add function to calculate CRC32 2015-10-04 21:16:27 -07:00
jp9000 05748195a8 libobs/util: Save filename in config_create
Fixes a bug where config_save could not save the file due to the fact
that it did not store the path of the file as it was supposed to.
2015-10-04 21:16:26 -07:00
jp9000 b3d6d9e49d libobs: Add file serializers 2015-10-04 21:16:25 -07:00
jp9000 8c1fb99e99 libobs/util: Use int64_t as return for serializer
Intended as a means of expressing an error occurred (-1) when performing
a seek or getting a position.
2015-10-04 21:16:24 -07:00
jp9000 af11984314 libobs/util: Call SymInitialize before other Sym*
On the first call to update the symbol paths, pass the path string to
the SymInitializeW function first if it hasn't been called yet.  If it
has been called, then defer to SymSetSearchPathW and then
SymRefreshModuleList.  This is meant to reduce a needless extra call to
the latter two functions on the first use of the function.
2015-10-04 21:16:23 -07:00
jp9000 9630c3032c libobs: Update version to 0.12.0 2015-09-22 20:49:04 -07:00
jp9000 088debdef4 libobs: Call CoInitializeEx in libobs
Due to the fact that certain modules may need COM on startup, initialize
COM by default in libobs.
2015-09-22 11:30:38 -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 0a228d0740 libobs/util: Use gzopen* instead of gzdopen
Using gzdopen will not work properly if the C standard library used to
get the descriptor is not the same library as the one that was compiled
with zlib.  When this is the case, it causes zlib to fail to write a
file, and would report a C standard library error.  Use gzopen and
gzopen_w instead to ensure that the file is opened and closed by zlib
itself, ensuring that zlib and the libobs do not have to share the C
standard library between each other.
2015-09-21 00:01:19 -07:00
jp9000 c52b954b8e libobs: Add output stop error for "no space left" 2015-09-18 22:04:23 -07:00
jp9000 fb32b85f4c libobs: Shut down encoder if valid but not active
It's not impossible that this sort of thing could happen, although
unlikely.
2015-09-17 14:47:51 -07:00
jp9000 6285a47726 (API Change) libobs: Pass type data to get_name callbacks
API changed from:
obs_source_info::get_name(void)
obs_output_info::get_name(void)
obs_encoder_info::get_name(void)
obs_service_info::get_name(void)

API changed to:
obs_source_info::get_name(void *type_data)
obs_output_info::get_name(void *type_data)
obs_encoder_info::get_name(void *type_data)
obs_service_info::get_name(void *type_data)

This allows the type data to be used when getting the name of the
object (useful for plugin wrappers primarily).

NOTE: Though a parameter was added, this is backward-compatible with
older plugins due to calling convention.  The new parameter will simply
be ignored by older plugins, and the stack (if used) will be cleaned up
by the caller.
2015-09-16 09:21:12 -07:00
jp9000 0ed913a136 libobs: Add functions to get private type data
The private type data is the type_data variable that's provided when
object types are registered by plugins.
2015-09-16 09:17:14 -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 fa7286f84c libobs: Shut down encoder when not in use
This prevents encoders (hardware encoders in particular) from being
continually active when all outputs disconnect from an encoder.  This is
mostly just a temporary measure; the encoding interface may need a bit
of a redesign.  It will also definitely needs to be able to flush at
some point.  Currently when an output is stopped, the pending data is
discarded, which needs to be fixed.
2015-09-13 16:03:01 -07:00
jp9000 af310fb556 libobs: Allow object creation if id not found
Allows objects to be created regardless of whether the actual id exists
or not.  This is a precaution that preserves objects/settings if for
some reason the id was removed for whatever reason (plugin removed, or
hardware encoder that disappeared).  This was already added for sources,
but really needs to be added for other libobs objects as well: outputs,
encoders, services.
2015-09-13 11:55:06 -07:00
jp9000 a746c8cdd1 libobs: Remove potential NULL pointer dereference 2015-09-13 11:53:33 -07:00
jp9000 df14671d2f libobs: Fix cmake bug (make sure variable exists)
If the FFMPEG_AVCODEC_LIBRARIES variable does not exist, it will
generate a cmake error, so check to make sure the variable exists before
executing this code.
2015-09-13 11:29:28 -07:00
jp9000 d78d0072a0 libobs/util: Add functions to inhibit sleep
These fucntions prevent the computer from going to sleep, hibernating,
or starting up a screen saver.

On linux, it will also attempt to use DBus to prevent gnome/kde/etc
sleep, but it's not necessarily required in order to compile the
library.  Otherwise, it will simply call "xdg-screensaver reset" once
every 30 seconds to reset the screensaver timer.
2015-09-12 22:08:05 -07:00
jp9000 5096b3c697 libobs: Set reconnect to false on user cancel
This fixes the issue when an output cancels reconnecting, reconnect is
left at true, causing obs_output_active to always return true even
though reconnecting has actually been canceled.
2015-09-11 08:20:18 -07: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
jp9000 582ecdab0f libobs: Add activate/deactivate output signals
Indicates when an output is considered active/inactive.
2015-09-10 12:12:42 -07:00
Palana b2714fa353 libobs/util: Restore original code point
This was broken in cd222f8ce0 which had a
horrible commit message that makes replicating the issue impossible if
there weren't others who reported similar visual studio issues when
using a Japanese locale
2015-09-08 11:36:19 +02:00
jp9000 c7ad09fc0b libobs: Move encoded_callback_t to obs-internal.h
Allows it to be used in multiple source files.
2015-09-06 15:29:17 -07:00
jp9000 ed8a06bf65 libobs: Add validity checks for obs objects
These functions are intended to log a warning when an obs function is
called with a null object.
2015-09-06 15:26:47 -07:00
jp9000 46101b6d5b libobs: Fix various string format warnings
GCC 5.1+ seems to be more aggressive about spotting potentially
non-matching printf format specifiers.
2015-08-30 23:41:09 -07:00
jp9000 ba718e94b5 libobs: Add function to duplicate scenes 2015-08-28 15:01:15 -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 ff6cf508e5 libobs/media-io: Improve audio data logging
This improves logging for when audio data insertion is way out of bounds
or is getting cut off in the front due to a bad negative sync offset.

Instead of throwing out a log message for every time this happens with
each piece of data, it now states when the out of bounds or cutoff has
started and stopped only.
2015-08-27 16:33:07 -07:00
jp9000 263037102b libobs/media-io: Fix potential crash inserting audio
This fixes a case where an insertion of audio data would pass
valid_timestamp_range yet the insert position would cause a negative
integer position and thus an unsigned integer overflow.
2015-08-27 16:33:06 -07:00
jp9000 e479d4d0dc libobs: Add obs_data funcs for safe file handling
obs_data_create_from_json_file_safe: Attempts to create an obs_data
object from a file, and if that fails and a backup file exists, deletes
the old file and tries to open it again.

obs_data_save_json_safe: Saves json data to a temporary file first,
optionally backs up the target file if the file exists and backup_ext is
valid (otherwise deletes it), and then renames the temporary file to the
target file.  This helps reduce the chance of json corruption on save.
2015-08-21 18:22:24 -07:00
jp9000 40988f7e1d libobs: Add obs_data_save_json function
We keep having to repeat code for saving the json data to a file, so add
a helper function to help clean up some of that code.
2015-08-21 17:47:13 -07:00
jp9000 dd9107dbd8 libobs: Don't return valid obs_data if json fails
If obs_data_create_from_json fails on loading the json data, do not
return a valid data object; return NULL instead.
2015-08-21 17:45:03 -07:00
jp9000 f29431d8db libobs/util: Add config_save_safe function
This safely saves a configuration file, optionally with a backup.
2015-08-21 17:42:24 -07:00
jp9000 3a77ac3516 libobs/util: Add os_quick_write_utf8_file_safe
This helper function saves to a temporary file first, (optionally) backs
up the original file, then renames the temporary file to the actual file
name.  This helps reduce the chance of file corruption under various
circumstances (such as shutdown or crash while the file is being written
to disk).
2015-08-21 17:31:23 -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 2bd8ab7c09 (API Change) libobs: Add global module config path
API Changed:
---------------------------
From:
- bool obs_startup(const char *locale, profiler_name_store_t *store);

To:
- bool obs_startup(const char *locale, const char *module_config_path,
		profiler_name_store_t *store);

Summary:
---------------------------
This allows plugin modules to store plugin-specific configuration data
(rather than only allowing objects to store configuration data).  This
will be useful for things like caching data, for example looking up and
storing ingests from remote (rather than storing locally), or caching
font data (so it doesn't have to build a font cache each time), among
other things.

Also adds a module-specific directory for the UI
2015-08-19 12:16:20 -07:00
jp9000 cd222f8ce0 libobs/util: Fix character encoding issue
Manually specifies the UTF-8 character codes used by the file rather
than relying on the compiler to determine what the codes are manually.
I was getting compile errors due to the fact that my current code page
is not at the default code page; so visual c++ tried to use my current
code page rather than UTF-8 and it would cause an error on the file.
2015-08-19 11:56:17 -07:00
jp9000 1afd32e70b libobs: Update version to 0.11.4 2015-08-16 15:04:15 -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
jp9000 d53cef47ac libobs: Add obs_data_create_from_json_file func
Just a little helper function that allows you to create an obs_data_t
object from a json file (rather than having to manually open it each
time and then call obs_data_create_from_json on the file data)
2015-08-16 06:43:43 -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 13b2469d61 libobs/util: Extend profiler csv export data
The id and parent_id fields should now allow better recovery of the
actual call trees, though they aren't compatible between different data
dumps in a single profiler session anymore; for that reason the new
fields name_id and parent_name_id are introduced, they hold the old id
and parent_id values respectively
2015-08-13 11:57:42 +02:00
Palana 91ea844333 libobs/util: Add compressed profiler snapshot saving 2015-08-12 15:30:30 +02:00
Palana c6140b4756 libobs/media-io: Profile audio/video_thread 2015-08-12 15:30:29 +02:00