Windows project migration to platform/windows

This commit is contained in:
2025-09-28 03:47:43 +09:00
parent a75d7e769f
commit 484e4e0338
176 changed files with 2736 additions and 119 deletions

5
.gitignore vendored
View File

@@ -378,7 +378,8 @@ output.mp4
# 그럴 경우 이 줄을 주석 처리하거나 더 구체적인 경로를 지정해야 합니다.
*.a
*.so
/vav2/Vav2Player/packages/
/vav2/VavCore/lib/
/vav2/Vav2Player_Android/vavcore/build/
/vav2/godot_extension/libs/
/vav2/platforms/windows/applications/vav2player/packages/
/vav2/platforms/windows/godot-plugin/libs/
/vav2/platforms/windows/vavcore/lib

View File

@@ -224,80 +224,88 @@ WinUI 3 C++로 작성된 AV1 파일 재생 플레이어
## 📁 프로젝트 파일 경로 (Project File Locations)
### **메인 프로젝트 파일들** (2025-09-25 구조 재편성 완료)
- **GUI 프로젝트**: `D:\Project\video-av1\vav2\Vav2Player\Vav2Player\Vav2Player.vcxproj`
- **헤드리스 테스트**: `D:\Project\video-av1\vav2\Vav2Player\Vav2PlayerHeadless\Vav2PlayerHeadless.vcxproj`
- **유닛 테스트**: `D:\Project\video-av1\vav2\Vav2Player\Vav2UnitTest\Vav2UnitTest.vcxproj`
- **VavCore 라이브러리**: `D:\Project\video-av1\vav2\Vav2Player\VavCore\VavCore.vcxproj`
- **솔루션 파일**: `D:\Project\video-av1\vav2\Vav2Player\Vav2Player.sln`
### **메인 프로젝트 파일들** (2025-09-28 플랫폼별 구조 완성)
- **VavCore 라이브러리**: `D:\Project\video-av1\vav2\platforms\windows\vavcore\VavCore.vcxproj`
- **Godot Extension**: `D:\Project\video-av1\vav2\platforms\windows\godot-plugin\src\VavCore.Godot\VavCore.Godot.csproj`
- **GUI 애플리케이션**: `D:\Project\video-av1\vav2\platforms\windows\applications\vav2player\Vav2Player\Vav2Player.vcxproj`
- **솔루션 파일**: `D:\Project\video-av1\vav2\platforms\windows\applications\vav2player\Vav2Player.sln`
- **테스트 프로젝트들**: `D:\Project\video-av1\vav2\platforms\windows\tests\*\`
### **빌드 명령어 템플릿**
### **빌드 명령어 템플릿** (플랫폼별 구조)
```bash
# GUI 프로젝트 빌드
cd "D:\Project\video-av1\vav2\Vav2Player\Vav2Player"
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2Player.vcxproj //p:Configuration=Debug //p:Platform=x64 //v:minimal
# 전체 Windows 플랫폼 빌드 (모든 컴포넌트)
cd "D:\Project\video-av1\vav2\platforms\windows"
./build-all.bat
# VavCore 라이브러리 빌드
cd "D:\Project\video-av1\vav2\Vav2Player\VavCore"
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" VavCore.vcxproj //p:Configuration=Debug //p:Platform=x64 //v:minimal
# 개별 컴포넌트 빌드
# VavCore 라이브러리
cd "D:\Project\video-av1\vav2\platforms\windows\vavcore"
./build.bat Debug
# 헤드리스 테스트 빌드
cd "D:\Project\video-av1\vav2\Vav2Player\Vav2PlayerHeadless"
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2PlayerHeadless.vcxproj //p:Configuration=Debug //p:Platform=x64 //v:minimal
# Godot Extension
cd "D:\Project\video-av1\vav2\platforms\windows\godot-plugin"
./build.bat Debug
# 유닛 테스트 빌드
cd "D:\Project\video-av1\vav2\Vav2Player\Vav2UnitTest"
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2UnitTest.vcxproj //p:Configuration=Debug //p:Platform=x64 //v:minimal
# 전체 솔루션 빌드
cd "D:\Project\video-av1\vav2\Vav2Player"
# GUI 애플리케이션
cd "D:\Project\video-av1\vav2\platforms\windows\applications\vav2player"
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2Player.sln //p:Configuration=Debug //p:Platform=x64 //v:minimal
# 모든 테스트 실행
cd "D:\Project\video-av1\vav2\platforms\windows\tests"
./run-all-tests.bat Debug
```
### **실행 파일 경로** (2025-09-25 구조 재편성 완료)
- **GUI 실행파일**: `D:\Project\video-av1\vav2\Vav2Player\Vav2Player\x64\Debug\Vav2Player\Vav2Player.exe`
- **헤드리스 실행파일**: `D:\Project\video-av1\vav2\Vav2Player\Vav2PlayerHeadless\x64\Debug\Headless\Vav2PlayerHeadless.exe`
- **유닛 테스트 DLL**: `D:\Project\video-av1\vav2\Vav2Player\Vav2UnitTest\x64\Debug\UnitTest\Vav2UnitTest.dll`
- **VavCore 라이브러리**: `D:\Project\video-av1\vav2\Vav2Player\VavCore\x64\Debug\VavCore\VavCore.lib`
### **실행 파일 경로** (2025-09-28 플랫폼별 구조)
- **VavCore DLL**: `D:\Project\video-av1\vav2\platforms\windows\vavcore\lib\VavCore-debug.dll`
- **Godot Extension**: `D:\Project\video-av1\vav2\platforms\windows\godot-plugin\bin\Debug\`
- **GUI 실행파일**: `D:\Project\video-av1\vav2\platforms\windows\applications\vav2player\x64\Debug\Vav2Player\Vav2Player.exe`
- **테스트 실행파일들**: `D:\Project\video-av1\vav2\platforms\windows\tests\*\bin\Debug\`
### **주요 디렉토리** (2025-09-25 구조 재편성 완료)
- **GUI 소스 코드**: `D:\Project\video-av1\vav2\Vav2Player\Vav2Player\src\`
- **헤드리스 소스**: `D:\Project\video-av1\vav2\Vav2Player\Vav2PlayerHeadless\src\`
- **유닛 테스트 소스**: `D:\Project\video-av1\vav2\Vav2Player\Vav2UnitTest\tests\`
- **VavCore 소스**: `D:\Project\video-av1\vav2\Vav2Player\VavCore\src\`
- **VavCore 헤더**: `D:\Project\video-av1\vav2\Vav2Player\VavCore\include\VavCore\`
### **주요 디렉토리** (2025-09-28 플랫폼별 구조)
- **VavCore 소스**: `D:\Project\video-av1\vav2\platforms\windows\vavcore\src\`
- **VavCore 헤더**: `D:\Project\video-av1\vav2\platforms\windows\vavcore\include\VavCore\`
- **Godot Extension 소스**: `D:\Project\video-av1\vav2\platforms\windows\godot-plugin\src\`
- **GUI 애플리케이션 소스**: `D:\Project\video-av1\vav2\platforms\windows\applications\vav2player\Vav2Player\src\`
- **테스트 소스들**: `D:\Project\video-av1\vav2\platforms\windows\tests\*\`
## 프로젝트 구조 (2025-09-25 구조 재편성 완료)
## 프로젝트 구조 (2025-09-28 플랫폼별 구조 완성)
```
D:\Project\video-av1\
├── vav2/
│ └── Vav2Player/ # WinUI 3 C++ 프로젝트 루트
── Vav2Player.sln # Visual Studio 솔루션
├── Vav2Player/ # GUI 프로젝트
│ │ ├── Vav2Player.vcxproj # GUI 프로젝트 파일
│ │ ├── MainWindow.xaml.* # 메인 윈도우 (네비게이션)
│ │ ├── MainVideoPage.xaml.* # 메인 비디오 페이지
│ │ ── MultiVideoPage.xaml.* # 멀티 비디오 페이지 (이름 변경됨)
├── LayeredVideoPage.xaml.*# 레이어드 비디오 페이지
│ │ ── VideoPlayerControl.* # 비디오 플레이어 컨트롤
├── Vav2PlayerHeadless/ # 헤드리스 테스트 프로젝트
│ │ ├── Vav2PlayerHeadless.vcxproj
│ │ └── src/ # 헤드리스 소스 코
├── Vav2UnitTest/ # 유닛 테스트 프로젝트
│ │ ── Vav2UnitTest.vcxproj
└── tests/ # 테스트 소스 코드
└── VavCore/ # VavCore 정적 라이브러리
│ ├── VavCore.vcxproj
├── include/VavCore/ # Public API 헤더
└── src/ # VavCore 구현 코드
│ └── platforms/ # 플랫폼별 통합 디렉토리
── windows/ # Windows 플랫폼 전용
├── vavcore/ # VavCore 라이브러리
│ ├── VavCore.vcxproj # C/C++ DLL 프로젝트
│ ├── build.bat # VavCore 개별 빌드
│ ├── include/VavCore/ # Public API 헤더
── src/ # VavCore 구현 코드
├── godot-plugin/ # Godot 4.4.1 Extension
── src/VavCore.Wrapper/ # C# P/Invoke 래퍼
│ ├── src/VavCore.Godot/ # Godot 플러그인
│ ├── libs/windows-x86_64/ # 빌드된 DLL
│ └── build.bat # Godot 확장 빌
├── applications/ # Windows 애플리케이션들
── vav2player/ # Vav2Player GUI 앱
│ ├── Vav2Player.sln # Visual Studio 솔루션
└── Vav2Player/ # WinUI3 프로젝트
│ ├── tests/ # 모든 Windows 테스트
│ ├── vavcore-dll/ # VavCore DLL 연결 테스트
│ ├── godot-extension/ # Godot 확장 테스트
│ │ ├── integration/ # 통합 테스트
│ │ ├── unit-tests/ # 유닛 테스트
│ │ ├── headless/ # 헤드리스 성능 테스트
│ │ └── run-all-tests.bat # 모든 테스트 실행
│ └── build-all.bat # 전체 Windows 빌드
├── include/
│ ├── libwebm/ # libwebm 헤더 (mkvparser, mkvmuxer)
── dav1d/ # dav1d 헤더 (dav1d.h, picture.h 등)
── dav1d/ # dav1d 헤더 (dav1d.h, picture.h 등)
│ ├── amf/ # AMD AMF 헤더
│ └── libvpl/ # Intel VPL 헤더
└── lib/
├── libwebm/webm.lib # libwebm 정적 라이브러리 (x64)
── dav1d/ # dav1d 동적 라이브러리 (x64)
├── dav1d.dll
└── dav1d.lib
── dav1d/ # dav1d 동적 라이브러리 (x64)
├── amf/ # AMD AMF 라이브러리
└── libvpl/ # Intel VPL 라이브러리
```
## 전체 아키텍처 설계

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@@ -5,14 +5,7 @@ VisualStudioVersion = 17.14.36511.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vav2Player", "Vav2Player\Vav2Player.vcxproj", "{C52EFC56-E19C-4568-9D83-A5A5E5282E1E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vav2PlayerHeadless", "Vav2PlayerHeadless\Vav2PlayerHeadless.vcxproj", "{E8B13F42-1234-5678-9ABC-123456789ABC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vav2UnitTest", "Vav2UnitTest\Vav2UnitTest.vcxproj", "{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}"
ProjectSection(ProjectDependencies) = postProject
{B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A} = {B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VavCore", "..\VavCore\VavCore.vcxproj", "{B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VavCore", "..\..\vavcore\VavCore.vcxproj", "{B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -42,22 +35,6 @@ Global
{C52EFC56-E19C-4568-9D83-A5A5E5282E1E}.Release|x86.ActiveCfg = Release|Win32
{C52EFC56-E19C-4568-9D83-A5A5E5282E1E}.Release|x86.Build.0 = Release|Win32
{C52EFC56-E19C-4568-9D83-A5A5E5282E1E}.Release|x86.Deploy.0 = Release|Win32
{E8B13F42-1234-5678-9ABC-123456789ABC}.Debug|ARM64.ActiveCfg = Debug|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Debug|x64.ActiveCfg = Debug|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Debug|x64.Build.0 = Debug|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Debug|x86.ActiveCfg = Debug|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Release|ARM64.ActiveCfg = Release|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Release|x64.ActiveCfg = Release|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Release|x64.Build.0 = Release|x64
{E8B13F42-1234-5678-9ABC-123456789ABC}.Release|x86.ActiveCfg = Release|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Debug|ARM64.ActiveCfg = Debug|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Debug|x64.ActiveCfg = Debug|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Debug|x64.Build.0 = Debug|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Debug|x86.ActiveCfg = Debug|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Release|ARM64.ActiveCfg = Release|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Release|x64.ActiveCfg = Release|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Release|x64.Build.0 = Release|x64
{2F8B5F4C-7E8D-4A9B-8C6D-1E3F5A7B9C2D}.Release|x86.ActiveCfg = Release|x64
{B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A}.Debug|ARM64.ActiveCfg = Debug|x64
{B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A}.Debug|x64.ActiveCfg = Debug|x64
{B8F7E8E0-F8F7-4A8A-9A8A-8A8A8A8A8A8A}.Debug|x64.Build.0 = Debug|x64

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,119 @@
@echo off
REM =============================================================================
REM Windows Platform Build Script - All Components
REM =============================================================================
echo [BUILD] Starting Windows platform build process...
REM Set build configuration
set BUILD_CONFIG=Debug
set PLATFORM=x64
REM Build directories
set VAVCORE_DIR=%~dp0vavcore
set GODOT_DIR=%~dp0godot-plugin
set APP_DIR=%~dp0applications\vav2player
set TEST_DIR=%~dp0tests
echo.
echo ============================================================
echo BUILDING VAVCORE LIBRARY
echo ============================================================
cd /d "%VAVCORE_DIR%"
echo [BUILD] Building VavCore library...
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" VavCore.vcxproj /p:Configuration=%BUILD_CONFIG% /p:Platform=%PLATFORM% /v:minimal
if errorlevel 1 (
echo [ERROR] VavCore build failed!
exit /b 1
)
echo [SUCCESS] VavCore library built successfully
echo.
echo ============================================================
echo BUILDING GODOT EXTENSION
echo ============================================================
cd /d "%GODOT_DIR%"
echo [BUILD] Building Godot extension...
dotnet build src\VavCore.Wrapper\VavCore.Wrapper.csproj -c %BUILD_CONFIG%
if errorlevel 1 (
echo [ERROR] VavCore.Wrapper build failed!
exit /b 1
)
dotnet build src\VavCore.Godot\VavCore.Godot.csproj -c %BUILD_CONFIG%
if errorlevel 1 (
echo [ERROR] VavCore.Godot build failed!
exit /b 1
)
echo [SUCCESS] Godot extension built successfully
echo.
echo ============================================================
echo BUILDING APPLICATIONS
echo ============================================================
cd /d "%APP_DIR%"
echo [BUILD] Building Vav2Player application...
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2Player.sln /p:Configuration=%BUILD_CONFIG% /p:Platform=%PLATFORM% /v:minimal
if errorlevel 1 (
echo [ERROR] Vav2Player build failed!
exit /b 1
)
echo [SUCCESS] Vav2Player application built successfully
echo.
echo ============================================================
echo BUILDING TESTS
echo ============================================================
cd /d "%TEST_DIR%"
REM Build VavCore DLL Test
echo [BUILD] Building VavCore DLL test...
cd vavcore-dll
dotnet build TestVavCoreDLL.csproj -c %BUILD_CONFIG%
if errorlevel 1 (
echo [ERROR] VavCore DLL test build failed!
exit /b 1
)
REM Build Integration Test
echo [BUILD] Building integration test...
cd ..\integration
dotnet build VavCoreTest.csproj -c %BUILD_CONFIG%
if errorlevel 1 (
echo [ERROR] Integration test build failed!
exit /b 1
)
REM Build Unit Tests
echo [BUILD] Building unit tests...
cd ..\unit-tests\Vav2UnitTest
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2UnitTest.vcxproj /p:Configuration=%BUILD_CONFIG% /p:Platform=%PLATFORM% /v:minimal
if errorlevel 1 (
echo [ERROR] Unit tests build failed!
exit /b 1
)
REM Build Headless Test
echo [BUILD] Building headless test...
cd ..\..\headless
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" Vav2PlayerHeadless.vcxproj /p:Configuration=%BUILD_CONFIG% /p:Platform=%PLATFORM% /v:minimal
if errorlevel 1 (
echo [ERROR] Headless test build failed!
exit /b 1
)
echo [SUCCESS] All tests built successfully
echo.
echo ============================================================
echo BUILD COMPLETE
echo ============================================================
echo [SUCCESS] All Windows platform components built successfully!
echo.
echo Built components:
echo - VavCore Library (C/C++)
echo - Godot Extension (C# Wrapper + Godot Plugin)
echo - Vav2Player Application (WinUI3)
echo - All Test Projects
echo.
echo Build artifacts are located in respective output directories.

View File

@@ -26,10 +26,7 @@ class Program
{
Console.WriteLine($" ERROR: {ex.Message}");
Console.WriteLine($" Exception Type: {ex.GetType().Name}");
if (ex.InnerException != null)
{
Console.WriteLine($" Inner Exception: {ex.InnerException.Message}");
}
Console.WriteLine($" Stack Trace: {ex.StackTrace}");
}
Console.WriteLine();
@@ -92,10 +89,6 @@ class Program
catch (Exception ex)
{
Console.WriteLine($" ERROR creating player: {ex.Message}");
if (ex.InnerException != null)
{
Console.WriteLine($" Inner Exception: {ex.InnerException.Message}");
}
}
finally
{
@@ -160,5 +153,7 @@ class Program
Console.WriteLine();
Console.WriteLine("=== VavCore.Wrapper Test Completed ===");
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}

View File

@@ -0,0 +1,395 @@
# VavCore Godot 4.x Extension
Cross-platform C# extension for hardware-accelerated AV1 video decoding in Godot 4.x using VavCore library.
## 🎯 **Features**
### **🚀 Hardware-Accelerated AV1 Decoding**
- **Windows**: NVIDIA NVDEC, Intel VPL, AMD AMF, Media Foundation
- **Linux**: NVIDIA NVDEC, Intel VPL, AMD AMF, dav1d fallback
- **macOS**: VideoToolbox, dav1d fallback
- **Android**: MediaCodec, dav1d fallback (via Android plugin)
- **iOS**: VideoToolbox, dav1d fallback
### **🎮 Godot 4.x Integration**
- **High-level Nodes**: Easy-to-use video player components
- **Low-level API**: Direct decoder control for advanced use cases
- **Resource System**: Godot-native video file and settings resources
- **Editor Integration**: Asset importers, custom inspectors, dock widgets
### **🔧 Cross-Platform Architecture**
- **VavCore.Wrapper**: P/Invoke layer for C API access
- **VavCore.Godot**: Godot-specific nodes and utilities
- **Platform Plugins**: Native Android/iOS integration when needed
## 📁 **Project Structure**
```
vav2/godot_extension/
├── VavCoreGodot.sln # Visual Studio solution
├── src/
│ ├── VavCore.Wrapper/ # P/Invoke wrapper library
│ │ ├── VavCore.Wrapper.csproj # .NET 6.0 library project
│ │ ├── VavCoreTypes.cs # C# data types matching C API
│ │ ├── VavCoreNative.cs # P/Invoke declarations
│ │ └── VavCoreWrapper.cs # High-level C# wrapper
│ └── VavCore.Godot/ # Godot extension library
│ ├── VavCore.Godot.csproj # Godot 4.x project
│ ├── Nodes/ # Godot nodes
│ │ ├── VavCoreVideoPlayer.cs # High-level video player
│ │ ├── VavCoreVideoTexture.cs # Video texture with YUV conversion
│ │ └── VavCoreVideoStream.cs # Low-level stream control
│ ├── Resources/ # Godot resources
│ │ ├── VavCoreVideoFile.cs # Video file metadata resource
│ │ └── VavCoreDecoderSettings.cs # Decoder configuration resource
│ ├── Utilities/ # Helper utilities
│ │ ├── VavCoreGodotUtils.cs # Platform detection and optimization
│ │ └── VavCoreImageConverter.cs # Optimized YUV→RGB conversion
│ └── Plugin/ # Editor integration
│ └── VavCorePlugin.cs # Editor plugin and importers
├── libs/ # Native library binaries
│ ├── windows-x86_64/ # Windows VavCore.dll
│ ├── linux-x86_64/ # Linux libVavCore.so
│ └── osx-x86_64/ # macOS libVavCore.dylib
└── README.md # This file
```
## 🚀 **Getting Started**
### **1. Prerequisites**
- **Godot 4.2.1+** with C# support
- **.NET 6.0 SDK** or higher
- **Visual Studio 2022** or **VS Code** with C# extension
- **VavCore library** binaries for your platform
- **VavCore C API** implementation (vavcore_* functions)
### **2. Building the Extension**
```bash
# Clone or navigate to the extension directory
cd vav2/godot_extension/
# Restore NuGet packages
dotnet restore
# Build the solution
dotnet build --configuration Release
# Or build specific projects
dotnet build src/VavCore.Wrapper/VavCore.Wrapper.csproj --configuration Release
dotnet build src/VavCore.Godot/VavCore.Godot.csproj --configuration Release
```
### **3. Installing in Godot Project**
#### **Option A: Add as Project Reference**
```xml
<!-- In your Godot project's .csproj file -->
<ItemGroup>
<ProjectReference Include="path/to/vav2/godot_extension/src/VavCore.Godot/VavCore.Godot.csproj" />
</ItemGroup>
```
#### **Option B: Copy Built Assemblies**
```bash
# Copy built DLLs to your Godot project
cp src/VavCore.Wrapper/bin/Release/net6.0/VavCore.Wrapper.dll /path/to/godot/project/
cp src/VavCore.Godot/bin/Release/net6.0/VavCore.Godot.dll /path/to/godot/project/
# Copy native libraries
cp libs/windows-x86_64/* /path/to/godot/project/ # Windows
cp libs/linux-x86_64/* /path/to/godot/project/ # Linux
cp libs/osx-x86_64/* /path/to/godot/project/ # macOS
```
## 🎮 **Usage Examples**
### **Simple Video Player**
```csharp
using Godot;
using VavCore.Wrapper;
public partial class MyVideoPlayer : Control
{
private VavCoreWrapper _player;
public override void _Ready()
{
// Initialize VavCore library
if (!VavCoreWrapper.Initialize())
{
GD.PrintErr("Failed to initialize VavCore");
return;
}
// Create video player
_player = new VavCoreWrapper();
// Open and play video
if (_player.OpenFile("res://videos/sample.webm"))
{
// Get metadata
if (_player.GetMetadata(out var metadata))
{
GD.Print($"Video: {metadata.Width}x{metadata.Height}, {metadata.DurationSeconds:F2}s");
}
// Decode frames
DecodeFrames();
}
}
private void DecodeFrames()
{
while (!_player.IsEndOfFile)
{
if (_player.DecodeNextFrame(out var frame))
{
GD.Print($"Decoded frame {frame.FrameNumber}: {frame.Width}x{frame.Height}");
// Convert to RGB if needed
// VavCoreWrapper.ConvertYuvToRgb(frame, rgbBuffer, stride);
}
}
}
public override void _ExitTree()
{
_player?.Dispose();
VavCoreWrapper.Cleanup();
}
}
```
### **Advanced Stream Control**
```csharp
using VavCore.Godot.Nodes;
using VavCore.Wrapper;
public partial class AdvancedVideoControl : Node
{
private VavCoreVideoStream _videoStream;
public override void _Ready()
{
_videoStream = new VavCoreVideoStream();
// Connect to low-level events
_videoStream.PacketRead += OnPacketRead;
_videoStream.FrameDecoded += OnFrameDecoded;
_videoStream.StreamError += OnStreamError;
// Open stream with specific decoder
_videoStream.OpenStream("res://videos/4k_video.webm", VavCoreTypes.DecoderType.NVDEC);
}
private void DecodeManualFrame()
{
// Manual frame-by-frame decoding
if (_videoStream.ReadNextPacket(out var packet))
{
if (_videoStream.DecodePacket(packet, out var frame))
{
// Process decoded frame
GD.Print($"Decoded frame {frame.FrameIndex}: {frame.Width}x{frame.Height}");
}
}
}
private void OnPacketRead(ulong frameIndex, double timestamp, uint packetSize)
{
GD.Print($"Read packet {frameIndex}: {packetSize} bytes at {timestamp:F3}s");
}
private void OnFrameDecoded(ulong frameIndex, double timestamp, Vector2I resolution)
{
GD.Print($"Decoded frame {frameIndex}: {resolution.X}x{resolution.Y} at {timestamp:F3}s");
}
private void OnStreamError(string errorMessage)
{
GD.PrintErr($"Stream error: {errorMessage}");
}
}
```
### **Custom Decoder Settings**
```csharp
using VavCore.Godot.Resources;
public partial class VideoSettings : Control
{
public override void _Ready()
{
// Create optimal settings for current platform
var settings = VavCore.Godot.Utilities.VavCoreGodotUtils.CreateOptimalSettings();
// Customize settings
settings.PreferredDecoderType = VavCoreTypes.DecoderType.NVDEC;
settings.EnableHardwareAcceleration = true;
settings.MaxFrameBufferSize = 15;
settings.EnableZeroCopyDecoding = true;
// Apply quality preset
settings.ApplyPreset(VavCoreDecoderSettings.QualityPreset.Ultra);
// Save settings as resource
ResourceSaver.Save(settings, "user://vavcore_settings.tres");
// Load settings
var loadedSettings = GD.Load<VavCoreDecoderSettings>("user://vavcore_settings.tres");
}
}
```
### **Video File Metadata**
```csharp
using VavCore.Godot.Resources;
public partial class VideoMetadata : Control
{
public override void _Ready()
{
// Create video file resource
var videoFile = new VavCoreVideoFile("res://videos/sample.webm");
if (videoFile.IsValid)
{
// Access metadata
GD.Print($"Resolution: {videoFile.VideoWidth}x{videoFile.VideoHeight}");
GD.Print($"Duration: {videoFile.DurationSeconds:F2} seconds");
GD.Print($"Frame rate: {videoFile.FrameRate:F2} FPS");
GD.Print($"Codec: {videoFile.CodecType}");
GD.Print($"File size: {videoFile.GetFormattedFileSize()}");
// Get detailed info
var info = videoFile.GetVideoInfo();
foreach (var key in info.Keys)
{
GD.Print($"{key}: {info[key]}");
}
// Check decoder compatibility
var compatibleDecoders = videoFile.GetCompatibleDecoders();
GD.Print($"Compatible decoders: {string.Join(", ", compatibleDecoders)}");
var recommendedDecoder = videoFile.GetRecommendedDecoder();
GD.Print($"Recommended decoder: {recommendedDecoder}");
}
else
{
GD.PrintErr($"Invalid video file: {videoFile.ErrorMessage}");
}
}
}
```
## 🔧 **Configuration**
### **Decoder Settings Presets**
```csharp
// Ultra Quality (High-end systems)
settings.ApplyPreset(VavCoreDecoderSettings.QualityPreset.Ultra);
// High Quality (Gaming systems)
settings.ApplyPreset(VavCoreDecoderSettings.QualityPreset.High);
// Balanced (Most systems)
settings.ApplyPreset(VavCoreDecoderSettings.QualityPreset.Balanced);
// Performance (Lower-end systems)
settings.ApplyPreset(VavCoreDecoderSettings.QualityPreset.Performance);
// Power Saver (Mobile/battery)
settings.ApplyPreset(VavCoreDecoderSettings.QualityPreset.PowerSaver);
```
### **Platform-Specific Optimization**
```csharp
// Get platform information
var platformInfo = VavCoreGodotUtils.GetPlatformInfo();
GD.Print($"Platform: {platformInfo["platform"]}");
GD.Print($"Optimal decoder: {platformInfo["optimal_decoder"]}");
GD.Print($"Hardware acceleration: {platformInfo["hardware_acceleration"]}");
// Check hardware acceleration support
bool hwSupported = VavCoreGodotUtils.IsHardwareAccelerationSupported();
string perfCategory = VavCoreGodotUtils.GetPerformanceCategory();
string optimalAPI = VavCoreGodotUtils.GetOptimalGraphicsAPI();
// Validate video file
var (isValid, errorMessage) = VavCoreGodotUtils.ValidateVideoFile("path/to/video.webm");
```
## 📊 **Performance Monitoring**
```csharp
// Get performance statistics
var stats = videoPlayer.GetPerformanceStats();
GD.Print($"Frames decoded: {stats["frames_decoded"]}");
GD.Print($"Frames dropped: {stats["frames_dropped"]}");
GD.Print($"Average decode time: {stats["avg_decode_time_ms"]} ms");
// Format stats for display
string formattedStats = VavCoreGodotUtils.FormatPerformanceStats(stats);
GD.Print(formattedStats);
// Monitor hardware capabilities
var capabilities = videoPlayer.GetHardwareCapabilities();
GD.Print($"Hardware acceleration: {capabilities["hardware_acceleration"]}");
GD.Print($"Zero-copy decoding: {capabilities["zero_copy_decoding"]}");
```
## 🐛 **Troubleshooting**
### **Common Issues**
1. **VavCore library not found**
```
Error: Could not load VavCore.dll/libVavCore.so
Solution: Ensure native libraries are in the correct path
```
2. **Hardware acceleration not available**
```
Check: VavCoreGodotUtils.IsHardwareAccelerationSupported()
Solution: Use software decoder fallback
```
3. **Video file not supported**
```
Check: VavCoreVideoFile.IsFormatSupported(filePath)
Solution: Convert to WebM/MKV with AV1 codec
```
### **Debug Information**
```csharp
// Log comprehensive system information
VavCoreGodotUtils.LogSystemInfo();
// Create detailed system report
var systemReport = VavCoreGodotUtils.CreateSystemReport();
// Check video file validation
var (isValid, error) = VavCoreGodotUtils.ValidateVideoFile(videoPath);
```
## 🎯 **Next Steps**
1. **Audio Support**: Future integration with VavCore audio decoding
2. **Streaming**: Network video streaming support
3. **GPU Integration**: Direct GPU surface rendering optimization
4. **Mobile Optimization**: Enhanced Android/iOS performance
---
🎮 **Cross-platform AV1 video decoding made easy for Godot 4.x!**
⚡ **Hardware acceleration with software fallback for maximum compatibility!**

View File

@@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VavCore.Wrapper", "src\VavCore.Wrapper\VavCore.Wrapper.csproj", "{A1B2C3D4-E5F6-7890-ABCD-123456789ABC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VavCore.Godot", "src\VavCore.Godot\VavCore.Godot.csproj", "{B2C3D4E5-F6A7-8901-BCDE-234567890BCD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1B2C3D4-E5F6-7890-ABCD-123456789ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-123456789ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-123456789ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-123456789ABC}.Release|Any CPU.Build.0 = Release|Any CPU
{B2C3D4E5-F6A7-8901-BCDE-234567890BCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2C3D4E5-F6A7-8901-BCDE-234567890BCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2C3D4E5-F6A7-8901-BCDE-234567890BCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2C3D4E5-F6A7-8901-BCDE-234567890BCD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3D4E5F6-A7B8-9012-CDEF-345678901CDE}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,26 @@
@echo off
REM Godot Extension Build Script
echo [BUILD] Building Godot extension...
set BUILD_CONFIG=%1
if "%BUILD_CONFIG%"=="" set BUILD_CONFIG=Debug
echo Configuration: %BUILD_CONFIG%
echo [BUILD] Building VavCore.Wrapper...
dotnet build src\VavCore.Wrapper\VavCore.Wrapper.csproj -c %BUILD_CONFIG%
if errorlevel 1 (
echo [ERROR] VavCore.Wrapper build failed!
exit /b 1
)
echo [BUILD] Building VavCore.Godot...
dotnet build src\VavCore.Godot\VavCore.Godot.csproj -c %BUILD_CONFIG%
if errorlevel 1 (
echo [ERROR] VavCore.Godot build failed!
exit /b 1
)
echo [SUCCESS] Godot extension built successfully
echo Output: bin\%BUILD_CONFIG%\

View File

@@ -0,0 +1,58 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Assembly Info -->
<AssemblyTitle>VavCore Godot Extension</AssemblyTitle>
<AssemblyDescription>High-level Godot 4.x extension for VavCore AV1 decoder with managed nodes and resources</AssemblyDescription>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Company>VavCore Team</Company>
<Product>VavCore Godot Extension</Product>
<Copyright>Copyright © 2024 VavCore Team</Copyright>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE;GODOT</DefineConstants>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;GODOT</DefineConstants>
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
</PropertyGroup>
<!-- Godot 4.x Dependencies -->
<ItemGroup>
<PackageReference Include="Godot.SourceGenerators" Version="4.3.0" />
<PackageReference Include="GodotSharp" Version="4.3.0" />
</ItemGroup>
<!-- VavCore.Wrapper Dependency -->
<ItemGroup>
<ProjectReference Include="..\VavCore.Wrapper\VavCore.Wrapper.csproj" />
</ItemGroup>
<!-- Platform-specific library paths (inherited from VavCore.Wrapper) -->
<ItemGroup>
<None Include="..\..\libs\windows-x86_64\*" CopyToOutputDirectory="PreserveNewest" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<None Include="..\..\libs\linux-x86_64\*" CopyToOutputDirectory="PreserveNewest" Condition="$([MSBuild]::IsOSPlatform('Linux'))" />
<None Include="..\..\libs\osx-x86_64\*" CopyToOutputDirectory="PreserveNewest" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
</ItemGroup>
<!-- Source files are automatically included by .NET SDK -->
<!-- Documentation -->
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\VavCore.Godot.xml</DocumentationFile>
</PropertyGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Assembly Info -->
<AssemblyTitle>VavCore P/Invoke Wrapper</AssemblyTitle>
<AssemblyDescription>Low-level P/Invoke wrapper for VavCore AV1 decoder library</AssemblyDescription>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Company>VavCore Team</Company>
<Product>VavCore Godot Extension</Product>
<Copyright>Copyright © 2024 VavCore Team</Copyright>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
</PropertyGroup>
<!-- Platform-specific library paths -->
<ItemGroup>
<None Include="..\..\libs\windows-x86_64\*" CopyToOutputDirectory="PreserveNewest" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<None Include="..\..\libs\linux-x86_64\*" CopyToOutputDirectory="PreserveNewest" Condition="$([MSBuild]::IsOSPlatform('Linux'))" />
<None Include="..\..\libs\osx-x86_64\*" CopyToOutputDirectory="PreserveNewest" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
</ItemGroup>
<!-- Source files are automatically included by .NET SDK -->
<!-- Documentation -->
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\VavCore.Wrapper.xml</DocumentationFile>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,262 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace VavCore.Wrapper;
/// <summary>
/// Simple VavCore video decoder - all-in-one class
/// Direct P/Invoke wrapper for VavCore C API with minimal overhead
/// </summary>
public class VavCore : IDisposable
{
// ================================================
// Essential Data Types
// ================================================
public enum DecoderType : int
{
Auto = 0, DAV1D = 1, NVDEC = 2, MediaFoundation = 3,
VPL = 4, AMF = 5, MediaCodec = 6
}
public enum QualityMode : int
{
Conservative = 0, Fast = 1, UltraFast = 2
}
public enum SurfaceType : int
{
CPU = 0, D3D11Texture = 1, D3D12Resource = 2, VulkanImage = 7,
OpenGLTexture = 9, MetalTexture = 10, OpenGLESTexture = 6
}
[StructLayout(LayoutKind.Sequential)]
public struct VideoFrame
{
public IntPtr YPlane, UPlane, VPlane;
public int YStride, UStride, VStride;
public int Width, Height;
public ulong TimestampUs, FrameNumber;
// User-friendly properties
public ulong FrameIndex => FrameNumber;
public double TimestampSeconds => TimestampUs / 1_000_000.0;
}
[StructLayout(LayoutKind.Sequential)]
public struct VideoMetadata
{
public int Width, Height;
public double FrameRate, DurationSeconds;
public ulong TotalFrames;
public IntPtr CodecName;
}
[StructLayout(LayoutKind.Sequential)]
public struct PerformanceMetrics
{
public double AverageDecodeTimeMs, CurrentFps;
public ulong FramesDecoded, FramesDropped;
public int CurrentQualityLevel;
}
[StructLayout(LayoutKind.Sequential)]
public struct VideoFrameSurface
{
public SurfaceType SurfaceType;
public IntPtr YSurface, UVSurface; // GPU surface handles
public int Width, Height;
public ulong TimestampUs, FrameNumber;
// User-friendly properties
public ulong FrameIndex => FrameNumber;
public double TimestampSeconds => TimestampUs / 1_000_000.0;
}
// ================================================
// P/Invoke (Essential C API functions only)
// ================================================
private const string DllName = "VavCore-debug";
[DllImport(DllName)] private static extern int vavcore_initialize();
[DllImport(DllName)] private static extern void vavcore_cleanup();
[DllImport(DllName)] private static extern IntPtr vavcore_create_player();
[DllImport(DllName)] private static extern void vavcore_destroy_player(IntPtr player);
[DllImport(DllName)] private static extern int vavcore_open_file(IntPtr player, string filePath);
[DllImport(DllName)] private static extern int vavcore_close_file(IntPtr player);
[DllImport(DllName)] private static extern int vavcore_decode_next_frame(IntPtr player, ref VideoFrame frame);
[DllImport(DllName)] private static extern int vavcore_get_metadata(IntPtr player, ref VideoMetadata metadata);
[DllImport(DllName)] private static extern int vavcore_seek_to_time(IntPtr player, double timeSeconds);
[DllImport(DllName)] private static extern int vavcore_seek_to_frame(IntPtr player, ulong frameNumber);
[DllImport(DllName)] private static extern int vavcore_reset(IntPtr player);
[DllImport(DllName)] private static extern int vavcore_is_open(IntPtr player);
[DllImport(DllName)] private static extern int vavcore_is_end_of_file(IntPtr player);
[DllImport(DllName)] private static extern int vavcore_set_decoder_type(IntPtr player, DecoderType decoderType);
[DllImport(DllName)] private static extern int vavcore_set_quality_mode(IntPtr player, QualityMode qualityMode);
[DllImport(DllName)] private static extern int vavcore_get_performance_metrics(IntPtr player, ref PerformanceMetrics metrics);
[DllImport(DllName)] private static extern int vavcore_decode_to_surface(IntPtr player, SurfaceType targetType, IntPtr targetSurface, ref VideoFrameSurface frame);
// ================================================
// Simple Public API
// ================================================
private IntPtr _player = IntPtr.Zero;
private bool _disposed = false;
private static bool _initialized = false;
public bool IsOpen => _player != IntPtr.Zero && vavcore_is_open(_player) != 0;
public bool IsEndOfFile => _player != IntPtr.Zero && vavcore_is_end_of_file(_player) != 0;
public VavCore()
{
if (!_initialized)
{
if (vavcore_initialize() != 0)
throw new InvalidOperationException("Failed to initialize VavCore");
_initialized = true;
}
_player = vavcore_create_player();
if (_player == IntPtr.Zero)
throw new InvalidOperationException("Failed to create VavCore player");
}
public bool OpenFile(string filePath)
{
return vavcore_open_file(_player, filePath) == 0;
}
public void CloseFile()
{
if (IsOpen) vavcore_close_file(_player);
}
public bool DecodeNextFrame(out VideoFrame frame)
{
frame = new VideoFrame();
return vavcore_decode_next_frame(_player, ref frame) == 0;
}
public bool GetMetadata(out VideoMetadata metadata)
{
metadata = new VideoMetadata();
return vavcore_get_metadata(_player, ref metadata) == 0;
}
public bool SeekToTime(double timeSeconds)
{
return vavcore_seek_to_time(_player, timeSeconds) == 0;
}
public bool SeekToFrame(ulong frameNumber)
{
return vavcore_seek_to_frame(_player, frameNumber) == 0;
}
public bool Reset()
{
return vavcore_reset(_player) == 0;
}
public bool SetDecoderType(DecoderType decoderType)
{
return vavcore_set_decoder_type(_player, decoderType) == 0;
}
public bool SetQualityMode(QualityMode qualityMode)
{
return vavcore_set_quality_mode(_player, qualityMode) == 0;
}
public bool GetPerformanceMetrics(out PerformanceMetrics metrics)
{
metrics = new PerformanceMetrics();
return vavcore_get_performance_metrics(_player, ref metrics) == 0;
}
// ================================================
// GPU Surface Decoding (Primary method)
// ================================================
public bool DecodeToSurface(SurfaceType surfaceType, IntPtr targetSurface, out VideoFrameSurface frame)
{
frame = new VideoFrameSurface();
return vavcore_decode_to_surface(_player, surfaceType, targetSurface, ref frame) == 0;
}
// ================================================
// User-friendly helpers
// ================================================
public Dictionary<string, object> GetVideoInfo()
{
var info = new Dictionary<string, object>();
if (GetMetadata(out var meta))
{
info["width"] = meta.Width;
info["height"] = meta.Height;
info["duration"] = meta.DurationSeconds;
info["frames"] = (long)meta.TotalFrames;
info["fps"] = meta.FrameRate;
}
return info;
}
public Dictionary<string, object> GetStats()
{
var stats = new Dictionary<string, object>();
if (GetPerformanceMetrics(out var metrics))
{
stats["frames_decoded"] = (long)metrics.FramesDecoded;
stats["frames_dropped"] = (long)metrics.FramesDropped;
stats["avg_decode_time_ms"] = metrics.AverageDecodeTimeMs;
stats["current_fps"] = metrics.CurrentFps;
}
return stats;
}
// ================================================
// Static Utilities
// ================================================
public static bool Initialize()
{
if (!_initialized)
{
_initialized = vavcore_initialize() == 0;
}
return _initialized;
}
public static string GetVersion() => "1.0.0";
public static DecoderType GetOptimalDecoderType()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return DecoderType.Auto; // NVDEC/VPL/AMF
else
return DecoderType.DAV1D; // Fallback for Linux/macOS/Android
}
// ================================================
// Disposal
// ================================================
public void Dispose()
{
if (!_disposed)
{
CloseFile();
if (_player != IntPtr.Zero)
{
vavcore_destroy_player(_player);
_player = IntPtr.Zero;
}
_disposed = true;
}
}
~VavCore() => Dispose();
}

View File

@@ -0,0 +1,84 @@
using System;
using VavCore.Wrapper;
// Simple console test to verify VavCore DLL connection
class TestVavCoreDLL
{
static void Main(string[] args)
{
Console.WriteLine("VavCore DLL Connection Test");
Console.WriteLine("===========================");
try
{
// Test VavCore DLL connection
Console.WriteLine("Testing VavCore DLL connection...");
// Get version string
var version = VavCore.GetVersion();
Console.WriteLine($"VavCore version: {version}");
// Initialize VavCore
Console.WriteLine("Initializing VavCore...");
bool initSuccess = VavCore.Initialize();
Console.WriteLine($"VavCore initialization: {(initSuccess ? "SUCCESS" : "FAILED")}");
if (initSuccess)
{
// Test player creation
Console.WriteLine("Creating VavCore player...");
var player = VavCore.CreatePlayer();
Console.WriteLine($"Player creation: {(player != IntPtr.Zero ? "SUCCESS" : "FAILED")}");
if (player != IntPtr.Zero)
{
// Test decoder type setting
Console.WriteLine("Setting decoder type to AUTO...");
bool setDecoderSuccess = VavCore.SetDecoderType(player, DecoderType.AUTO);
Console.WriteLine($"Set decoder type: {(setDecoderSuccess ? "SUCCESS" : "FAILED")}");
// Test surface type support
Console.WriteLine("Checking Vulkan surface support...");
bool vulkanSupported = VavCore.SupportsSurfaceType(SurfaceType.Vulkan);
Console.WriteLine($"Vulkan surface support: {(vulkanSupported ? "SUPPORTED" : "NOT SUPPORTED")}");
Console.WriteLine("Checking D3D11 surface support...");
bool d3d11Supported = VavCore.SupportsSurfaceType(SurfaceType.D3D11);
Console.WriteLine($"D3D11 surface support: {(d3d11Supported ? "SUPPORTED" : "NOT SUPPORTED")}");
// Get optimal surface type
Console.WriteLine("Getting optimal surface type...");
var optimalSurface = VavCore.GetOptimalSurfaceType();
Console.WriteLine($"Optimal surface type: {optimalSurface}");
// Test performance metrics
Console.WriteLine("Getting performance metrics...");
var metrics = VavCore.GetPerformanceMetrics(player);
Console.WriteLine($"Performance metrics - FPS: {metrics.CurrentFPS:F2}, Dropped: {metrics.DroppedFrames}");
// Clean up player
Console.WriteLine("Destroying player...");
VavCore.DestroyPlayer(player);
Console.WriteLine("Player destroyed");
}
// Clean up VavCore
Console.WriteLine("Cleaning up VavCore...");
VavCore.Cleanup();
Console.WriteLine("VavCore cleanup completed");
}
Console.WriteLine("\n=== VavCore DLL Connection Test COMPLETED SUCCESSFULLY ===");
}
catch (Exception ex)
{
Console.WriteLine($"\n=== VavCore DLL Connection Test FAILED ===");
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Stack trace: {ex.StackTrace}");
return;
}
Console.WriteLine("\nPress any key to exit...");
Console.ReadKey();
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="src\VavCore.Wrapper\VavCore.Wrapper.csproj" />
</ItemGroup>
</Project>

View File

@@ -53,14 +53,14 @@
<PreprocessorDefinitions>_DEBUG;_CONSOLE;HEADLESS_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>$(ProjectDir)src;$(ProjectDir)..\..\VavCore\include;$(ProjectDir)..\..\..\include\libwebm;$(ProjectDir)..\..\..\include\dav1d;$(ProjectDir)..\..\..\oss\nvidia-video-codec\Interface;$(CUDA_PATH_V13_0)\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)src;$(ProjectDir)..\..\vavcore\include;$(ProjectDir)..\..\..\..\..\include\libwebm;$(ProjectDir)..\..\..\..\..\include\dav1d;$(ProjectDir)..\..\..\..\..\oss\nvidia-video-codec\Interface;$(CUDA_PATH_V13_0)\include</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\VavCore\lib;$(ProjectDir)..\..\..\lib\libwebm;$(ProjectDir)..\..\..\lib\dav1d;$(ProjectDir)..\..\..\lib\amf;$(ProjectDir)..\..\..\lib\libvpl;$(ProjectDir)..\..\..\oss\nvidia-video-codec\Lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\vavcore\lib;$(ProjectDir)..\..\..\..\..\lib\libwebm;$(ProjectDir)..\..\..\..\..\lib\dav1d;$(ProjectDir)..\..\..\..\..\lib\amf;$(ProjectDir)..\..\..\..\..\lib\libvpl;$(ProjectDir)..\..\..\..\..\oss\nvidia-video-codec\Lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64</AdditionalLibraryDirectories>
<AdditionalDependencies>VavCore-debug.lib;webm-debug.lib;dav1d-debug.lib;amf-debug.lib;vpld.lib;nvcuvid.lib;cuda.lib;mfplat.lib;mf.lib;mfuuid.lib;d3d11.lib;d3d12.lib;dxgi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
@@ -73,7 +73,7 @@
<PreprocessorDefinitions>NDEBUG;_CONSOLE;HEADLESS_BUILD;VAVCORE_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>$(ProjectDir)src;$(ProjectDir)..\..\VavCore\include;$(ProjectDir)..\..\..\include\libwebm;$(ProjectDir)..\..\..\include\dav1d;$(ProjectDir)..\..\..\oss\nvidia-video-codec\Interface;$(CUDA_PATH_V13_0)\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)src;$(ProjectDir)..\..\vavcore\include;$(ProjectDir)..\..\..\..\..\include\libwebm;$(ProjectDir)..\..\..\..\..\include\dav1d;$(ProjectDir)..\..\..\..\..\oss\nvidia-video-codec\Interface;$(CUDA_PATH_V13_0)\include</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
@@ -82,7 +82,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\VavCore\lib;$(ProjectDir)..\..\..\lib\libwebm;$(ProjectDir)..\..\..\lib\dav1d;$(ProjectDir)..\..\..\lib\amf;$(ProjectDir)..\..\..\lib\libvpl;$(ProjectDir)..\..\..\oss\nvidia-video-codec\Lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\vavcore\lib;$(ProjectDir)..\..\..\..\..\lib\libwebm;$(ProjectDir)..\..\..\..\..\lib\dav1d;$(ProjectDir)..\..\..\..\..\lib\amf;$(ProjectDir)..\..\..\..\..\lib\libvpl;$(ProjectDir)..\..\..\..\..\oss\nvidia-video-codec\Lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64</AdditionalLibraryDirectories>
<AdditionalDependencies>VavCore.lib;webm.lib;dav1d.lib;amf.lib;vpl.lib;nvcuvid.lib;cuda.lib;mfplat.lib;mf.lib;mfuuid.lib;d3d11.lib;d3d12.lib;dxgi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

Some files were not shown because too many files have changed in this diff Show More