Commit Graph

843 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks 0eddfd75ae util/threadpool: Formatting and allow cancelling of tasks 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks a9bb56c5ee project: Optimize to use single fullscreen tri instead 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks 775e27caff gs-helper: Only include debug markers if profiling is enabled 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks 49f1cbc15e project: Improve performance profiling support
Adds a new CMake option "ENABLE_PROFILING" which enables all CPU and GPU performance profiling available in StreamFX for tracking what's actually causing things to be slow.
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 071760b867 ffmpeg-encoder/nvenc: Invert "no-scenecut" option for "Adaptive I-Frames"
Our "Adaptive I-Frames" is the inverse of the expected parameter to "no-scenecut" in FFmpegs NVENC.

Related #191
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 0966b61f76 ffmpeg-encoder/nvenc: Test for "h264_nvenc" in for "Adaptive B-Frames"
Fixes the bug where "Adaptive B-Frames" would not be applied in the way it was expected to be applied.

Related: #191
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks fb024cad73 gfx-blur-dual-filtering: Implement asynchronous rendering
Asynchronous rendering allows the GPU to perform work while the CPU performs other work, and is significantly faster than lockstep immediate rendering. By reusing existing render targets we can see a performance improvement of up to 500%, while still doing the same things.
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 9b13d64551 filter-blur: Add debug markers for performance tracking 2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 6e8135dc98 gfx-blur-*: Add debug markers for performance tracking 2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 4947d46aa1 gs-mipmapper: Update API usage, remove broken options and optimize
The new libOBS API allows us to directly access the underlying API instead of having to mess around in memory. By using it we can avoid crashing in case the compiler for it is different, or in case the actual back end structure changes.

Additionally the mostly unimplemented and unused options have also been removed, which streamlines the use of this class even further and reduces both shader and code complexity.

Finally by optimizing the use of the internal render target we can achieve a speed up of up to 3000% over the old way, allowing for many more mipmapped filters.
2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks 47a22ce462 gs-vertexbuffer: Initialize memory to 0 2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks 8b0cc92d10 ui: Fix incorrect namespace for Qt symbol
Q_INIT_RESOURCE and Q_CLEANUP_RESOURCE can't be called from within a namespace and instead have to be in outside of the namespace, so by moving them into small inline functions we can fulfill this restriction.

Related: #192 #155
2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks a553b39a6d gfx-shader: Actually fix the thing 93207d was supposed to fix 2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks c2c5afd763 gfx-shader: Actually write alpha channel to render target 2023-03-28 12:40:39 +02:00
Michael Fabian 'Xaymar' Dirks bb21d940bf project: Fix virtual overrides not using the correct type 2023-03-28 12:40:39 +02:00
Michael Fabian 'Xaymar' Dirks a5518388ec util-profiler: Specify type for template 2023-03-28 12:40:38 +02:00
Michael Fabian 'Xaymar' Dirks 544b67d55e util-profiler: Fix typo with in reparent() 2023-03-28 12:40:38 +02:00
Michael Fabian 'Xaymar' Dirks ad4d00e0ea util-event: Fix unknown type 2023-03-28 12:40:37 +02:00
Michael Fabian 'Xaymar' Dirks a19e8d1e00 gfx-shader: Add default path for file selection 2023-03-28 12:40:37 +02:00
Michael Fabian 'Xaymar' Dirks 7a929d6af4 locale: Add missing and remove unused strings 2020-04-23 09:14:31 +02:00
Michael Fabian 'Xaymar' Dirks 5291b193e2 gfx-shader: Fix rendering at unexpected sizes and fix performance
Fixes rendering at unexpected sizes by first rendering to a render target and then rendering the contents of that render target to the frame buffer instead. This also prevent rendering twice or more, which might cause severe FPS impact.
2020-04-23 08:10:01 +02:00
Michael Fabian 'Xaymar' Dirks f58ce9f421 project: Implement a brand new UI with fancy windows
Implements support for various new UI features that weren't possible up until now, such as an 'About StreamFX' window with a thank you to everyone that supported the project up until now.
2020-04-23 01:09:02 +02:00
Michael Fabian 'Xaymar' Dirks d0941895ad project: Refactor into namespace streamfx 2020-04-23 00:50:39 +02:00
Michael Fabian 'Xaymar' Dirks 2ab8949ba5 cmake: Place Windows exclusive functionality into own file 2020-04-22 23:32:22 +02:00
Michael Fabian 'Xaymar' Dirks 9ddc9051c7 configuration: Add global configuration handler 2020-04-22 23:15:32 +02:00
Michael Fabian 'Xaymar' Dirks 6cbfee4579 obs-tools: Add OBS data deleter 2020-04-22 23:15:32 +02:00
Michael Fabian 'Xaymar' Dirks ce74d2f7cd common: Undefine the unsafe 'strtoll' define from libobs 2020-04-22 23:11:30 +02:00
Michael Fabian 'Xaymar' Dirks 04ac0a640f filter-nv-face-tracking: Improve performance with asynchronous tracking
Through converting the code to a threaded asynchronous approach, the libOBS video renderer no longer has to wait on our tracking code to run, and we can enjoy a little bit of extra calculation time before we actually have to do anything.

However due to the remaining synchronization with the Direct3D11/OpenGL context, it is not entirely safe to spend a full frame tracking as libOBS will then start skipped/dropping frames. Even though the priority of the stream is now increased, this still means that we can't just sit around and have to quickly finish all work.

Related #150
2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks 4d8ff417e7 nvidia-cuda: Improve usage of CUDA resources and functions
Load additional functions from CUDA and add new enumerations to support them:
* cuDevicePrimaryCtxSetFlags allows us to sched scheduling mode for the GPU.
* cuCtxgetStreamPriorityRange allows us to check which priority levels are supported.
* cuStreamCreateWithPriority allows us to create streams with non-default priority.

The scheduler mode is now set to yield so that other threads can do work when we hit an eventual stalling problem. Streams can also now be created with higher priority and different flags, if necessary. In most cases this should allow CUDA resources to execute even while the GPU is under heavy load.
2020-04-17 11:44:37 +02:00
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