#libvorbis #encoding #lancer #libvorbisenc #vorbisfile #aotuv

sys aotuv_lancer_vorbis_sys

Low-level FFI bindings for libvorbis, vorbisfile, and libvorbisenc C libraries with the aoTuV and Lancer patches

5 releases

0.1.4 Dec 10, 2023
0.1.3 Nov 25, 2023
0.1.2 Nov 25, 2023
0.1.1 Apr 14, 2023
0.1.0 Oct 21, 2022

#311 in Audio

Download history 277/week @ 2023-12-18 165/week @ 2023-12-25 125/week @ 2024-01-01 118/week @ 2024-01-08 85/week @ 2024-01-15 131/week @ 2024-01-22 101/week @ 2024-01-29 97/week @ 2024-02-05 103/week @ 2024-02-12 178/week @ 2024-02-19 233/week @ 2024-02-26 184/week @ 2024-03-04 180/week @ 2024-03-11 140/week @ 2024-03-18 124/week @ 2024-03-25 173/week @ 2024-04-01

668 downloads per month
Used in 3 crates (via vorbis_rs)

BSD-3-Clause

2MB
44K SLoC

C 32K SLoC // 0.1% comments Visual Studio Project 7.5K SLoC Rust 3K SLoC // 0.0% comments Perl 786 SLoC // 0.1% comments M4 497 SLoC // 0.2% comments Visual Studio Solution 483 SLoC Automake 232 SLoC // 0.1% comments C++ 44 SLoC Shell 36 SLoC // 0.1% comments

Contains (obscure autoconf code, 10KB) vorbis_vendor/configure.ac, (obscure autoconf code, 6KB) ogg_vendor/configure.ac

vorbis-rs logo

vorbis-rs

Rust bindings for the best-in-breed C libraries of the Vorbis audio codec and Ogg container encapsulation.

CI workflow status crates.io latest version docs.rs status

crates.io downloads

The vorbis_rs package in this repository provides updated, well-documented and ergonomic bindings for a modified version of the latest reference Vorbis encoder, available here, with the aoTuV and Lancer patchsets applied to it. These patches are considered to implement significant encoding quality and performance improvements by the community.

The supporting aotuv_lancer_vorbis_sys and ogg_next_sys packages provide automatically-generated low-level bindings used by vorbis_rs.

The minimum supported Rust version (MSRV) for every package in this repository is 1.64. Bumping this version is not considered a breaking change for semantic versioning purposes. We will try to do it only when we estimate that such a bump would not cause widespread inconvenience or breakage.

❓ Motivation

The Rust ecosystem already has bindings for these libraries (see vorbis-sys and vorbis), but the quality and maintenance status of the available crates is problematic in an entangled way that does not seem reasonable to fix via PRs or patching:

  • The high-level vorbis crate was not updated in 6 years, has arguably low code quality (lots of panic! with messages containing e-mail addresses, etc.), and depends on an old version of vorbis-sys. In turn vorbis-sys depends on an old version of the libvorbis C library with known security vulnerabilities. It also lacks APIs to do some operations needed by sensible audio processing applications that are offered by the C libraries.
  • vorbis-sys only contains bindings for libvorbis, but updated bindings for libvorbisenc and vorbisfile are necessary to do meaningful Vorbis stream operations in a sane way. These are not available either.
  • There are several random crates in crates.io depending on several of these unsatisfactory binding projects, and it seems unlikely that their maintainers will promptly accept breaking changes on them, generating ecosystem fragmentation.
  • Like most software libraries, frameworks and even Linux distributions, the existing crates seem to be oblivious to the existence of the aoTuV and Lancer patchsets, even though they are meant to be drop-in replacements. Thus, users may reasonably expect any patches to be mentioned, which is a good reason to do a different set of binding crates anyway.

Given these issues and the need for a better solution for Ogg Vorbis audio processing applications in Rust, it was decided to spend development effort on making new bindings: it was estimated that the upfront cost of fixing the technical debt of the ecosystem was higher than starting bindings from scratch and periodically updating the library bindings from upstream. Rewriting the patched Vorbis encoder in Rust was deemed unfeasible.

⚖️ License

The bindings in this repository are licensed under the BSD 3-Clause "New" or "Revised" License (LICENSE or https://opensource.org/licenses/BSD-3-Clause), which is the same permissive license used by the upstream projects.

Contribution license

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in vorbis_rs by you shall be licensed as above, without any additional terms or conditions.

✨ Contributing

This repository started as an ad-hoc solution to address the needs of a Rust application, but it has grown into a project of its own - PRs are welcome!

Cloning & updating

The C libraries sources are managed with submodules, so updating the binding crates with the latest upstream changes should be easy:

  1. Update the submodules.
  2. Run the generate-bindings.sh script on a Unix-like system (Linux, macOS, BSD) with rust-bindgen, or build the project with cargo build --features build-time-bindgen. This will regenerate the low-level FFI bindings according to the latest source code.
  3. Run cargo test. This will execute some basic sanity checks, including encoding and decoding example files, to check that the bindings still work.
  4. Review the changes and/or fix failing tests until there is reasonable confidence that the upgrade was completed successfully.
  5. Commit the changes.

When cloning the repository, remember to also check out the submodules with the vendor code. You can do this by running git submodule update --init --recursive.

Each time vendor code is updated, it will be necessary to release a new version of aotuv_lancer_vorbis_sys and/or ogg_next_sys, so that users of vorbis_rs can download binding crates with the updated vendor code.

🤝 Contact

We welcome friendly talk about the project, including questions, congratulations, and suggestions. Head to the GitHub Discussions page to interact with fellow users, contributors and developers.

🧑‍🤝‍🧑 Contributors

Thanks goes to these wonderful people (emoji key):

Alejandro González
Alejandro González

💻 📖 💡 🚧 📆
Vivian
Vivian

💻 🤔
Martin Algesten
Martin Algesten

💻
Kyle Chen
Kyle Chen

🤔
Daniel Collin
Daniel Collin

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Dependencies