Commit graph

914 commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks
97e1846156 obs-tools: Add deleter for obs_weak_source_t 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks
e4b4dc23e8 gs-helper: Define extra debug colors 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks
05d69e3c59 util-threadpool: Fix rare double-execute bug 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks
984a1132bf ffmpeg-encoder: Implement additional support checks 2020-04-17 11:13:10 +02:00
Michael Fabian 'Xaymar' Dirks
a9c881130e ffmpeg-encoder/nvenc: Fix Look Ahead setting
Also now disables Adaptive I & B as they do nothing without Look-Ahead set to non-zero.

Fixes #159
2020-04-17 11:13:10 +02:00
Michael Fabian 'Xaymar' Dirks
c03fc933bb ffmpeg-encoder/d3d11: Set highest eviction priority for buffers
This should ideally prevent textures from being removed from the GPU while the encoder is actively using them.
2020-04-11 15:23:07 +02:00
Michael Fabian 'Xaymar' Dirks
908d1f0a20 project: Modernize code to proper C++ 2020-04-09 00:17:25 +02:00
Michael Fabian 'Xaymar' Dirks
05399bd183 filter-dynamic-mask: Add missing include
Fixes #134
2020-04-06 15:39:12 +02:00
Michael Fabian 'Xaymar' Dirks
6a9921c9ce project: Fix include ordering and reapply formatting 2020-04-06 15:39:12 +02:00
Michael Fabian 'Xaymar' Dirks
cd5acd42f4 obs-source-factory: Add settings migration code
Previously sources had to manually implement migration code, which resulted in unresolvable regression issues due to the lack of version and commit tagging. With the new migration code, all sources automatically have this version and commit tagging at all times, and as such can now have a temporary regression fixed without the user needing to change any values manually.
2020-04-05 07:28:10 +02:00
Michael Fabian 'Xaymar' Dirks
a138f95126 cmake: Fix clang support in native OBS Studio build 2020-04-05 06:50:21 +02:00
Michael Fabian 'Xaymar' Dirks
9e9e9cbcd5 ffmpeg-encoder/prores: Improve pixel format override logic 2020-04-04 19:34:58 +02:00
Michael Fabian 'Xaymar' Dirks
87163f5f70 ffmpeg-encoder: Use correct key when getting pixel formats 2020-04-04 19:34:58 +02:00
Michael Fabian 'Xaymar' Dirks
9ca190c96a gfx-shader: Don't use modified_properties to reload shaders
As OBS Studio locks some mutexes in a different order depending on what actions are being done, using modified_properties for GPU work causes things to freeze in place. Instead have users manually click the refresh button when they changed files in order to prevent this freeze from happening.

Fixes: #118
2020-04-03 18:54:56 +02:00
Michael Fabian 'Xaymar' Dirks
cc9d3486b2 project: Fix Linux support by fixing errors and warnings
With this, GCC 8 and above should now be able to compile the project both in obs-studio and as a standalone install. Some features are currently still not fully supported and require extra work, but the majority of things are supported and work out of the box. Exact feature parity can be looked up here on the wiki: https://github.com/Xaymar/obs-StreamFX/wiki/Platform-Feature-Parity

Related: #119 #98 #30
2020-04-02 20:37:45 +02:00
Michael Fabian 'Xaymar' Dirks
3ad2424b22 ffmpeg-encoder: Throw std::runtime_error instead of std::exception 2020-04-02 17:05:02 +02:00
Michael Fabian 'Xaymar' Dirks
59fa1d36d7 common: Common header include for improved platform support
This header includes all common data between headers used in the plugin. This should improve cross-platform compiling support whenever possible, as all platform-dependent common includes and defines can be done here.
2020-04-02 17:02:01 +02:00
Michael Fabian 'Xaymar' Dirks
451d31546f gs-effect-*: Replace strnlen_s with strnlen 2020-04-02 16:21:42 +02:00
Michael Fabian 'Xaymar' Dirks
89b99402c0 util-threadpool: Add missing includes 2020-04-01 14:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
30aaea8449 filter-nv-face-tracking: Possibly fix for rare 0x0 bug 2020-04-01 01:41:18 +02:00
Michael Fabian 'Xaymar' Dirks
cf6e867ba5 source-shader: Fix size and parameters 2020-04-01 00:09:21 +02:00
Michael Fabian 'Xaymar' Dirks
3dcf4e5dd6 filter-shader: Fix detected sizes 2020-03-31 22:42:18 +02:00
Michael Fabian 'Xaymar' Dirks
ac8844b305 gfx-shader: Add defaults 2020-03-31 22:34:22 +02:00
Michael Fabian 'Xaymar' Dirks
d5dffbbe03 filter-shader: Fix some crashes 2020-03-31 22:26:50 +02:00
Michael Fabian 'Xaymar' Dirks
bb2f43a629 filter-shader: Fix incorrect shader mode 2020-03-31 22:22:55 +02:00
Michael Fabian 'Xaymar' Dirks
43f1dcf205 filter-nv-face-tracking: Nvidia exclusive Face Tracking filter
Ever wished you had a professional camera operator to highlight and follow the action, ensuring the audience never misses a beat? Thanks to NVIDIA, you can now do this at home for free! The new NVIDIA AR SDK unlocks augmented reality features, including motion tracking for faces.

This allows me to provide you with an automated zoom and cropping solution for your video camera to transform your streams into a slick, polished broadcast, where you’ll always be the star of the show. Don’t forget - everything is customizable so the possibilities are endless. You can even recreate that Futurama squinting meme if you wanted to (with some scripting)!

The filter requires compatible Nvidia RTX hardware and the Nvidia AR SDK Runtime to be installed ahead of time. This filter is considered "stable" and shouldn't change much from version to version.
2020-03-31 21:46:47 +02:00
Michael Fabian 'Xaymar' Dirks
88213e81f6 nvidia-cuda: GPL compatible CUDA library interface
Due to the 'nvcuda' library being part of the driver, it falls in a clause of the GPL which allows us to load and interface with system drivers. Since we can't rely on Nvidias headers here (incompatible license), most of this was pulled from FFmpeg and other things were found out via testing.
2020-03-31 21:46:47 +02:00
Michael Fabian 'Xaymar' Dirks
2e48723e83 util-profiler: Possible fix for issue #119
Microsoft automatically includes cmath by default, while GCC and Clang don't seem to do this.
2020-03-31 21:46:03 +02:00
Michael Fabian 'Xaymar' Dirks
1285e7efd3 util-event: Fix duplicated name 2020-03-31 15:47:15 +02:00
Michael Fabian 'Xaymar' Dirks
79406b0b08 gfx-shader: Additional stable time values
'Time.x' gets inaccurate if OBS Studio is running for more than two hours, therefore we have to do something to fix it. By allowing the shader code to control when things loop using 'Time.y' (0..1) and 'Time.z' (the number of times 'Time.y' wrapped back to 0), a much more stable animation can be achieved.
2020-03-28 22:17:33 +01:00
Michael Fabian 'Xaymar' Dirks
43b5d309eb transition: Add initial version of Shader filter
These allow you to apply any kind of filtering to a any source, using just standard HLSL. Just like transitions, one extra parameter is set called 'InputA'.

Fixes #95
2020-03-28 18:54:56 +01:00
Michael Fabian 'Xaymar' Dirks
ead355beea transition-shader: Add initial version of Shader transitions
With this, the first proper shader effect is now possible. By using the four new automated shader parameters 'InputA', 'InputB', 'TransitionTime' and 'TransitionSize' you can write your own transition in HLSL.

Fixes #96
2020-03-28 18:38:45 +01:00
Michael Fabian 'Xaymar' Dirks
2e250ad826 obs-source-factory: Fix support for transitions
Transitions always require audio and video rendering.
2020-03-28 18:37:20 +01:00
Michael Fabian 'Xaymar' Dirks
6ae9904e13 gfx-shader: Support for filters and transitions
Due to render logic required for transitions, some of the render logic is split into an additional function called 'prepare_render'. Additionally the storage for some temporary objects has been removed as it these objects usually do not outlive their rendering time anyway.

Related: #96 #95 #94 #5
2020-03-28 18:37:00 +01:00
Michael Fabian 'Xaymar' Dirks
e66acbeb98 filter-transform: Fix function location 2020-03-28 16:24:26 +01:00
Michael Fabian 'Xaymar' Dirks
18b3cd30bf filter-transform: Migration code for earlier stable versions
This fixes #116 which was caused by a refactor in commit efb6b0b9be. This bug was left undiscovered until users started upgrading from the last stable version to the current pre-release.
2020-03-28 16:18:17 +01:00
Michael Fabian 'Xaymar' Dirks
4f7c1cb35e ffmpeg-encoder: Various warning fixes and cleanup
Also don't include it from plugin.cpp if it's not enabled.
2020-03-27 20:10:29 +01:00
Michael Fabian 'Xaymar' Dirks
ff3c2e8c66 filter-dynamic-mask: Initialize all members 2020-03-27 20:10:17 +01:00
Michael Fabian 'Xaymar' Dirks
87e6767033 gs-mipmapper: Fix some warnings 2020-03-27 20:10:17 +01:00
Michael Fabian 'Xaymar' Dirks
1942782b56 util-threadpool: Fix order of initialization 2020-03-27 20:10:09 +01:00
Michael Fabian 'Xaymar' Dirks
10fee7f048 util-profiler: Easy to use profiling helper 2020-03-27 20:10:09 +01:00
Michael Fabian 'Xaymar' Dirks
03bee0aaf2 source-mirror: Fix freeze introduced in OBS Studio v25.x
For an unknown reason, OBS Studio v25.x now causes a freeze to happen at this location. This should hopefully work around that issue by ensuring that we are in a location that does not cause an unusual lock order.
2020-03-21 09:13:31 +01:00
Michael Fabian 'Xaymar' Dirks
b54e9431c0 ffmpeg-encoder: Fall back to software encoding for scaling 2020-03-21 08:59:53 +01:00
Michael Fabian 'Xaymar' Dirks
ccb8a205b0 source-mirror: Update first, then acquire source
Fixes a bug where a 2nd update is necessary for proper audio mirroring.
2020-03-21 08:59:35 +01:00
Michael Fabian 'Xaymar' Dirks
d6c903a3bd source-mirror: Fix out-of-order playback of audio
On highly parallel systems (> 4 Threads) audio had a chance of being played back out of order, causing it to jitter. This queue should help eliminate the issue entirely.

Fixes #111
2020-03-20 23:59:42 +01:00
Michael Fabian 'Xaymar' Dirks
ba1780afa6 utility: Add lerp and 1D Kalman filter 2020-03-20 23:24:25 +01:00
Michael Fabian 'Xaymar' Dirks
6f2b50b0ad cmake: Redesign for future features 2020-03-20 23:09:46 +01:00
Michael Fabian 'Xaymar' Dirks
0b3ce10aff filter-transform: Fix discoloration issue
Previously a wrong blend state caused a slight discoloration on transparent sources, which was caused by assuming them to always be fully solid without transparency. By instead relying on OBS to do the rendering we do not have to deal with blend states as much and instead can simply enjoy the result.

Fixes #104
2020-03-07 03:43:30 +01:00
Michael Fabian 'Xaymar' Dirks
f2913685ed ffmpeg-encoder/nvenc: See description
* Remove Minimum Bitrate as it is not supported by the encoder.
* Add several default states (-1 or Default) to options.
* Possibly fix bitrate lock with CQP and CQ mode.
* Fix log output for bitrate and B-Frames.
2020-03-07 01:52:04 +01:00
Michael Fabian 'Xaymar' Dirks
549e7c7437 ffmpeg-encoder: Fix leftover errors from refactor 2020-03-07 01:48:23 +01:00
Michael Fabian 'Xaymar' Dirks
e2c83f546e ffmpeg/tools: Allow overriding option context 2020-03-07 01:48:06 +01:00
Michael Fabian 'Xaymar' Dirks
5223d3980f ffmpeg/tools: Also log default values 2020-03-07 00:33:55 +01:00
Michael Fabian 'Xaymar' Dirks
087845de49 source-mirror: Reimplement audio mirroring using thread pool
The new logic drastically simplifies Source Mirror and reduces the attack surface for bugs introduced by humans. Additionally the new layout detection should help with improved audio mirroring which hopefully will not crash libobs as often.

Fixes #61.
2020-03-03 02:17:26 +01:00
Michael Fabian 'Xaymar' Dirks
08024049c2 util-threadpool: Implement global thread pool
This thread pool can take large or small tasks and as such alleviates the burden of having a thread per source. Particularly for large setups, this drastically reduces the number of threads running in the background waiting for work.
2020-03-03 01:52:54 +01:00
Michael Fabian 'Xaymar' Dirks
d91042fe2a source-mirror: Fix OBS_SOURCE_CUSTOM_DRAW support & more
Fixes support for OBS_SOURCE_CUSTOM_DRAW sources and refactors the class onto better isolated and wrapped classes to deal with specific tasks. This drastically improves stability without causing code complexity to increase, and makes the code vastly easier to read too.

Related: #99
2020-02-14 07:55:18 +01:00
Michael Fabian 'Xaymar' Dirks
4baa2360c5 obs-source: Disallow copy constructor 2020-02-14 07:52:28 +01:00
Michael Fabian 'Xaymar' Dirks
681a586ae9 util-event: Rest of fb5041a69d 2020-02-14 07:52:15 +01:00
Michael Fabian 'Xaymar' Dirks
baf265fd5b obs-signal-handler: Fix possible crash 2020-02-14 07:31:30 +01:00
Michael Fabian 'Xaymar' Dirks
326fa68d9f obs-signal-handler: Helper classes for signals and audio 2020-02-14 07:30:46 +01:00
Michael Fabian 'Xaymar' Dirks
42c9375333 obs-tools: Fix obs::tools::child_source not checking return value 2020-02-14 07:29:31 +01:00
Michael Fabian 'Xaymar' Dirks
fb5041a69d util-event: Ensure thread safety 2020-02-14 07:28:57 +01:00
Michael Fabian 'Xaymar' Dirks
5d38ca8a74 ffmpeg-encoder/nvenc: Various additional default states 2020-02-13 11:19:30 +01:00
Michael Fabian 'Xaymar' Dirks
40369bf72d obs-tools: Add child_source helper class 2020-02-13 10:34:26 +01:00
Michael Fabian 'Xaymar' Dirks
53d4ad31e6 source-mirror: Remove useless group 2020-02-13 05:18:28 +01:00
Michael Fabian 'Xaymar' Dirks
a47dbaefc8 source-mirror: Remove scaling and caching
Scaling shouldn't be part of the Source and instead should be done as a filter. Not only does supporting it drastically increase code complexity, it also doesn't add anything that is really necessary as you can do everything it did better in an actual transform.

Caching wasn't actually used except for scaling and was mostly broken too, causing flickering.
2020-02-13 05:17:06 +01:00
Michael Fabian 'Xaymar' Dirks
c6a1edf46f util-event: Fix and cleanup 2020-02-13 05:09:14 +01:00
Michael Fabian 'Xaymar' Dirks
f8ee95d71c obs-*: Cleanup 2020-02-13 05:09:14 +01:00
Michael Fabian 'Xaymar' Dirks
5956a6f7a9 ffmpeg-encoder/nvenc: Add AUD and DPB Size options 2020-01-15 13:43:33 +01:00
Michael Fabian 'Xaymar' Dirks
98c7a2e379 ffmpeg-encoder/nvenc: Fix typo 2020-01-15 05:53:54 +01:00
Michael Fabian 'Xaymar' Dirks
34b2859dac ffmpeg-encoder/nvenc: Add minimum bitrate, fix target quality and more
Adds support for specifying Minimum Bitrate directly in the UI instead of requiring custom settings to do so. Additionally Adaptive I/B-Frames are now only shown if Look-Ahead is a value greater than 0 frames.

Quality Minimum can also now be left at a default value of -1, the Quality group is no longer toggleable and Quality Target moved into the group. Settings options on the context is now searching children too (if there are any).

Finally, some C++17 formatting was done.

Fixes #101
2020-01-15 05:50:31 +01:00
Michael Fabian 'Xaymar' Dirks
5d5a104819 ffmpeg-encoder: Improve UI, fix acceleration encode, etc 2020-01-15 03:59:03 +01:00
Michael Fabian 'Xaymar' Dirks
96ac0bd11b ffmpeg-encoder: Fix weird bug with std::map crashing in constructor 2020-01-14 10:36:04 +01:00
Michael Fabian 'Xaymar' Dirks
109b1c9b0f ffmpeg-encoder: Fix incorrect call 2020-01-14 10:03:42 +01:00
Michael Fabian 'Xaymar' Dirks
a72eba6ded ci: Remove Node.JS requirement 2020-01-14 09:31:41 +01:00
Michael Fabian 'Xaymar' Dirks
8df90dfda8 ffmpeg-encoder: Fix handler detection 2020-01-14 02:15:05 +01:00
Michael Fabian 'Xaymar' Dirks
14d05ccdac plugin: Enable FFmpeg Encoders 2020-01-14 01:55:31 +01:00
Michael Fabian 'Xaymar' Dirks
b306cebd6b project: More warnings fixed 2020-01-14 01:39:13 +01:00
Michael Fabian 'Xaymar' Dirks
ebc50dcefe utility: Merge util-math and util-memory 2020-01-14 01:11:08 +01:00
Michael Fabian 'Xaymar' Dirks
1987bfb853 ffmpeg-encoder: Fix some warnings 2020-01-14 01:04:49 +01:00
Michael Fabian 'Xaymar' Dirks
a33dd83d72 project: Merged FFmpeg Encoders Step 3 2020-01-13 23:40:08 +01:00
Michael Fabian 'Xaymar' Dirks
0a16ce07dc project: Merged FFmpeg Encoders Step 2 2020-01-13 22:40:15 +01:00
Michael Fabian 'Xaymar' Dirks
3eea289679 project: Merged FFmpeg Encoders Step 1 2020-01-13 01:52:30 +01:00
Michael Fabian 'Xaymar' Dirks
3062d3b331 gfx-shader: Better logging, and ViewSize parameter 2020-01-01 04:21:02 +01:00
Michael Fabian 'Xaymar' Dirks
3e02857d39 gfx-shader-param: Initialize all variables 2020-01-01 02:59:02 +01:00
Michael Fabian 'Xaymar' Dirks
26a58645a7 gfx-shader-param-basic: Support for scaling and fix enumerations
Scaling is now fully supported for Floats and Integers, which allows much higher precision inputs, or upscaling to a different range. Complex functions for scaling are not supported as those would be a scripting thing and should be kept as that (OBS Studio has built in Lua scripting).

Additionally, enumerations are now correctly loaded with data.

Related #5
2020-01-01 02:58:45 +01:00
Michael Fabian 'Xaymar' Dirks
ce15bc6abc gfx-shader-param: Fix is_visible 2019-12-25 20:10:09 +01:00
Michael Fabian 'Xaymar' Dirks
f79502b9b0 gfx-shader: Deal with remaining compile errors 2019-12-25 19:18:44 +01:00
Michael Fabian 'Xaymar' Dirks
731a22e1ea gfx-shader-param-basic: Automatically resize min/max/step/scale buffers 2019-12-25 19:10:56 +01:00
Michael Fabian 'Xaymar' Dirks
975d2e293e gfx-shader-param-basic: Add Integers, Enumerations, Arrays 2019-12-25 19:10:01 +01:00
Michael Fabian 'Xaymar' Dirks
903d416607 gfx-shader-param: Fix get_parameter 2019-12-25 19:09:30 +01:00
Michael Fabian 'Xaymar' Dirks
17ee2d713c gs-effect-parameter: Implement copy and move 2019-12-25 19:09:13 +01:00
Michael Fabian 'Xaymar' Dirks
1902d005e9 gfx-shader-param: Add support for automatic parameters
Allows other parameters to be a seed to these parameters.
2019-12-25 10:14:04 +01:00
Michael Fabian 'Xaymar' Dirks
907216f143 gfx-shader: Don't show parameters that are invisible 2019-12-25 10:10:06 +01:00
Michael Fabian 'Xaymar' Dirks
4acbfedd40 gfx-shader-param: Support for input, slider, enum and more 2019-12-25 10:09:56 +01:00
Michael Fabian 'Xaymar' Dirks
777556f4f6 gfx-shader-param: Vastly improve parameter functionality
Allow for overriding type and size of an element, opening the path for `int#[]`, `float#[]`, `int#x#`, `float#x#`, `bool#x#`, `vector<type, #>` and `matrix<type, #, #>`. Also allows for specifying the exact type of texture instead of hoping the user gets it right, as well as samplers.

Parameters are also now created if they are invisible, which means that the properties() function must not be called, but they must still be used like any other. This is due to a problem with default values not being applied all the time, and sometimes just vanishing.

The code also now throws exceptions with reasonable text, which should be caught by the gfx::shader implementation and refuse a load of the effect. No other state should be modified at that point, so care must be taken that up until the moment the complete initialization is done no other state is modified.
2019-12-24 22:02:37 +01:00
Michael Fabian 'Xaymar' Dirks
eab3ae4fbc gfx-shader-param: Add support for order and overall name/desc 2019-12-24 08:38:01 +01:00
Michael Fabian 'Xaymar' Dirks
9696f836e0 gfx-shader: Fix startup and select crash if file is missing 2019-12-24 08:37:37 +01:00
Michael Fabian 'Xaymar' Dirks
3018c9b9ea project: Version 0.8.0a1 2019-12-22 08:31:00 +01:00
Michael Fabian 'Xaymar' Dirks
4c5a7018a3 gfx-shader: Add file watching and dynamic UI updates
Thanks to the workaround in obs::tools, gfx::shader::shader now supports dynamically rebuilding the properties with new properties without crashing OBS Studio. This effectively allows you to have an up to date view of the current parameters for the shader technique.

Additionally with file watching, live development of shaders is possible at very little cost. Currently only file times and size is looked at every 333ms, but in the future it is possible to also watch for file renames and more.
2019-12-22 06:14:26 +01:00
Michael Fabian 'Xaymar' Dirks
bd6b4f2d2a gfx-shader-param-basic: Add support for defaults function 2019-12-22 06:07:54 +01:00
Michael Fabian 'Xaymar' Dirks
672c6d39af gfx-shader-param: Split setting defaults from properties 2019-12-22 06:07:37 +01:00
Michael Fabian 'Xaymar' Dirks
1ff6c0cf41 obs-tools: Add work around for property memory corruption
The current implementation of obs_properties_remove_by_name corrupts the obs_properties_t object whenever it is called on the first or last property in the list. This leads to rapid unscheduled disassembly, and therefore must be fixed in order for this function to be used.

Fixed by upstream PR https://github.com/obsproject/obs-studio/pull/2257.
2019-12-22 06:07:07 +01:00
Michael Fabian 'Xaymar' Dirks
9ef60cc2f9 gfx-shader: Add support for validating file differences
Removes the stutter when re-opening the properties dialog which was caused by recompiling the same exact shader every time this happened. Also paves the way for simple file watching.
2019-12-21 18:23:26 +01:00
Michael Fabian 'Xaymar' Dirks
2faa68f9be gs-effect: Pass unmodified parameters as const reference 2019-12-21 18:20:36 +01:00
Michael Fabian 'Xaymar' Dirks
1d9a4ddbf5 gs-helper: Fix nonstandard usage of va_start 2019-12-21 18:07:08 +01:00
Michael Fabian 'Xaymar' Dirks
624bdda6a3 gs-texture: Reduce context lock time and improve code 2019-12-21 18:06:17 +01:00
Michael Fabian 'Xaymar' Dirks
aa59806322 gs-effect: Fix warning 2019-12-21 18:05:54 +01:00
Michael Fabian 'Xaymar' Dirks
e5fb68d2c1 utility: Add any and exact matching for enum class bitmasks 2019-12-21 18:05:32 +01:00
Michael Fabian 'Xaymar' Dirks
cbada3e438 obs-source: Deprecate obs::source due to stability issues
This should be replaced with a class inheriting from std::shared_ptr.
2019-12-21 17:43:12 +01:00
Michael Fabian 'Xaymar' Dirks
7e5cbe18cf project: Apply clang-format 2019-12-21 17:05:53 +01:00
Michael Fabian 'Xaymar' Dirks
1f0c595a0a obs-source-factory: Add missing include 2019-12-21 17:05:49 +01:00
Michael Fabian 'Xaymar' Dirks
d13778b017 gfx-shader: Fix some crash/problematic locations 2019-12-18 07:49:56 +01:00
Michael Fabian 'Xaymar' Dirks
24edee795a gfx-shader-param: FIXME Don't create parameters for invisible 2019-12-18 07:49:43 +01:00
Michael Fabian 'Xaymar' Dirks
de473f0c2e gfx-shader-param-basic: Fix incorrect float properties 2019-12-18 07:49:19 +01:00
Michael Fabian 'Xaymar' Dirks
b7f76f5e01 locale: New translatable strings 2019-12-18 06:39:08 +01:00
Michael Fabian 'Xaymar' Dirks
47dba25052 source-shader: Update to new gfx::shader::shader 2019-12-18 06:39:08 +01:00
Michael Fabian 'Xaymar' Dirks
e6220b18f6 project: Temporarily disable Custom Shader filters 2019-12-18 06:39:07 +01:00
Michael Fabian 'Xaymar' Dirks
f1b9a1a712 gfx-shader: Initial code 2019-12-18 06:39:07 +01:00
Michael Fabian 'Xaymar' Dirks
0a761b97a2 gfx-shader-param*: Initial code 2019-12-18 06:39:07 +01:00
Michael Fabian 'Xaymar' Dirks
f49f3a30b6 filter-displacement: Fix typo 2019-12-18 06:39:07 +01:00
Michael Fabian 'Xaymar' Dirks
3b66860a8f gfx-blur-gaussian*: Update to new API 2019-12-18 06:39:07 +01:00
Michael Fabian 'Xaymar' Dirks
c0f131642b gs-effect-parameter: Improve API and fix incorrect functions 2019-12-18 06:39:06 +01:00
Michael Fabian 'Xaymar' Dirks
cd82e2cac7 gs-effect-pass: Implement parameter getter and fix possible crash 2019-12-18 06:39:06 +01:00
Michael Fabian 'Xaymar' Dirks
570b70479f gs-effect-technique: Fix possible crash 2019-12-18 06:39:06 +01:00
Michael Fabian 'Xaymar' Dirks
47dc948861 gfx-blur-gaussian: Remove left over obs_enter_graphics (#83)
This single line causes OBS to freeze in place, and is not needed as the Graphics Context is already locked by gs::context().

Fixes #83
2019-12-17 23:53:21 +01:00
Michael Fabian 'Xaymar' Dirks
16347beb87 filter-*, source-*: Fix rendering of filters and duplication of sources 2019-12-17 23:52:10 +01:00
Michael Fabian 'Xaymar' Dirks
1c7fd1495c source-mirror: Fix potential lockup and rescaling with original size
Getting the resolution of a source is very expensive in libOBS, as libOBS does not cache it and instead always calls into the filters and sources to determine the actual source. This also leads to potential lockups due to the filter list mutex being locked for the target source.

Therefore instead of calling it multiple times, cache the result of the call, if that result is even necessary. This reduces the need to synchronize lightly parallelized work (UI and libOBS code) and helps against the potential race condition in libOBS.
2019-12-16 23:53:20 +01:00
Michael Fabian 'Xaymar' Dirks
01f23e17fe gs-effect: Also override finalizer for the stored ptr 2019-12-16 23:07:49 +01:00
Michael Fabian 'Xaymar' Dirks
e7b46063aa gs-effect: Fix typo from refactor 2019-12-16 22:53:25 +01:00
Michael Fabian 'Xaymar' Dirks
b54e95527a gs-effect*: Finish up refactoring onto std::shared_ptr
This is most likely not the last refactor, the entire obs/gs stuff is very very basic right now and likely needs a complete rewrite.
2019-12-15 12:55:19 +01:00
Michael Fabian 'Xaymar' Dirks
11a2329519 gs-effect: Refactor onto std::shared_ptr 2019-12-15 11:13:47 +01:00
Michael Fabian 'Xaymar' Dirks
1f25b56579 gs-effect-technique: Return nullptr instead of throwing exception 2019-12-15 10:37:57 +01:00
Michael Fabian 'Xaymar' Dirks
ef76e353d3 gs-effect-pass/technique: Change to protected inheritance
Prevents the use of get() and reset() where not actually needed and forces us to actually implement all of the methods needed to interface with the object, leading to cleaner and safer code.
2019-12-15 10:37:41 +01:00
Michael Fabian 'Xaymar' Dirks
50ac6893bf gs-effect-parameter: Refactor effect_parameter onto std::shared_ptr
Prevents problems further down the line and supports multiple types of parents to ensure that lifetime is guaranteed.
2019-12-15 10:35:29 +01:00
Michael Fabian 'Xaymar' Dirks
0ad896e905 gfx-shader: Rename from gfx-effect-source 2019-12-15 09:09:11 +01:00
Michael Fabian 'Xaymar' Dirks
738b08de36 gs-effect-pass/technique: Implement wrapper code based on std::shared_ptr
These two wrap the underlying gs_epass and gs_effect_technique objects, to allow direct and improved access to them without relying on the libobs API to provide this access for us. Additionally these make it safe for us to use them instead of relying on C-like code to deal with it.
2019-12-15 09:05:23 +01:00
Michael Fabian 'Xaymar' Dirks
d53e9eeadf filter-sdf-effects: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:32 +01:00
Michael Fabian 'Xaymar' Dirks
01895c1ccc filter-dynamic-mask: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:25 +01:00
Michael Fabian 'Xaymar' Dirks
af78c177ad filter-displacement: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:16 +01:00
Michael Fabian 'Xaymar' Dirks
a24e0d2c10 filter-blur: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:06 +01:00
Michael Fabian 'Xaymar' Dirks
d8e1c7c779 filter-transform: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:32:48 +01:00
Michael Fabian 'Xaymar' Dirks
b311d79e50 source-mirror: Remove OBS_SOURCE_CUSTOM_DRAW 2019-12-14 02:37:04 +01:00
Michael Fabian 'Xaymar' Dirks
66abaac67b filter-color-grade: Refactor onto obs::source_factory
Related: #90
2019-12-14 02:34:48 +01:00
Michael Fabian 'Xaymar' Dirks
7e98df0d1c obs-source-factory: Add helper functionality to make things easier to use 2019-12-14 02:34:48 +01:00
Michael Fabian 'Xaymar' Dirks
5be2941299 filter-sdf-effects: Move factory to bottom of the file 2019-12-03 20:38:34 +01:00
Michael Fabian 'Xaymar' Dirks
59878b62d0 filter-dynamic-mask: Fix nonstandard use of va_start 2019-12-03 20:38:14 +01:00
Michael Fabian 'Xaymar' Dirks
d9f43ec2e8 filter-blur: Refactor onto obs::source_factory 2019-12-03 20:37:57 +01:00
Michael Fabian 'Xaymar' Dirks
4e1dcb533c filter-dynamic-mask: Rebase onto obs::source_factory 2019-12-03 20:11:27 +01:00
Michael Fabian 'Xaymar' Dirks
0e425ab48f source-mirror: Fix missing input selection 2019-12-03 20:08:16 +01:00
Michael Fabian 'Xaymar' Dirks
efb6b0b9be filter-transform: Further refactoring 2019-12-03 18:28:42 +01:00
Michael Fabian 'Xaymar' Dirks
48e17ad562 filter-sdf-effects: Refactor onto obs::source_factory
Also replaces the global effect objects with per-source ones
2019-12-03 17:47:39 +01:00
Michael Fabian 'Xaymar' Dirks
df8ebd94ea filter-displacement: Refactor onto obs::source_factory
This drastically improves stability and prevents all exceptions from leaking into libobs C code, which prevents crashes and unexpected freezes from exception handlers further down the stack.

Additionally minor work was done to further improve the quality and user experience for the filter.
2019-11-18 03:03:11 +01:00
Michael Fabian 'Xaymar' Dirks
6efdb1950b obs-source-factory: Fix typo and missing return 2019-11-18 03:03:11 +01:00
Michael Fabian 'Xaymar' Dirks
db85883821 obs/obs-source-factory: Fix potential null-pointer-dereference 2019-11-17 14:07:54 +01:00
Michael Fabian 'Xaymar' Dirks
87f83738c3 gs-helper: Add common debug colors 2019-10-31 05:59:16 +01:00
Michael Fabian 'Xaymar' Dirks
10681d30c8 gs-helper: Remove unused constructor 2019-10-18 23:04:23 +02:00
Michael Fabian 'Xaymar' Dirks
90cdc30ef1 gs-helper: Add class for managed debug markers 2019-10-18 22:59:30 +02:00
Michael Fabian 'Xaymar' Dirks
9b0ea98243 filter-transform: Add GPU debug markers 2019-10-18 22:42:07 +02:00
Michael Fabian 'Xaymar' Dirks
ba71b43a39 gfx-source-texture: Add debug markers 2019-10-18 22:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
141a5efd00 filter-transform: Refactor onto obs::source_factory 2019-10-18 22:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
bacf52f9b6 source-mirror: Refactor to improve performance
Caching the output of a source is only necessary for really expensive to render sources, so it is disabled by default now. Thanks to that, most Source Mirrors are now "free" instead of requiring two context switches and a texture, while those really expensive can be manually set to cache.

The scaling mode is also set to disabled instead of point when rescaling is off to further improve performance. The previous method would incorrectly cause an extra texture to be used.

Additionally we now have support for debug markers for graphics debugging, allowing us to exactly tell apart improvements in rendering cost for this source.
2019-10-18 22:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
52c9e372ba source-mirror: Refactor onto obs::source_factory 2019-10-18 22:31:53 +02:00
Michael Fabian 'Xaymar' Dirks
d47ab0570f obs-source-factory: Barebone Source Factory and Instance
This class and template should be used to reduce the code clutter from repeatedly doing the same thing. It requires OBS v24.0 or newer since the get_properties2 and get_defaults2 API were fully implemented with it.
2019-10-18 22:31:52 +02:00
Michael Fabian 'Xaymar' Dirks
6db575c9cf source-mirror: Add debug markers 2019-10-16 04:54:40 +02:00
Michael Fabian 'Xaymar' Dirks
03c2a68846 gfx-effect-source: Catch exceptions as const 2019-10-13 07:28:59 +02:00
Michael Fabian 'Xaymar' Dirks
e832dbd628 filter-sdf-effects: Fix and improve various problematic locations 2019-10-13 07:28:29 +02:00
Michael Fabian 'Xaymar' Dirks
4fe76a85ae filter-blur: Fix some warnings 2019-10-13 07:28:12 +02:00
Michael Fabian 'Xaymar' Dirks
bbcbd0fa1e filter-color-grade: Fix and improve various problematic locations 2019-10-13 07:27:59 +02:00
Michael Fabian 'Xaymar' Dirks
e07d7c01fc filter-displacement: Fix and improve various problematic locations 2019-10-13 07:27:42 +02:00
Michael Fabian 'Xaymar' Dirks
ef5e6ac896 filter-dynamic-mask: Catch const exceptions 2019-10-13 07:08:56 +02:00
Michael Fabian 'Xaymar' Dirks
06d9a3d2f5 filter-transform: Catch and log exceptions 2019-10-13 07:08:02 +02:00
Michael Fabian 'Xaymar' Dirks
96466100b4 obs-source: Ensure that exceptions are const 2019-10-13 07:07:31 +02:00
Michael Fabian 'Xaymar' Dirks
b5d3131203 filter-dynamic-mask: Fix some crashy locations 2019-10-13 07:02:04 +02:00
Michael Fabian 'Xaymar' Dirks
0ef94aad0f gs-vertexbuffer: Fix and improve various problematic locations 2019-10-13 06:38:15 +02:00
Michael Fabian 'Xaymar' Dirks
45d2431ef5 source-mirror: Fix and improve various problematic locations 2019-10-13 06:20:41 +02:00
Michael Fabian 'Xaymar' Dirks
fd0b79e97d utility-event: Remove unused event handler 2019-10-13 05:58:53 +02:00
Michael Fabian 'Xaymar' Dirks
f1a376d44b cmake: Add commit to version.hpp template
Switches out the `const uint16_t` for actual defines, which are easier to deal with and work in C out of the box.
2019-10-13 05:54:20 +02:00
Michael Fabian 'Xaymar' Dirks
e02225262c obs-source: Add noexcept try-catch to C facing callbacks 2019-09-07 21:35:32 +02:00
Michael Fabian 'Xaymar' Dirks
d6f1979dee project: Fix missing returns 2019-09-07 21:28:54 +02:00
Michael Fabian 'Xaymar' Dirks
5a4d38d249 project: Fix a massive list of dangerous warnings
This is a massive improvement to stability and safety when using the plugin, as all exceptions should now no longer be leaked into C controlled code, which can't actually handle exceptions at all.

Warnings fixed:

* Potentially throwing exception during library load.
* Possibly throwing function passed to C.
* Statement does nothing.
* Variable is initialized but not referenced.
* Variable overloads variable in parent scope.
2019-09-05 18:42:28 +02:00
Michael Fabian 'Xaymar' Dirks
2a4a3bf501 util-memory: Cast to intptr_t 2019-09-05 18:09:33 +02:00
Michael Fabian 'Xaymar' Dirks
4c44496b87 source-mirror: Handle uncaught exceptions in C callbacks
Fixes various crashes and undefined behavior due to exceptions falling into C code where they now wreak havoc with the current stack.
2019-09-04 20:52:37 +02:00
Michael Fabian 'Xaymar' Dirks
f65dfcbbf0 filter-blur: Don't throw exceptions into C code
It is extremely problematic to throw C++ exceptions into C code, especially because C code usually does not handle C++ exceptions at all. Therefore we have to prevent any exception from leaving the function and define it as noexcept.
2019-09-04 20:43:40 +02:00
Michael Fabian 'Xaymar' Dirks
f61cdeb582 utility-event: Fix compile errors 2019-09-04 20:30:16 +02:00
Michael Fabian 'Xaymar' Dirks
29ab00633c utility-event: Safer event handling with proper lifetime
The util::event code suffers from the problem that it could call into a class that no longer exists, corrupting memory or even crashing. By tracking lifetime using std::weak_ptr<void> this can be avoided and the dead listeners can be automatically removed.
2019-09-04 16:36:32 +02:00
Michael Fabian 'Xaymar' Dirks
da9124fc1a util-memory: Avoid MSVC specific C++ and use Std++ if available 2019-09-04 03:22:05 +02:00
Michael Fabian 'Xaymar' Dirks
82faab4380 project: Re-apply formatting 2019-09-04 03:03:41 +02:00
Michael Fabian 'Xaymar' Dirks
ce7e4c97d4 project: Don't use non-standard strcmpi 2019-09-04 03:02:19 +02:00
Michael Fabian 'Xaymar' Dirks
03c704de1a project: Correct usage of exceptions and include stdexcept 2019-09-04 02:59:04 +02:00
Michael Fabian 'Xaymar' Dirks
4765c57828 filter-sdf-effects: Don't define structs in nameless unions 2019-09-04 02:49:04 +02:00
Michael Fabian 'Xaymar' Dirks
f27320c6c9 project: Remove use of P_INITIALIZER
Does not support cross-platform very well and breaks on Apple for no apparent reason.

Add resolution scale to shader filter.
2019-09-04 02:47:27 +02:00
Michael Fabian 'Xaymar' Dirks
9ace96285d filter-dynamic-mask: Use snprintf instead of sprintf_s 2019-09-04 02:39:59 +02:00
Michael Fabian 'Xaymar' Dirks
2e98c2e754 color-grade: Fix and improve advanced options
These new options allow further control over the Tint tool in Color grading.
2019-09-04 02:18:40 +02:00
Michael Fabian 'Xaymar' Dirks
781307fbe6 color-grade: Add further Tint options 2019-09-04 01:41:15 +02:00
Michael Fabian 'Xaymar' Dirks
deeb6719c4 project: Apply formatting 2019-08-24 12:59:32 +02:00
Michael Fabian 'Xaymar' Dirks
250dc97603 gfx-effect-source: enumerate child sources correctly 2019-08-07 20:40:04 +02:00
Michael Fabian 'Xaymar' Dirks
a04d102568 gfx-effect-source: Support for textures and some crash resistance 2019-08-07 20:22:12 +02:00
Michael Fabian 'Xaymar' Dirks
f945f08ab0 strings: Texture formats 2019-08-07 20:21:39 +02:00
Michael Fabian 'Xaymar' Dirks
d7e66b17f1 filter-shader: Don't ignore all properties 2019-08-07 19:22:10 +02:00
Michael Fabian 'Xaymar' Dirks
b8fc0d5284 source-shader: Fix rendering 2019-08-07 19:20:44 +02:00
Michael Fabian 'Xaymar' Dirks
7fdd9498a0 filter-shader: Fix blending 2019-08-07 19:20:32 +02:00
Michael Fabian 'Xaymar' Dirks
90699f6b6f gfx-effect-source: Implement defaults for bool, value and matrix 2019-08-07 19:19:56 +02:00
Michael Fabian 'Xaymar' Dirks
39e6959c67 source-shader: Fix rendering and reapply parameters on change 2019-08-07 18:43:34 +02:00
Michael Fabian 'Xaymar' Dirks
181df6e3d9 filter-shader: Reapply parameters if there was a change 2019-08-07 18:43:19 +02:00
Michael Fabian 'Xaymar' Dirks
9be36d5ec4 gfx-effect-source: Add function to get "default" value 2019-08-07 18:42:54 +02:00
Michael Fabian 'Xaymar' Dirks
2b2f87e6fc gfx-effect-source: Fix validity check
Had the check inverted oops.
2019-08-07 18:16:20 +02:00
Michael Fabian 'Xaymar' Dirks
c88535c7ab gfx-effect-source: Remove/replace old defines 2019-08-07 18:11:46 +02:00
Michael Fabian 'Xaymar' Dirks
c670ab60a1 source-shader: Use custom draw video_render 2019-08-07 18:10:44 +02:00
Michael Fabian 'Xaymar' Dirks
8cb2ddaa82 source-shader, cmake: 'Shader' source 2019-08-07 18:06:48 +02:00
Michael Fabian 'Xaymar' Dirks
1b34e5210a gfx-effect-source: Expose defines to set default file and technique 2019-08-07 18:06:24 +02:00
Michael Fabian 'Xaymar' Dirks
9ad93c0ee9 filter-shader: Rename from Custom shader 2019-08-07 18:05:49 +02:00
Michael Fabian 'Xaymar' Dirks
98a18480d0 gfx-effect-source: Fix UI mode detection 2019-08-07 17:45:32 +02:00
Michael Fabian 'Xaymar' Dirks
8ec8a22928 filter-custom-shader: Add new callbacks 2019-08-07 17:37:52 +02:00
Michael Fabian 'Xaymar' Dirks
335847945d gfx-effect-source: Allow overriding value and visibility of parameters 2019-08-07 17:37:34 +02:00
Michael Fabian 'Xaymar' Dirks
ff4a556f3f filter-custom-shader: Update to use new gfx::effect_source::effect_source 2019-08-07 17:15:46 +02:00
Michael Fabian 'Xaymar' Dirks
bde4e278bf gfx-effect-source: Further work on rewrite
This partially implements most behavior to an acceptable degree for use right now.
2019-08-07 17:14:44 +02:00
Michael Fabian 'Xaymar' Dirks
845a2cbb21 gs-effect: Don't include the null character in strings 2019-08-07 17:14:14 +02:00
Michael Fabian 'Xaymar' Dirks
b88cc0fe01 gs-effect: Check correct size in get_default_string 2019-08-07 17:07:54 +02:00
Michael Fabian 'Xaymar' Dirks
8603fef897 gs-effect: Fix get_string and get_default_string 2019-08-07 16:41:26 +02:00
Michael Fabian 'Xaymar' Dirks
c6559d84ba gs-effect: Check if effect is nullptr, not if its a valid ptr
Woops, that somehow went completely by me without checking.
2019-08-07 16:17:12 +02:00
Michael Fabian 'Xaymar' Dirks
7b0159947e gs-effect: Add helpers and fix bad enable_shared_from_this 2019-08-07 16:11:09 +02:00
Michael Fabian 'Xaymar' Dirks
e59bc2fdd2 filter-custom-shader: Rewrite from scratch 2019-08-07 12:43:23 +02:00
Michael Fabian 'Xaymar' Dirks
1092dc1de1 gfx-effect-source: Complete rewrite from scratch 2019-08-07 12:42:25 +02:00
Michael Fabian 'Xaymar' Dirks
087cd79a7a filter-color-grade: Always return something in get_width/get_height 2019-08-07 12:41:34 +02:00
Michael Fabian 'Xaymar' Dirks
f5b4c1f7a1 filter-color-grade: Fix crash if color-grade.effect is missing 2019-08-04 23:20:35 +02:00
Michael Fabian 'Xaymar' Dirks
71b223dcb5 gs-effect: Add ::create for shared_ptr and remove default constructor 2019-08-04 23:19:38 +02:00
Michael Fabian 'Xaymar' Dirks
9db7cd8da2 filter-displacement: Fix crash on nullptr file path 2019-08-04 23:14:43 +02:00
Michael Fabian 'Xaymar' Dirks
0c447f4055 gs-effect: Use std::shared_ptr and track effect lifetime
This fixes the case where the effect vanishes, but we still hold an invalid pointer to a parameter of that effect. With the new code, the effect will not vanish as long as an effect pointer exists.

However, all effects must be created either through std::shared_ptr or std::make_shared. If they were not made through one of those means, the code will crash on the ->shared_from_this() call.
2019-08-04 23:12:30 +02:00
Michael Fabian 'Xaymar' Dirks
ff6f4d5ddf gs-effect: Add string support, get accessors and annotations 2019-08-04 22:44:46 +02:00
Michael Fabian 'Xaymar' Dirks
9be02e6f2b project: Fix up previous commit 2019-08-04 20:29:04 +02:00
Michael Fabian 'Xaymar' Dirks
0e350415b3 project: Apply new coding guidelines 2019-08-04 16:20:26 +02:00
Michael Fabian 'Xaymar' Dirks
533de01061 filter-color-grade: Always return true in tool_modified 2019-08-04 12:34:54 +02:00
Michael Fabian 'Xaymar' Dirks
2ca15bb28c source-mirror: Allow overriding audio layout 2019-08-04 12:34:42 +02:00
Michael Fabian 'Xaymar' Dirks
93ba39545f filter-color-grade: Implement Tool selection for OBS Studio 24.x 2019-08-03 12:29:47 +02:00
Michael Fabian 'Xaymar' Dirks
721f2bdf8f filter-color-grade: Fully feature Color Grading filter
Allows controlling Lift, Gamma, Gain, Offset, Tint and various Correction factors directly from within OBS without having to create a new LUT.
2019-08-02 23:49:18 +02:00
Michael Fabian 'Xaymar' Dirks
a6ce6c5860 utility: Add some extra functionality 2019-08-02 23:49:17 +02:00
Michael Fabian 'Xaymar' Dirks
ad270bc6ee gs-effect: Fix uninitialized member variable 2019-08-02 23:49:17 +02:00
Michael Fabian 'Xaymar' Dirks
c716e75ba3 project: Fix various catch-by-value locations 2019-07-27 19:57:50 +02:00
Michael Fabian 'Xaymar' Dirks
e887a53463 filter-sdf-effects: Fix a crash due to failed rendering
For whatever reason, the initial render target render fails when an async source is being used.
2019-07-27 19:57:49 +02:00
Michael Fabian 'Xaymar' Dirks
2c94852ba8 source-mirror: Allow changing source alignment
Adds a new property to control the alignment of the source within the calculated boundary when rescaling the source. Also fixes the permanently left aligned mirror at the same time.
2019-05-28 20:04:26 +02:00
Michael Fabian 'Xaymar' Dirks
45728702ff utility: Add recursive text lookup function
Similar to the one used in enc-amf, allows looking up string containing other strings, thus drastically simplifying the necessary time to build translated strings, while also caching them for future use.
2019-05-28 19:54:23 +02:00
Michael Fabian 'Xaymar' Dirks
95b1e81ee5 filter-dynamic-mask: Don't crash if a texture is missing
When copying or re-ordering filters, an occasional crash can be observed due to the rendering not being possible yet. With this, it will simply revert back to the original source instead of crashing.
2019-05-28 02:51:27 +02:00
Michael Fabian 'Xaymar' Dirks
ccc4c6ea22 filter-sdf-effects: Fix and improve effect rendering
Fixes the bug that rendering an outline would remove all other effects not directly under the outline, while also improving the rendering speed drastically by only initializing and clearing the rendertarget once instead of for each effect.
2019-05-28 02:51:27 +02:00
Michael Fabian 'Xaymar' Dirks
9e7894c9c3 filter-dynamic-mask: Implement Dynamic Mask filter
This filter allows the use of another source as a mask, allowing complex filter graphs and trippy effects, such as creating a text source with three animated videos, each using a different color channel as the mask.

Fixes #18.
2019-04-27 17:56:10 +02:00
Michael Fabian 'Xaymar' Dirks
c46e881697 obs-source: Don't un/register audio capture with no source
Fixes the log spam if a source could not be found.
2019-04-27 16:08:54 +02:00
Michael Fabian 'Xaymar' Dirks
8bb1ca50ac obs-source-tracker: Also keep track of sources being renamed
When a source was renamed, obs::source_tracker did not use the new name and instead relied on the old name. This caused source lists with this feature to slowly degrade over time as sources were renamed, until libobs was restarted.

With this fix the renamed sources are now properly tracked, updating as expected.

Related Issue: #64
2019-04-27 16:07:50 +02:00
Michael Fabian 'Xaymar' Dirks
f6687c7ed6 filter-displacement: Don't crash if the file can't be found
Fixes a user reported issue where obs-studio began crashing out of nowhere.
2019-04-23 17:20:18 +02:00
Michael Fabian 'Xaymar' Dirks
bbcde070f3 filter-displacement: Do not allow zero-length file names
Fixes a crash when using c_str() on an empty string, causing an unexpected crash.
2019-04-23 17:00:18 +02:00
Michael Fabian 'Xaymar' Dirks
f8e685cf42 project: Apply clang-format manually again 2019-04-19 20:40:07 +02:00
Michael Fabian 'Xaymar' Dirks
be4d42312d project: Fix all remaining portability issues
Clang on Windows and Clang on Linux behave differently, and of course GCC on Windows (MinGW) and GCC on Linux do too. This is the point where using either compiler on either platform should successfully compile the project without any issues.

Clang and GCC have a ton of warnings however, which definitely need to be fixed in the near future. Some of them are great warnings, like old C style casts, others are non-sense like suggest brackets.

Fixes #47
Fixes #60
2019-04-19 14:18:29 +02:00
Michael Fabian 'Xaymar' Dirks
aac52f736d project: Clang support
Lots and lots of errors and warnings fixed with this single commit, in the name of clang support.

Related #60, #47.
2019-04-19 09:42:15 +02:00
Michael Fabian 'Xaymar' Dirks
432b8e8c14 source-mirror: Automatically update hover text for Bounds Type 2019-04-19 08:20:33 +02:00
Michael Fabian 'Xaymar' Dirks
e24b9a61fa filter-blur: Update long description of Type and Subtype fields
Automatically updates the long description (hover text) if the Type or Subtype field is changed, allowing for more contextual information about what the selected information does.
2019-04-15 12:54:19 +02:00
Michael Fabian 'Xaymar' Dirks
c59ec2511b filter-sdf-effects: Refactor to include Glow and Stroke (#2, #4)
This refactors the SDF Effects to use a normal blend function instead of doing the blend in the effect itself, improving quality and reducing problematic sampling issues. In addition to this, the effect files have been cleaned up slightly and renamed to their proper names. Glow and Stroke are now supported, which solves both #2 and #4 in one go.

The caching optimization has also now been implemented, reducing the number of renders for this filter to 1 for each tick.
2019-04-14 14:19:59 +02:00
Michael Fabian 'Xaymar' Dirks
787409b2d9 filter-transform: Fix description for Position, Rotation, Scale & Shear
This would previously incorrectly reference descriptions that don't exist, and thus not translate correctly.
2019-04-06 18:19:35 +02:00
Michael Fabian 'Xaymar' Dirks
86e09b6f72 obs-source: Explicitly clear events and copy events 2019-04-03 06:44:04 +02:00
Michael Fabian 'Xaymar' Dirks
fa60be1593 source-mirror: Fix incorrect source alignment
This bug was introduced in 0.6.0 and had sources render half offscreen to the left, as the alignment 4 meant "center left" instead of just "center".
2019-04-03 06:13:23 +02:00
Michael Fabian 'Xaymar' Dirks
2a53e84bdb filter-blur: Fix more compiler warnings 2019-04-03 02:59:48 +02:00
Michael Fabian 'Xaymar' Dirks
bdf6b893ab source-mirror: Fix a dead lock issue and use a queue system
This fixes a dead lock due to attempting to lock the same filter mutex twice, causing libOBS to completely lock up on every mutex. This extends the fix for 4fc25cfd8d.

Additionally this switches to a proper queue system for audio, so we no longer cause audio stuttering or audio skipping.
2019-04-03 02:58:54 +02:00
Michael Fabian 'Xaymar' Dirks
721bdaf642 project: Reapply clang-format globally 2019-04-03 00:19:01 +02:00
Michael Fabian 'Xaymar' Dirks
b1d7814c64 gs-helper: Add managed obs graphics context
To further distance the code from having to do too much manually, the graphics context is now available as a managed class. All places that previously used obs_enter_graphics and obs_leave_graphics are now using the new gs::context class instead.
2019-04-03 00:16:13 +02:00
Michael Fabian 'Xaymar' Dirks
8ebdde5d36 obs-source: Fix additional compiler warnings 2019-04-02 22:58:50 +02:00
Michael Fabian 'Xaymar' Dirks
ad22341ab0 source-mirror: Fix a few compiler warnings 2019-04-02 22:46:11 +02:00
Michael Fabian 'Xaymar' Dirks
4fc25cfd8d source-mirror: Don't render scene items with 0 size
libOBS will simply forget to unlock a mutex if you set the boundary size to zero, resulting in the filters dialog for that source simply getting stuck. Why video rendering can affect the audio filter dialogs is a question for another time, but it's best to just accept it and move on.
2019-04-02 22:10:23 +02:00
Michael Fabian 'Xaymar' Dirks
5738e51e73 obs-source: Also move events in move constructor and operator 2019-04-02 22:08:20 +02:00
Michael Fabian 'Xaymar' Dirks
381aa3ecd4 source-mirror: Correctly check for Audio and Video source
Previously this would not do anything correctly, as the call to obs_source_get_flags does not return anything for most sources. Instead obs_source_get_output_flags should be used to verify that we actually have a video or audio capable source to work with.
2019-04-02 20:19:40 +02:00
Michael Fabian 'Xaymar' Dirks
4d66938832 source-mirror: Replace obs_enum_* with obs::source_tracker
obs::source_tracker allows us to do more over more versions of OBS Studio, so we are able to enumerate any and all Sources, Scenes and Transitions that weren't created private. If we were to rely on libOBS for this, we would need to limit ourselves to version 23 or higher, but with this we can go very far back - as far back as the global event system was fully supported.
2019-04-02 20:19:10 +02:00
Michael Fabian 'Xaymar' Dirks
ee97321319 filter-blur: Add empty entry to the Mask Source input 2019-04-02 19:58:14 +02:00
Michael Fabian 'Xaymar' Dirks
ddf75d3e9f obs-audio-capture: Remove unused code 2019-04-02 19:45:10 +02:00
Michael Fabian 'Xaymar' Dirks
bcf5b56c44 source-mirror: Switch to obs::source audio capture 2019-04-02 19:44:48 +02:00
Michael Fabian 'Xaymar' Dirks
8fb7d193f5 obs-source: Add audio capture and selectively listen to events
Audio capture previously needed an additional class, however there is no need for this if this can be done together with the actual obs::source object. So obs::source now has a new audio_data event that can be listened to, which handles capturing audio data if requested.

Additionally all other events are now selectively listened to, instead of permanently listening to them. This should drastically reduce the overhead of using obs::source.
2019-04-02 19:30:25 +02:00
Michael Fabian 'Xaymar' Dirks
1b7de8b6b1 util-event: Automatically clear event listeners when destructed 2019-04-02 19:11:26 +02:00
Michael Fabian 'Xaymar' Dirks
8e9e39a88e project: Remove unused content 2019-04-02 04:37:37 +02:00
Michael Fabian 'Xaymar' Dirks
21eef998ec filter-blur: Refactor to use new Blur code
This removes the ridiculous amount of hardcoded values and functions and moves everything to the more modular blur approach.

Fixes #45
Fixes #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
7c4d46c1fe gfx/blur/dual-filtering: Implement Dual Filtering Blur
Dual Filtering (or Dual Kawase) is an approximation of Gaussian Blur that can reach much higher Blur sizes at a much lower cost. However it is locked to a 2^n size, which means that currently it isn't possible to use it for blur sizes like 19, 24 and 31.

The Blur works by using the linear sampling of a GPU, combined with down- and upsampling and carefully placed sampling points. This means that there is no need for a linear optimized version of this Blur.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
b6d45ce73c gfx/blur/gaussian-linear: Refactor Linear Gaussian Blur
While Gaussian Blur is not a Blur type that really benefits much from linear sampling, it can be used for a slight quality and gpu usage reduction. However for Area and Directional Blur there is a better alternative: Dual Filtering Blur. And as with all other currently implement Linear versions of Blur, only Area and Directional Blur are supported.

This type of Gaussian Blur also has the loading hitch that exists in normal Gaussian Blur.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
fedc8e075c gfx/blur/gaussian: Refactor Gaussian Blur
Gaussian Blur is another Blur that now supports the new system, increasing the maxium Blur size to 128 and adding support for Rotational and Zoom blur. Various optimizations were done to the actual shader code which further reduced the GPU usage.

Currently the Gaussian curve is recalculated when the blur is first created, which can lead to a short hitch due to it having to search for the correct kernels. This is currently unavoidable and expected behavior until a better solution is found.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
68a8fb9224 gfx/blur/box-linear: Refactor Linear Box Blur
Box Blur is a prime candidate for Linear optimizations, and as such reducing the total necessary samples by about half. However due to the reduction in samples, only Area and Directional Blur are supported.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
8c5dc3c630 gfx/blur/box: Refactor Box Blur
Box Blur is the first to be on the new system and has received all the new features and optimizations available. The maximum Blur size has been increased to 128, Rotational and Zoom Blur are supported and a small optimization has been done to the shader.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
395e284a37 gfx/blur/base: Newly refactored blur code base
This is the new code base for blur effects, which is much more effective at being re-usable than the old code base. It allows for much better extendable behavior and uses an interface and factory pattern, instead of hardcoding supported features.
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
3f92e1cc89 utility: Move helper macros
As not everything in the plugin needs to use these, they have no place in the plugin header, and thus are now in utility.hpp
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks
18b8cc2b5c obs-source-tracker: Use the output flags instead of flags
This fixes being able to filter by the source type (audio, video).
2019-03-01 20:38:49 +01:00
Michael Fabian 'Xaymar' Dirks
f902f8f0f5 filter-blur: Actually call load in the load signal 2019-03-01 20:38:06 +01:00
Michael Fabian 'Xaymar' Dirks
ba00fbb97e project: Fix even more warnings 2019-03-01 12:00:30 +01:00
Michael Fabian 'Xaymar' Dirks
da6feda981 source-mirror: Remove double mutex lock 2019-03-01 11:37:24 +01:00
Michael Fabian 'Xaymar' Dirks
c0f951d855 project: Fix various warnings 2019-03-01 11:33:19 +01:00
Michael Fabian 'Xaymar' Dirks
133978bbca util-math: Remove alignment from vec2a 2019-03-01 11:14:06 +01:00
Michael Fabian 'Xaymar' Dirks
fa502734ce filter-blur: Allow direct rendering
Small performance optimization as this removes the extra texture render that would be done by libobs which we don't actually need as we already have a texture to render to for it.
2019-03-01 10:59:11 +01:00
Michael Fabian 'Xaymar' Dirks
1c072d67cb filter-transform: Validate source size each tick
Rendering happens with cached Geometry that is only updated when necessary, such as when the user changes settings. This optimization was necessary to reduce CPU and GPU usage as we can simply re-use the same geomtry instead of recalculating it.

However, the actual source size was never checked. That meant that when a source changed size through any means, the filter would not update the geomtry accordingly, and the result was a squished or stretched image.

With this, the source size is now checked each tick.

Fixes #48
2019-02-15 13:52:44 +01:00
Michael Fabian 'Xaymar' Dirks
3bf1333c84 project: Restructure of the file system
The number of files in the source directory was a little bit much and just made file naming more complex than it had to be. Therefore all files were moved into subdirectories where it matters.

Filters now reside in source/filters/, Sources in source/sources/, OBS Wrappers in obs/, OBS GS Wrappers in obs/gs/, Transitions will reside in source/transitions, Graphics Helpers will be in gfx/.
2019-02-11 04:03:57 +01:00
Michael Fabian 'Xaymar' Dirks
3e4930e6e0 filter-transform: Fix incorrect names for properties and options
MipGenerator.Strength was renamed to MipGenerator.Intensity, which better fits the actual intention of the property. Additionally all the mipmap generator options are now correctly named.
2019-02-11 04:03:56 +01:00
Michael Fabian 'Xaymar' Dirks
9f28144b0b filter-blur: Properly set Image(s) filter for path property 2019-02-01 19:58:05 +01:00
Michael Fabian 'Xaymar' Dirks
43136b00c4 filter-blur: Precalculate correct filter width for Gaussian
Gaussian blur used to have a hard edge which was caused by the filter width being wider than the actual sampling range, which is what is determined by the size option. In order to fix this, we have to figure out the proper filter width for a sampling range, so that we avoid any and all hard edges.

Additionally removes the old texture method entirely.

Fixes #44
2019-02-01 08:35:58 +01:00
Michael Fabian 'Xaymar' Dirks
10f7047042 util-math: Add templated gaussian function 2019-02-01 08:35:58 +01:00
Michael Fabian 'Xaymar' Dirks
3ee815b152 filter-sdf-effects: Extend shadow range to -16...16 2019-01-31 04:53:39 +01:00
Michael Fabian 'Xaymar' Dirks
cfc828f0f8 source-mirror: Fix crash with audio sources and late video sources
Source Mirror would incorrectly crash if an Audio only source was selected, as it expected a video frame to be present of any size. This fixes the problem by first testing if there is any video information to render and then just catching any exception that happens during rendering.
2019-01-31 02:57:18 +01:00
Michael Fabian 'Xaymar' Dirks
f5424d1aad gs-effect: Replace OBS cached file loading with custom one
The normal OBS behavior is to cache files that are loaded from disk, however this is not the behavior we want at all, as it can miss file updates as it never checks the disk for an updated file.

So instead of relying on OBS, this implements the file reading and effect creation without the cache. If a cache is necessary, it would not be the job of this class.
2019-01-31 02:30:18 +01:00
Michael Fabian 'Xaymar' Dirks
75009c617a filter-sdf-effects: Support for scaling SDF Texture Size
This allows increasing or decreasing the accuracy of the Signed Distance Field at runtime without requiring the initial source to be resized. Use case for this would be small text where the higher quality would only be noticable on the shadow and not the text itself.
2019-01-30 03:12:12 +01:00
Michael Fabian 'Xaymar' Dirks
493ef5da23 filter-sdf-effects: Move factory definitions before instance 2019-01-30 02:39:42 +01:00
Michael Fabian 'Xaymar' Dirks
7cf3e17b9b filter-sdf-effects: Fix black border and add inverse gradient shadow
Sources were rendering with a black border around them if they had a soft fade, which is due to how the shadow calculated the image sample. With the new shader code this is now fixed and the source looks like it should be. Additionally this removes the bug where enabling any shadow would cause only the texels to draw that were above the threshold.

Additionally this adds support for inverse gradients (min > max) and negative gradients for outer shadows instead of only positive gradients. This technically allows for cleaner shadows.
2019-01-30 02:38:34 +01:00
Michael Fabian 'Xaymar' Dirks
3ebbc84ee2 filter-sdf-effects: Rename Shadow (SDF) Filter (Part 2)
This finalizes the rename started in the previous commit by changing the class name and also updating the locale strings
2019-01-29 07:35:14 +01:00
Michael Fabian 'Xaymar' Dirks
a7161b51e0 filter-sdf-effects: Rename Shadow (SDF) Filter (Part 1)
The nature of this Signed Distance Field based Filter is not to only draw shadows, but to also draw an outline or even glow around a source. Therefore the name "Inner/Outer Shadow (SDF)" does not fit well with the intent of the actual Filter.
2019-01-29 04:35:12 +01:00
Michael Fabian 'Xaymar' Dirks
a56cbf89a9 filter-blur: Refactoring 2019-01-28 01:08:13 +01:00
Michael Fabian 'Xaymar' Dirks
4eb3197720 gfx-source-texture: Don't create two references to the same source 2019-01-28 00:47:36 +01:00
Michael Fabian 'Xaymar' Dirks
c529e45cfd filter-blur: Refactoring, one-time rendering, fix mask logic
Unfortunately load is never called on filters.
2019-01-28 00:00:45 +01:00
Michael Fabian 'Xaymar' Dirks
97bf38633b gfx-source-texture: Release child source if add_active_child fails 2019-01-27 23:33:38 +01:00
Michael Fabian 'Xaymar' Dirks
10c0081f32 project: Refactoring Part 2 2019-01-27 23:33:12 +01:00
Michael Fabian 'Xaymar' Dirks
39b0600aa3 filter-blur: Update in load and create 2019-01-27 23:30:37 +01:00
Michael Fabian 'Xaymar' Dirks
8a64e360c4 filter-blur: Switch to obs-source-tracker
Completely eliminates the need for obs_emum_sources and obs_enum_scenes, thus improving backwards compatibility.
2019-01-27 23:19:09 +01:00
Michael Fabian 'Xaymar' Dirks
fa4a81bb54 gfx-source-texture: Delete copy and move constructors and operators 2019-01-27 22:50:35 +01:00
Michael Fabian 'Xaymar' Dirks
a15f1934b3 filter-custom-shader: Do not build for release
This feature is postponed until 0.6.0 for stability and UI/UX issues.
2019-01-27 22:44:45 +01:00
Michael Fabian 'Xaymar' Dirks
551cbb83b1 obs-source-tracker: Source Tracking Compatibility Layer
Allows for enumerating any kind of source, as long as it has a name and is not private. As obs_enum_scenes is a 23.x and above function, this class should be used instead to remain backwards compatible.
2019-01-27 22:43:49 +01:00
Michael Fabian 'Xaymar' Dirks
d56c0d6f25 project: Refactoring Part 1 2019-01-25 17:55:36 +01:00
Cat Stevens
b91700e74f filter-blur: delete pointer in destroy() (#42) 2019-01-25 17:40:59 +01:00
Michael Fabian 'Xaymar' Dirks
3ac7e46628 filter-shadow-sdf: Remove shadow_sdf namespace, rename shadow_sdf_instance to shadow_sdf 2019-01-25 00:55:40 +01:00
Michael Fabian 'Xaymar' Dirks
7708dd0792 filter-shadow-sdf: Refactoring, fix and optimize rendering
Fixes the m_source_texture = nullptr bug, which happened due to m_tick and m_last_tick both being 0, as no video_tick is called when the source is first created. Instead a boolean flag is now used that is reset to false on each video_tick.
2019-01-25 00:54:34 +01:00
Michael Fabian 'Xaymar' Dirks
d29f5ce477 filter-transform: Transform to transform, ...Addon to ..._factory 2019-01-25 00:38:20 +01:00
Michael Fabian 'Xaymar' Dirks
2aa4595bd3 filter-displacement: Rename Displacement to displacement, ...Addon to ..._factory 2019-01-25 00:38:01 +01:00
Michael Fabian 'Xaymar' Dirks
7a61006d2b source-mirror: Rename Mirror to mirror, ...Addon to ..._factory 2019-01-25 00:36:54 +01:00
Michael Fabian 'Xaymar' Dirks
a37d9bbb59 filter-shadow-sdf: Actually delete instances in destroy()
This fixes a memory leak discovered by @catb0t.

Related #33
2019-01-25 00:31:50 +01:00
Michael Fabian 'Xaymar' Dirks
ddfb08f39e filter-displacement: Update file logic and rendering
This replaces the use of gs_texture_t* with gs::texture, further improving stability. Additionally some of the useless checks were replaced or reduced.
2019-01-25 00:28:06 +01:00
Michael Fabian 'Xaymar' Dirks
0bdf8e3bba filter-displacement: Use gs::effect instead of gs_effect_t*
The managed gs::effect class handles all acquire and release calls for us. Also slightly simplifies the video_render logic.
2019-01-25 00:28:06 +01:00
Michael Fabian 'Xaymar' Dirks
fedb6e3259 filter-displacement: Further refactoring 2019-01-25 00:28:06 +01:00
Michael Fabian 'Xaymar' Dirks
c1995c03a9 filter-displacement: Refactor to match new class structure 2019-01-25 00:28:05 +01:00
Cat Stevens
c749f5dd62 obs-audio-capture.hpp: missing memory include 2019-01-24 23:30:42 +01:00
Michael Fabian 'Xaymar' Dirks
160ad3b5a9 locale: Replace file filters with file types
The filters are always the same for every language and should not be translated, instead only the file type should be translated. This way bad translations will not affect the options that the user can select.
2019-01-24 20:34:28 +01:00
Michael Fabian 'Xaymar' Dirks
0ae120835a filter-transform: Optimize rendering, fix bad property names
The Transform filter will now no longer render the child source more than once per tick(), resulting in an overall speed up for heavy sources. This also applies to mipmapping and shape rendering. Any other calls to video_render will instead just use the cached texture.

Additionally the crash on exit has been fixed which was caused by strings.hpp containing static const char*s and using these directly in obs calls. Instead we now use #define for those property names
2019-01-24 20:20:34 +01:00
Michael Fabian 'Xaymar' Dirks
e28334d27b util-memory: Fix alligned_alloc for MSVC
Microsofts _aligned_malloc has size and alignment switched around, which causes an unwanted exception.
2019-01-24 20:18:28 +01:00
Michael Fabian 'Xaymar' Dirks
b3c2845d15 filter-transform: Refactoring and formatting 2019-01-24 15:57:33 +01:00
Michael Fabian 'Xaymar' Dirks
e4a534fbfe plugin: Remove legacy instance references
The modern system is a self-registering system using initializers and finalizers
2019-01-24 14:26:08 +01:00
Michael Fabian 'Xaymar' Dirks
406326b378 util-math: Add 16-byte aligned version of vec2 2019-01-24 05:14:17 +01:00
Michael Fabian 'Xaymar' Dirks
98baa0d98b filter-transform: Fix order of functions 2019-01-24 04:35:22 +01:00
Michael Fabian 'Xaymar' Dirks
ff6176d7bc filter-transform: Destructor comes before Constructors 2019-01-24 04:33:56 +01:00
Michael Fabian 'Xaymar' Dirks
c1441e72c0 filter-transform: Refactor to match source-mirror structure 2019-01-24 04:32:14 +01:00
Michael Fabian 'Xaymar' Dirks
9d55013ec2 source-mirror: Improve rendering and add new rescaling options
Rendering will now use a cached version of the mirrored source in order to reduce rendering cost drastically for heavy sources or scenes. Additionally rescaling now uses the internal scene instead of being a custom implementation, allowing for some new things.

Rescaling now has a new option: Bounds Type! This option allows control over just how a source is scaled, by default it is set to Stretch, but there are other options that can keep the aspect ratio of the mirrored source in tact.

Additionally the ScalingMethod struct has been replaced with obs_scale_type, which means that Bilinear Low Resolution is now no longer an option.

Implements #35
2019-01-24 04:28:11 +01:00
Michael Fabian 'Xaymar' Dirks
82f64d16eb source-mirror: Refactoring and partially revert 4bb32a71bc
Initialization happens in the constructor again, as using a delayed initialization only caused update() to be slower.

Additionally refactored some variable names to make more sense.
2019-01-24 01:12:48 +01:00
Michael Fabian 'Xaymar' Dirks
144323bec3 source-mirror: Revert thread name from c5e02af178 2019-01-24 01:00:38 +01:00
Michael Fabian 'Xaymar' Dirks
6b7ef2d3ed gfx-source-texture: Allocate a render target in constructor
Can't really render without one.
2019-01-24 00:12:42 +01:00
Michael Fabian 'Xaymar' Dirks
bf35b54957 gs-rendertarget: Don't ignore failed creation of render target 2019-01-24 00:08:26 +01:00
Michael Fabian 'Xaymar' Dirks
04ddf76920 source-mirror: Release reference in modified_properties callback
Fixes the problem where additional references to other sources would appear if properties are opened or modified.

Fixes #34
2019-01-23 23:23:49 +01:00
Michael Fabian 'Xaymar' Dirks
4bb32a71bc source-mirror: Use load() and update() for initialization
load() is guaranteed to happen after all sources have been created and no earlier, and we can use update() to guarantee that we don't need to duplicate our initialization code in case we go back to initializing earlier than load().
2019-01-23 22:25:48 +01:00
Michael Fabian 'Xaymar' Dirks
b2b3f5fde8 source-mirror: Add empty list entry to select no source 2019-01-23 22:04:25 +01:00
Michael Fabian 'Xaymar' Dirks
c5e02af178 source-mirror: Remove unused references, set scene and thread name 2019-01-23 22:03:47 +01:00
Michael Fabian 'Xaymar' Dirks
73b96b8900 source-mirror: Fix various issues, reformat, redesign
This fixes the multi-reference issue that caused Source Mirror to keep a permanent reference to a source that should have been released.

The obs::audio_capture was also updated to now use the util::event code for improved callback support. There are a bunch of new additional checks in the acquire_input function that prevent bad references from happening, and is also now self-cleaning through the use of obs::source
2019-01-23 21:06:05 +01:00
Michael Fabian 'Xaymar' Dirks
911b8a1cf4 obs-audio-capture: Use util::event and delete move and copy operator
By using util::event a single obs::audio_capture can now have multiple callbacks for the same data, without requiring additional obs::audio_capture to be present. Additionally it allows us to stop listening on an obs callback if there are no actual listeners, and start listening as soon as there is a listener.

Move and Copy constructors are currently not supported by this class and thus have been marked deleted. Internally also now using obs::source to keep track of the used source.
2019-01-23 20:06:30 +01:00
Michael Fabian 'Xaymar' Dirks
52af973014 util-event: Listen, Silence callbacks and other operators 2019-01-23 20:02:50 +01:00
Michael Fabian 'Xaymar' Dirks
9848c5aa28 obs-source: Implement copy and move constructors and operators
There was no proper implementation for all copy and move constructors and operators before, which meant that occasionally the default behavior took over. This is not what we want, as the default behavior doesn't deal well with reference counted pointers.

Related: #32, #33
2019-01-23 18:49:20 +01:00
Michael Fabian 'Xaymar' Dirks
f910312a2d gfx-effect-source: Make destructor virtual 2019-01-23 02:26:32 +01:00
Michael Fabian 'Xaymar' Dirks
5a54a67946 project: Remove unused parameters and fix additional warnings 2019-01-23 02:26:32 +01:00
Michael Fabian 'Xaymar' Dirks
f0fa36a19e source-mirror: Fix format string and remove unused parameters 2019-01-23 02:26:32 +01:00
Michael Fabian 'Xaymar' Dirks
52f4e4641f project: Additional #ifdef _MSC_VER checks 2019-01-23 02:26:32 +01:00
Michael Fabian 'Xaymar' Dirks
f41bd2c7c1 source-mirror: Remove unnecessary register keyword
This keyword also no longer exists in C++17
2019-01-23 02:26:32 +01:00
Michael Fabian 'Xaymar' Dirks
ec544bddb3 gs-texture: Move ENABLE_BITMAPS_OPERATORS to global scope 2019-01-23 02:26:32 +01:00
Michael Fabian 'Xaymar' Dirks
e0e2d9fe80 project: Improve Linux support (#27 and #13)
While Linux was not an original goal of the project, it should still be supported out of the box. Therefore a number of changes are contained in this changeset:

- All C++ .h files were renamed to .hpp.
- All C includes (<....h>) were replaced with C++ includes (<c...>) and missing includes were added.
- std::memset and std::memcpy was replaced with memset and memcpy.
- All anonymous structs were removed where necessary.
- `extern "C"` was removed where it wasn't needed.
- #pragma warning was placed behind an #ifdef _MSC_VER
- The macros for `min`, `max` and `clamp` were removed as they were not used.
- `-fpedantic` was added to the GCC flags for bitmask support.
- `gs::rendertarget_op` is now declared before use.
- std::exception(const char*) was replaced with std::runtime_error(const char*).
- Added aligned_alloc and aligned_free macros for GCC and MSVC support.
- Replaced use of `sprintf_s` with `snprintf`.
- Placed additional guards around windows only code.

Additonally some changes were made that do not affect Linux:
- `NOMINMAX` and `NOINOUT` were removed.

Fixes: #27
Fixes: #13
2019-01-14 22:31:35 +01:00
Michael Fabian 'Xaymar' Dirks
ca1e26fd20 filter-shadow-sdf: Fix crash when adding source
I'm not sure how this one passed by me. Or how this worked, as I have screenshots and videos of it working before applying this fix.
2018-12-23 23:48:08 +01:00
Michael Fabian 'Xaymar' Dirks
95fdcff3a9 cmake: Reworked build system for Installers and Archives 2018-12-23 21:15:05 +01:00
Michael Fabian 'Xaymar' Dirks
c94a3fa11f util-math: Use C++ math header 2018-12-23 19:57:07 +01:00
Michael Fabian 'Xaymar' Dirks
3952c33c60 filter-blur: Add Directional Blur (Motion Blur) and Step Scaling
Directional Blur (also known as Motion Blur in some art software) enables full control over the direction the passes are applied in, which can further be combined with the scaling option. With this very simple blur effects can have a massively bigger influence.

Step Scaling allows for improved control over individual Blur passes and can be combined with Directional Blur to imitate certain effects. It also allows smaller Blur sizes to cover a larger area, although with a drastic loss in final quality. For example, if someone is streaming at 720p and wants to have their dynamic 2160p background blurry to a very high degree, this option would allow that at next to no quality loss in the final stream. The actual values that need to be used vary for each source and encoder however, so they will have to be chosen carefully.
2018-12-23 19:54:57 +01:00
Michael Fabian 'Xaymar' Dirks
ad97eeebe7 filter-blur: Fix translucent source rendering and modernize code
Translucent sources previously rendered with wrong alpha, which caused sources to look different than they should. With the new code, this is no longer the case and instead now renders the source correctly.

Additionally the modernized code should reduce any problems with rendering by reducing the amount of duplicated manually written code and instead using classes.
2018-12-23 18:27:24 +01:00
Michael Fabian 'Xaymar' Dirks
fd14fd62a6 gs-rendertarget: Add function to get texture directly 2018-12-23 17:56:52 +01:00
Michael Fabian 'Xaymar' Dirks
a6f9451654 filter-blur: Switch to Kernel Array instead of Kernel Texture
This speeds up Gaussian Blur and Linear Gaussian Blur drastically reduces time spent reading textures and instead uses existing registers - maximizing time spent reading the actual image texture.

See Also: #21 Blur Quality
2018-12-23 02:00:30 +01:00
Michael Fabian 'Xaymar' Dirks
92c4b54177 filter-blur: Add Linear Gaussian Blur
Similar to Linear Box Blur, this version of Gaussian Blur reduces the total number of sample by up to n. This results in a total sample count (per pass) of O(n+1) for even radii and O(n+2) for odd radii. The quality sacrificed to do this is higher this time, though careful adjustment of the halfTexelDelta value can bring it much closer to normal Gaussian Blur. The current offset however had no noticable effects on visual quality.

See Also: #21 Blur Quality
2018-12-22 22:54:30 +01:00
Michael Fabian 'Xaymar' Dirks
93df9b50b8 filter-blur: Add Linear Box Blur and combine all effects
Linear Box Blur abuses the fact that with Linear Sampling we can sample up to four adjacent texels at the same time and get a correct result for Box Blur back. Using this the total number of sample for Box Blur is reduced by n, making the total either n+1 (Even Radius) or n (Odd Radius).

Additionally all blur effect files have been merged into a single blur.effect file to reduce the time required to change a single parameter name. New blur effects should be added as a new technique instead of as a new effect file.

See Also: #21 Blur Quality
2018-12-22 22:08:55 +01:00
Michael Fabian 'Xaymar' Dirks
0c92f3dbf5 filter-shadow-sdf: Inner/Outer shadow based on signed distance fields
Adds Inner/Outer Shadows for dynamic sources based on signed distance field generation. This is fast, but does add a bit of latency when it comes to updates - which means that moving objects will leave a trail before the generator has a chance to update.

Fixes #3
2018-11-08 13:52:43 +01:00
Michael Fabian 'Xaymar' Dirks
c0cb20300b filter-blur: Rename factory and instance to blur_* 2018-11-08 11:16:55 +01:00
Michael Fabian 'Xaymar' Dirks
1aa42c58f0 plugin: Fix double plugin name in log line 2018-11-08 11:16:33 +01:00
Michael Fabian 'Xaymar' Dirks
844fcee0bd source-mirror: Additional protections against crashes on impossible behavior 2018-11-08 08:17:04 +01:00
Michael Fabian 'Xaymar' Dirks
ac06ff48bc source-mirror: Fix crash caused by source renames and forced destroy of a source 2018-11-08 08:08:38 +01:00
Michael Fabian 'Xaymar' Dirks
9ffe53754b obs-source: Add support for all signals on a source 2018-11-08 08:08:06 +01:00
Michael Fabian 'Xaymar' Dirks
79daeb5a75 util-event: Template event handler class 2018-11-08 08:07:49 +01:00
Michael Fabian 'Xaymar' Dirks
e4a5b34745 gfx-source-texture: Check for valid child and parent 2018-11-08 04:26:01 +01:00
Michael Fabian 'Xaymar' Dirks
6d25342302 obs-source: Check for early source destruction
This should prevent problems where the source is destroyed but a pointer is still around to it.
2018-11-08 04:25:21 +01:00
Michael Fabian 'Xaymar' Dirks
11fc32f935 source-mirror: Fix crash with audio mirroring
Fixes #23
2018-11-07 15:29:24 +01:00
Michael Fabian 'Xaymar' Dirks
b87ca70796 project: Formatting 2018-11-07 15:24:25 +01:00
Michael Fabian 'Xaymar' Dirks
16f55ca583 source-mirror: Fix crash with audio data on obs_shutdown (#22)
Due to the lack of checking aud and aoi, a rare race condition crash can be observed with audio mirroring enabled on closing OBS. In this case, aoi is used even though it is null, causing OBS to crash instead of closing normally.

Fixes #22
2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks
b5339b4429 source-mirror: Add support for scenes and fix last commit 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks
c084a0bfd0 source-mirror: Use a private scene source for rendering 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks
0be79842e7 filter-transform: Fix various warnings 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks
eef9f0697d gfx-effect-source: Fix various warnings 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks
55abc87126 plugin: extern "C" around obs includes 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks
f54efe7704 gfx-source-texture: Support for new obs-source managed class
This also adds support for proper source management in unmanaged cases.
2018-11-07 14:44:06 +01:00
Michael Fabian 'Xaymar' Dirks
234cbf5dab obs-tools: Various obs related tools 2018-11-07 14:44:06 +01:00
Michael Fabian 'Xaymar' Dirks
9c0761adde obs-source: Managed class for obs_source_t 2018-11-07 14:44:06 +01:00
Michael Fabian 'Xaymar' Dirks
daad792eda filter-blur: Add support for scene as mask input (#14)
Adds full support for Scenes as mask input so that you can re-use your overlay scene as a blur input and have the blur follow behind your overlay.

Closes #14
2018-10-01 01:03:48 +02:00
Michael Fabian 'Xaymar' Dirks
382a217f06 filter-blur: Add support for image and source masks (#14) 2018-10-01 01:00:00 +02:00
Michael Fabian 'Xaymar' Dirks
ebbc0cb1ce filter-blur: Fix Mask Type and split Color into Color and Alpha 2018-10-01 00:57:22 +02:00
Michael Fabian 'Xaymar' Dirks
999df5e6e5 gfx-source-texture: Refactoring 2018-10-01 00:54:18 +02:00
Michael Fabian 'Xaymar' Dirks
d56f4f9eac filter-blur: Add proper mask options
* Removes the old 'Region' fields and places them under a 'Mask' option that can do much more.
* Supported Mask types: Region, Image, Source.
* Image and Source mask types allow for a color filter and multiplier.
2018-09-30 22:48:47 +02:00
Michael Fabian 'Xaymar' Dirks
cfaa7eb1b9 strings: Add translated File Filters for Images 2018-09-30 21:55:13 +02:00
Michael Fabian 'Xaymar' Dirks
f327f4ccc6 util-math: Undefine macro 2018-09-30 21:44:00 +02:00
Michael Fabian 'Xaymar' Dirks
3135214a03 filter-blur: Refactor and formatting
* Now using a Factory and Instance approach to simplify and beautify the code at the same time.
* Additionally we now keep track of created filters and only load data if there is a filter active, and unload data if there are no more filters. This reduces memory and GPU overhead when no filter is active, but adds a first time filter creation overhead.
* Variables and functions now use snake_case.
2018-09-30 20:50:00 +02:00
Michael Fabian 'Xaymar' Dirks
354445bc81 strings: Remove plugin:: namespace 2018-09-30 20:18:13 +02:00
Michael Fabian 'Xaymar' Dirks
8296af68c6 project: Rename 'Filter' to 'filter' 2018-09-30 18:49:52 +02:00
Michael Fabian 'Xaymar' Dirks
da22e72da7 filter-transform: Fix mipmapping for npot input
The filter will now automatically rescale the parent stack into the next best power of two size. With this, even non-power-of-two sources can now be mipmapped semi-correctly.

To accurately support mipmapping even for npot textures, this feature would have to be built into OBS and OBS would have to stop refusing to create textures with mipmaps that are not a power of two in size. Almost all common Direct3D 11 (except Intel) are capable of npot mipmaps at full speed, while OpenGL usually depends on the GPU and Driver used.
2018-09-29 17:05:58 +02:00
Michael Fabian 'Xaymar' Dirks
6561ea9b3c util-math: Rename get_power_of_two to get_power_of_two_exponent 2018-09-29 16:57:41 +02:00
Michael Fabian 'Xaymar' Dirks
9a8a44045b gs-mipmapper: Fix support for very small mipmaps
This fixes the final mip map of a texture being empty, in cases where either width or height is reduced to just a single pixel.
2018-09-29 16:57:17 +02:00
Michael Fabian 'Xaymar' Dirks
0a7283b2ba filter-transform: more Formatting, add mipmap options 2018-09-29 15:57:25 +02:00
Michael Fabian 'Xaymar' Dirks
dbe577e372 filter-transform: Formatting, refactoring and mipmapping
The '3D Transform' filter now support mipmapping using the Linear generator. This results in smoother images when the shape is squished or distant, instead of a pixelated mess.
2018-09-29 01:07:38 +02:00
Michael Fabian 'Xaymar' Dirks
7c520ae9ee gs-mipmapper: Implement actual mipmap generation
This enables full mipmapping support for textures with a shader view that allows accessing different mip levels. In order to access mip levels, you have to specify gs::texture:🎏:BuildMipMaps when creating the texture, as OBS currently forces the maximum mip level to 1 even if you actually have mip data available.
2018-09-29 01:06:30 +02:00
Michael Fabian 'Xaymar' Dirks
c591902fea gs-texture: Allow texture creation without data
This is a valid operation and allows for creation of uninitialized textures, which can be copied to but should not be read from until that moment.
2018-09-28 23:34:43 +02:00