MoosicBox Opus Codec
RFC 6716 compliant Opus audio codec decoder for Symphonia.
Overview
The MoosicBox Opus package provides an Opus audio codec decoder that integrates with the Symphonia multimedia framework. It implements RFC 6716 packet parsing in Rust and uses libopus (via the audiopus crate) for audio decoding.
Features
- ✅ Complete RFC 6716 packet structure parsing (all code types 0-3)
- ✅ TOC (Table of Contents) byte interpretation
- ✅ Frame length decoding with VBR and CBR support
- ✅ Padding extraction and handling
- ✅ DTX (Discontinuous Transmission) frame detection
- ✅ Symphonia
Decodertrait implementation - ✅ Support for all Opus modes (SILK, CELT, Hybrid) via libopus
- ✅ Codec registry integration
Installation
[]
= "0.1.1"
Usage
Register the Opus decoder with a Symphonia codec registry:
use CodecRegistry;
use register_opus_codec;
let mut registry = new;
register_opus_codec;
Or create a registry with default Symphonia codecs plus Opus:
use create_opus_registry;
let registry = create_opus_registry;
Parse Opus packets directly when you need RFC 6716 packet inspection:
use OpusPacket;
let packet_bytes: & = &;
let packet = parse?;
let toc = packet.toc;
let frame_count = packet.frames.len;
let padding_len = packet.padding.len;
Core public API items:
register_opus_codecandcreate_opus_registryfor Symphonia integrationOpusDecoder(symphonia::core::codecs::Decoderimplementation for Opus)OpusPacketandOpusPacket::parsefor packet/frame parsingTocByte,OpusMode, andBandwidthfor TOC and mode/bandwidth interpretationOpusFrame,FramePacking, anddecode_frame_lengthfor frame-level packet handling
Implementation
This package implements:
- Packet parsing (
packet.rs) - Pure Rust parsing of Opus packet structures - TOC handling (
toc.rs) - Configuration and mode extraction - Frame processing (
frame.rs) - Frame length decoding and packing modes - Decoder integration (
decoder.rs) - Symphonia codec interface with libopus backend - Registry (
registry.rs) - Codec registration helpers
Audio decoding is performed by libopus through the audiopus crate.
License
Licensed under the same terms as the MoosicBox project.
See Also
- MoosicBox Audio Decoder - Audio decoding framework
- RFC 6716 - Opus codec specification
- Symphonia - Multimedia decoding framework