### Get opusic-c Encoder Bitrate Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the current bitrate configuration of the opusic-c encoder. ```Rust pub fn get_bitrate(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Application Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the configured application type for the Opus encoder. This setting is typically mandatory during the encoder's initialization. ```rust pub fn get_application(&mut self) -> Result ``` -------------------------------- ### Rust: Get Encoder Sample Rate Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured sample rate for the current encoder instance. This is essential for audio processing. ```rust pub fn get_sample_rate(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Application (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured application type for the Opus encoder. The application type is a mandatory argument during encoder initialization. ```rust pub fn get_application(&mut self) -> Result ``` -------------------------------- ### Get Sample Rate - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the configured sample rate of the encoder instance. Returns a Result containing the SampleRate or an ErrorCode. ```rust pub fn get_sample_rate(&mut self) -> Result ``` -------------------------------- ### Configure Opus Encoder Bitrate Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Allows getting and setting the encoder's target bitrate. The actual bitrate may vary slightly due to frame size constraints (must be an integer number of bytes). ```Rust pub fn get_bitrate(&mut self) -> Result ``` ```Rust pub fn set_bitrate(&mut self, value: Bitrate) -> Result<(), ErrorCode> ``` -------------------------------- ### Get Opus Encoder Lookahead Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the total delay introduced by the encoder in samples. This value indicates how many samples the decoder should expect the real data to begin after the start of the stream. ```Rust pub fn get_look_ahead(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Bandwidth Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the current bandpass configuration of the Opus encoder. This determines the frequency range of the encoded audio. ```rust pub fn get_bandwidth(&mut self) -> Result ``` -------------------------------- ### Get opusic-c Encoder VBR Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Checks whether Variable Bitrate (VBR) is currently enabled in the opusic-c encoder. ```Rust pub fn get_vbr(&mut self) -> Result ``` -------------------------------- ### Get Encoder Channels Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the number of channels configured for the encoder. This is used during encoding to determine frame size based on input length and channel count. ```Rust pub fn channels(&self) -> Channels ``` -------------------------------- ### Get Opus Encoder Bandwidth (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the currently configured bandpass for the Opus encoder. This setting determines the frequency range of the encoded audio. ```rust pub fn get_bandwidth(&mut self) -> Result ``` -------------------------------- ### Rust: Get TypeId Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Gets the `TypeId` of the current object. This is a fundamental method for runtime type identification. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Rust: Get Encoder Phase Inversion Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured status of phase inversion for the encoder. This indicates whether phase inversion is enabled or disabled. ```rust pub fn get_phase_inversion_disabled(&mut self) -> Result ``` -------------------------------- ### opusic-c: Get libopus version Source: https://docs.rs/opusic-c/1.5.2/opusic_c/index Retrieves the version string of the linked libopus library. This function is useful for compatibility checks and debugging. ```Rust pub fn version() -> &'static str; ``` -------------------------------- ### Get Number of Frames in Repacketizer Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Returns the total number of frames that have been submitted to the repacketizer state since the last call to `reset()`. This helps in managing the audio data within the repacketizer. ```Rust pub fn get_nb_frames(&self) -> u32 ``` -------------------------------- ### Get Opus Encoder Signal Type Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the currently configured signal type hint for the Opus encoder. This hint assists the encoder in selecting the optimal encoding mode. ```rust pub fn get_signal(&mut self) -> Result ``` -------------------------------- ### Reset Opus Encoder State Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Resets the encoder's internal state to its initial configuration. This is useful for starting a new audio stream or recovering from errors. ```Rust pub fn reset(&mut self) -> Result<(), ErrorCode> ``` -------------------------------- ### Rust: Get Encoder DTX Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Accesses the current Discontinuous Transmission (DTX) status of the encoder. DTX is primarily applicable to the LPC layer. ```rust pub fn get_dtx(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Prediction Status (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured prediction status of the Opus encoder. Prediction is a technique used to improve compression efficiency. ```rust pub fn get_prediction_disabled(&mut self) -> Result ``` -------------------------------- ### Get opusic-c Encoder Constrained VBR Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Determines if constrained VBR is enabled for the opusic-c encoder. This setting is only relevant when the encoder is operating in CBR mode. ```Rust pub fn get_vbr_constraint(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Max Bandwidth (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the maximum allowed bandpass for the Opus encoder. This allows the encoder to automatically select the bandpass while respecting an upper limit. ```rust pub fn get_max_bandwidth(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Complexity Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the current computational complexity setting of the Opus encoder. This value indicates how much processing power the encoder is configured to use. ```rust pub fn get_complexity(&mut self) -> Result ``` -------------------------------- ### Get Phase Inversion Status - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the encoder's configured phase inversion status. Returns a Result containing a boolean indicating the status or an ErrorCode. ```rust pub fn get_phase_inversion_disabled(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Prediction Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the current prediction status of the Opus encoder. If prediction is disabled, frames become more independent, which can reduce quality. ```rust pub fn get_prediction_disabled(&mut self) -> Result ``` -------------------------------- ### Get opusic-c Encoder Lookahead Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the total lookahead delay introduced by the opusic-c encoder in samples. This indicates how many samples late the actual decoded data begins from the decoder's perspective. ```Rust pub fn get_look_ahead(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Complexity (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the current complexity setting of the Opus encoder. Complexity ranges from 0 to 10, with higher values indicating more computational effort for better quality. ```rust pub fn get_complexity(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Frame Duration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the configured setting for variable duration frames in the Opus encoder. This determines if the encoder can use shorter frames than requested. ```rust pub fn get_frame_duration(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Signal Type (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured signal type for the Opus encoder. This setting provides a hint to the encoder for optimizing its mode selection. ```rust pub fn get_signal(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Packet Loss Percentage Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the configured percentage of expected packet loss for the Opus encoder. This influences the encoder's behavior to optimize for packet loss resilience. ```rust pub fn get_packet_loss(&mut self) -> Result ``` -------------------------------- ### Get DTX Status - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Accesses the encoder's Discontinuous Transmission (DTX) value. Returns a Result containing a boolean indicating the DTX status or an ErrorCode. ```rust pub fn get_dtx(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Inband FEC Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the configured status of inband forward error correction (FEC) for the Opus encoder. This feature is only applicable to the LPC layer. ```rust pub fn get_inband_fec(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Frame Duration (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured setting for variable duration frames in the Opus encoder. This allows the encoder to use frames of different lengths. ```rust pub fn get_frame_duration(&mut self) -> Result ``` -------------------------------- ### Rust: Get Encoder DRED Duration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the encoder's configured Deep Redundancy (DRED) maximum number of frames. DRED helps in ensuring data redundancy. ```rust pub fn get_dred_duration(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Inband FEC Status (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured status of inband forward error correction (FEC) for the Opus encoder. This feature is specifically applicable to the LPC layer. ```rust pub fn get_inband_fec(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder Packet Loss Percentage (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured expected packet loss percentage for the Opus encoder. This value influences the encoder's behavior to optimize for packet loss resilience. ```rust pub fn get_packet_loss(&mut self) -> Result ``` -------------------------------- ### Create opusic-c Encoder Instance Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Initializes a new opusic-c encoder instance. Requires configuration details like channel count, sample rate, and application type. Returns a Result containing the encoder or an ErrorCode. ```Rust pub fn new( config: Config, rate: SampleRate, app: Application, ) -> Result ``` -------------------------------- ### Get Opus Encoder LSB Depth (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Retrieves the configured least significant bit (LSB) depth for the Opus encoder. This setting helps the encoder identify silence and near-silence based on signal intensity. ```rust pub fn get_lsb_depth(&mut self) -> Result ``` -------------------------------- ### Get Opus Encoder LSB Depth Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Retrieves the configured least significant bit (LSB) depth for the Opus encoder. This value helps the encoder identify silence and near-silence by indicating the number of significant bits. ```rust pub fn get_lsb_depth(&mut self) -> Result ``` -------------------------------- ### Initialize Opus Encoder Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Creates a new instance of the Opus encoder. Requires specifying the number of channels, sample rate, and application type. Returns a Result containing the encoder instance or an ErrorCode. ```Rust pub fn new( channels: Channels, rate: SampleRate, app: Application, ) -> Result ``` -------------------------------- ### Get Type ID - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Gets the `TypeId` of the current instance. This is a standard method for trait objects. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### From Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `From` trait, providing a `from` method. This allows creating an `OngoingRepacketizer` instance from itself, typically used for identity conversions. ```Rust fn from(t: T) -> T ``` -------------------------------- ### Create Packet from Repacketizer Data Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Constructs a new packet from data previously submitted to the repacketizer state within a specified frame range. The output buffer size should be estimated based on the frame range and individual packet lengths. ```Rust pub fn create_packet( &self, range: (u32, u32), out: &mut [MaybeUninit], ) -> Result ``` -------------------------------- ### Opus Multistream Encoder Configuration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/index Defines the configuration for encoding multistream Opus data. This structure likely holds parameters necessary for initializing and managing the multistream encoder. ```Rust struct Encoder; // ... other fields and methods ``` -------------------------------- ### TryInto Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `TryInto` trait, providing a `try_into` method for attempting conversion from `OngoingRepacketizer` to another type. It defines an `Error` type for potential conversion failures. ```Rust type Error = >::Error ``` -------------------------------- ### Create Full Packet from Repacketizer Data Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Constructs a new packet using all available frames currently stored in the repacketizer state. This is equivalent to calling `create_packet` with the full range of available frames. ```Rust pub fn create_full_packet( &self, out: &mut [MaybeUninit], ) -> Result ``` -------------------------------- ### TryFrom Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `TryFrom` trait, providing a `try_from` method for attempting conversion into `OngoingRepacketizer`. It defines an `Error` type for potential conversion failures. ```Rust type Error = Infallible fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Opus Packet Manipulation with opusic-c Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/index The opusic-c crate provides functionalities to manage Opus packets. This includes tools for repacketizing, which involves merging or splitting Opus packets. It also offers functions to pad packets to a larger size or remove padding while optimizing the TOC sequence. ```Rust /// Pads a given Opus packet to a larger size (possibly changing the TOC sequence). pub fn pad_packet(...) { // Implementation details... } /// Remove all padding from a given Opus packet and rewrite the TOC sequence to minimize space usage. pub fn unpad_packet(...) { // Implementation details... } ``` -------------------------------- ### Opus Multistream Decoder Configuration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/index Defines the configuration for decoding multistream Opus data. This structure likely holds parameters necessary for initializing and managing the multistream decoder. ```Rust struct Decoder; // ... other fields and methods ``` -------------------------------- ### Set opusic-c Encoder Bitrate Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the bitrate for the opusic-c encoder. The actual bitrate may vary slightly due to frame length constraints. ```Rust pub fn set_bitrate(&mut self, value: Bitrate) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Application (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the intended application for the Opus encoder. This is a mandatory setting provided during the encoder's construction. ```rust pub fn set_application(&mut self, value: Application) -> Result<(), ErrorCode> ``` -------------------------------- ### Into Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `Into` trait, providing an `into` method. This allows converting an `OngoingRepacketizer` instance into another type that implements `From` for it. ```Rust fn into(self) -> U ``` -------------------------------- ### Add Packet to Repacketizer State Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Adds a packet of audio data to the current repacketizer state. The packet must match the existing configuration (coding mode, bandwidth, frame size, channel count) and the total duration must not exceed 120 ms after addition. Mismatched packets or exceeding duration requires a `reset()` call. ```Rust pub fn add_packet(&mut self, input: &'buf [u8]) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Application Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the intended application for the Opus encoder. This is a mandatory argument required during the encoder's construction. ```rust pub fn set_application(&mut self, value: Application) -> Result<(), ErrorCode> ``` -------------------------------- ### opusic-c: Re-export opusic_sys as sys Source: https://docs.rs/opusic-c/1.5.2/opusic_c/index This re-export makes the underlying opusic_sys functionalities available under the `sys` alias, providing direct access to the low-level C bindings of the libopus library. ```Rust pub use opusic_sys as sys; ``` -------------------------------- ### TryInto Conversion - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Performs a conversion that may fail, using the `TryFrom` trait. Returns a Result containing the converted value or an error. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### TryFrom Conversion - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Performs a conversion that may fail. Returns a Result containing the converted value or an error. ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### DredPacket Any Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Demonstrates the blanket implementation of the Any trait for DredPacket, allowing it to be downcast to specific types at runtime. ```Rust impl Any for T where T: 'static + ?Sized ``` -------------------------------- ### DredPacket TryFrom Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Covers the blanket implementation of the TryFrom trait for DredPacket, allowing fallible conversions from other types. ```Rust impl where U: Into ``` -------------------------------- ### Rust: TryFrom Conversion Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Attempts to convert a value into another type. Returns a `Result` indicating success or failure. ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### DredPacket TryInto Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Details the blanket implementation of the TryInto trait for DredPacket, enabling fallible conversions into other types. ```Rust impl where U: TryFrom ``` -------------------------------- ### OngoingRepacketizer Struct Definition Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Defines the OngoingRepacketizer struct, used for repacketizing audio data. It includes lifetime parameters 'a and 'buf, indicating dependencies on the original Repacketizer instance and the lifetime of the last added buffer, respectively. ```Rust pub struct OngoingRepacketizer<'a, 'buf> { /* private fields */ } ``` -------------------------------- ### Configure Opus Encoder Force Channels (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Sets the mono/stereo forcing for the Opus encoder. This allows forcing mono or stereo packets regardless of input audio format, useful for mono sources in stereo streams. ```rust pub fn set_force_channels( &mut self, value: Option, ) -> Result<(), ErrorCode> ``` -------------------------------- ### Rust: TryInto Conversion Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Attempts to convert a value into another type using the `TryFrom` trait. Returns a `Result` indicating success or failure. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Set Opus Encoder Max Bandwidth (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the maximum bandpass the Opus encoder can automatically select. This is recommended over `set_bandwidth` as it allows the encoder to adapt to lower bitrates while maintaining quality. ```rust pub fn set_max_bandwidth(&mut self, value: Bandwidth) -> Result<(), ErrorCode> ``` -------------------------------- ### Rust: From Conversion Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Converts a value into the same type. This is a simple identity conversion. ```rust fn from(t: T) -> T ``` -------------------------------- ### Into Conversion - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Calls `U::from(self)`. This method facilitates type conversions where a `From` implementation exists. ```rust fn into(self) -> U ``` -------------------------------- ### DredPacket Into Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Explains the blanket implementation of the Into trait for DredPacket, enabling conversions from itself into other types. ```Rust impl where U: From ``` -------------------------------- ### Set Opus Encoder Bandwidth (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Sets a specific bandpass for the Opus encoder, overriding automatic selection. This is useful when the input audio's bandpass is known, but `set_max_bandwidth` is generally preferred for flexibility. ```rust pub fn set_bandwidth(&mut self, value: Bandwidth) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Phase Inversion - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures phase inversion for the encoder. Setting this to true disables phase inversion for intensity stereo, potentially improving mono downmix quality at a slight cost to stereo quality. Returns a Result indicating success or an ErrorCode. ```rust pub fn set_phase_inversion_disabled( &mut self, value: bool, ) -> Result<(), ErrorCode> ``` -------------------------------- ### Opus Multistream Configuration Structure Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/index Represents the configuration settings for Opus multistream operations. This structure is used for both encoding and decoding multistream Opus packets. ```Rust struct Config; // ... other fields and methods ``` -------------------------------- ### Borrow Method Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `Borrow` trait, providing an immutable borrow method. This allows accessing the `OngoingRepacketizer` instance as a reference to its contained type. ```Rust fn borrow(&self) -> &T ``` -------------------------------- ### From Conversion - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Returns the argument unchanged. This is a simple identity conversion. ```rust fn from(t: T) -> T ``` -------------------------------- ### Configure Opus Encoder VBR Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Enables or disables Variable Bitrate (VBR) mode. When VBR is enabled, the encoder adjusts bitrate dynamically. Constrained VBR can also be enabled, though its adherence depends on the Opus mode. ```Rust pub fn get_vbr(&mut self) -> Result ``` ```Rust pub fn set_vbr(&mut self, value: bool) -> Result<(), ErrorCode> ``` ```Rust pub fn get_vbr_constraint(&mut self) -> Result ``` ```Rust pub fn set_vbr_constraint(&mut self, value: bool) -> Result<(), ErrorCode> ``` -------------------------------- ### BorrowMut Method Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `BorrowMut` trait, providing a mutable borrow method. This allows modifying the `OngoingRepacketizer` instance through a mutable reference. ```Rust fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### DredPacket From Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Details the blanket implementation of the From trait for DredPacket, facilitating conversions into other types. ```Rust impl From for T ``` -------------------------------- ### opusic-c: Compute frame size in bytes Source: https://docs.rs/opusic-c/1.5.2/opusic_c/index Calculates the size of an Opus frame in bytes for a given duration. This is essential for managing audio buffers and network packets. ```Rust pub fn frame_bytes_size(duration: FrameDuration, channels: Channels, bitrate: Bitrate) -> usize; ``` -------------------------------- ### Rust: Set Encoder Phase Inversion Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures phase inversion for the encoder. Setting this to `true` disables phase inversion for intensity stereo, which improves mono downmix quality at a slight cost to stereo quality. ```rust pub fn set_phase_inversion_disabled( &mut self, value: bool, ) -> Result<(), ErrorCode> ``` -------------------------------- ### Encode Integer Samples to Opus Frame Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Encodes a frame of interleaved integer audio samples (u16) into an Opus frame. The output is written to a mutable slice of uninitialized bytes. The number of bytes written is returned on success. Input size must match the configured sample rate and frame duration. Interleaved input is required for multi-channel configurations. ```Rust pub fn encode_to( &mut self, input: &[u16], output: &mut [MaybeUninit], ) -> Result ``` -------------------------------- ### Encode Float Samples to Opus Frame Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Encodes a frame of interleaved floating-point audio samples (f32) into an Opus frame. The output is written to a mutable slice of uninitialized bytes. The number of bytes written is returned on success. Input size must match the configured sample rate and frame duration. Interleaved input is required for multi-channel configurations. It's recommended to use samples within the +/-1.0 range. ```Rust pub fn encode_float_to( &mut self, input: &[f32], output: &mut [MaybeUninit], ) -> Result ``` -------------------------------- ### Reset OngoingRepacketizer State Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Re-initializes the OngoingRepacketizer state, resetting any ongoing repacketization progress. This is crucial before adding new packets with different configurations or exceeding duration limits. ```Rust pub fn reset(&mut self) ``` -------------------------------- ### Set Opus Encoder Packet Loss Percentage (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the expected packet loss percentage for the Opus encoder (0-100). Higher values encourage more loss-resistant encoding, potentially at the cost of quality in ideal conditions but improving it under loss. ```rust pub fn set_packet_loss(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Rust: Into Conversion Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Converts a value into another type using the `From` trait. This allows for flexible type conversions. ```rust fn into(self) -> U ``` -------------------------------- ### Set Opus Encoder Packet Loss Percentage Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the expected packet loss percentage for the Opus encoder (0-100). Higher values encourage more loss-resistant encoding, potentially at the cost of quality in ideal conditions but improving it under packet loss. ```rust pub fn set_packet_loss(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Configure Opus Encoder Forced Channels Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Allows retrieving the currently configured forced channel mode for the encoder, if any is set. This overrides automatic channel detection. ```Rust pub fn get_force_channels(&mut self) -> Result, ErrorCode> ``` -------------------------------- ### Encode Integer Samples to Opus Frame Slice Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Encodes a frame of interleaved integer audio samples (u16) into an Opus frame, writing the output directly to a mutable slice of bytes. This is a convenience function that refers to the details of `encode_to`. ```Rust pub fn encode_to_slice( &mut self, input: &[u16], output: &mut [u8], ) -> Result ``` -------------------------------- ### Create DredPacket Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Provides a function to create a new, uninitialized DredPacket. This function returns a Result, indicating success with the packet or an ErrorCode on failure. ```Rust pub fn new() -> Result ``` -------------------------------- ### Set Opus Encoder Maximum Bandwidth Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the maximum bandpass the Opus encoder will automatically select. This allows setting an upper limit while still enabling the encoder to reduce bandwidth at lower bitrates for improved quality. ```rust pub fn set_max_bandwidth(&mut self, value: Bandwidth) -> Result<(), ErrorCode> ``` -------------------------------- ### Rust: Configure Encoder Frame Duration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Sets the encoder's frame duration configuration. When variable duration is enabled, the encoder can use a shorter frame size than requested. The user must verify the encoded audio amount via the ToC byte of the encoded packet and resend unencoded audio. ```rust pub fn set_frame_duration( &mut self, value: FrameDuration, ) -> Result<(), ErrorCode> ``` -------------------------------- ### Set opusic-c Encoder VBR Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Enables or disables Variable Bitrate (VBR) for the opusic-c encoder. Note that the target bitrate might not be met exactly due to frame byte length requirements. ```Rust pub fn set_vbr(&mut self, value: bool) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Bandwidth Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Sets a specific bandpass for the Opus encoder, overriding automatic selection. It's recommended to use `set_max_bandwidth` for better quality under varying bitrates. ```rust pub fn set_bandwidth(&mut self, value: Bandwidth) -> Result<(), ErrorCode> ``` -------------------------------- ### Encode u16 Audio Data Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Encodes a frame of u16 audio data into a buffer. The output buffer must be pre-allocated with sufficient capacity. Input data should be interleaved if multiple channels are used. Frame size is dependent on the sample rate. ```Rust pub fn encode_to( &mut self, input: &[u16], output: &mut [MaybeUninit], ) -> Result ``` ```Rust pub fn encode_to_slice( &mut self, input: &[u16], output: &mut [u8], ) -> Result ``` ```Rust pub fn encode_to_vec( &mut self, input: &[u16], output: &mut Vec, ) -> Result ``` -------------------------------- ### Encode Float Samples to Opus Frame Slice Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Encodes a frame of interleaved floating-point audio samples (f32) into an Opus frame, writing the output directly to a mutable slice of bytes. This function refers to the details of `encode_float_to`. ```Rust pub fn encode_float_to_slice( &mut self, input: &[f32], output: &mut [u8], ) -> Result ``` -------------------------------- ### DredPacket BorrowMut Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Illustrates the blanket implementation of the BorrowMut trait for DredPacket, allowing mutable borrowing of its contents. ```Rust impl BorrowMut for T where T: ?Sized ``` -------------------------------- ### Apply soft-clipping to audio signal (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/utils/fn The soft_clip function takes a mutable slice of f32 representing the audio signal and a Channels enum. It applies a smooth clipping algorithm to values outside the [-1,1] range, preserving signal integrity. ```Rust pub fn soft_clip(input: &mut [f32], channels: Channels) ``` -------------------------------- ### Set Opus Encoder Complexity (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the computational complexity of the Opus encoder. Supported values are 0-10, where 10 represents the highest complexity. ```rust pub fn set_complexity(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Encode f32 Audio Data Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Encodes a frame of f32 audio data into a buffer. Similar to the u16 encoding, it requires pre-allocated output space and handles interleaved input for multi-channel audio. Float inputs should ideally be in the +/-1.0 range. ```Rust pub fn encode_float_to( &mut self, input: &[f32], output: &mut [MaybeUninit], ) -> Result ``` ```Rust pub fn encode_float_to_slice( &mut self, input: &[f32], output: &mut [u8], ) -> Result ``` ```Rust pub fn encode_float_to_vec( &mut self, input: &[f32], output: &mut Vec, ) -> Result ``` -------------------------------- ### Encode Integer Samples to Opus Frame Vector Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Encodes a frame of interleaved integer audio samples (u16) into an Opus frame, writing the output into a mutable vector. The vector's length is modified on success. The user is responsible for ensuring sufficient capacity in the vector. This function refers to the details of `encode_to`. ```Rust pub fn encode_to_vec( &mut self, input: &[u16], output: &mut Vec, ) -> Result ``` -------------------------------- ### DredPacket Borrow Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Shows the blanket implementation of the Borrow trait for DredPacket, enabling immutable borrowing of its contents. ```Rust impl Borrow for T where T: ?Sized ``` -------------------------------- ### Set Opus Encoder Complexity Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the computational complexity of the Opus encoder. The supported range is 0-10, where 10 represents the highest complexity, impacting encoding performance and quality. ```rust pub fn set_complexity(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Add Packet and Modify Lifetime Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Adds a packet to the ongoing state and returns a new `OngoingRepacketizer` instance with a potentially modified lifetime ('new_buf). This function refers to `add_packet` for detailed behavior and constraints. ```Rust pub fn with_packet<'new_buf>( self, input: &'new_buf [u8], ) -> Result, ErrorCode> where 'buf: 'new_buf, ``` -------------------------------- ### Set Opus Encoder Signal Type Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the type of signal being encoded by the Opus encoder. This serves as a hint to help the encoder choose the most appropriate encoding mode. ```rust pub fn set_signal(&mut self, value: Signal) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Inband FEC (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the use of inband forward error correction (FEC) for the Opus encoder. This setting impacts the LPC layer and improves robustness against packet loss. ```rust pub fn set_inband_fec(&mut self, value: InbandFec) -> Result<(), ErrorCode> ``` -------------------------------- ### Unpad Opus Packet (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/fn Removes padding from an Opus packet and optimizes the TOC sequence. Returns an error if the size cannot fit a u32, otherwise returns the new size of the input data. ```Rust pub fn unpad_packet(input: &mut [u8]) -> Result ``` -------------------------------- ### Encode Float Samples to Opus Frame Vector Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Encodes a frame of interleaved floating-point audio samples (f32) into an Opus frame, writing the output into a mutable vector. The vector's length is modified on success. The user is responsible for ensuring sufficient capacity in the vector. This function refers to the details of `encode_float_to`. ```Rust pub fn encode_float_to_vec( &mut self, input: &[f32], output: &mut Vec, ) -> Result ``` -------------------------------- ### Drop Implementation for OngoingRepacketizer Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `Drop` trait for `OngoingRepacketizer`, defining the behavior when the struct goes out of scope, typically involving cleanup or resource release. ```Rust fn drop(&mut self) ``` -------------------------------- ### Rust: Borrow Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Immutably borrows the object. This allows access to the object's data without taking ownership. ```rust fn borrow(&self) -> &T ``` -------------------------------- ### Reset opusic-c Encoder State Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Resets the internal state of the opusic-c encoder to its initial configuration. This is useful for reusing an encoder instance without re-initializing it. Returns a Result indicating success or an ErrorCode. ```Rust pub fn reset(&mut self) -> Result<(), ErrorCode> ``` -------------------------------- ### GetTypeId Method Source: https://docs.rs/opusic-c/1.5.2/opusic_c/repacketizer/struct Implements the `Any` trait, providing a `type_id` method that returns the `TypeId` of the `OngoingRepacketizer` instance. This is useful for runtime type identification. ```Rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Rust: Set Encoder DTX Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the encoder's use of Discontinuous Transmission (DTX). This setting is only relevant for the LPC layer. ```rust pub fn set_dtx(&mut self, value: bool) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder LSB Depth (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the LSB depth for the Opus encoder, ranging from 8 to 24 (default is 24). This parameter aids in silence detection and is interpreted differently for floating-point and fixed-point encoding. ```rust pub fn set_lsb_depth(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Set DTX Status - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the encoder's use of Discontinuous Transmission (DTX). This setting is only applicable to the LPC layer. Returns a Result indicating success or an ErrorCode. ```rust pub fn set_dtx(&mut self, value: bool) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Frame Duration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the Opus encoder's use of variable duration frames. When enabled, the encoder may use shorter frames than requested, requiring the user to check the ToC byte for the actual encoded audio length. ```rust pub fn set_frame_duration( &mut self, value: FrameDuration, ) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Signal Type (Rust) Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the type of signal being encoded by the Opus encoder. This hint assists the encoder in selecting the most appropriate encoding mode. ```rust pub fn set_signal(&mut self, value: Signal) -> Result<(), ErrorCode> ``` -------------------------------- ### Set opusic-c Encoder Constrained VBR Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Enables or disables constrained VBR for the opusic-c encoder. This option is disregarded if the encoder is in Constant Bitrate (CBR) mode. ```Rust pub fn set_vbr_constraint(&mut self, value: bool) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder Inband FEC Status Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the use of inband forward error correction (FEC) for the Opus encoder. This setting is specifically relevant to the LPC layer. ```rust pub fn set_inband_fec(&mut self, value: InbandFec) -> Result<(), ErrorCode> ``` -------------------------------- ### Set Opus Encoder LSB Depth Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Configures the depth of the signal being encoded by the Opus encoder, ranging from 8 to 24 bits. This is a hint for silence detection; for fixed-point encoding, the encoder uses the minimum of this value and 16. ```rust pub fn set_lsb_depth(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Rust: Set Encoder DRED Duration Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Configures the Deep Redundancy (DRED) for the encoder. Setting a non-zero value enables DRED and specifies the maximum number of 10-ms redundant frames. ```rust pub fn set_dred_duration(&mut self, value: u8) -> Result<(), ErrorCode> ``` -------------------------------- ### Borrow Immutably - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Immutably borrows from an owned value. This is a fundamental borrowing operation in Rust. ```rust fn borrow(&self) -> &T ``` -------------------------------- ### Rust: BorrowMut Source: https://docs.rs/opusic-c/1.5.2/opusic_c/struct Mutably borrows the object. This allows modification of the object's data while maintaining ownership. ```rust fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### DredPacket Send Implementation Source: https://docs.rs/opusic-c/1.5.2/opusic_c/dred/struct Indicates that the DredPacket struct implements the Send trait, allowing it to be safely sent across threads. ```Rust impl Send for DredPacket ``` -------------------------------- ### Borrow Mutably - Rust Source: https://docs.rs/opusic-c/1.5.2/opusic_c/multistream/struct Mutably borrows from an owned value. This allows for in-place modification of the data. ```rust fn borrow_mut(&mut self) -> &mut T ```