Commit Graph

107 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 96466100b4 obs-source: Ensure that exceptions are const 2019-10-13 07:07:31 +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 e02225262c obs-source: Add noexcept try-catch to C facing callbacks 2019-09-07 21:35:32 +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 82faab4380 project: Re-apply formatting 2019-09-04 03:03:41 +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 deeb6719c4 project: Apply formatting 2019-08-24 12:59:32 +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 71b223dcb5 gs-effect: Add ::create for shared_ptr and remove default constructor 2019-08-04 23:19:38 +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 0e350415b3 project: Apply new coding guidelines 2019-08-04 16:20:26 +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 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 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 86e09b6f72 obs-source: Explicitly clear events and copy events 2019-04-03 06:44:04 +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 5738e51e73 obs-source: Also move events in move constructor and operator 2019-04-02 22:08:20 +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 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 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 ba00fbb97e project: Fix even more warnings 2019-03-01 12:00:30 +01:00
Michael Fabian 'Xaymar' Dirks c0f951d855 project: Fix various warnings 2019-03-01 11:33:19 +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