Skip to content

AWAS666/Spout.NETCore

Repository files navigation

Spout.NETCore

Spout.NET is a C# .NET Core Implementation for Spout2, a video frame sharing system for Windows.

This is mostly generated by CPPSharp and appears to work just fine as is, but not everything has been tested.

It links the Spout.dll MD version.

Heavily inspired by https://github.com/Ruminoid/Spout.NET but dotnet core 8 compatible.

Feel free to contribute to fix any bugs if anything comes up.

nuget package

Sample Code (same as .net framework variant):

using System;
using System.IO;
using System.Threading;
using Spout.Interop;
using Spout.NETCore;

namespace SpoutTest
{
    class Program
    {
        static unsafe void Main(string[] args)
        {           
            SpoutSender sender = new SpoutSender();
            sender.CreateSender("CsSender", 640, 360, 0); // Create the sender
            byte[] data = new byte[640 * 360 * 4];
            int i = 0;
            fixed (byte* pData = data) // Get the pointer of the byte array
                while (true)
                {
                    for (int j = 0; j < 640 * 360 * 4; j+=4)
                    {
                        data[j] = i == 0 ? byte.MaxValue : byte.MinValue;
                        data[j + 1] = i == 1 ? byte.MaxValue : byte.MinValue;
                        data[j + 2] = i == 2 ? byte.MaxValue : byte.MinValue;
                        data[j + 3] = byte.MaxValue;
                    }
                    Console.WriteLine($"Sending (i = {i})");
                    sender.SendImage(
                        pData, // Pixels
                        640, // Width
                        360, // Height
                        GLFormats.RGBA, // GL_RGBA
                        true, // B Invert
                        0 // Host FBO
                        );
                    Thread.Sleep(1000); // Delay
                    if (i < 2) i++;
                    else i = 0;
                }
        }
    }
}

LICENSE

MIT

About

Dotnetcore wrapper for Spout2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages