NetObsBindings is a library that provides .NET bindings for Open Broadcaster Software (OBS).
These bindings are generated from the OBS repository, specifically libobs and obs-frontend projects.
The approach taken is to generate a static class per header file via ClangSharp generator. This means, that, for example, you could find functions exported from the obs-service.h file in the ObsService C# class.
These bindings can be used to create your own plugin in C#. There is one caveat: make sure you are publishing the plugins as NativeAOT libraries, this is essential to make it work due to the plugin model of OBS.
Examples:
- samples folder contains a simple plugin example.
- more comprehensive example - ObsCSharpExample by @YorVeX
Example for an OBS plugin written in C# containing various standard items like output, filter, source or a settings dialog in the OBS Tools menu.
Plugins made using this library:
- xObsBrowserAutoRefresh by @YorVeX
OBS plugin providing a filter for automatically refreshing a browser source in a configurable interval.
In order to generate bindings locally, please use the build.ps1 script. Make sure that you have ClangSharpPInvokeGenerator dotnet tool installed.
This script will:
- Clone the OBS repository
- Generate bindings for all required modules
- Insert the version of the OBS library to Obs.Version.cs file.
NB: to change the OBS version - modify the $GitTag variable in the ./init_obs.ps1 script
Originally, these bindings generated in the blog post https://sharovarskyi.com/blog/posts/clangsharp-dotnet-interop-bindings/