Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 2.71 KB

README.md

File metadata and controls

44 lines (26 loc) · 2.71 KB

NetObsBindings

NuGet version (NetObsBindings)

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.

How to use these bindings?

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:


How to generate bindings locally?

In order to generate bindings locally, please use the build.ps1 script. Make sure that you have ClangSharpPInvokeGenerator dotnet tool installed.

This script will:

  1. Clone the OBS repository
  2. Generate bindings for all required modules
  3. 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. Also please update the package version to indicate the OBS version that it is generated from. E.g. 30.0.2.0 means that the bindings were generated from the OBS version 30.0.2.


Originally, these bindings generated in the blog post https://sharovarskyi.com/blog/posts/clangsharp-dotnet-interop-bindings/