LibVLC.AutoGen 2.0.0

dotnet add package LibVLC.AutoGen --version 2.0.0
                    
NuGet\Install-Package LibVLC.AutoGen -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LibVLC.AutoGen" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LibVLC.AutoGen" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LibVLC.AutoGen" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LibVLC.AutoGen --version 2.0.0
                    
#r "nuget: LibVLC.AutoGen, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LibVLC.AutoGen@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LibVLC.AutoGen&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LibVLC.AutoGen&version=2.0.0
                    
Install as a Cake Tool

LibVLC.AutoGen

NuGet Version NuGet Downloads

!!!!! This is NOT an official libVLC project !!!!!

P/Invoke bindings auto-generated from libvlc headers using ClangSharpPInvokeGenerator and Custom Source Generator.

Quick start

dotnet add package LibVLC.AutoGen
using LibVLCSharp.AutoGen;
using static LibVLCSharp.AutoGen.Interop.libvlc;
using static LibVLCSharp.AutoGen.LibVLC;

internal class Program
{
    static unsafe void Main(string[] args)
    {
        var psz_version = (IntPtr)libvlc_get_version(); // LibVLCSharp.AutoGen.Interop, snake_case
        var version1 = psz_version.GetString(); // to utf8 string
        var version2 = VlcGetVersion(); // LibVLCSharp.AutoGen, PascalCase 
    }
}

List

  • LibVLC.AutoGen is a standard wrapper using [DllImport("libvlc")].
  • LibVLC.AutoGen.Static using [DllImport("__Internal")] for static linked libvlc.
  • LibVLC.AutoGen.Dynamic for runtime loaded libvlc, requires manual Initialize.

Notes

  • no libvlc_printerr, C# has poor compatibility with C variadic arguments.
  • no libvlc_role_Last, It is equivalent to libvlc_role_Test.

What it does?

Via GitHub Action: pull the latest VLC code daily at midnight.

  • Check if there are any updates in the vlc/include/vlc directory.
  • If updates are detected, automatically bump the version number of the current project, create a Git tag, and push it to the remote repository.

Pushing a tag will trigger an automated build process:

  • Execute generate.ps1, which uses ClangSharpPInvokeGenerator with the configuration file "@generate.rsp" to automatically generate LibVLC.Interop.cs.
  • When building the LibVLC.AutoGen project, LibVLC.SourceGenerator runs during the pre-compilation phase to auto-generate a renamed version: LibVLC.Interop.g.cs, based on LibVLC.Interop.cs.
  • When building the LibVLC.AutoGen.Dynamic/Static projects, LazyImport.Fody is additionally integrated to modify the assemblies post-compilation, converting methods marked with DllImport into runtime-loaded implementations.

The final compiled assemblies contain two namespaces:

  • LibVLC.Interop.cs uses the LibVLCSharp.AutoGen.Interop namespace and follows the snake_case naming convention consistent with the C header files, similar to the FFmpeg.AutoGen project, enabling direct usage of the libvlc C code.
  • LibVLC.Interop.g.cs uses the LibVLCSharp.AutoGen namespace and follows C#'s default PascalCase naming convention, similar to the LibVLCSharp project.

Why this project?

This project started because I needed to use libvlc_video_set_output_callbacks, the new video rendering API from LibVLC 4.0.0.
I believe it provides a cleaner solution to airspace issues in WPF and other UI frameworks.
While LibVLCSharp is very well-designed, the v4 prerelease is not yet officially stable, and its interop layer is not fully automated.
For that reason, I created this fresh project:
It uses GitHub Actions + ClangSharpPInvokeGenerator + Custom Source Generator to automatically generate up-to-date P/Invoke bindings for VLC.

Feedback and contributions are welcome!

TODO

Create a new VLC media control using the video rendering API libvlc_video_set_output_callbacks.

Reference & Thanks

License

This project is licensed under the MIT License.
But the LibVLC is licensed under the GNU LGPLv2.1 License, use and distribution must comply with the LGPL.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 83 3/21/2026
1.0.12 85 3/18/2026
1.0.11 79 3/17/2026
1.0.10 87 3/17/2026