Ahsoka.Extensions.VideoPlayer 5.1.0

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

Showing the top 1 NuGet packages that depend on Ahsoka.Extensions.VideoPlayer:

Package Downloads
Ahsoka.Extensions.VideoPlayer.UX

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.1.1-zzz-develop.7 644 12/2/2025
5.1.1-zzz-develop.6 153 10/3/2025
5.1.1-zzz-develop.5 69 10/3/2025
5.1.1-zzz-develop.4 76 10/3/2025
5.1.1-zzz-develop.3 165 10/1/2025
5.1.1-zzz-develop.2 136 10/1/2025
5.1.1-zzz-develop.1 153 9/25/2025
5.1.0 229 9/13/2025
5.0.2-zzz-develop.14 56 9/13/2025
5.0.2-zzz-develop.13 90 9/5/2025
5.0.1-zzz-develop.58 151 9/3/2025
5.0.1-zzz-develop.57 133 9/2/2025
5.0.1-zzz-develop.56 195 8/26/2025
5.0.1-zzz-develop.55 81 8/22/2025
5.0.1-zzz-develop.54 82 8/22/2025
5.0.1-zzz-develop.53 140 8/21/2025
5.0.1-zzz-develop.52 125 8/21/2025
5.0.1-zzz-develop.51 94 8/15/2025
5.0.1-zzz-develop.50 140 8/13/2025
5.0.1-zzz-develop.49 158 6/19/2025
5.0.1-zzz-develop.48 298 6/11/2025
5.0.1-zzz-develop.47 283 6/10/2025
5.0.1-zzz-develop.46 283 6/10/2025
5.0.1-zzz-develop.45 88 6/6/2025
5.0.1-zzz-develop.44 91 6/6/2025
5.0.1-zzz-develop.43 135 6/5/2025
5.0.1-zzz-develop.42 136 6/5/2025
5.0.1-zzz-develop.41 130 6/5/2025
5.0.1-zzz-develop.40 131 6/5/2025
5.0.1-zzz-develop.39 138 6/5/2025
5.0.1-zzz-develop.38 139 6/4/2025
5.0.1-zzz-develop.35 138 6/3/2025
5.0.1-zzz-develop.34 132 6/2/2025
5.0.1-zzz-develop.33 137 6/2/2025
5.0.1-zzz-develop.32 99 5/30/2025
5.0.1-zzz-develop.31 99 5/30/2025
5.0.1-zzz-develop.30 72 5/23/2025
5.0.1-zzz-develop.29 67 5/23/2025
5.0.1-zzz-develop.28 78 5/23/2025
5.0.1-zzz-develop.27 88 5/23/2025
5.0.1-zzz-develop.26 95 5/23/2025
5.0.1-zzz-develop.25 141 5/21/2025
5.0.1-zzz-develop.24 137 5/20/2025
5.0.1-zzz-develop.23 132 5/19/2025
5.0.1-zzz-develop.22 147 5/16/2025
5.0.1-zzz-develop.21 226 5/13/2025
5.0.1-zzz-develop.20 214 5/13/2025
5.0.1-zzz-develop.19 222 5/13/2025
5.0.1-zzz-develop.18 216 5/12/2025
5.0.1-zzz-develop.17 216 5/12/2025
5.0.1-zzz-develop.16 150 5/7/2025
5.0.1-zzz-develop.15 129 5/6/2025
5.0.1-zzz-develop.14 134 5/5/2025
5.0.1-zzz-develop.13 86 5/2/2025
5.0.1-zzz-develop.12 92 5/2/2025
5.0.1-zzz-develop.11 153 4/28/2025
5.0.1-zzz-develop.10 144 4/28/2025
5.0.1-zzz-develop.9 83 4/25/2025
5.0.1-zzz-develop.8 159 4/24/2025
5.0.1-zzz-develop.7 157 4/23/2025
5.0.1-zzz-develop.6 130 4/22/2025
5.0.1-zzz-develop.5 138 4/22/2025
5.0.1-zzz-develop.4 152 4/10/2025
5.0.1-zzz-develop.3 200 3/20/2025
5.0.1-zzz-develop.2 157 3/19/2025
4.1.0 517 2/26/2025
4.0.1-zzz-develop.6 90 2/26/2025
4.0.1-zzz-develop.5 96 2/26/2025
4.0.1-zzz-develop.4 92 2/26/2025
4.0.1-zzz-develop.3 84 2/26/2025
4.0.1-zzz-develop.2 152 2/10/2025
4.0.1-zzz-develop.1 95 2/10/2025