[−][src]Crate audiopus
Audiopus is a high level abstraction over the Opus library.
This crate uses its own implementation of TryInto
/TryFrom
attempting to
convert to newtypes (Packet
, MutPacket
, and MutSignals
) ensuring Opus'
restrictions will be kept in mind by checking these on construction.
Without these restrictions, crashes would occur because Opus does not know
any types larger than i32
and does not expect empty packets.
Hence our own TryInto
/TryFrom
allows us to couple restriction-checks
with actual types and yet remaining stable Rust.
Packet
, MutPacket
, MutSignals
implement conversions from
&Vec[T]
/&[T]
, they do not move or destroy the original type.
A Packet
references an underlying buffer of type &[u8]
, it cannot be
empty and not longer than std::i32::MAX
.
Same goes for MutPacket
, except the type mutably borrows the buffer thus
checks length before handing out the length-value as Result
.
MutSignals
wraps around a generic buffer and represents Opus' output.
E.g. when encoding, Opus will fill the buffer with the encoded data.
Audiopus aims to never panic or crash when interacting with Opus, if either occurs, consider this a bug.
Re-exports
pub use crate::error::Error; |
pub use crate::error::ErrorCode; |
pub use crate::error::Result; |
pub use audiopus_sys as ffi; |
Modules
coder | |
error | |
packet | |
repacketizer | |
softclip |
Structs
MutSignals | A newtype wrapping around a mutable buffer. They represent mutably borrowed arguments that will be filled by Opus. E.g. you pass this to an encode-method and Opus encodes data into the underlying buffer. |
Enums
Application | Represents possible application-types for Opus. |
Bandwidth | Represents possible bandwidths of an Opus-stream. |
Bitrate | |
Channels | Represents possible audio channels Opus can use. |
SampleRate | Represents possible sample rates Opus can use. Values represent Hertz. |
Signal |
Traits
TryFrom | While |
TryInto | While |