Skip to main content

AlecEncoderConfig

Struct AlecEncoderConfig 

Source
#[repr(C)]
pub struct AlecEncoderConfig { pub history_size: u32, pub max_patterns: u32, pub max_memory_bytes: u32, pub keyframe_interval: u32, pub smart_resync: bool, pub num_channels: u32, }
Expand description

Runtime configuration for a new ALEC encoder.

Mirrors the Milesight-integration defaults (history=20, patterns=256, memory=2048B, keyframe=50, smart_resync=true).

Pass a NULL pointer to alec_encoder_new_with_config to use all defaults. Any numeric field set to 0 is replaced by its default, so callers can opt in to a single override while keeping the rest. num_channels is the only documented exception — 0 means “do not pre-warm” (legacy behaviour), any positive value activates the init-time pre-warm described below.

Fields§

§history_size: u32

Per-source history window size. Default: 20.

§max_patterns: u32

Maximum patterns retained in the context dictionary. Default: 256.

§max_memory_bytes: u32

Maximum memory budget for the context in bytes. Default: 2048.

§keyframe_interval: u32

Interval (in messages) between forced Raw32 keyframes. Default: 50. Set to 0 to disable periodic keyframes.

§smart_resync: bool

If true, the encoder honours downlink-driven resync requests (via alec_force_keyframe). Default: true.

§num_channels: u32

v1.3.9 addition. Number of fixed channels to pre-allocate at encoder-creation time. When > 0, alec_encoder_new_with_config immediately allocates one SourceStats entry per channel (ids 1..=num_channels, matching the fixed_channel_source_id convention), so the first call to alec_encode_multi_fixed performs ZERO heap allocations.

Set to the number of channels your firmware uses (5 for the Milesight EM500-CO2). 0 disables the pre-warm and keeps the pre-v1.3.9 behaviour — the first encode allocates on demand, which can panic on heaps partially consumed between alec_encoder_new_with_config and the first encode.

Upper bound: 64 (matches Encoder::encode_multi_fixed’s channel cap). Values above 64 are treated as 0.

Implementations§

Source§

impl AlecEncoderConfig

Source

pub fn defaults() -> Self

Return a config pre-populated with all Milesight defaults.

Trait Implementations§

Source§

impl Clone for AlecEncoderConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AlecEncoderConfig

Source§

impl Debug for AlecEncoderConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.