Skip to content

RevoProject/revo-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

90 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

revo-lib

License Platform Rust

Safe Rust wrapper around libobs-wrapper for streaming and recording functionality

[!INFO] βœ… Migration to libobs-rs completed β€” Using stable, production-grade libobs-wrapper bindings instead of manually built obs-studio with bindgen

Warning

The current release only works on Linux based systems

πŸ’» Usage

  • RevoStream β€” coming soon

πŸ“¦ Installation

Add to your Cargo.toml:

[dependencies]
revo-lib = { git = "https://github.com/revoproject/revo-lib" }

πŸ“‹ Migration Summary

What Changed

Aspect Before After
FFI Bindings Manual bindgen from C headers libobs-wrapper pre-built bindings
Build Complexity Clone obs-studio, CMake, compile (5+ min) Use pre-built crate (~30s)
Local Size 231MB (obs-studio sources) 0MB (external dependency)
Output Wrappers Raw *mut obs_output pointers Safe ObsOutputRef with trait-based API
Threading Atomic flags for init state Thread-safe context with RAII
Error Handling Custom RevoLibError enum Conversion from libobs_wrapper::ObsError

Architecture Improvements

Before:

  • ❌ Manual obs-studio cloning (231MB+)
  • ❌ Bindgen FFI generation at build time
  • ❌ Raw C pointer management
  • ❌ Duplicated output code (StreamingOutput + RecordingOutput)
  • ❌ Single-threaded initialization

After:

  • βœ… Pre-built, production-grade libobs-wrapper
  • βœ… Safe, idiomatic Rust abstractions
  • βœ… Trait-based polymorphic outputs (ObsOutputTrait)
  • βœ… DRY principle (unified output handling)
  • βœ… Thread-safe context with automatic cleanup (RAII)
======================== CHANGE SUMMARY ========================
    [raw libobs FFI]  --->  [libobs-wrapper]
                 |                     |
                 |                     +-- safe bindings
                 |                     +-- RAII context
                 |                     +-- shared output wrapper
                 |
                 +-- removed:
                         - bindgen build step
                         - obs-studio local source tree
                         - duplicated streaming / recording code
================================================================

πŸ“¦ Dependencies

Crate Purpose Version
libobs-wrapper Safe Rust wrapper around libobs From GitHub main

Removed:

  • bindgen β€” Replaced by libobs-wrapper
  • libc β€” Handled by libobs-wrapper
  • obs-studio sources β€” No longer needed

πŸ“š API Reference

Core Types

// Runtime initialization
let ctx = revo_lib::runtime::ObsContext::startup("en-US", None)?;

// Streaming
use revo_lib::streaming::StreamingOutput;
let stream = StreamingOutput::from_raw(output)?;
stream.start()?;
stream.stop();

// Recording
use revo_lib::recording::RecordingOutput;
let recording = RecordingOutput::from_raw(output)?;
recording.start()?;
recording.stop();

Error Handling

use revo_lib::error::{RevoLibError, RevoLibResult};

match some_operation() {
    Ok(result) => { /* ... */ }
    Err(RevoLibError::ObsStartupFailed) => eprintln!("OBS init failed"),
    Err(RevoLibError::Other(msg)) => eprintln!("Error: {}", msg),
    Err(e) => eprintln!("Other error: {}", e),
}

πŸ”— References

πŸ“œ Additional Scripts

πŸ“ License

This project is licensed under the same terms as OBS Studio (GNU General Public License v3.0 or later).