Commit Graph

1315 Commits (b0054a16d06e8e64a7dad08a2301ee08a66b01bf)

Author SHA1 Message Date
jp9000 4f4d7cde7e libobs/util: Add os_get_program_data_path* functions
Allows getting the system-local program data path.  Typically:

Windows:  C:\ProgramData
Mac:      /Library/Application Support
Linux:    /usr/local/share
2016-07-06 03:47:50 -07:00
jp9000 e29c7751e1 libobs: Update version to 0.15.0 2016-07-05 12:52:14 -07:00
jp9000 a9caa99c5b libobs: Fix source active/show incrementing/decrementing
The active_refs and show_refs variable would only increment/decrement
their children if their values were 1 and 0, which means that in the
case of scenes within scenes, sub-sources of scenes within scenes would
end up having the wrong ref values.
2016-07-02 14:13:17 -07:00
jp9000 4d61fa9a4c libobs: Use item texture if scene item is scene
Allows rendering scenes as scene items without off-screen sub-source of
the scene popping out on the sides.
2016-07-01 15:21:12 -07:00
jp9000 643823505c libobs: Fix obs_source_duplicate on scenes
Scenes have special duplication handling, so make it internally call
obs_scene_duplicate instead.
2016-07-01 15:20:27 -07:00
jp9000 364cb9fb03 libobs: Use strings instead of enums when saving scale data
Saves the scene item scale filters as strings instead of enums.  It's
important to save data in a form that won't break if an API enum
changes.
2016-06-29 08:19:23 -07:00
jp9000 d49833830c libobs: Add ability to use scale filters on scene items
Allows the ability to use scale filters such as point, bicubic, lanczos
on specific scene items, disabled by default.  When using one of the
latter two options, if the item's scale is under half of the source's
original size, it uses the bilinear low resolution downscale shader
instead.
2016-06-29 08:00:54 -07:00
jp9000 4dc0024198 libobs/graphics: Add ability to set shader texture sampler
(Note: This also modifies libobs-d3d11 and libobs-opengl)

Allows overriding the sampler for a specific shader parameter.
2016-06-29 04:15:38 -07:00
jp9000 f60952fe09 libobs: Add obs_data_item_get_name function
Allows getting the name of a data sub-item.
2016-06-28 02:52:15 -07:00
jp9000 a90c37987f libobs/graphics: Change BorderColor to just use number
Instead of prefixing the color with the '#' character, just take it as
an actual integer.
2016-06-28 02:46:35 -07:00
jp9000 d5e2cdf4d3 libobs/util: Add func to go to next CF token and copy it
Adds a function to the C-family parser to go to the next token and
create a string copy of it.  Useful for when you want to get a copy of
the next token regardless of what type it is.
2016-06-28 02:46:35 -07:00
Kurt Kartaltepe 7ef690d4e1 libobs: Fix obs-module.h typo
Fixes a small typo in the obs-module.h comments.

Closes jp9000/obs-studio#557
2016-06-27 18:14:42 -07:00
jp9000 5cc59256e7 libobs: Fix 'set but unused' warnings 2016-06-22 14:10:43 -07:00
jp9000 41277f6cac libobs: Fix 'may be uninitialized' warning 2016-06-22 14:10:43 -07:00
jp9000 b738f496b5 libobs: Forcibly stop output if stopped during reconnect
This fixes an design flaw where a delayed output would schedule a
stop even while in the process of reconnecting instead of just shutting
down right away.
2016-06-22 14:10:40 -07:00
jp9000 e13dd53376 libobs: Fix output shutdown order
When obs_output_actual_stop is called on shutdown, it should wait for
the output to fully stop before doing anything, and then it should wait
for the data capture to end.  The service should not be removed until
after the output has stopped, otherwise it could result in a possible
memory leak on stop.  Packets should be freed last.
2016-06-22 14:10:40 -07:00
jp9000 d7db0b8b01 (API Change) libobs: Fix output data cutoff on stop
(Note: This commit also modifies obs-ffmpeg and obs-outputs)

API Changed:
obs_output_info::void (*stop)(void *data);

To:
obs_output_info::void (*stop)(void *data, uint64_t ts);

This fixes the long-time design flaw where obs_output_stop and the
output 'stop' callback would just shut down the output without
considering the timing of when obs_output_stop was used, discarding any
possible buffering and causing the output to get cut off at an
unexpected timing.

The 'stop' callback of obs_output_info now takes a timestamp with the
expectation that the output will use that timestamp to stop output data
in accordance to that timing.  obs_output_stop now records the timestamp
at the time that the function is called and calls the 'stop' callback
with that timestamp.  If needed, obs_output_force_stop will still stop
the output immediately without buffering.
2016-06-22 14:10:39 -07:00
jp9000 29e849e355 libobs: Move output/encoder shutdown to independent thread
obs_output_end_data_capture could cause a hard lock due to mutex lock
ordering, depending on what thread it was called in.
2016-06-22 03:08:44 -07:00
jp9000 7018c6039d libobs: Do not allow output stop calls more than once 2016-06-22 03:08:43 -07:00
jp9000 ceb675f6df libobs: Use atomics for certain output boolean variables 2016-06-22 03:08:32 -07:00
jp9000 3d53cf3a6c libobs: Store system timestamp DTS on packets 2016-06-20 02:28:52 -07:00
jp9000 9948eee6c2 libobs/util: Add function to get path extension 2016-06-15 16:18:56 -07:00
jp9000 aa88b323aa libobs: Do not draw transitions if size 0 2016-06-15 16:18:43 -07:00
jp9000 b5df4537a9 libobs: Fix null pointer dereference w/ null private sources 2016-06-11 12:27:05 -07:00
jp9000 03b2ca65cf libobs: Only lock audio meter/fader when accessing data
Fixes an issue where the audio meter/fader would call an obs function
and lock another mutex, potentially causing a mutual inverted lock in
another thread.
2016-06-11 11:36:46 -07:00
jp9000 fb1ff173f9 libobs: Fix crash with 4:2:0 async source resolutions
When using GPU conversion for 4:2:0 frames on async video sources, it
would create a texture bigger than necessary and try to copy too much
data from the frame, resulting in a crash.
2016-06-06 23:46:56 -07:00
jp9000 695278dd42 libobs/util: Do not append .so w/ .dylibs on OSX 2016-06-06 23:46:55 -07:00
jp9000 1c37200549 libobs/util: Check for null pointer before calling dlclose
Apparently dlclose can crash if you use it with a null pointer.
2016-05-30 16:03:01 -07:00
hwdro e3847109be libobs/graphics: Add SSE intrinsics for matrix4_transpose 2016-05-26 22:13:01 -07:00
hwdro 017d77b399 libobs/graphics: Remove redundant variable assignment 2016-05-26 22:12:54 -07:00
jp9000 07a26b1720 libobs: Add more editable list types
(Note: This commit also modifies the UI)

The editable list only had two types: A type that allows both files and
URLS, and a type that only allows strings.

This changes it so the editable list can have a "files only" type, a
"files and URLs" type, and a "strings only" type.
2016-05-26 10:55:51 -07:00
jp9000 cb9ce7547d libobs: Fix bug activating/showing transitions in a tree
When a transition is a sub-source of another source, it would not call
the transition's active source enum function, meaning that any sources
the transition had would not increment their active/showing refs (it
would only be called when activating the transition directly before).
That would result in negative/invalid active/showing refs on its
sub-sources, causing them to become permanently active/inactive and/or
permanently showing/hidden.
2016-05-26 08:13:21 -07:00
jp9000 0c5fd7a0fb libobs/graphics: Always load gif frame if needed
Under certain circumstances it's necessary to seek, but if the frame
isn't loaded for the position that's being seeked to, it won't update
the texture.  This just ensures the texture will update when seeking.
2016-05-26 08:13:21 -07:00
jp9000 fe62658c69 libobs: Recalculate transition transforms when starting
If custom transforms were used, the very first frame after starting
would always render with the previous transform before calculating the
new transform.
2016-05-24 07:30:42 -07:00
jp9000 2f6a10c93f libobs: Fix log message about max memory on 32bit
Sometimes windows will report 2 gigs instead of 4 gigs max.
2016-05-24 07:30:41 -07:00
jp9000 ddc7484a6e libobs: Fix rendering of transitions with fixed sizes
If a transition had a fixed size, it would not render itself or its
sub-sources according to that fixed size.  The fixed size value was
essentially being ignored.
2016-05-24 07:30:41 -07:00
jp9000 9a295a188f libobs: Render transition sub-sources w/ matrix
When a transition is not in the state of transitioning from one source
to another, it would not use the sub-source's assigned matrix to render.
2016-05-24 07:30:40 -07:00
jp9000 1ca1502518 libobs: Set projection matrix for transition renders
This fixes a bug where the sub-sources on a transition wouldn't render
with the expected size when the transition had a different size from its
sub-sources
2016-05-24 07:30:40 -07:00
jp9000 c5008e9c65 libobs: Update version to 0.14.2 2016-05-13 23:00:07 -07:00
jp9000 2741624fbe libobs: Log when a filter is added/removed from a source 2016-05-04 20:29:26 -07:00
jp9000 3cb36bbd51 libobs: Fix deinterlacing discarding flipped status
When rendering the deinterlaced surface, it would not take in to account
whether the async surfaces were marked as flipped or not.
2016-05-01 16:56:21 -07:00
jp9000 7af9c2d882 libobs: Don't prematurely stop transition audio
Transition audio was programmed to stop if there is no queued audio from
both sources.  Because of that, when a source's audio started after the
transition started, it would cause audio from the source to be excluded
from the transition until the transition had completed because the audio
had already been marked as stopped.

Instead, if there's no audio from the transition sources, the audio
should only be marked as stopped when video has stopped.  This allows
the to/from sources to have an opportunity to start/restart audio during
the transition safely.
2016-05-01 15:22:27 -07:00
jp9000 853ec3cba0 libobs: Update to 0.14.1 2016-04-24 16:40:58 -07:00
jp9000 84ce1076f1 libobs: Fix field order of retro/linear 2x shaders
The field orders of retro 2x and linear 2x deinterlace shaders were
inverted.  Note that yadif 2x does not act the same in this regard, its
field ordering is correct due to how it operates.
2016-04-24 01:21:30 -07:00
jp9000 ff99ba7818 libobs: Allow filter processing function to return false
(Note: this commit also modifies the obs-filters and test-input modules)

Changes the obs_source_process_filter_begin return type so that it
returns true/false to indicate that filter processing should or should
not continue (for example if the filter is bypassed or if there's some
other sort of issue that causes the filtering to fail)
2016-04-22 10:18:12 -07:00
jp9000 737a66cb39 libobs: Update version to 0.14.0 2016-04-21 06:19:21 -07:00
jp9000 8a9f1bc7c1 libobs: Fix discard/retro deinterlace equations 2016-04-20 20:13:49 -07:00
jp9000 82a7d795db libobs: Always prune excessive starting audio packets
On outputs that use already-active video/audio encoder, the audio
pruning to sync up audio packets with video packets doesn't always get
called (for example if the video pruning function was called).  Always
prune excess starting audio packets.
2016-04-20 20:13:49 -07:00
jp9000 84ad6b563e libobs: Improve output packet pruning debug message
Specifies whether packets were pruned or not
2016-04-20 20:13:48 -07:00
Richard Stanway 65094eefe4
libobs: Don't try to keep rendering if a texture wasn't allocated
Fixes issues with invalid textures causing huge output or large black
regions to be rendered.
2016-04-21 00:21:07 +02:00
Richard Stanway 1f39b6a612
libobs: Don't use was_down for hotkey detection
From MSDN: "The behavior of the least significant bit of the return value
is retained strictly for compatibility with 16-bit Windows applications
(which are non-preemptive) and should not be relied upon."

This caused problems with hotkeys firing if the user pressed a hotkey key
in another application, followed by the modifier keys at any other time.
OBS would then think the hotkey key was just pressed based on the was_down
behavior and incorrectly trigger a hotkey event.

Fixes 0000443.
2016-04-20 03:46:30 +02:00
jp9000 caa5723c21 libobs: Don't parse sei if sei callback returns 0/NULL 2016-04-19 08:29:25 -07:00
jp9000 1a38d779c9 libobs: Add function to extract AVC header/sei
Allows extraction of headers/sei from a frame so that an encoder can
separate those headers and provide them for later use.
2016-04-19 08:29:24 -07:00
jp9000 cbd13063c6 libobs: Fix another sync issue with encoder sharing
If audio buffering is very high, the audio packets built up in the
interleaved buffer would be significantly before the first video packet,
causing the offset between the starting video/audio packet pairs to be
significantly off, leading to desync.

This issue was not spotted until recently because it only happens when
streaming/recording with same encoders while audio buffering is very
high.
2016-04-18 14:02:57 -07:00
Jim 06889b77ed Merge pull request #536 from AnthonySuper/master
libobs: remove duplicated determinant calculation
2016-04-14 18:57:12 -07:00
jp9000 e38a5c61d3 libobs: Add encoder caps (with deprecated flag)
Allows the ability to mark an encoder as deprecated (such as the media
foundation h264 encoders)
2016-04-13 19:01:06 -07:00
Richard Stanway bc231eda75
libobs: Fix a race condition when initializing audio sources
The source shouldn't be inserted into obs->data.first_audio_source until it's
fully initialized, or other threads will access source->control and
dereference an uninitialized pointer.
2016-04-13 18:39:24 +02:00
Richard Stanway a73b09c74e
libobs: Remove various dead code found by static analysis
Detected by Coverity Scan (CID 92178, 92171)
2016-04-13 02:43:11 +02:00
Anthony Super 1fe0743256 libobs: Remove duplicated determinant calculation 2016-04-12 14:31:52 -06:00
jp9000 5920778572 libobs: Add ability to create private services
This is a band-aid solution to be able to create temporary services
without logging them and keep them out of enumeration functions.

This is a band-aid solution -- 'master obs context lists' should not be
kept by the core.  Logging of object creation/destruction should also be
controlled by the front-end instead of the core.
2016-04-10 22:53:15 -07:00
jp9000 8b2173f591 libobs/util: Add double-quote escape value for text lookup 2016-04-10 02:11:03 -07:00
jp9000 ac23ec8359 libobs/util: Fix warning (data type size mismatch)
Fixes warning on Visual Studio 2013:
'initializing' : conversion from 'size_t' to 'int', possible loss of
data
2016-04-09 18:15:47 -07:00
jp9000 2274b57926 libobs: Mark filters as private (band-aid fix)
This patch fixes a specific crash where if the user named a filter the
same name as an input source that already existed in the system, scene
item loading code could find the filter with the same name instead of
the source, and mistakenly use it as the scene item's source directly.
This would cause a crash when trying to render that filter as a regular
source.

Marking filters as private is a temporary and simple workaround to the
solution.  Filters are currently not meant to be found via the main
enumeration/search functions, which is a design flaw (lack of
consistency).  In future major API revisions of libobs, filters should
be reworked to act as sources, with the sources they filter as
sub-sources ideally.

Additionally, the concept of "private context objects" and "primary
lists of context objects" in the back-end should probably also be
removed, allowing the font-end (or optional separate API layers) to
control all primary lists of obs context objects.  These minor issues
that occur ultimately stem from API design flaws which need to be
corrected.
2016-04-09 18:12:50 -07:00
jp9000 f23974ab64 libobs: Fix possible crash with filters
This crash happened when a filter was mistakenly used as a regular
source due to an unrelated bug in filter code and scene loading code.
The filter and the source it belongs to both had the same names, and the
source loading code found the filter and mistakenly used it as the
source instead of the actual source with the same name.
2016-04-09 18:12:49 -07:00
jp9000 822ffb8519 libobs: Add obs_obj_invalid function
Determines whether an obs object was created successfully.  If a plugin
that's used for a saved object is removed (third party plugins), its
data will become invalid, but the objects can often still be created for
the sake of preserving user settings, but sometimes these objects can
cause problems if they're actually used (such as using them for
transitions).
2016-04-03 21:54:02 -07:00
jp9000 81ac57cd6c libobs/util: Add os_stat function (win32 compatibility)
Windows needs filenames to be processed as wide, while libobs operates
on UTF-8, so a windows-specific function is needed here.
2016-04-03 18:02:45 -07:00
jp9000 acd8b612ee libobs: Reset projection transform when cropping
The crop texture would not always render correctly because the
projection matrix had not been set.
2016-03-31 11:01:29 -07:00
jp9000 eb1ee87f38 libobs: Add functions to crop individual scene items
Renders the scene item to a texture if crop is enabled; otherwise
renders directly.
2016-03-30 18:59:36 -07:00
jp9000 0d7a969ebf libobs: Add functions to defer scene item update
Allows the ability to defer updating the item transform until all
functions have been executed.
2016-03-30 18:35:59 -07:00
jp9000 96d848f3d2 libobs: Add premultiplied alpha base effect 2016-03-26 21:41:49 -07:00
sam8641 a7ce53367c libobs: Fix lanczos scaling quality issue
Closes jp9000/obs-studio#526
2016-03-24 12:35:24 -07:00
jpk c3629eacb5 libobs: Add Y800 color format support
(Note: Also modified the obs-ffmpeg plugin module)

Allows the ability for frame data to pass 8-bit grayscale images (Y800
color format).

Closes jp9000/obs-studio#515
2016-03-24 03:33:35 -07:00
jp9000 07c644c581 libobs: Add deinterlacing API functions
Adds deinterlacing API functions.  Both standard and 2x variants are
supported.  Deinterlacing is set via obs_source_set_deinterlace_mode and
obs_source_set_deinterlace_field_order.

This was implemented in to the core itself because deinterlacing should
happen before effect filters are processed, but after async filters are
processed.  If this were added as a filter, there is the possibility
that a different filter is processed before deinterlacing, which could
mess with the result.  It was also a bit easier to implement this way
due to the fact that that deinterlacing may need to have access to the
previous async frame.

Effects were split in to separate files to reduce load time (especially
for yadif shaders which take a significant amount of time to compile).
2016-03-21 21:22:32 -07:00
jp9000 11d9a8f3e4 libobs: Rename async_convert_texrender to async_texrender 2016-03-21 21:22:31 -07:00
jp9000 9a86a10f91 libobs: Update async textures via function parameters
Instead of just updating the async texture variables directly in the
source, allow the ability to pass the async texture variables via
function parameters to allow the ability to parse more than one frame to
more than one texture.

This code is primarily intended to be used to upload/convert the
"previous" async frame for the deinterlacer (if necessary).
2016-03-21 21:22:31 -07:00
jp9000 12cdaec1a7 libobs: Move frame-related functions to obs-internal.h
Allows access in other source files (particularly the deinterlacer)
2016-03-21 21:22:30 -07:00
jp9000 3019dccf87 libobs: Add obs_load_effect function
Just creates an effect to the target variable only if its current value
is null.  This will be used for deinterlacing effects to prevent having
to compile the shaders unless they're actually being used.
2016-03-21 21:22:30 -07:00
John Bradley 431a02459d libobs/graphics: Add int vector support to shaders 2016-03-21 21:22:28 -07:00
John Bradley 310f390e1e libobs: Allow filters to specify technique 2016-03-21 21:22:27 -07:00
jp9000 9e15e3d8fd libobs: Remove need for DrawMatrix technique in effects
(Note: This commit also modifies obs-filters and text-freetype2)

This simplifies writing of effects.  DrawMatrix is no longer necessary
because there are no sources that require drawing with a color matrix
other than async sources, and async sources are automatically processed
and don't defer their initial render stage to filters.
2016-03-21 21:22:26 -07:00
jp9000 e9a814740b libobs/util: Fix copy sizes in dstr_insert_* functions
These functions would copy the wrong amount of data, resulting in
writing to memory that may not be allocated.
2016-03-21 21:22:26 -07:00
jp9000 ae8b4bc538 libobs/util: Make sure to set capacity in dstr_ncopy* funcs 2016-03-21 21:22:25 -07:00
jp9000 45a2fa0e1a libobs/util: Make sure includes are from current file dir
When the #include directive in in the C lexer preprocessor is
encountered, the files being included need to be relative to the
directory of the file that the include was used in.
2016-03-21 21:22:25 -07:00
jp9000 82969a1da5 libobs: Update version to 0.13.4 2016-03-21 15:30:11 -07:00
jp9000 2b92262324 libobs: Update version to 0.13.3 2016-03-19 10:24:38 -07:00
jp9000 772f70ec9e libobs: Change email
Kindly ignore this commit, this is to prove that this is also my email.
2016-03-12 06:28:59 -08:00
jp9000 aa2bea3749 (API Change) libobs: Don't use signal for obs_load_sources
(Note: This commit also changes the UI)

Changed:
-------------------
void obs_load_sources(obs_data_array_t *sources_list);

To:
-------------------
void obs_load_sources(obs_data_array_t *sources_list,
		obs_source_load_cb callback, void *private_data);

Signals should really never be required to use to make some function
work properly.  The "source_load" signal was required for the
obs_load_sources function, but it's meant more for loading private data
in the settings, not for general loading of sources.

This changes it so that a callback is explicitly required to load the
sources.
2016-03-04 12:59:56 -08:00
jp9000 0facb9be9a libobs: Add function to get obs object id 2016-02-27 02:49:04 -08:00
jp9000 d069302b2e libobs: Add function to get obs object type 2016-02-27 02:49:03 -08:00
jp9000 d339c67c29 libobs: Update version to 0.13.2 2016-02-22 10:47:50 -08:00
jp9000 85ffa10d3f libobs/graphics: Fix vec4_to_(rgba/bgra) functions
These functions were not properly shifting the bits when calculating the
output.
2016-02-22 10:47:49 -08:00
jp9000 f6728189f5 libobs: Implement BorderColor sampler state value 2016-02-21 12:06:19 -08:00
jp9000 876cc94d51 libobs: Fix bug where bool constant size would be 1
(This commit also modifies libobs-d3d11)

Boolean constant size should be 4
2016-02-21 12:05:04 -08:00
jp9000 31496ec363 libobs: Lower max audio tick count to 45 (approx >1 sec)
The default buffering time for audio was always 1 second before the
audio subsystem was changed, and it was always more than sufficient for
max audio buffering time
2016-02-21 11:30:22 -08:00
jp9000 a64f7dd649 libobs: Fix an issue that would cause audio stuttering
Under certain circumstances, the timing_adjust variable would cause line
1161 to continually trigger over and over again.  The "loop detection"
code incorrectly made it so that any timestamp that was just simply
below the expected value would be seen as a jump.  After that, the
timing_adjust variable would be set for the frame again, and then the
audio would see it as a jump again after that, and those two things
would continue endlessly.  This would cause stuttering particularly with
certain devices (particularly elgato/lgp/hdpvr) where the audio/video
data are decoded and sent at varying/different/unpredictable times.

To fix this issue, it should not detect values below as jumps, but
instead should only do it for values that exceed the MAX_TS_VAR (maximum
timestamp variance) value.
2016-02-21 11:04:34 -08:00
partouf d75ed15037 libobs: Add file saving to file property
(This commit also modifies the UI)

Closes jp9000/obs-studio#502
2016-02-07 16:33:57 -08:00
jp9000 a6c8a923e9 libobs: Remove trailing whitespace 2016-02-04 15:45:58 -08:00
jp9000 7db6a4d5bd libobs: Log milliseconds of audio buffering, not ticks
Makes the log message a bit less confusing
2016-02-04 11:48:59 -08:00
jp9000 f3df14374f libobs: Fix obs_scene_duplicate excluding rotatation 2016-02-04 10:10:53 -08:00
jp9000 fa8ae473cf libobs: Fix bug where source audio could stop outputting
If obs_source::audio_ts is set to 0 (such as by discard_if_stopped in
obs-audio.c), but the push_back variable in the source_output_audio_data
function in obs-source.c was being set to true (meaning it's within the
seamless audio smoothing threshold), it would cause it to never reset
the obs_source::audio_ts value, and thus all audio data from the source
would become perpetually ignored by the audio subsystem until there was
finally some sort of timestamp jump that caused it to call
source_output_audio_place, and thus reset obs_source::audio_ts.

obs_source::audio_ts is only reset in source_output_audio_place, not in
source_output_audio_push_back, so the most simple solution is to just
call source_output_audio_push_back is obs_source::audio_ts is 0.
2016-02-04 01:36:13 -08:00