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

25 Commits

Author SHA1 Message Date
jp9000
41fad2d1a4 (API Change) Use const params where applicable
This Fixes a minor flaw with the API where data had to always be mutable
to be usable by the API.

Functions that do not modify the fundamental underlying data of a
structure should be marked as constant, both for safety and to signify
that the parameter is input only and will not be modified by the
function using it.
2014-09-26 17:23:07 -07: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
50ec8b0d55 (API Change) libobs/callback: Unsquish names
Renamed:                  To:
-------------------------------------------------
calldata_getdata          calldata_get_data
calldata_getint           calldata_get_int
calldata_getfloat         calldata_get_float
calldata_getbool          calldata_get_bool
calldata_getptr           calldata_get_ptr
calldata_getstring        calldata_get_string
calldata_setdata          calldata_set_data
calldata_setint           calldata_set_int
calldata_setfloat         calldata_set_float
calldata_setbool          calldata_set_bool
calldata_setptr           calldata_set_ptr
calldata_setstring        calldata_set_string
2014-08-09 11:57:38 -07:00
Timo R
85fd6863e2 Fix missing initialization
Found by compiling with gcc 4.8, which shows a warning for use in the
inlined function called in that function.

Closes #155
2014-07-10 18:17:06 +02:00
jp9000
4b17bb89ed Allow signal callback deletion while signalling
I encountered a situation where I wanted to delete a callback for a
signal while inside of that signal.  However it would hard lock, and
even after that, it would mess up the loop for the callback list.

So, change the mutex of the individual signals to a recursive-style
mutex, and then if a callback of a signal is deleted while currently in
that signal, just mark it for deletion, which will happen after the
signal is complete.
2014-06-14 23:42:00 -07:00
jp9000
d891e9772c libobs: Fix signal handler lock bug
There was a return statement within a section of code that had a locked
mutex.
2014-06-03 04:41:12 -07:00
jp9000
f91b4ef98e Check for duplicate names (function parser) 2014-03-02 19:44:22 -07:00
jp9000
1eeece5b97 Simplify and improve 'list' property
When a source/output/etc has a property of a 'list' type, there was no
way to get the names associated with its values.  That, and it only
supported lists of either text, or enums (0..[value] only).

Now, you can associate translated names with those values, and use
integer, float, or string values.  Put it all in to one function as well
to simplify its usage.

I plan on using this to help get enumerations from devices/etc for
certain types of sources.  For example, if I get the properties of an
audio source, I'd like to have a list of available devices with it as
well.
2014-03-02 06:32:47 -07:00
jp9000
e9342143a7 Simplify and extend callback/signalling system
- Signals and dynamic callbacks now require declarations to be made
  before being used.  What this does is allows us to get information
  about the functions dynamically which can be relayed to the user and
  plugins for future extended usage (this should have big implications
  later for scripting in particular, hopefully).

- Reduced the number of types calldata uses from "everything I could
  think of" to simply integer, float, bool, pointer/object, string.
  Integer data is now stored as long long.  Floats are now stored as
  doubles (check em).

- Use a more consistent naming scheme for lexer error/warning macros.

- Fixed a rather nasty bug where switching to an existing scene would
  cause it to increment sourceSceneRefs, which would mean that it would
  never end up never properly removing the source when the user clicks
  removed (stayed in limbo, obs_source_remove never got called)
2014-03-01 05:54:55 -07:00
jp9000
268e4e7811 Add more checks for NULL pointers 2014-02-23 22:39:33 -07:00
jp9000
966b943d5b Remove majority of warnings
There were a *lot* of warnings, managed to remove most of them.

Also, put warning flags before C_FLAGS and CXX_FLAGS, rather than after,
as -Wall -Wextra was overwriting flags that came before it.
2014-02-14 15:13:36 -07:00
jp9000
9879eead83 Fix a couple of warnings 2014-02-09 08:53:19 -08:00
jp9000
968f5fed32 Added some return-style functions to calldata.h
When using signal callbacks, there is rarely a need to check to see if
the callback paramters are actually validl; in those cases, if they are
invalid, then the signal is being used incorrectly.  The calldata_get*
functions are meant to be used more for when using dynamic function
calls rather than when using signals.  The calldata_get* functions made
it so that you have to declare your varaibles, and then call that
function to assign that value to those variables, which was slightly
annoying to constantly have to do over and over.

  Therefore I created a few extra functions for returning the value
without having to check for validity.  Although you would think this
would be an issue for maintaining, keep in mind that these functions
return base types.  Admittedly, these functions are merely for
convenience.
2014-01-04 13:28:27 -07:00
Palana
7ca68a9d04 fix function pointer types in dynamic procedure handler 2014-01-03 02:58:17 +01:00
Palana
ec5cdf1b17 fix incompatible types warning in signal system 2014-01-01 03:33:16 +01:00
jp9000
78eb116cc8 add 'static' to inline functions in callback/calldata.h 2013-12-30 11:09:32 -07:00
jp9000
72633e40a3 also include bmem.h in the header, minor oversight 2013-12-30 10:14:28 -07:00
jp9000
cec94b042e implement scene adding callbacks, make a few API tweaks 2013-12-28 05:33:16 -07:00
jp9000
261b9d7056 fix a few bugs with callback system, add some test signals 2013-12-27 05:08:58 -07:00
jp9000
6edcd456fe implement signal/procedure handling into libobs and individual sources 2013-12-26 23:10:15 -07:00
jp9000
3b48f79442 fix one minor bug with the disconnct function 2013-12-26 04:33:16 -07:00
jp9000
233694ad04 add one minor error message to signal handler 2013-12-26 04:28:09 -07:00
jp9000
6ac6256ac5 fill in rest of signal/callback/proc 2013-12-26 04:26:17 -07:00
jp9000
a136748bd3 don't hide calldata structure, no reason to, and forced an unnecessary allocation which is bad 2013-12-26 02:02:24 -07:00
jp9000
e9ded173f1 add my signal/callback interface from another project, also update license of utility files to ISC 1.3 2013-12-25 22:40:33 -07:00