Commit graph

731 commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks
54127f6ced gfx/shader: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
aacb1d41bc obs/gs/effect: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
cc1b9c1559 obs/gs/mipmapper: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
0a71af9d6a util/library: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
55ad82aac0 gfx/blur: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
71a969c30f configuration: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
4de094511a plugin: Implement proper functions to get config and data files
Using the obs_module_file and obs_module_config_path macros works okay, but it comes with a slight overhead as well as additional requirements when passing it to C++ functions that expect certain rules to be fulfilled. By instead wrapping the actual functionality into our own functions and using those we can avoid most of the issues that come with the old approach.

Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks
f796c85527 util/bitmask: Move bitmask functionality its own file 2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks
7e7ed80a9a util/library: Use string_view instead of string
Slightly improves performance and reduces memory impact, as string data is not duplicated.
2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks
032a3c6deb obs/source-factory: Skip broken filter rendering by default
Fixes a black screen issue if a filter happens to run into an unexpected issue which it considers unrecoverable.
2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks
d36e735bb1 util/curl: Add missing include for vector 2023-03-28 13:11:02 +02:00
Michael Fabian 'Xaymar' Dirks
74c621cde5 ui/updater: Set modal flag after hiding the dialog
This fixes a bug with older Qt versions which would not remove the modal window from the parent in the setModal() call, resulting in an unusable parent window.

Fixes #368
2023-03-28 13:11:02 +02:00
Michael Fabian 'Xaymar' Dirks
e6cef83588 ui/updater: Always initialize members to zero 2023-03-28 13:11:02 +02:00
Daniel Molkentin
3d5e752139 encoders/handlers/debug: Always return something in to_string (#354) 2023-03-28 13:11:01 +02:00
Daniel Molkentin
2c8687f4b7 encoders/ffmpeg: Use correct parameter for log (#355) 2023-03-28 13:11:01 +02:00
Michael Fabian 'Xaymar' Dirks
daa4a385d7 encoder/ffmpeg: Don't use hardware encoding for unsupported formats 2023-03-28 13:11:00 +02:00
Michael Fabian 'Xaymar' Dirks
6bc1a6b870 encoders/ffmpeg: Don't overwrite already correct settings 2023-03-28 13:11:00 +02:00
Michael Fabian 'Xaymar' Dirks
9938422d5c ffmpeg/tools: Set correct information when encoding
Improves the previous logic and makes it compatible with the new additions in 26.x, such as sRGB. This was previously broken as the focus was on existing features which could be tested without requiring a compiler to be installed.

Incorrect understanding of how sRGB works with RGB and YCC/YUV formats also caused sRGB to be treated as RGB when I444 was selected. This should also now be fixed, hopefully permanently.

Fixes #331
2023-03-28 13:11:00 +02:00
Michael Fabian 'Xaymar' Dirks
82413fd85c ui/updater: Apply workaround for OBS Studio checking for modals
In order to work around a bug in the OBS Studio UI code, we have to swap our modal status right before showing and right after hiding, so that the OBS Studio tray menu continuous working correctly. This is a bit of a weird solution, but it does work as expected.

Related: https://github.com/obsproject/obs-studio/issues/3518
2023-03-28 13:10:59 +02:00
Michael Fabian 'Xaymar' Dirks
07c892b6a4 ui/about: Fix incorrect icon for YouTube URL
Fixes #329
2023-03-28 12:52:28 +02:00
Michael Fabian 'Xaymar' Dirks
f907fc80b0 updater: Add functionality to check for updates
Implements a manual and automatic update checker with support for both release and testing update channels, allowing users to stay as up to date as possible. It is fully compliant with privacy regulations around the world, as it stays completely silent and inactive until the user gives the Ok to connect to GitHub for the latest releases.
2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks
1107c1e390 util/curl: Add C++ wrapper for CURL 2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks
59950bec3b ui: Fix support for disambiguation in translations 2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks
36976cb550 util/threadpool: Don't hold work endlessly after processing it 2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks
0e1377f359 encoders/handlers/nvenc: Don't list encoders on unsupported systems
Removes the NVENC entry on systems without an NVIDIA GPU by checking if the library for it can be loaded. If it can't be loaded, it's likely that the user does not have a system with NVENC capabilities - and guaranteed that they can't use the encoder as FFmpeg relies on these libraries.
2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks
8306dc5b92 encoders/ffmpeg: Add function to get info object 2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks
a39fd89ba7 util/library: Cross-platform handler for library loading
Adds a utility class and functions to load libraries and symbols from libraries somewhat safely. Libraries are immediately unloaded when the last reference to them is lost, so the shared_ptr should be stored if the library is actually needed.
2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks
ab9d9e8443 encoders/handlers/nvenc: Make code C++ standard compliant again 2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks
c445865111 encoders/ffmpeg: Support for FFmpeg versions older than 58.x 2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks
012027578a encoders/ffmpeg: Disable hardware path on Linux 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks
2f6070d7a2 encoders/handlers/prores_aw: Fix override warning 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks
6b57cdf019 encoders/codecs: Add missing includes 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks
66b1715d78 ffmpeg/tools: Fix compatibility with Ubuntu 18.04 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks
63a5873413 project: Remove non-standard std:: prefix from types 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks
c20ac4a413 templates: Add generated configuration file 2023-03-28 12:52:21 +02:00
Michael Fabian 'Xaymar' Dirks
f3b3af2030 ffmpeg/tools: Ensure we aren't comparing against a nullptr 2023-03-28 12:52:21 +02:00
Michael Fabian 'Xaymar' Dirks
dbb9db596e project: Apply formatting 2023-03-28 12:52:21 +02:00
Michael Fabian 'Xaymar' Dirks
f9f25dbd8a obs/gs/effect: Use the actual shared_ptr, not a pointer to it
Fixes several warnings and potential memory corruptions that could happen. Also makes the entire thing easier to read.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks
dbb71cf801 project: Code cleanup and reapply formatting
Changes applied:

* Moved utility files to /util/.
* Removed unused #includes.
* Removed unused ::ffmpeg::tools function.
* Removed unused variables.
* Fixed missing parentheses in the version macro.
* Fixed missing override on virtual function overrides and removed unnecessary virtual keyword from them.
* Disabled additional warning for ATL headers on MSVC only.
* Replaced direct printf parameters with their macro equivalent.
* Replaced C-style casts with C++-style casts.
* Applied clang-format again after an earlier change to the CMake file broke the integration for it.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks
d883f66fa0 util/threadpool: Show warnings for uncaught exceptions
Tasks should not leak exceptions, so it is better if we actually log them instead of silently ignoring them.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks
2fb901278f ui-about: Add new 'Thank You' entries 2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks
334ed4790c encoders/handlers/nvenc: Remove 5.2 from H.264
The levels 5.2 and above were added in a newer FFmpeg version than OBS Studio is shipping with. Ideally we'd take these options directly from FFmpeg, but that is for a future commit.
2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks
6185de2170 encoders/handlers/nvenc: Fix incorrect values being logged
Fixes the issue where "high444p" shows as "high", and "high" shows as "main", caused by the internal option mapping never being correct across version changes. Instead of keeping our own copy of things that has to be adjusted for each FFmpeg version, it's easier to just use the FFmpeg values and names.
2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks
f7da7283fb ffmpeg/tools: Add string value mapping to print_av_option 2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks
a0d0760f6d encoders/ffmpeg: Fix fallbacks, hide handler-less encoders and clean up
* Changes the encoder name to 'streamfx-{name}' from 'streamfx--{name}' as the latter is a typo, but adds a proxy to still support the latter in bad configurations.
* Some of the warning messages have been improved in order to better support end-users, and support for the new encoder error messages has been added.
* Adds support for the is_hw argument instead of blindly relying on obs_encoder_get_caps() which actually returns the wrong values due to rerouting.
* Fixed handler-less encoders showing up in the UI outside of debug builds.
2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks
a7ac58aba6 obs/encoder-factory: Fix encoder rerouting not working properly
Due to an oversight in the code, the fallback code would simply fail to work as the encoder was always the zero-copy version. This resulted in weird crashes and encoders not working that used to work before.

Fixes #295
2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks
81a8a25d4a obs/gs/vertexbuffer: Cleanup and add workaround for OBS Studio memory leak 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks
07034c0e6e obs/gs/helper: Throw exception if we aren't in a context 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks
c1abe07b0f utility: Don't crash on nullptr in free_aligned 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks
56a90db234 plugin: Fix missing include 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks
68a49498e6 common: Rename LOG_ to DLOG_ to avoid macro confusion 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks
2a7187a3c4 plugin: Fix problematic 'using namespace' code 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks
f98319dee7 obs/source-tracker: Don't leak pointers to sources 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks
f5bc53564d configuration: Don't leak pointers and add messages to exceptions 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks
75663f73a4 encoders/handlers/nvenc: Don't list 'each' mode for H.264 2023-03-28 12:52:16 +02:00
Michael Fabian 'Xaymar' Dirks
c9e8b889b0 encoders/handlers/nvenc: Improve UI/UX for NVENC
* "Quality" Minimum/Maximum is actually QP Minimum/Maximum
* Bitrate Limits is now just Limits
* Buffer Size and Quality Target have been moved into "Limits".
2023-03-28 12:52:16 +02:00
Michael Fabian 'Xaymar' Dirks
9a969a0b61 encoders/handlers/nvenc: Update names 2023-03-28 12:52:16 +02:00
Michael Fabian 'Xaymar' Dirks
c21f2c32a4 encoders/ffmpeg: Add support for settings migration 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks
d9198211f7 gfx/shader: Add Per-Instance/Activation/Frame Random values 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks
9562d84221 filters/shader: Fix occasional invisibility problem 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks
8fc9b5cf1f sources/mirror: Retrieve source size on acquire 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks
22e94bb0d8 filters/shader: Don't use scaled size for input capture 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks
b4250a74f5 gfx/shader: Increase size limit and function to get base size 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks
411b716402 obs/encoder-factory: Fix incorrect proxy registration 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks
ee0a69bbf0 project: Adjust object Ids and add proxies for compatibility 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks
203581f30c obs/source-factory: Add function to register proxy objects
Proxies allow for older configurations to work fine on newer versions, without having to manually adjust the scene collection to match the new ids at all. Thanks to the migration system we can freely support any number of old versions, as long as we write migration code.
2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks
5530d2d416 nvidia/cuda/cuda: Convert to global Singleton 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks
9658c1ee0f nvidia/cuda: Remove 'cu_' prefix from types 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks
6ae69a5c71 strings: Add global id prefix 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks
161f10a921 encoders/ffmpeg: Rename files to match naming scheme 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks
ce93f96a69 encoders/ffmpeg: Rebase onto obs::encoder_factory 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks
d3c2f288b4 obs/encoder-factory: Factory to create encoder instances 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks
5ad1f173de project: Apply formatting 2023-03-28 12:40:47 +02:00
Michael Fabian 'Xaymar' Dirks
40920204b5 source/mirror: Fix rare out-of-order lock on source
Occasionally, mostly due to other sources rebuilding their UI, an out-of-order lock freeze can be observed with Source Mirror. This is unwanted, so we need to move the freezing logic into a place where freezing shouldn't happen.

Fixes #228
Actually fixes #61
2023-03-28 12:40:47 +02:00
Michael Fabian 'Xaymar' Dirks
b60f68fcb8 ffmpeg/tools: Fix incorrect colors for sRGB 2023-03-28 12:40:46 +02:00
Michael Fabian 'Xaymar' Dirks
d85ced4107 encoders/ffmpeg: Assume source pixel format for empty support lists 2023-03-28 12:40:46 +02:00
Michael Fabian 'Xaymar' Dirks
a9da1481d7 configuration: Fix failed saving due to invalid path 2023-03-28 12:40:46 +02:00
Michael Fabian 'Xaymar' Dirks
04e52d143f ui: Fix about dialog not being shown and move menu
Moves the menu for StreamFX to the primary menu, so that it is not hidden under tools. This makes it clearer to the user if their installation of StreamFX is working correctly, in addition to reducing the steps necessary to use the menu.

Also the 'About StreamFX' dialog now actually shows up for every update, as expected.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks
4e24444524 transitions/shader: Fix order of assignment 2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks
c1b3972550 gfx/shader/param/basic: Fix bool and suffixes, add enums and optimize
Adds support for enumerations, a different way of selecting how something should behave in a shader. Enumerations rely on a continuous list of values, and will automatically detect how many values there are in the enumeration. Only non-vector types are supported as enumeration entries, and array/vector parameters can have each member set to a different enumeration value.

Furthermore suffixes now are properly assigned, and 'bool' no longer causes shaders to stop rendering. Additionally by inlining some functions and using std::string_view we can achieve a slightly better performance than before.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks
a2fd4dd2f6 gfx/shader: Inlining, std::string_view and optimizations 2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks
3a40a63832 obs/gs/effect-parameter: Use string_view over std::string
Using std::string_view over std::string (and const std::string&) has the advantage that we skip potential temporary std::string objects that are immediately thrown away, thus slowing down the code. It can also be implicitly cast to std::string, which makes it compatible with existing code that uses std::string.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks
9db3dfd874 ui/about: Add 'Thank You' images to the About dialog
Images were created by the talented Inga (https://twitter.com/IngaPotejto).
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks
5fc95b48d8 filters/nv-face-tracking: Improve tracking and remove high priority CUDA stream
The high priority CUDA stream causes libOBS to be at a lower priority than the tracking, which is not what we want. Instead we want tracking to be incomplete in those cases, rather than slowing down encoding and other things.

Geometry updates are also now done once per frame instead of one per tracking update, which should improve the smoothness without affecting performance too much. Additionally all tracking info is now in the 0..1 range, which drastically simplifies some math - especially with texture coordinates.

To deal with tracking and updates being asynchronous, a very simple approximation of movement velocity has been added. This is mostly wrong, but it can bridge the gap where tracking updates are slower, as the values are all filtered anyway.
2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks
b91df3e11a nvicia/cuda-context: Don't modify the primary context
Doing so could potentially cause other CUDA implementations to suddenly fail.
2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks
a40db1258a nvidia/cuda: Add cuCtxCreate, cuCtxSynchronize 2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks
7ac5670d54 ui/about: Add version information 2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks
1951fb62ee obs/gs-helper: Optimize performance with inline 2023-03-28 12:40:43 +02:00
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