I've got a device running Ubuntu 18.04LTS on a 64-bit ARM processor. I'd like to develop a GUI that will let me access the camera feed of potentially multiple attached devices (/dev/video0, /dev/video1). Ideally this will be possible with a .NET stack (.NET Core and AvaloniaUI are what I'm looking at). I'm aware of using P/Invoke, but only have a rough understanding of using it. I'm also aware of the libv4l2 library, however I'm not sure where to go from there.
If I have to phrase this as a more direct question for SO: How can I display the /dev/videoX feed on an Ubuntu-ARM64 device in a GUI app built with NET Core (ideally with AvaloniaUI)?
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vlc="clr-namespace:LibVLCSharp.Avalonia;assembly=LibVLCSharp.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="AvaloniaCam.MainWindow"
Title="AvaloniaCam">
<vlc:VideoView x:Name="VideoView"/>
</Window>
public class MainWindow : Window
{
public MainWindow()
{
AvaloniaXamlLoader.Load(this);
if(Design.IsDesignMode)
return;
var videoView = this.Get<VideoView>("VideoView");
var libVlc = new LibVLC();
videoView.MediaPlayer = new MediaPlayer(libVlc);
videoView.MediaPlayer.Play(new Media(libVlc, "v4l2://", FromType.FromLocation));
}
}
Note that you might need libvlc-dev
package installed for P/Invoke layer from libvlcsharp to work.