Skip to content

damianmonelle/ossuret-capture-viewer

Repository files navigation

Ossuret Capture Viewer

A professional Android application for USB camera capture, video streaming, and audio processing with support for MacroSilicon devices and HDMI capture.

🚀 Features

Core Functionality

  • V4L2 Native Camera Capture - Direct video capture from USB cameras using native C++ code
  • Video Streaming with OpenGL ES - Hardware-accelerated video rendering to SurfaceView
  • Audio Capture & Playback - Native audio system integration with ALSA compatibility
  • MacroSilicon Device Support - Full compatibility with MS2130 and MS2109 chipsets
  • HDMI Capture Capabilities - Device-specific driver integration for HDMI input
  • USB Device Management - Automatic device detection, enumeration, and management
  • Background Services - Capture monitoring and auto-start functionality
  • Configuration Management - Settings persistence and device preferences

Technical Features

  • Multi-Architecture Support - ARM64, ARMv7, x86, x86_64
  • API Level 21+ Compatibility - Supports Android 5.0 and above
  • Native Performance - C++ implementation for high-performance video processing
  • Comprehensive Logging - File-based logging and real-time performance monitoring
  • Error Handling - Robust error handling with user feedback
  • Permission Management - Camera, audio, USB, and storage permissions

📋 Requirements

Development Environment

  • Android Studio - Latest version (Hedgehog or newer)
  • Android SDK - API Level 34 (Android 14)
  • Android NDK - Version 29.0.13599879 or newer
  • CMake - Version 3.22.1 or newer
  • Gradle - Version 8.12 or newer
  • Java - OpenJDK 17 or newer

Hardware Requirements

  • Android Device - API Level 21+ (Android 5.0+)
  • USB Camera - V4L2 compatible device
  • MacroSilicon Devices - MS2130, MS2109, or compatible chipsets
  • HDMI Capture - Supported capture cards (device-specific drivers)

🛠️ Setup Instructions

1. Clone the Repository

git clone https://github.com/yourusername/ossuret-capture-viewer.git
cd ossuret-capture-viewer

2. Open in Android Studio

  • Launch Android Studio
  • Select "Open an existing Android Studio project"
  • Navigate to the cloned repository and select it
  • Wait for Gradle sync to complete

3. Configure NDK

  • Go to File → Settings → Appearance & Behavior → System Settings → Android SDK
  • Click on "SDK Tools" tab
  • Check "NDK (Side by side)" and install version 29.0.13599879
  • Set the NDK path in local.properties:
ndk.dir=C:\\Users\\YourUsername\\AppData\\Local\\Android\\Sdk\\ndk\\29.0.13599879

4. Build the Project

# Clean build
./gradlew clean

# Build debug version
./gradlew assembleDebug

# Build release version
./gradlew assembleRelease

5. Install on Device

# Install debug version
adb install app/build/outputs/apk/debug/app-debug.apk

# Install release version
adb install app/build/outputs/apk/release/app-release-unsigned.apk

🏗️ Project Architecture

Directory Structure

app/
├── src/main/
│   ├── java/com/ossuret/captureviewer/
│   │   ├── MainActivity.kt              # Main UI and device management
│   │   ├── DeviceAdapter.kt             # RecyclerView adapter for devices
│   │   ├── CaptureDevice.kt             # Device data model
│   │   ├── DeviceCapabilities.kt        # Device capabilities model
│   │   ├── V4L2Camera.kt                # V4L2 camera interface
│   │   ├── VideoStream.kt               # Video streaming interface
│   │   ├── AudioCapture.kt              # Audio capture interface
│   │   ├── AudioPlayback.kt             # Audio playback interface
│   │   ├── SettingsManager.kt           # Configuration management
│   │   ├── CaptureService.kt            # Background service
│   │   ├── BootReceiver.kt              # Auto-start receiver
│   │   ├── LogManager.kt                # Logging system
│   │   └── PerformanceMonitor.kt        # Performance tracking
│   ├── cpp/
│   │   ├── v4l2_camera.cpp              # V4L2 camera implementation
│   │   ├── video_stream.cpp             # Video streaming implementation
│   │   ├── audio_capture.cpp            # Audio capture implementation
│   │   ├── audio_playback.cpp           # Audio playback implementation
│   │   ├── video_renderer.cpp           # OpenGL ES video rendering
│   │   └── jni_interface.cpp            # JNI interface definitions
│   ├── res/
│   │   ├── layout/                      # UI layouts
│   │   ├── drawable/                    # Icons and graphics
│   │   ├── values/                      # Strings, colors, styles
│   │   └── menu/                        # Menu definitions
│   └── AndroidManifest.xml              # App manifest and permissions
├── build.gradle                         # App-level build configuration
└── CMakeLists.txt                       # Native build configuration

Key Components

Kotlin Classes

  • MainActivity: Main UI controller, device management, and user interactions
  • V4L2Camera: JNI interface for V4L2 camera operations
  • VideoStream: JNI interface for video streaming and rendering
  • AudioCapture/AudioPlayback: JNI interfaces for audio processing
  • SettingsManager: Configuration persistence and management
  • CaptureService: Background monitoring and auto-start functionality

Native C++ Components

  • v4l2_camera.cpp: V4L2 device enumeration, configuration, and capture
  • video_stream.cpp: Video frame processing and OpenGL ES rendering
  • audio_capture.cpp: Audio device management and capture
  • audio_playback.cpp: Audio output and playback
  • video_renderer.cpp: OpenGL ES shaders and rendering pipeline

🔧 Development Guidelines

Code Style

  • Kotlin: Follow official Kotlin coding conventions
  • C++: Follow Google C++ Style Guide
  • JNI: Use consistent naming conventions for JNI functions
  • Comments: Comprehensive documentation for complex algorithms

Logging

  • Use LogManager for file-based logging
  • Use PerformanceMonitor for performance tracking
  • Include device-specific information in logs
  • Log all error conditions with context

Error Handling

  • Implement comprehensive error handling in both Kotlin and C++
  • Provide user-friendly error messages
  • Log detailed error information for debugging
  • Graceful degradation when features are unavailable

Testing

  • Test on multiple Android API levels (21+)
  • Test with various USB camera devices
  • Test MacroSilicon device compatibility
  • Test HDMI capture functionality
  • Test background service behavior

📱 Usage

Device Detection

  1. Connect USB camera or MacroSilicon device
  2. App automatically detects and enumerates devices
  3. Device list shows with status and capabilities
  4. Select device to begin capture

Video Streaming

  1. Select a device from the device list
  2. Tap "Start Streaming" to begin video capture
  3. Video displays in the main SurfaceView
  4. Use resolution and framerate controls to adjust quality

Audio Capture

  1. Enable audio capture in settings
  2. Audio automatically captures with video
  3. Use audio playback controls to monitor audio
  4. Audio files saved to device storage

Configuration

  1. Access settings through menu
  2. Configure default devices and preferences
  3. Set auto-start and background monitoring
  4. Configure logging and performance monitoring

🐛 Troubleshooting

Common Issues

Build Errors

  • NDK not found: Ensure NDK is installed and path is correct in local.properties
  • CMake errors: Update CMake to version 3.22.1 or newer
  • Gradle sync fails: Clean project and invalidate caches

Runtime Issues

  • Device not detected: Check USB permissions and device compatibility
  • Video not streaming: Verify V4L2 device support and permissions
  • Audio not working: Check audio permissions and device compatibility
  • App crashes: Check logs for detailed error information

Performance Issues

  • High CPU usage: Reduce video resolution or framerate
  • Memory leaks: Monitor memory usage with PerformanceMonitor
  • Battery drain: Disable background services if not needed

Debug Commands

# Monitor logs
adb logcat -s OssuretCaptureViewer

# Check device permissions
adb shell dumpsys package com.ossuret.captureviewer

# Monitor performance
adb shell dumpsys meminfo com.ossuret.captureviewer

# Check USB devices
adb shell lsusb

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📞 Support

For support and questions:

  • Create an issue on GitHub
  • Check the troubleshooting section
  • Review the logs for error details
  • Test with different devices and configurations

🔄 Version History

v1.0.0 (Current)

  • Initial release with V4L2 camera support
  • MacroSilicon device compatibility
  • Video streaming with OpenGL ES
  • Audio capture and playback
  • Background services and auto-start
  • Comprehensive logging and monitoring
  • Multi-architecture support

📚 Additional Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors