Ahsoka.Extensions.VideoPlayer 5.0.1-zzz-develop.57

This is a prerelease version of Ahsoka.Extensions.VideoPlayer.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Ahsoka.Extensions.VideoPlayer --version 5.0.1-zzz-develop.57
                    
NuGet\Install-Package Ahsoka.Extensions.VideoPlayer -Version 5.0.1-zzz-develop.57
                    
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="Ahsoka.Extensions.VideoPlayer" Version="5.0.1-zzz-develop.57" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ahsoka.Extensions.VideoPlayer" Version="5.0.1-zzz-develop.57" />
                    
Directory.Packages.props
<PackageReference Include="Ahsoka.Extensions.VideoPlayer" />
                    
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 Ahsoka.Extensions.VideoPlayer --version 5.0.1-zzz-develop.57
                    
#r "nuget: Ahsoka.Extensions.VideoPlayer, 5.0.1-zzz-develop.57"
                    
#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 Ahsoka.Extensions.VideoPlayer@5.0.1-zzz-develop.57
                    
#: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=Ahsoka.Extensions.VideoPlayer&version=5.0.1-zzz-develop.57&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Ahsoka.Extensions.VideoPlayer&version=5.0.1-zzz-develop.57&prerelease
                    
Install as a Cake Tool

OpenPV - Ahsoka.Extensions.VideoPlayer

Overview

The Ahsoka.Extensions.VideoPlayer is a service-based C# wrapper around GStreamer functionality, providing a high-level abstraction for video playback operations.

Architecture

System Components

The VideoPlayer system consists of several key components:

  1. Video Service Layer - C# service providing high-level video control APIs
  2. Platform Implementation Layer - Platform-specific video implementations
  3. GStreamer Pipeline Builder - Dynamic GStreamer pipeline generation
  4. Native C Video Player - Low-level GStreamer wrapper executable
  5. Configuration System - Dynamic player configuration and management

Component Hierarchy

VideoService (C#)
├── VideoPlayerImpl (Base Implementation)
├── Platform Implementations
│   ├── LinuxVideoServiceImplementation (In-process GStreamer)
│   ├── LinuxVideoOutOfProcServiceImplementation (Out-of-process executable)
│   └── DesktopVideoServiceImplementation (Development/Testing)
├── GStreamer Pipeline Builders
│   ├── FilePipeline (File playback)
│   ├── UsbCameraPipeline (USB camera input)
│   ├── CsiCameraPipeline (CSI camera input)
│   └── GmslCameraPipeline (GMSL camera input)
└── Native VideoPlayer (C executable)

Core Components

VideoService (VideoService.cs)

The main service class that handles video playback requests and manages multiple video player instances.

Key Features:

  • Multi-player support with unique player IDs
  • Platform-specific implementation selection
  • Configuration-driven player instantiation
  • Message-based communication protocol

Supported Platforms:

  • OpenViewLinux - Standard ARM32 embedded Linux
  • OpenViewLinuxPro - ARM64 embedded linux
  • Windows64 / Ubuntu64 - Development platforms

VideoPlayerImpl (VideoPlayerImpl.cs:8)

Base implementation class providing common video player functionality including state management, playback control, and status reporting.

Core Methods:

  • PlayVideo() - Start video playback
  • PauseVideo() - Pause current playback
  • ResumeVideo() - Resume paused playback
  • StopVideo() - Stop playback and cleanup
  • PositionVideo() - Seek to specific position
  • GetStatus() - Query current playback status

State Management:

  • Thread-safe operations using lock synchronization
  • Automatic status update timer system
  • Callback-based status notifications

Platform Implementations

LinuxVideoServiceImplementation (LinuxVideoServiceImplementation.cs:7)

In-process GStreamer implementation for direct video playback on embedded Linux systems.

Features:

  • Direct GStreamer API integration
  • Wayland display system support
  • Real-time video status monitoring
  • Bus message handling for pipeline events

GStreamer Integration:

  • Uses GStreamer C# bindings
  • Supports fullscreen and windowed playback
  • Automatic pipeline state management
  • Error handling and recovery
LinuxVideoOutOfProcServiceImplementation (LinuxVideoOutOfProcServiceImplementation.cs)

Out-of-process implementation that launches separate video player executables for enhanced system stability.

Benefits:

  • Process isolation for crash protection
  • Reduced memory footprint in main application
  • Independent video player lifecycle
  • Inter-process communication via stdin/stdout

Communication Protocol:

  • PLAY - Resume playback
  • PAUSE - Pause playback
  • QUIT - Exit video player
  • POSITION:<ms> - Seek to position
  • NOTIFY:<ms> - Set status update interval

GStreamer Pipeline System

GstreamerPipelineBuilder (GstreamerPipelineBuilder.cs)

Factory class for creating appropriate GStreamer pipelines based on input type.

Supported Input Types:

  • File - Local file playback
  • Usb - USB camera streaming
  • Csi - CSI camera interface
  • Gmsl - GMSL camera interface
Pipeline Implementations
FilePipeline (FilePipeline.cs:4)

Handles local file playback with platform-specific optimizations.

OpenViewLinux Pipeline:

filesrc location=<file> ! decodebin ! videoconvert ! videoscale ! waylandsink fullscreen=true

OpenViewLinuxPro Pipeline:

playbin uri=file://<file> video-sink=waylandsink
CsiCameraPipeline (CsiCameraPipeline.cs:4)

CSI camera interface pipeline (OpenViewLinuxPro only).

Pipeline Configuration:

v4l2src device=<device> ! video/x-raw, format=YUY2, framerate=15/1 ! waylandsink

Native Video Player (Ahsoka.VideoPlayer.c:1)

C-based GStreamer wrapper providing low-level video control capabilities.

Key Features:

  • Command-line GStreamer pipeline execution
  • Real-time keyboard/stdin command processing
  • Position and duration reporting
  • Comprehensive message bus handling

Supported Commands:

  • PLAY / PAUSE - Playback control
  • POSITION:<ms> - Seek operations
  • NOTIFY:<ms> - Status update timing
  • INFO - Current status query
  • QUIT - Application termination

Status Reporting:

  • POSITION: HH:MM:SS.mmm - Current playback position
  • DURATION: HH:MM:SS.mmm - Total media duration
  • STATE: PLAYING/PAUSED - Current playback state
  • END - Playback completion notification

Embedded Linux Integration

Display System Integration

Wayland Support:

  • Native Wayland compositor integration
  • Hardware-accelerated video overlay
  • Multi-surface video rendering
  • Surface ID management for multi-display

Environment Variables:

  • WAYLANDSINK_SURFACE_ID - Target display surface
  • Display selection via environment configuration

Hardware Acceleration

The system leverages hardware video acceleration available on embedded platforms:

  • Decode Acceleration - Hardware video decoders
  • Scale Acceleration - GPU-based video scaling
  • Color Conversion - Hardware colorspace conversion
  • Overlay Support - Direct video overlay to framebuffer

Configuration System

VideoPlayer Configuration

Configuration is managed through protobuf-serialized configuration files located in the application directory.

Configuration Structure:

  • Player ID management
  • Input type specification
  • Display surface assignment
  • Platform-specific settings

Message Protocol

Service Messages (VideoServiceMessages.cs)

The system uses a structured message protocol for video operations:

Request Types:

  • GetVideoPlayers - Query available players
  • PlayVideo - Start video playback
  • StopVideo - Stop current playback
  • PauseVideo - Pause playback
  • ResumeVideo - Resume playback
  • PositionVideo - Seek to position
  • RequestStatus - Query current status

Response Types:

  • VideoPlayerInfo - Player information
  • VideoStatus - Current playback status

Notifications:

  • StatusUpdated - Automatic status updates

Message Flow

Client Request → VideoService → VideoPlayerImpl → Platform Implementation → GStreamer
                                                                            ↓
Client Notification ← VideoService ← Status Updates ← Platform Implementation ← GStreamer Events

Build System Integration

CMake Configuration

The native components integrate with the broader CMake build system:

Build Targets:

  • Ahsoka.VideoPlayer - Native video player executable
  • Platform-specific output directories
  • Automatic executable permissions setup

Cross-Compilation Support:

  • ARM cross-compilation toolchains
  • Platform-specific SDK integration
  • Target-specific optimization flags

Dependencies

Required Libraries:

  • GStreamer 1.x (core, base, plugins)
  • GLib 2.x (main loop and utilities)
  • Wayland client libraries
  • Video4Linux2 (camera support)

Optional Dependencies:

  • Hardware-specific acceleration libraries
  • Platform codec libraries
  • Advanced camera interface drivers

Usage Examples

Basic File Playback

// Create video playback request
var request = new VideoPlaybackRequest
{
    VideoPlayerID = 1,
    VideoURL = "/path/to/video.mp4",
    PlayFullScreen = true,
    StatusUpdateInMs = 1000
};

// Send play request
var response = videoService.PlayVideo(request);

Camera Stream Display

// CSI camera configuration
var cameraRequest = new VideoPlaybackRequest  
{
    VideoPlayerID = 2,
    VideoURL = "/dev/video0", // V4L2 device
    InputType = InputType.Csi,
    VideoWidth = 1920,
    VideoHeight = 1080
};

var response = videoService.PlayVideo(cameraRequest);

Multi-Player Management

// Query available players
var playerInfo = videoService.GetVideoPlayers();

// Control specific player
videoService.PauseVideo(new VideoPlayer { VideoPlayerID = 1 });
videoService.ResumeVideo(new VideoPlayer { VideoPlayerID = 1 });

Performance Considerations

Memory Management

  • Process Isolation - Out-of-process implementation reduces main application memory usage
  • Resource Cleanup - Automatic cleanup of GStreamer resources
  • Buffer Management - Efficient video buffer handling

Real-Time Performance

  • Hardware Acceleration - Leverage embedded GPU capabilities
  • Direct Memory Access - Zero-copy video path where possible
  • Priority Scheduling - Appropriate thread priorities for video tasks

System Integration

  • Power Management - Coordinate with system power states
  • Thermal Management - Monitor system thermal conditions
  • Resource Arbitration - Coordinate camera and display resource usage

Troubleshooting

Common Issues

Video Player Executable Not Found:

  • Verify Ahsoka.VideoPlayer.<Platform> exists in AhsokaLib directory
  • Check executable permissions (automatically set by system)

Wayland Display Issues:

  • Verify WAYLANDSINK_SURFACE_ID environment variable
  • Ensure Wayland compositor is running
  • Check display permissions

GStreamer Pipeline Errors:

  • Review GStreamer plugin availability
  • Verify codec support for media format
  • Check hardware acceleration availability

Debug Information

The system provides comprehensive logging at multiple verbosity levels:

  • High - Critical errors and state changes
  • Medium - Pipeline setup and configuration
  • Low - Detailed message bus events

Logging Categories:

  • Pipeline state changes
  • Buffer status and timing
  • Hardware acceleration status
  • Display system integration

For more information about developing in OpenPV Click Here.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
5.1.0 11 9/13/2025
5.0.2-zzz-develop.14 11 9/13/2025
5.0.2-zzz-develop.13 75 9/5/2025
5.0.1-zzz-develop.58 131 9/3/2025
5.0.1-zzz-develop.57 112 9/2/2025
5.0.1-zzz-develop.56 176 8/26/2025
5.0.1-zzz-develop.55 67 8/22/2025
5.0.1-zzz-develop.54 64 8/22/2025
5.0.1-zzz-develop.53 120 8/21/2025
5.0.1-zzz-develop.52 110 8/21/2025
5.0.1-zzz-develop.51 77 8/15/2025
5.0.1-zzz-develop.50 123 8/13/2025
5.0.1-zzz-develop.49 138 6/19/2025
5.0.1-zzz-develop.48 278 6/11/2025
5.0.1-zzz-develop.47 269 6/10/2025
5.0.1-zzz-develop.46 268 6/10/2025
5.0.1-zzz-develop.45 70 6/6/2025
5.0.1-zzz-develop.44 76 6/6/2025
5.0.1-zzz-develop.43 124 6/5/2025
5.0.1-zzz-develop.42 123 6/5/2025
5.0.1-zzz-develop.41 118 6/5/2025
5.0.1-zzz-develop.40 117 6/5/2025
5.0.1-zzz-develop.39 119 6/5/2025
5.0.1-zzz-develop.38 126 6/4/2025
5.0.1-zzz-develop.35 126 6/3/2025
5.0.1-zzz-develop.34 121 6/2/2025
5.0.1-zzz-develop.33 121 6/2/2025
5.0.1-zzz-develop.32 85 5/30/2025
5.0.1-zzz-develop.31 88 5/30/2025
5.0.1-zzz-develop.30 61 5/23/2025
5.0.1-zzz-develop.29 55 5/23/2025
5.0.1-zzz-develop.28 65 5/23/2025
5.0.1-zzz-develop.27 72 5/23/2025
5.0.1-zzz-develop.26 79 5/23/2025
5.0.1-zzz-develop.25 127 5/21/2025
5.0.1-zzz-develop.24 121 5/20/2025
5.0.1-zzz-develop.23 119 5/19/2025
5.0.1-zzz-develop.22 136 5/16/2025
5.0.1-zzz-develop.21 208 5/13/2025
5.0.1-zzz-develop.20 203 5/13/2025
5.0.1-zzz-develop.19 212 5/13/2025
5.0.1-zzz-develop.18 206 5/12/2025
5.0.1-zzz-develop.17 205 5/12/2025
5.0.1-zzz-develop.16 129 5/7/2025
5.0.1-zzz-develop.15 120 5/6/2025
5.0.1-zzz-develop.14 121 5/5/2025
5.0.1-zzz-develop.13 77 5/2/2025
5.0.1-zzz-develop.12 80 5/2/2025
5.0.1-zzz-develop.11 142 4/28/2025
5.0.1-zzz-develop.10 131 4/28/2025
5.0.1-zzz-develop.9 70 4/25/2025
5.0.1-zzz-develop.8 147 4/24/2025
5.0.1-zzz-develop.7 143 4/23/2025
5.0.1-zzz-develop.6 119 4/22/2025
5.0.1-zzz-develop.5 124 4/22/2025
5.0.1-zzz-develop.4 140 4/10/2025
5.0.1-zzz-develop.3 187 3/20/2025
5.0.1-zzz-develop.2 144 3/19/2025
4.1.0 394 2/26/2025
4.0.1-zzz-develop.6 80 2/26/2025
4.0.1-zzz-develop.5 79 2/26/2025
4.0.1-zzz-develop.4 78 2/26/2025
4.0.1-zzz-develop.3 78 2/26/2025
4.0.1-zzz-develop.2 140 2/10/2025
4.0.1-zzz-develop.1 86 2/10/2025