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

776 Commits

Author SHA1 Message Date
jp9000
9f82085243 libobs: Add obs_source_enum_filters function
Enumerates filters that are currently present on a source.
2015-03-06 09:12:00 -08:00
jp9000
0b5a5c16a9 libobs: Fix bug rendering async video with filters
This code was originally meant to skip some checks as an optimization,
but it did not account for async video sources and would call
obs_source_default_render (which is only for synchronous video sources),
this fixes the issue by just calling obs_source_video_render.
2015-03-06 09:09:57 -08:00
jp9000
502f4005f1 libobs: Fix race condition when adding a filter
The source would sometimes be rendered before the code to add it to the
filter chain was executed, therefore it would cause a crash.
2015-03-06 09:09:57 -08:00
jp9000
b1ba8561ff libobs: Keep references to filters when on sources
When a filter is added to a source, it does not currently keep a
reference when it's associated that that source, this fixes that
problem.
2015-03-06 09:09:56 -08:00
jp9000
3510e69121 libobs: Account for filters in source dimensions
The obs_source_get_width and obs_source_get_height functions need to
account for filters that may change their width/height such as a crop
filter or something similar.

As a side effect of this commit, because these functions need to lock
the filter mutex, these functions can no longer be used with a
const-qualified obs_source_t pointer.
2015-03-06 09:09:56 -08:00
jp9000
46341725c2 libobs: Remove inline from function
This function is somewhat big and is a function called conditionally,
therefore having it be inline is somewhat of a waste if it's not always
being called.
2015-03-06 09:09:56 -08:00
jp9000
818a57c33f libobs: Fix graphics memory leak
Graphics data has to be freed inside of an active graphics context,
otherwise the resources will not be freed; in the future, we should
probably make sure that the graphics subsystem automatically
asserts/warns about this scenario.
2015-03-06 09:09:56 -08:00
jp9000
8e5a0970b1 libobs: Fix releasing filters on source destroy
I was iterating through the obs_source::filters array to remove filters,
but every time I removed a filter, it would remove itself from the
array, therefore it would end up skipping items in the array, therefore
leaving filters unreleased.  This just removes the first filter until
all filters have been removed.
2015-03-06 09:09:56 -08:00
jp9000
95a5e8009f libobs: Add filter add/remove signals
Adds "filter_remove" and "filter_add" signals that signal when a filter
is added or removed
2015-03-06 09:09:55 -08:00
Socapex
e270192a61 libobs: Add function to set scene item position
Allows setting a specific position for scene items rather than just
up/down/top/bottom
2015-03-05 02:33:21 -08:00
Socapex
577d0b2129 libobs: Replace item_move_* signals
These signals introduce unnecessary complexity.  Instead of emitting a
signal for a specific move direction, just signal that the scene has
been reordered, that way the target just refreshes the list.
2015-03-05 02:28:17 -08:00
jp9000
8323799113 libobs: Use video thread for show/active callbacks
For the show/hide and activate/deactivate callbacks, schedule these
callbacks to only be called from within the video thread rather than in
a separate thread.  This ensures that any potential graphics activity
that occurs within them is kept in the same thread.
2015-03-02 18:53:25 -08:00
jp9000
7055775c7c libobs: Add functions to show/hide sources
obs_source_inc_showing and obs_source_dec_showing are used to indicate
that a source is showing or no longer being shown in a particular area
of the program outside from the main render view.

One could use an obs_view, but I felt like it was unnecessary because
using an obs_view just to display a single source feels somewhat
superfluous.
2015-03-02 12:23:25 -08:00
jp9000
ab520cab25 libobs: Hide sources when an obs_view is destroyed
This fixes a bug where sources would not decrement their showing
references when an obs_view is destroyed.
2015-03-02 12:23:25 -08:00
jp9000
eed1a51d3a libobs: Free main view separately from std. views
The main view does not need to worry about hiding/deactivation of
sources when it's being freed here, when the obs context is shutting
down in this section of obs, all the sources are being freed, thus
there's no need to worry about deactivating/hiding sources.
2015-03-02 12:23:25 -08:00
Socapex
753959170b libobs: Fix bug (last scene item potentially lost) 2015-03-01 17:43:31 -08:00
jp9000
0c63afccf5 libobs: Update to 0.8.3 2015-02-20 21:56:03 -08:00
Palana
d085d6e4a1 libobs: Allow duplicate sources per scene
Previously having a source multiple times in a single scene would cause
the recursion check to trigger. Example scenes.json:

{
    "current_scene": "Scene",
    "sources": [
        {
            "flags": 0,
            "id": "scene",
            "mixers": 0,
            "name": "Scene",
            "settings": {
                "items": [
                    {
                        "align": 5,
                        "bounds": {
                            "x": 0.0,
                            "y": 0.0
                        },
                        "bounds_align": 0,
                        "bounds_type": 0,
                        "name": "Text (FreeType 2)",
                        "pos": {
                            "x": 0.0,
                            "y": 0.0
                        },
                        "rot": 0.0,
                        "scale": {
                            "x": 1.0,
                            "y": 1.0
                        },
                        "visible": true
                    },
                    {
                        "align": 5,
                        "bounds": {
                            "x": 0.0,
                            "y": 0.0
                        },
                        "bounds_align": 0,
                        "bounds_type": 0,
                        "name": "Text (FreeType 2)",
                        "pos": {
                            "x": 0.0,
                            "y": 98.0
                        },
                        "rot": 0.0,
                        "scale": {
                            "x": 1.0,
                            "y": 1.0
                        },
                        "visible": true
                    }
                ]
            },
            "sync": 0,
            "volume": 1.0
        },
        {
            "flags": 0,
            "id": "text_ft2_source",
            "mixers": 0,
            "name": "Text (FreeType 2)",
            "settings": {},
            "sync": 0,
            "volume": 1.0
        }
    ]
}
2015-02-17 13:41:49 +01:00
Palana
9dca07db30 libobs: Handle obs_scene_add failure
Previously a NULL item would cause a crash when reading transform info.
The crash can be reproduced by e.g. editing scenes.json so that two
scenes contain each other. Example scenes.json:

{
    "current_scene": "Scene",
    "sources": [
        {
            "flags": 0,
            "id": "scene",
            "mixers": 0,
            "name": "Scene",
            "settings": {
                "items": [
                    {
                        "align": 5,
                        "bounds": {
                            "x": 1440.0,
                            "y": 900.0
                        },
                        "bounds_align": 0,
                        "bounds_type": 2,
                        "name": "Scene 2",
                        "pos": {
                            "x": 0.0,
                            "y": 0.0
                        },
                        "rot": 0.0,
                        "scale": {
                            "x": 1.0,
                            "y": 1.0
                        },
                        "visible": true
                    }
                ]
            },
            "sync": 0,
            "volume": 1.0
        },
        {
            "flags": 0,
            "id": "scene",
            "mixers": 0,
            "name": "Scene 2",
            "settings": {
                "items": [
                    {
                        "align": 5,
                        "bounds": {
                            "x": 1.0,
                            "y": 1.0
                        },
                        "bounds_align": 0,
                        "bounds_type": 0,
                        "name": "Scene",
                        "pos": {
                            "x": 854.0,
                            "y": -520.0
                        },
                        "rot": 0.0,
                        "scale": {
                            "x": 1.75,
                            "y": 1.7562724351882935
                        },
                        "visible": true
                    }
                ]
            },
            "sync": 0,
            "volume": 1.0
        }
    ]
}
2015-02-17 13:41:49 +01:00
jp9000
ba3cac938a libobs: Update to version 0.8.2 2015-02-11 13:10:53 -08:00
jp9000
ffc7b3c666 libobs: Fix multi. video encoder sync issues
When using multiple video encoders together with a single audio encoder,
the audio wouldn't be in sync.

The reason why this occurred is because the dts_usec variable of the
encoder packet (which is based on system time) would always be reset to
a value based upon the dts (which is not guaranteed to be based on
system time) in the apply_interleaved_packet_offset function.  This
would then in turn cause it to miscalculate the starting audio/video
offsets, which are required to calculate sync.

So instead of calling that function unnecessarily, separate the check
for whether audio/video has been received in to a new function, and only
start applying the interleaved offsets after audio and video have
actually started up and the starting offsets have been calculated.
2015-02-10 22:10:41 -08:00
jp9000
a05ed355f5 libobs: Fix 64bit -> 32bit conversion warnings 2015-02-10 19:31:25 -08:00
jp9000
4eacb5f3e9 libobs: Add API to apply service encoder settings
Instead of having services automatically apply encoder settings on
initialization (whether the output wants to or not), instead make it
something that must be explicitly called by the developer.  There are
cases where the developer may not wish to apply the service-specific
settings, or may wish to override them for whatever reason.
2015-02-10 19:23:36 -08:00
jp9000
fe849ec482 libobs: Update to 0.8.1 2015-02-09 19:32:40 -08:00
jp9000
268f8daf2e libobs: Update version to 0.8.0 2015-02-09 16:25:59 -08:00
jp9000
e26dec916e libobs: Use windows wide <-> UTF8 conversion
If on windows, use the windows UTF conversion functions due to the fact
that the existing utf code is meant for 32bit wide characters, while the
windows conversion functions will properly handle 16bit wide characters.
2015-02-09 03:49:16 -08:00
jp9000
0c30dca526 libobs: Update to latest version of ComPtr.hpp 2015-02-09 03:49:15 -08:00
jp9000
5dfecab15c Fix windows printf format warnings (from mingw) 2015-02-09 03:49:14 -08:00
jp9000
0c1d121ff2 Remove various unused variables
Unused variables detected by mingw
2015-02-09 03:49:13 -08:00
martell
a83e74dc1c Disable SEH for mingw-w64
The SEH implementation is not quite working properly in mingw-w64, so
disable it for the time being.
2015-02-09 03:47:27 -08:00
martell
f9fa9c289f libobs: fix warning when logging the win version
The OSVERSIONINFOW structure contains DWORD variables, so to keep mingw
happy this should be printed with %ld
2015-02-09 03:41:49 -08:00
martell
9dd542f4fb libobs: fix warning when logging the cpu speed
Speed is a DWORD and should be printed as %ld.  This will keep mingw
happy and warning free
2015-02-09 03:41:49 -08:00
martell
ef37b9b888 libobs: fix windows version log warning
OSVERSIONINFOW uses SIZE_T so cast to unsigned long instead.
2015-02-09 03:41:48 -08:00
martell
23d39ea5a8 libobs: threading-windows mingw-w64 support
Enable support for mingw-w64 in threading-windows.c
2015-02-09 03:41:44 -08:00
martell
079d15d518 libobs: mingw-w64 threading-posix
Enable support for mingw-w64 in threading-posix.c
2015-02-09 03:41:43 -08:00
martell
47c86b6cbe libobs: avoid using to w32-pthreads for mingw-w64
mingw-w64 provides its own pthreads library.

also change some link libs as mingw-w64 libraries are not postfixed .lib
2015-02-09 03:41:37 -08:00
jp9000
99c674e41f libobs: Add UI-independent plugin search paths
Adds an additional search path for UI-independent and
installation-independent plugins for windows/mac.

Windows:
%appdata%/obs-plugins/

Mac:
~/Library/Application Support/obs-plugins/

Plugin directory format is [module]/bin and [module]/data.

On windows, for 32bit binaries:
[module]/bin/32bit

and 64bit binaries:
[module]/bin/64bit
2015-02-08 00:55:26 -08:00
jp9000
7e3efa86e5 libobs: Don't search '.' and '..' dirs for modules
On windows doing os_glob will also include '.' and '..', exclude these
when searching for modules.
2015-02-08 00:54:07 -08:00
jp9000
b72e68afe7 (API Change) Fix obs_service_gettype func name
Before:                After:
obs_service_gettype    obs_service_get_type

It seems there was an API function that was missed when we were doing
our big API consistency update.  Unsquishes obs_service_gettype to
obs_service_get_type.
2015-02-07 08:19:34 -08:00
jp9000
cb8acd59ce libobs: Export obs_properties_apply_settings
I didn't think it would ever need to be exported, but this function is
actually useful for applying settings to properties (to call all of
their update callbacks based upon the settings) without necessarily
having to have an object associated with it.
2015-02-04 16:51:59 -08:00
jp9000
bd76f16564 libobs: Add functions to get an encoder's type
'obs_encoder_get_type' to get the type of an existing encoder, and
'obs_get_encoder_type' to get the type via its identifier
2015-02-04 16:51:58 -08:00
jp9000
0e398c89be libobs: Add obs_get_encoder_codec function
This allows the ability to get the codec of an encoder via its
identifier string
2015-02-04 16:51:58 -08:00
jp9000
c0c24ab234 libobs: Add obs_encoder_set_name function 2015-02-04 16:51:55 -08:00
jp9000
84e1f47ced (API Change) Add support for multiple audio mixers
API changed:
--------------------------

void obs_output_set_audio_encoder(
		obs_output_t *output,
		obs_encoder_t *encoder);

obs_encoder_t *obs_output_get_audio_encoder(
		const obs_output_t *output);

obs_encoder_t *obs_audio_encoder_create(
		const char *id,
		const char *name,
		obs_data_t *settings);

Changed to:
--------------------------

/* 'idx' specifies the track index of the output */
void obs_output_set_audio_encoder(
		obs_output_t *output,
		obs_encoder_t *encoder,
		size_t idx);

/* 'idx' specifies the track index of the output */
obs_encoder_t *obs_output_get_audio_encoder(
		const obs_output_t *output,
		size_t idx);

/* 'mixer_idx' specifies the mixer index to capture audio from */
obs_encoder_t *obs_audio_encoder_create(
		const char *id,
		const char *name,
		obs_data_t *settings,
		size_t mixer_idx);

Overview
--------------------------
This feature allows multiple audio mixers to be used at a time.  This
capability was able to be added with surprisingly very little extra
overhead.  Audio will not be mixed unless it's assigned to a specific
mixer, and mixers will not mix unless they have an active mix
connection.

Mostly this will be useful for being able to separate out specific audio
for recording versus streaming, but will also be useful for certain
streaming services that support multiple audio streams via RTMP.

I didn't want to use a variable amount of mixers due to the desire to
reduce heap allocations, so currently I set the limit to 4 simultaneous
mixers; this number can be increased later if needed, but honestly I
feel like it's just the right number to use.

Sources:

Sources can now specify which audio mixers their audio is mixed to; this
can be a single mixer or multiple mixers at a time.  The
obs_source_set_audio_mixers function sets the audio mixer which an audio
source applies to.  For example, 0xF would mean that the source applies
to all four mixers.

Audio Encoders:

Audio encoders now must specify which specific audio mixer they use when
they encode audio data.

Outputs:

Outputs that use encoders can now support multiple audio tracks at once
if they have the OBS_OUTPUT_MULTI_TRACK capability flag set.  This is
mostly only useful for certain types of RTMP transmissions, though may
be useful for file formats that support multiple audio tracks as well
later on.
2015-02-04 16:51:29 -08:00
jp9000
e4fdd61c74 libobs: Clarify comment on obs_source_set_flags
The comment says "these are different", but doesn't state why.
Actually, I should really rename the output flags so they're not flags,
but instead just "caps", because that's really all that they are.
2015-02-04 15:40:22 -08:00
jp9000
24eaf77963 libobs: Fix typo, 'audio' instead of 'video'
For some extremely inexplicable reason, I somehow managed to use 'video'
for the audio data instead of 'audio'.
2015-02-04 15:40:21 -08:00
jp9000
fec29532de libobs: Removed unused parameter and variable 2015-02-04 15:40:21 -08:00
jp9000
af8d5db4ad libobs: Add obs_data_clear to clear settings
This function is intended to clear all settings outside of
default/autoselect values.
2015-01-24 22:09:24 -08:00
jp9000
b042e20e24 libobs: Fix obs_data_apply
obs_data_apply is used to apply the changes of a source object in to a
destination object.  Problem with this however is that if sub-objects
are in use, it currently just copies the pointer of the sub-object,
meaning that the source and destination will both share the same
sub-object via reference.  If anything modifies that sub-object data,
it'll modify it for both objects, which was not intended.

Instead of copying the object pointer, create a new copy and then
recursively repeat the process to ensure the data is always completely
separate.
2015-01-24 21:03:04 -08:00
jp9000
82320a9ca7 (API Change) Make os_get_config_path safer to use
Changed:
  char *os_get_config_path(const char *name);

To:
  int os_get_config_path(char *dst, size_t size, const char *name);

Also added:
  char *os_get_config_path_ptr(const char *name);

I don't like this function returning an allocation by default.
Similarly to what was done with the wide character conversion functions,
this function now operates on an array argument, and if you really want
to just get a pointer for convenience, you use the *_ptr version of the
function that clearly indicates that it's returning an allocation.
2015-01-15 23:44:38 -08:00