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

661 Commits

Author SHA1 Message Date
jp9000
c9e225d719 Prevent loading image files with null/empty paths 2014-07-24 00:25:59 -07:00
jp9000
6d89dde0da Fix dstr_end bug (it's len - 1)
Somewhat of an embarassing fix.  Using 'len' will just return the null
terminator.
2014-07-23 20:16:37 -07:00
jp9000
dc42ac0012 Add dstr_end function to get the last character 2014-07-23 17:53:27 -07:00
Palana
77bb225910 Add OBS_TEXT_MULTILINE for text obs properties 2014-07-21 04:31:19 +02:00
jp9000
778cc2b318 (API Change) obs_reset_video: Use return codes
Changed API functions:
libobs: obs_reset_video

Before, video initialization returned a boolean, but "failed" is too
little information, if it fails due to lack of device capabilities or
bad video device parameters, the front-end needs to know that.

The OBS Basic UI has also been updated to reflect this API change.
2014-07-20 18:25:57 -07:00
jp9000
89a5bdbcf1 Add gs_device_type function
This allows a programatic way of determining the type of graphics module
currently active.
2014-07-20 16:23:03 -07:00
jp9000
a446dd74af Add gs_device_name function
This returns the name of the device, "Direct3D 11" or "OpenGL"
respectively.
2014-07-20 15:31:45 -07:00
Jim
45c58f55c1 Merge pull request #162 from fryshorts/fixes
Implement system information on linux
2014-07-18 23:54:22 -07:00
BtbN
415a698bac Add support for build time dependency copying 2014-07-19 01:38:42 +02:00
BtbN
38c2fc87aa Move all data into the subdir it belongs to
Completely removes the build dir in favor of cmake based build layouting
2014-07-19 01:38:41 +02:00
BtbN
973435cb52 Move config include path, so it works for the exported target 2014-07-17 21:32:31 +02:00
BtbN
3b26db389d Fix Jansson dependency importing 2014-07-17 18:13:25 +02:00
jp9000
5da8d14570 Fix update checck bug
Fix bug where updates for windows would check for mac updates and vise
versa.

(I am ashamed)
2014-07-17 07:03:27 -07:00
jp9000
a5a7ba4650 Update to 0.4.1 2014-07-17 06:25:37 -07:00
Palana
bd2b4c91b6 libobs/media-io: Handle VIDEO_CS_DEFAULT in video_format_get_parameters 2014-07-16 22:39:00 +02:00
fryshorts
14e1549f7a Add system information for linux
This adds support for printing system information on linux.
2014-07-15 20:02:09 +02:00
fryshorts
0fa123dc47 Small coding style fixes 2014-07-15 20:01:39 +02:00
HomeWorld
6b284d9e58 Fix audio meters so that volume is applied linearly. 2014-07-14 21:12:53 +03:00
HomeWorld
336c3821fc Corrected a math mistake in obs_source.c calc_volume_levels. 2014-07-14 19:24:04 +03:00
jp9000
f801348a33 Add MAKE_SEMANTIC_VERSION macro 2014-07-13 23:55:46 -07:00
jp9000
73c7248cdb Fix 'missing braces' warning 2014-07-13 12:44:33 -07:00
jp9000
115d8da4bd Update version to 0.4.0 2014-07-13 12:38:44 -07:00
jp9000
70559b98a0 Fix bug where bmem.h wasn't always included 2014-07-13 11:34:56 -07:00
Palana
850d92bac0 libobs: Add config_has_(user|default)_value functions
Similar to obs_data_has_(user_value|default|autoselect), these allow
library users to distinguish between user config values and default
values
2014-07-13 19:10:38 +02:00
jp9000
893746f487 Log audio/video settings 2014-07-13 05:02:44 -07:00
jp9000
dde9caface Fix potentially dereferenced null pointer 2014-07-13 05:01:53 -07:00
jp9000
413641a11f Log when any libobs objects are created/destroyed 2014-07-13 05:01:02 -07:00
jp9000
322f148c9c Remove duplicate include 2014-07-13 02:59:14 -07:00
jp9000
1570e53364 Add obs_encoder_getname function 2014-07-13 02:58:55 -07:00
jp9000
0c135d9804 Remove duplicate function declaration 2014-07-13 01:21:20 -07:00
jp9000
52c0d223fd Change dstr_init_strref to dstr_init_copy_strref 2014-07-13 01:20:53 -07:00
jp9000
a27f2fbb3a Fix potentially uninitialized variable warnings 2014-07-12 11:59:46 -07:00
jp9000
f675c8029f Fix 'unused parameter' warnings on windows 2014-07-12 11:59:07 -07:00
Palana
9e65c1af78 Log OS name and version on OSX 2014-07-12 20:33:58 +02:00
Palana
75bba68a03 Fix obs-cocoa CPU cores log output
According to http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-vol-2a-manual.html
the cores_per_package and logical_per_package returns the maximum number
of (logical) cores addressable per package instead of the actual number
of (logical) cores
2014-07-12 20:33:58 +02:00
jp9000
ad6b70e938 Add null pointer checks to platform functions
It's a sad day when I realize that I did not add any null pointer
checking to any of the functions in this file.  Discovered it while
checking all the different languages, happened when there was a missing
locale file for a certain module that hadn't had the language uploaded
yet.
2014-07-12 04:48:16 -07:00
jp9000
76ff395aed Log system information on startup 2014-07-12 00:31:42 -07:00
jp9000
aed8f54f1a libobs: Add macro for default module locale
These macros are used as easy helper functions to load/unload module
locale that's based upon the text_lookup system.  You simple place the
OBS_MODULE_USE_DEFAULT_LOCALE macro once in the module, call
OBS_MODULE_FREE_DEFAULT LOCALE in obs_module_unload, and then
call obs_module_text anywhere in your module where you need to look up
text.

By default, it will look for a locale directory in your module's data
directory, and look for language files within it (INI locale format)
2014-07-11 17:26:24 -07:00
jp9000
ac760efb57 libobs: Add function for default module locale
This function is used to simplify the process when using the default
locale handling for modules.  It will automatically search in the plugin
data directory associated with the specific module specified, load the
default locale text (for example english if its default language is
english), and then it will load the set locale on top of the default
locale, which will cause text to use the default locale if the desired
locale text is not found.
2014-07-11 17:26:23 -07:00
Jim
83c041e14f Merge pull request #152 from BtbN/cmake_fixes
Cmake fixes
2014-07-10 20:43:23 -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
BtbN
d09f6dae1f Don't hardcode include directory for plugins 2014-07-10 14:38:46 +02:00
Timo R
a53c75f67e Add forgotten obs.hpp header to CMakeLists 2014-07-10 14:37:50 +02:00
jp9000
6e4a79a640 libobs: Use the correct module unload function 2014-07-09 20:44:12 -07:00
jp9000
3d1c132989 Add statistics functions to outputs
Total bytes, total frames, and frames dropped.  Total frames is
generated automatically, but total bytes and total dropped frames are
returned via callbacks.
2014-07-06 17:36:44 -07:00
jp9000
64074e9fda Add counting of total video frames to outputs
Before it would assign the encoder/media callbacks directly to the
output's callbacks, so instead of doing that, it now goes through
intermediary functions for the sake of counting the frames.
2014-07-06 17:36:44 -07:00
jp9000
41f1ad32f2 Remove unused function 2014-07-05 16:16:32 -07:00
jp9000
b060d86614 If reconnecting, ignore the disconnect code
Usually if you are reconnecting after network outage, it will give a
different code (such as OBS_OUTPUT_CONNECT_FAILED).  So, if already
reconnecting, ignore the code unless it's OBS_OUTPUT_SUCCESS.
2014-07-05 15:01:10 -07:00
jp9000
0781d86a2b Implement CPU usage monitoring functions 2014-07-04 23:03:26 -07:00
jp9000
6db5458f22 Define magickcore macros to remove warnings 2014-07-04 11:34:15 -07:00
jp9000
9fc05e2a1d Set default values for blend state structure 2014-07-03 14:19:34 -07:00
jp9000
57cfd4f991 Implement function to reset blend state
I was implementing a pushing/popping attributes function like with GL,
but I realized that for our particular purposes (and actually for most
purposes) its usage was somewhat..  niche.  I may still implement
pushing/popping of attributes in the future, though right now I feel
using a function to reset the state is sufficient for our purposes.
2014-07-03 14:11:30 -07:00
jp9000
d4cf9db638 Remove unnecessary context initialization code
There was no need to call the context free function in the
initialization function, and it's safer to just initialize the memory to
0 before using (which also negates the need for da_init)
2014-07-02 21:05:46 -07:00
jp9000
87475cdf89 Add rename cache for thread safety
This just ensures that if an obs object is renamed that the pointer to
older names will still be valid.  Prevents renames from causing any
invalid memory access.

When the obs object is destroyed, so are the cached names.
2014-07-02 20:58:30 -07:00
jp9000
4f2a731acf Implement reconnecting
The core itself now provides reconnection options (enabled by default, 2
second timeout between reconnects, 20 retries max until actual
disconnection occurs).  This will make things easier for both module
developers and UI developers.

Reconnecting treats the stream as though it were still active, and
signals are sent when reconnecting and upon successful reconnection.

Need to implement user interface information for reconnections.
2014-07-02 20:39:39 -07:00
jp9000
267af930ab Add obs_output_getname
This will get the user-defined name of the output (if any)
2014-07-01 16:29:38 -07:00
jp9000
c7bb73fe07 Implement high encoder CPU usage handling
This implements the 'frame skipping' mechanism to forcibly cause frames
to be duplicated in order to reduce encoder complexity so the encoder
can catch up to the video, otherwise it will continue to be
progressively behind and will cause a desync of the video.

Typically, if a user gets this issue, they should turn down their
settings.  For the love of god do not tell them that 'frames are
skipping', just tell them that CPU usage is high, and that they should
consider turning down their settings.
2014-07-01 11:01:22 -07:00
jp9000
dc27cb2051 Add signal for renaming sources 2014-06-30 00:05:35 -07:00
jp9000
d098087b06 Set default blend function to srcalpa/invsrcalpha 2014-06-29 11:43:52 -07:00
jp9000
7e06af1aa8 Don't use swscale if format is supported 2014-06-29 10:57:20 -07:00
jp9000
f313aaa5a6 Fix bug magickcore file loading freeze
This seemed to happen if the 'file' variable was NULL.  For some reason,
magickcore would just totally freeze.
2014-06-28 18:52:13 -07:00
BtbN
17a9fcaafb Use propper ffmpeg compatiblity instead of relying on deprecated functions 2014-06-28 20:54:14 +02:00
BtbN
ed9d5b1d63 Add ImageMagic/Libavcodec find logic 2014-06-28 20:37:57 +02:00
jp9000
8b0315ada6 Use older FFmpeg API functions for AVFrame
Compatibility with older FFmpeg versions may be broken if the av_frame_*
functions are used instead of the avcodec_* equivalents.
2014-06-28 11:12:25 -07:00
jp9000
bcd8d5d346 Add MagickCore image file support to the core
MagickCore is provided here as an alternative to FFmpeg in case FFmpeg
is not easily supported (for example, debian-based linux distros).

NOTE: Cmake configuration needs to be changed in order to allow
MagickCore image support.
2014-06-28 10:12:58 -07:00
jp9000
32b4d12fe3 Add FFmpeg image file support to the core 2014-06-28 10:12:58 -07:00
jp9000
4812a6130c libobs: Fill in rest of 'path' property code
A path should have a filter, default search directory, and a way to
indicate whether or not a directory or file is desired.
2014-06-28 10:12:57 -07:00
jp9000
7b12133af3 Use uint8_t* instead of void* for texture data
NOTE: In texture_setimage, I had to move variables to the top of the
scope because microsoft's C compiler will give the legacy C90 error of:
'illegal use of this type as an expression'.

To sum it up, microsoft's C compiler is still utter garbage.
2014-06-28 10:12:57 -07:00
jp9000
3af33e11b7 Fix 'potentially uninitialized' warning on var 2014-06-27 21:37:40 -07:00
jp9000
e44addccb0 Rename GS_ERROR_MODULENOTFOUND
Rename GS_ERROR_MODULENOTFOUND to GS_ERROR_MODULE_NOT_FOUND
2014-06-27 15:16:29 -07:00
jp9000
dbb9124bf6 Remove 'effect' param from effect param funcs
Similar to the shader functions, the effect parameter functions take
the effect as a parameter.  However, the effect parameter is pretty
pointless, because the effect parameter.. parameter stores the effect
pointer interally.
2014-06-25 22:24:27 -07:00
jp9000
d76c775126 Remove unused 'shader' param from effect funcs 2014-06-25 19:54:07 -07:00
jp9000
caf8ca9ba8 Remove 'shader' param from shader param functions 2014-06-25 19:50:08 -07:00
jp9000
27010a2f56 Add a 'flush' command to graphics subsystem
...I'm actually concerned that I went a bit overkill trying to prevent
backwards compatibility issues with this abstraction design, because
this is a large number of files that have to be modified just to add a
single graphics subsystem export.  Someone's going to strangle me, and
when you know that someone might strangle you, that means that you did
something wrong.  We'll have to look in to simplifying this in the
future without killing backward compatibility safety.
2014-06-25 19:32:34 -07:00
jp9000
749cff2e3a Fix device_copy_texture_region export formatting 2014-06-25 18:45:27 -07:00
jp9000
77edf6f263 Remove unused parameter for texture file loading 2014-06-25 18:34:23 -07:00
jp9000
16f45e7244 Remove unused texture file loading functions
Getting cubemaps and volume textures from file is very unlikely to ever
happen for our purposes.
2014-06-25 18:33:03 -07:00
Palana
603c87cd8f Fix b(w)strdup_n returning NULL for empty strings 2014-06-25 23:18:18 +02:00
Jim
2ea50cab36 Merge pull request #124 from jp9000/new-locale-handling
Update to new module locale API
2014-06-25 12:58:05 -07:00
jp9000
1abf91577e Add module callbacks for loading locale data
The module callback obs_module_set_locale will be called after loading
the module, and any time the locale is manually changed via core API.

When this function is called, the module is expected to load new text
lookup values for all the text it uses based upon the current locale.
2014-06-25 12:37:06 -07:00
jp9000
0b4a259e56 Remove 'locale' parameter from all callbacks
The locale parameter was a mistake, because it puts extra needless
burden upon the module developer to have to handle this variable for
each and every single callback function.  The parameter is being removed
in favor of a single centralized module callback function that
specifically updates locale information for a module only when needed.
2014-06-25 12:36:26 -07:00
jp9000
74b4743bce Remove 'locale' from properties
Having the value stored here is somewhat pointless, so this is one step
in fixing the locale handling.  Locale should be handled by the modules
themselves with their own loaded locale lookup information.
2014-06-25 12:36:26 -07:00
jp9000
899f053034 Add API for setting/getting current locale
This API is used to set the current locale for libobs, which it will set
for all modules when a module is loaded or specifically when the locale
is manually changed.
2014-06-25 12:36:17 -07:00
Palana
070f6cb6a6 Add DStr move assignment operator 2014-06-25 17:00:02 +02:00
Palana
5afedb1092 Fix DStr move constructor
Previously dstr_move would try to free the uninitialized value in
DStr::str::array
2014-06-25 17:00:01 +02:00
Palana
113454a2c8 Fix export for obs_property_list_item_remove 2014-06-25 15:29:00 +02:00
jp9000
8aa49cc9ad Remove unused graphics subsystem functions
These functions were mostly related to being able to set true fullscreen
mode -- however, this has no place for our purposes, and these functions
were just sitting empty and unused, so they should be removed.

Besides, fullscreen mode only applies to the windows operating system.
2014-06-25 01:54:32 -07:00
jp9000
f4e7a893c5 Remove 'rebuild' variable from vertexbuffer_flush
This variable is currently somewhat pointless, I was originally going to
use it to tell the graphics subsystem to completely rebuild the internal
vertex buffers, but it would be bad/inefficient to allow that
functionality.
2014-06-25 01:54:32 -07:00
Palana
c2bb95250b Add obs-data autoselect functions
These are meant to reflect auto-detection configuration changes that
should not be written to the config, for example, frame rate changes
for a camera where the (user-/config-file-)configured frame rate isn't
available but a similar frame rate can be automatically chosen
2014-06-22 01:32:09 +02:00
Palana
7f172eb1b4 Change semantics of obs-data default values
Default values are now permanently stored in the obs_data_items and
can be accessed via the new get_default functions

Also default values are no longer serialized to JSON to ease transition
to new default values
2014-06-22 01:32:09 +02:00
Palana
a6b52156b2 Move obs-data accessor value handling logic into static helper functions 2014-06-22 01:32:09 +02:00
Palana
7cbc260f90 Unify obs_data_set* and obs_data_item_set* funtion implementations 2014-06-22 01:32:09 +02:00
Palana
92e9284270 Refactor obs-data internals to forward reallocation results to callers 2014-06-22 01:32:09 +02:00
Palana
0d77dc702d Refactor set_item(_def) to only look up items if no item is supplied 2014-06-22 01:32:09 +02:00
Palana
23e2f623f9 Unify obs_data_set* and obs_data_set_default_* function implementations 2014-06-22 01:32:08 +02:00
Palana
f29f4d8009 Unify obs_data_get* and obs_data_item_get* functions handling 2014-06-22 01:32:08 +02:00
Palana
e007d02c21 Allow property list entries to be disabled
This allows, for example, disconnected devices for dshow/avcapture to
be listed (and to stay selected in the user config) while making them
unavailable for selection in new sources
2014-06-17 17:03:27 +02:00
Palana
ed7b37b522 Return index of added property list entry 2014-06-17 17:03:27 +02:00
Palana
56b3685940 Add include for ptrdiff_t 2014-06-17 17:02:28 +02:00
jp9000
9b23914c37 libobs: Add 'initialize' callback to services
The 'initialize' callback is used before the encoders/output start up so
it can adjust encoder settings to required values if needed.

Also added the function 'obs_encoder_active' that returns true or false
depending on whether that encoder is active or not.
2014-06-16 21:37:53 -07:00
Jim
dfabbf7936 Merge pull request #111 from antihax/cleanup
Removed unresolved EXPORT from previous revision of volume meter & modified locale not found error.
2014-06-16 18:13:20 -07:00
jp9000
ed5b4f590c Fix a number of warnings
Structures with anonymous unions would a warning when you do a brace
assignment on them.

Also fixed some unused parameters and removed some unused variables.
2014-06-16 17:55:48 -07:00
Danni
af1408d84f Removed unresolved EXPORT from previous revision of volume meter 2014-06-16 18:52:55 -05:00
jp9000
452e0695f4 UI: Add scene editing
So, scene editing was interesting (and by interesting I mean
excruciating).  I almost implemented 'manipulator' visuals (ala 3dsmax
for example), and used 3 modes for controlling position/rotation/size,
but in a 2D editing, it felt clunky, so I defaulted back to simply
click-and-drag for movement, and then took a similar though slightly
different looking approach for handling scaling and reszing.

I also added a number of menu item helpers related to positioning,
scaling, rotating, flipping, and resetting the transform back to
default.

There is also a new 'transform' dialog (accessible via menu) which will
allow you to manually edit every single transform variable of a scene
item directly if desired.

If a scene item does not have bounds active, pulling on the sides of a
source will cause it to resize it via base scale rather than by the
bounding box system (if the source resizes that scale will apply).  If
bounds are active, it will modify the bounding box only instead.

How a source scales when a bounding box is active depends on the type of
bounds being used.  You can set it to scale to the inner bounds, the
outer bounds, scale to bounds width only, scale to bounds height only,
and a setting to stretch to bounds (which forces a source to always draw
at the bounding box size rather than be affected by its internal size).
You can also set it to be used as a 'maximum' size, so that the source
doesn't necessarily get scaled unless it extends beyond the bounds.

Like in OBS1, objects will snap to the edges unless the control key is
pressed.  However, this will now happen even if the object is rotated or
oriented in any strange way.  Snapping will also occur when stretching
or changing the bounding box size.
2014-06-15 20:33:13 -07:00
jp9000
b23f8cc6e1 Scenes: Implement more item positioning features
There are a ridiculous number of features related to scaling and
positioning due to requests by a number of people who complained that
they hated the way that OBS1 would always resize their sources when the
source's base size changed.  There were also people who wanted more
control for how the resizing was handled, or the ability to completely
prevent resizing entirely if desired.  So I made it so that you can
optionally use a 'bounds' system, which allows you to specify different
styles of controlling resizing.

If disabled, the source will always automatically resize and only the
base scale is applied.  If enabled, you have a variety of different ways
to limit/control how it can resize within the bounds, or make it so it
can't resize at all.  You can also control alignment within that
bounding box, so you can make it so that a source always aligns to a
side or corner of the box.

I also added an alignment value which changes how the source is oriented
relative to the position of the scene item.  For example, setting
bottom-right alignment will make it so that the position of the item is
the bottom right corner of the source.  When the source resizies, it
will resize leftward and upward in that case, which solves the problem
of how a source resizes relative to a desired position.
2014-06-15 20:33:13 -07:00
jp9000
254d830c08 Make a minor OCD tweak to align parameters 2014-06-15 00:14:08 -07:00
jp9000
65f84cf356 Add solid_effect variable to obs_core_video 2014-06-14 23:59:39 -07:00
jp9000
89df81e72d libobs: Add helper functions for math data 2014-06-14 23:57:00 -07:00
jp9000
2a7f202e7e libobs: Add 'solid' effect for basic primitives 2014-06-14 23:55:10 -07:00
jp9000
44066f8e61 Fix null pointer dereference in text lookup
Fix potential null pointer dereference for when splitting a node.
2014-06-14 23:47:22 -07: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
9d66c96299 Fix bug with creating immediate vertex buffers
Check to make sure graphics subsystem pointer isn't null before
derefrencing, and fix bugs when creating vertex buffers from
immediate-style helpers
2014-06-14 23:30:58 -07:00
jp9000
1c2a0524b7 Change graphics subsystem to 4x4 matrices
4x4 matrices aren't as optimal, but are much more sensible to handle
when you want to do more advanced stuff like scaling, skewing, or
inversion.
2014-06-14 23:17:04 -07:00
Danni
a91174e2b2 Slight modification of mixing function 2014-06-08 11:48:38 -05:00
jp9000
42a0411f1c libobs: Fix switch warning 2014-06-07 06:04:13 -07:00
jp9000
20a61ace77 libobs: Account for volume with audio levels 2014-06-06 08:56:37 -07:00
Jim
4eb6267372 Merge pull request #90 from antihax/master
Added simple volume meter for reference of input levels.
2014-06-03 05:15:18 -07:00
jp9000
4ccf928ea1 libobs/media-io: Remove obsolete mixing functions
Also, Remove the volume level processing from audio-io.c, it was moved
to obs_source instead.
2014-06-03 04:50:15 -07:00
jp9000
5cd64ce7f2 libobs: Add level/magnitude/peak volume levels
This replaces the older code which simply queried the max volume level
value for any given audio.

I'm still not 100% sure on if this is how I want to approach the
problem, particularly, whether this should be done in obs_source or in
audio_line, but it can always be moved later if needed.

This uses the calculations by the awesome Bill Hamilton that OBS1 used
for its volume levels.  It calculates the current max (level),
magnitude, and current peak.  This data then can be used to create
awesome volume meter controls later on.

NOTE: Will probably need optimization, does one float at a time right
now.

Also, change some of the naming conventions.  I actually need to change
a lot of the naming conventions in general so that all words are
separated by underscores.  Kind of a bad practice there on my part.
2014-06-03 04:48:20 -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
Palana
7d0a1502bd Fix typo in conversion technique name (there is no UYUV, only UYVY) 2014-06-02 16:44:37 +02:00
jp9000
1343d6bdee libobs: Allow deferred source udpate on create
This allows sources to optionally defer update on creation in order to
prevent updates from being called from threads other than the video
thread.
2014-05-30 03:24:15 -07:00
jp9000
924709735e libobs/util: Add DStr RAII helper class
..Could also add some super nifty stuff later on too.  However, I think
using std::string whenever possible is probably for the best.
2014-05-30 02:46:08 -07:00
jp9000
dfdba6636b libobs/util: Fix string conversion functions
There was a fundamental flaw with the string type conversion functions
where the sizes were not being properly accounted for.  They were using
the 'len' value as a value for the output rather than only for the
input, which was bad because the output could have more or less
characters than the input.
2014-05-30 02:42:03 -07:00
jp9000
e18795a164 libobs/util/dstr.c: Add missing dstr_from_wcs 2014-05-30 02:40:23 -07:00
jp9000
38b610efca libobs/util/dstr.c: Don't find/replace if empty 2014-05-30 02:39:33 -07:00
jp9000
75d25b4e5b libobs: Init source info before calling 'create'
When a source's private data is being created by a module, it wasn't
able to call most source functions because most functions rely on the
obs_source_info part of the context to be set.  This fixes that issue.

It was strange that this wasn't already the case because the other
context types already did the same thing.
2014-05-30 02:35:24 -07:00
jp9000
9595a78e8a libobs: Add planar 4:2:0 async texture support
This uses the reverse planar YUV 4:2:0 conversion shader to output a YUV
texture without having to convert it via CPU.  Again, this will reduce
video upload bandwidth usage to 37.5% of the original rate.  I suspect
this will be particularly useful for when an FFmpeg or libav input
plugin for playing videos is made.

NOTE: There's an issue with certain texture sizes right now I haven't
been able to identify, if the full size of texture data divided by the
base texture width is an uneven number, the V chroma plane seems like it
can potentially shift, though I only had this happen with 160x90
resolution C920.  Almost all resolutions tend to be even.  Needs further
testing with more devices that support planar YUV 4:2:0 output.
2014-05-30 02:23:36 -07:00
jp9000
85dcfcaa34 libobs: Add button support to properties
This adds button support to properties, which will allow a properties
pane to let the user click a button to activate something with a
particular obs context.  When pressed, the button will execute the
callback given, with the context's private data as a parameter.
2014-05-30 02:16:46 -07:00
Danni
9c3fb4b8dc Added simple volume meter. Updated per comments Pull Req #90 2014-05-24 16:42:54 -07:00
Danni
90d9a5204f Updated per comments pull #90. 2014-05-24 16:24:48 -07:00
BtbN
e2c2e50f4c Fix ffmpeg/x264 find modules according to cmake find module naming conventions 2014-05-22 13:03:47 +02:00
jp9000
d536df30b0 Add dst_size parameter to character conv funcs
Character conversion functions did not previously ask for a maximum
buffer size for their 'dst' parameter, it's unsafe to assume some given
destination buffer may have enough size to accommodate a conversion.
2014-05-22 03:46:57 -07:00
jp9000
3a850e67c3 libobs: Move API version info to obs-config.h
This way it doesn't interfere with any actual relevant commits related
to obs.h.
2014-05-21 03:58:20 -07:00
jp9000
bba6848c0c Update core to 0.2.4 2014-05-21 03:48:29 -07:00
Danni
bc542a3e75 Added simple volume meter for reference of input levels. 2014-05-20 09:26:18 -05:00
Jim
6e6cb9f317 Merge pull request #87 from fryshorts/fixes
Use memmove instead of memcpy for potentially overlapping memory
2014-05-18 18:47:35 -07:00
jp9000
5ba8b09c9c Add help menu with log file uploading
Added github gist API uploading to the help menu to help make problems a
bit easier to debug in the future.  It's somewhat vital that this
functionality be implemented before any release in order to analyze any
given problem a user may be experiencing.
2014-05-18 17:44:10 -07:00
jp9000
b64900e630 Graphics: Comment out parsed shader logging 2014-05-18 17:37:30 -07:00
fryshorts
3c5e8674b5 Use memmove instead of memcpy for potentially overlapping memory
This fixes an issue reported by valgrind where overlapping memory
was copied with memcpy.
This also removes a redundant assignment where the array size was
explicitly set to zero when it was already zero.
2014-05-17 15:47:59 +02:00
fryshorts
739c58187c Remove output from encoder when output is destroyed.
This fixes an issue reported by valgrind where a destroyed output is
still referenced by the encoder.
2014-05-16 20:32:30 +02:00
jp9000
1d2e5d50a4 Add FLV file output code
This doesn't add FLV file output to the user interface yet, but we'll
get around to that eventually.  This just adds an FLV output type.

Also, removed ftello/fseeko because off_t is a really annoying data
type, and I'd rather have a firm int64_t for large sizes, so I named it
to os_fseeki64 and os_ftelli64 instead, and changed the file size
function to return an int64_t.
2014-05-16 00:18:23 -07:00
jp9000
a1d01aec98 Show commit hash in version string
Also, update to 0.2.2
2014-05-15 19:11:33 -07:00
jp9000
457dc6520b libobs: Prevent adding of null user sources
Not entirely sure how this happened but I *think* that a null source was
somehow being added to the list of user sources for one particular user,
and then I noticed this code does not check to see whether the source is
null or not.
2014-05-15 18:55:29 -07:00
jp9000
999d8ee916 Add ability to move source up/down/etc 2014-05-15 17:40:53 -07:00
jp9000
4f9e4a27d5 libobs/util: Remove dup. code, add os_opendir
Just use platform-nix.c code for general stuff that mac is compliant
with, and put a define around everything else.  Take that code out of
platform-cocoa.m.

Added os_opendir, os_readdir, and os_closedir to be able to query
available files within a directory.
2014-05-14 17:44:32 -07:00
jp9000
4bdcbe0600 libobs/util: Add func to get current log handler 2014-05-14 17:43:23 -07:00
jp9000
03ca5919ce UI: Add popup warnings for connection failure
Also, check for null stream path/key in the RTMP output module.
2014-05-12 15:34:46 -07:00
BtbN
e958bc16e4 Move static to front of declaration, as required by c99 2014-05-10 03:40:05 +02:00
BtbN
0236d4fb09 Fix obs_data_item_set for number types 2014-05-10 03:38:33 +02:00
BtbN
9d88c10ca4 Fix multi-char constant warnings 2014-05-10 02:06:59 +02:00
BtbN
fe8d964889 Add sse/mmx flags, so used intrinsics compile on 32bit 2014-05-08 23:08:45 +02:00
BtbN
34923f1f83 Also export a plugin destination, so external plugins know where to install stuff 2014-05-08 14:43:16 +02:00
BtbN
b5743a1b78 Make include path more pretty 2014-05-08 14:43:16 +02:00
BtbN
ce542525fc Fix dependency on win32-pthreads 2014-05-08 14:43:16 +02:00
BtbN
38594fff9e Export libobs cmake target, so external plugins can be built without ugly hacks 2014-05-08 14:43:16 +02:00
jp9000
1c54dac3ac Update libobs to use semantic versioning (0.2.0) 2014-05-04 23:04:35 -07:00
jp9000
2ab48dd590 obs-source.c: Fix a few potential concerns
First, if the private data of the source fails to be created, then do
not destroy the source.  If the source is destroyed, all the user's data
associated with that source is lost, which could end up being a
potential problem.  Instead, let it linger as a 'dead' source until the
user chooses to fix the problem (though this should never really happen,
the source module functions should be programmed to handle this
scenario)

Secondly, rename new_frame_ready to ready_async_frame, and fix a
potential memory leak with it.
2014-05-04 16:20:11 -07:00
Palana
4682cfb61b Fix an issue with async (video) source destruction
obs_source_output_video can cause cached frames to be freed twice if
called with a partially destroyed source, among other undesirable
effects; freeing the source private data right after the destroy signal
has been processed ensures proper behavior
2014-05-04 21:02:01 +02:00
jp9000
52746c2523 Add (temporary terrible) volume controls
- Add volume control

   These volume controls are basically nothing more than sliders.  They
   look terrible and hopefully will be as temporary as they are
   terrible.

 - Allow saving of specific non-user sources via obs_load_source and
   obs_save_source functions.

 - Save data of desktop/mic audio sources (sync data, volume data, etc),
   and load the data on startup.

 - Make it so that a scene is created by default if first time using the
   application.  On certain operating systems where supported, a default
   capture will be created.  Desktop capture on mac, particularly.  Not
   sure what to do about windows because monitor capture on windows 7 is
   completely terrible and is bad to start users off with.
2014-05-03 22:54:38 -07:00
jp9000
0b5ba66b33 async vid.: Fix potential endless buffering issue
If a source with async video wasn't currently active, it would endlessly
buffer the video data, which would cause memory to grow endlessly until
available memory was extinguished.

This really needs to be replaced with a proper caching mechanism at some
point.
2014-04-28 20:38:15 -07:00
Palana
14f3e79260 Add async texrender to cleanup 2014-04-28 21:54:13 +02:00
jp9000
7114f65d18 Fix a few warnings 2014-04-28 00:15:26 -07:00
jp9000
65455c27be Add preliminary saving/loading of scene/sources
This saves scenes/sources from json on exit, and properly loads it back
up when starting up the program again, as well as the currently active
scene.

I had to add a 'load' and 'save' callback to the source interface
structure because I realizes that certain sources (such as scenes)
operate different with their saved data; scenes for example would have
to keep track of their settings information constantly, and that was
somewhat unacceptable to make it functional.

The optional 'load' callback will be called only after having loaded
setttings specifically from file/imported data, and the 'save' function
will be called only specifically when data actually needs to be saved.

I also had to adjust the obs_scene code so that it's a regular input
source type now, and I also modified it so that it doesn't have some
strange custom creation code anymore.  The obs_scene_create function is
now simply just a wrapper for obs_source_create.  You could even create
a scene with obs_source_create manually as well.
2014-04-26 23:47:50 -07:00
jp9000
21b67d007b Add helper functions to obs_data and fix bug
Add math helpers to the obs_data functions for vec2/3/4 and quat, and
fix a bug where it wouldn't load arrays from json
2014-04-26 23:45:41 -07:00
jp9000
bfeb16e884 Fix bug with matrix rotation function 2014-04-26 23:44:27 -07:00
jp9000
6a59aef372 Improve output packet interleaving
The 'wait' constant was a terrible means of trying to ensure that the
packets were interleaved.  Instead, calculate the current highest
timestamps of each encoder that's present in the interleaved buffer, and
use that as a means of detecting whether the current packet should be
sent off.  This will guarantee sorting without relying on some arbirary
constant that 'assumes' that it'll be interleaved.  It also reduces
buffering any more than what is needed to interleave.
2014-04-26 23:29:40 -07:00
fryshorts
e8bf01acfc Fix destructor video outputs.
This fixes a crash on Linux that supposedly occurs when pthread_join
is called multiple times.
2014-04-26 01:39:43 +02:00
jp9000
633383bdaf libobs/media-io/video-matrices.c: Fix VC warnings 2014-04-24 21:10:39 -07:00
Palana
52b9f5fe52 Fix defaults for DrawMatrix 2014-04-24 22:33:02 +02:00
Palana
12cc06b560 Add GPU based frame decompression for async video sources 2014-04-24 22:03:32 +02:00
Palana
065379bffa Add limited range rendering for rendering YUV non-full range sources 2014-04-24 21:45:54 +02:00
Palana
9f43e6c257 Add yuv_to_rgb matrices and video_format_get_parameters utility 2014-04-24 16:47:06 +02:00
Palana
b77b9feb61 Add helper to convert from FOURCC to VIDEO_FORMAT 2014-04-24 16:46:54 +02:00
jp9000
8830c4102f obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
   the output gets data from that service rather than via settings.
   This allows the service context to have control over how an output is
   used, and makes it so that the URL/key/etc isn't necessarily some
   static setting.

   Also, if the service is attached to an output, it will stick around
   until the output is destroyed.

 - The settings interface has been updated so that it can allow the
   usage of service plugins.  What this means is that now you can create
   a service plugin that can control aspects of the stream, and it
   allows each service to create their own user interface if they create
   a service plugin module.

 - Testing out saving of current service information.  Saves/loads from
   JSON in to obs_data_t, seems to be working quite nicely, and the
   service object information is saved/preserved on exit, and loaded
   again on startup.

 - I agonized over the settings user interface for days, and eventually
   I just decided that the only way that users weren't going to be
   fumbling over options was to split up the settings in to simple/basic
   output, pre-configured, and then advanced for advanced use (such as
   multiple outputs or services, which I'll implement later).

   This was particularly painful to really design right, I wanted more
   features and wanted to include everything in one interface but
   ultimately just realized from experience that users are just not
   technically knowledgable about it and will end up fumbling with the
   settings rather than getting things done.

   Basically, what this means is that casual users only have to enter in
   about 3 things to configure their stream:  Stream key, audio bitrate,
   and video bitrate.  I am really happy with this interface for those
   types of users, but it definitely won't be sufficient for advanced
   usage or for custom outputs, so that stuff will have to be separated.

 - Improved the JSON usage for the 'common streaming services' context,
   I realized that JSON arrays are there to ensure sorting, while
   forgetting that general items are optimized for hashing.  So
   basically I'm just using arrays now to sort items in it.
2014-04-24 02:19:03 -07:00
jp9000
3cbc711f02 Add obs_data JSON loading/saving functions 2014-04-24 01:45:56 -07:00
jp9000
4a6d19f206 libobs: Add services API, reduce repeated code
Add API for streaming services.  The services API simplifies the
creation of custom service features and user interface.

Custom streaming services later on will be able to do things such as:

 - Be able to use service-specific APIs via modules, allowing a more
   direct means of communicating with the service and requesting or
   setting service-specific information

 - Get URL/stream key via other means of authentication such as OAuth,
   or be able to build custom URLs for services that require that sort
   of thing.

 - Query information (such as viewer count, chat, follower
   notifications, and other information)

 - Set channel information (such as current game, current channel title,
   activating commercials)

Also, I reduce some repeated code that was used for all libobs objects.
This includes the name of the object, the private data, settings, as
well as the signal and procedure handlers.

I also switched to using linked lists for the global object lists,
rather than using an array of pointers (you could say it was..
pointless.)  ..Anyway, the linked list info is also stored in the shared
context data structure.
2014-04-19 20:38:53 -07:00
jp9000
8225a0697a util/darray.h: Fix astoundingly silly assert 2014-04-19 20:35:03 -07:00
jp9000
7a60694159 obs-properties: Add a few features
Just wanted the ability to be able to add private data to the properties
data.  Makes it a little easier to manage data if you get updates from
controls.
2014-04-19 20:29:11 -07:00
jp9000
79b88c4cbb Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-04-19 06:34:13 -07:00
jp9000
c78fe3e306 obs-video.c: Fix minor bug
The pointer here is confusing, so I'm just going to remove it and have
it return the value instead.
2014-04-19 06:33:11 -07:00
Palana
4bb4b859bf Initialize returned pointer to always trigger NULL checks in callers
Also avoid allocation roundtrip if the file is empty after the BOM
2014-04-19 07:37:38 +02:00
jp9000
81153cb16d Fix code that breaks with VC (terrible compiler)
VC2013 still does not properly support placement of variables anywhere
in the scope.  It's a garbage compiler, always will be a garbage
compiler.
2014-04-14 14:21:32 -07:00
Palana
3990c18aac Add NULL checks and assertions to fix clang static analysis problems
Also remove an unused variable from obs-encoder.c (via clang static
analysis)
2014-04-14 23:02:53 +02:00
Palana
c86fa7bb30 Use libc++ inspired clock instead of the deprecated AbsoluteToNanoseconds
This also makes the clang static analyzer happy (it complained about
uninitialized fields in the AbsoluteTime struct)
2014-04-14 23:02:53 +02:00
jp9000
fa490fa8c4 Implement some basic logging for windows 2014-04-14 04:02:11 -07:00
jp9000
a4a52d1c87 Fix bug where packets weren't interleaving
Packets were not interleaving, thus new data was being sent out with
potentially non-monotonically increasing timestamps
2014-04-14 02:02:59 -07:00
BtbN
075820028f Improve bundle fixup 2014-04-13 11:05:46 -07:00
jp9000
2451b80ef6 Fix drawing bug with async video sources
Before, async video sources would flicker because they were only being
drawn when they were updated.  So when updated, they'd draw that frame,
then it would stop drawing it until it updated again.  This fixes that
issue and they should now draw properly.

Also, fix a few other minor bugs and issues relating to async video,
and make it so that non-async video filters can be properly applied to
them.

For the purposes of testing, change the 'test-random' source to an async
video source that updates every quarter of a second with a new random
face.

Also fix a bug where non-async video sources wouldn't have filter
effects applied properly.
2014-04-13 02:22:28 -07:00
Jim
b53e2a88a3 Merge pull request #59 from BtbN/linux_fixes
Linux fixes and additions
2014-04-12 10:53:09 -07:00
jp9000
b427397aa9 RTMP output: Implement frame drop code
A little bit of history about frame dropping:

I did a large number of experiments with frame dropping in old versions
of OBS1, and it's not an easy thing to deal with.  I tried just about
everything from standard i-frame delay, to large buffers, to dumping
packets, to super-unnecessarily-complex things that just ended up
causing more problems than they was worth.

When I did my experiments, I found that the most ideal frame drop system
(in terms of reducing the amount of total data that needed to be
dropped) was in the 0.4xx days where I had a 3 second frame-drop buffer
where I could calculate the actual buffer size in bytes, and then
intellgently choose packets in that buffer to trim it down to a specific
size while minimizing the number of p-frames and i-frames dropped, and
preventing the actual impact of dropped frames on the stream.  The
downside of it was that it required too much extra latency, and far too
many people complained about it, so it was removed in favor of the
current system.

The current system I just refer to just as 'packet dumping', which when
combined with low keyframe intervals (like most services use these
days), is the next-best method from my experience.  Just dump the buffer
when you reach a threshold of buffering (which I prefer to measure with
time rather than in size), then wait for a new i-frame.  Simple,
effective, and reduces the risk of consecutive buffering, while still
having fairly low impact on the stream output due to the low keyframe
interval of services.

By the way, audio will not (and should not ever) be dropped, lest you
end up with syncing issues (among other nasty things) specific to server
implementation.
2014-04-12 04:34:15 -07:00
BtbN
97c94b183a Add copy_texture_region function 2014-04-12 12:45:18 +02:00
Timo R
b312261abd Flush after logging 2014-04-12 12:45:18 +02:00
jp9000
519c4f4118 Fix issue when using multiple video encoders
- Fix an issue that could occur when using more than one video encoder.
   Audio/video would not sync up correctly because they were expected to
   be paired with a particular encoder.  This simply adds a little
   helper variable to encoder packets that specifies the system time in
   microseconds.  We then use that system time to sync

 - Fix an issue with x264 with fractional FPS rates (29.97 and 59.94
   particularly) where it would create ridiculously large stream
   outputs.  The problem was that you shouldn't set the timebase_*
   variables in the x264 params manually, let x264 handle the default
   values for it and leave them at 0.

 - Make x264 use CFR output, because there's no reason to ever use VFR
   in this case.
2014-04-10 11:59:42 -07:00
jp9000
92522d1886 Implement RTMP module (still needs drop code)
- Implement the RTMP output module.  This time around, we just use a
   simple FLV muxer, then just write to the stream with RTMP_Write.
   Easy and effective.

 - Fix the FLV muxer, the muxer now outputs proper FLV packets.

 - Output API:
   * When using encoders, automatically interleave encoded packets
     before sending it to the output.

   * Pair encoders and have them automatically wait for the other to
     start to ensure sync.

   * Change 'obs_output_signal_start_fail' to 'obs_output_signal_stop'
     because it was a bit confusing, and doing this makes a lot more
     sense for outputs that need to stop suddenly (disconnections/etc).

 - Encoder API:
   * Remove some unnecessary encoder functions from the actual API and
     make them internal.  Most of the encoder functions are handled
     automatically by outputs anyway, so there's no real need to expose
     them and end up inadvertently confusing plugin writers.

   * Have audio encoders wait for the video encoder to get a frame, then
     start at the exact data point that the first video frame starts to
     ensure the most accrate sync of video/audio possible.

   * Add a required 'frame_size' callback for audio encoders that
     returns the expected number of frames desired to encode with.  This
     way, the libobs encoder API can handle the circular buffering
     internally automatically for the encoder modules, so encoder
     writers don't have to do it themselves.

 - Fix a few bugs in the serializer interface.  It was passing the wrong
   variable for the data in a few cases.

 - If a source has video, make obs_source_update defer the actual update
   callback until the tick function is called to prevent threading
   issues.
2014-04-07 22:00:10 -07:00
jp9000
7eec72245d Fix graphics device export header
Caused D3D11 library to fail on load.  Don't know how I didn't see this
sooner.
2014-04-07 01:31:13 -07:00
jp9000
59969844a1 Add comments to config-file.h
Someone got rather confused over what the "default" functions did, so
hopefully this clears it up a bit.
2014-04-07 01:29:56 -07:00
jp9000
fd24d0de2f Use atomics for allocation counter
I was getting cases where the CPU cache was causing issues with the
allocation counter, for the longest time I thought I was doing something
wrong, but when the allocation counter went below 0, I realized it was
because I didn't use atomics for incrementing/decrementing the
allocation counter variable.  The allocation counter now always should
have the correct value.
2014-04-07 01:25:38 -07:00
jp9000
22aec1c391 Well, that was embarassing. (Remove size macro)
...I think I need sleep.  That last commit before this one shows it
quite clearly.
2014-04-05 01:49:21 -07:00
jp9000
ac43d9bb89 And fix another bug that I just made
Accidentally removed a function from the main module declaration macro.
2014-04-05 01:47:08 -07:00