transcode_voice

Function transcode_voice 

Source
pub fn transcode_voice(
    target: ProtocolKind,
    event: &VoiceEvent,
    cached_header: Option<&DStarHeader>,
    out: &mut [u8],
) -> Result<usize, TranscodeError>
Expand description

Encode a voice event in the given target protocol’s wire format.

For DCS, cached_header must be Some on stream-start AND on every subsequent frame (because each DCS voice packet embeds the header). For DPlus and DExtra, cached_header is only consulted on the header frame itself (and on StreamEnd where the downstream protocol still needs the header for its own framing on some encoders — currently unused, but kept for symmetry).

Returns the number of bytes written into out.

§Errors