libogg 0.2.0

Safe bindings for libogg.
Documentation
  • Coverage
  • 6.98%
    3 out of 43 items documented0 out of 35 items with examples
  • Size
  • Source code size: 35.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hatzel

Safe Rust Bindings for libogg

CI

Simple bindings for libogg.

In most cases it should be preferable to use the ogg crate. However, their README states that the encoder is not well tested. It does at the time of writing not offer some options (e.g. setting a stream id). Still, you are probably better off using ogg unless it's a very special case.

These bindings are not zero-copy! The functions producing a page don't return a reference as modeling their invalidation would make the API more complicated.

Simple Example

extern crate libogg;
use libogg::{Packet, Stream};

fn main() {
    let mut stream = Stream::new(1234); // provide a unique stream id

    // This loop puts data into the stream until a page is returned
    loop {
        match stream.pageout() {
            Some(page) => {
                // `page` holds a header and body, write them to a file
                println!("header: {:?}/body {:?}", page.header, page.body);
                break;
            },
            None => {
                let mut vec = Vec::new();
                for x in 0..255 {
                    vec.push(x);
                }
                // Push in new data
                let mut pkt = Packet::new(&mut vec);
                stream.packetin(&mut pkt)
            }
        }
    }
}

Documentation

This crate has some sporadic documentation, check out the libogg docs for details.