Module transcode

Module transcode 

Source
Expand description

Cross-protocol voice-frame transcoding.

When cross_protocol_forwarding is enabled in ReflectorConfig, a voice frame received on one protocol’s endpoint may need to be re-broadcast on a different protocol’s endpoint. This module owns the re-encoding step and the CrossProtocolEvent broadcast envelope the Reflector uses to plumb events between endpoints.

The transcoding is NOT loss-free across all protocol/frame type combinations. Specifically:

  • DPlus/DExtra header frames encode the same 41-byte D-STAR header and can be copied directly after protocol-specific framing.
  • DCS voice frames include the D-STAR header embedded in every packet — when transcoding DCSDPlus/DExtra, the endpoint emits a synthetic header frame on the first DCS packet of a stream and data frames for subsequent packets.
  • DPlus/DExtraDCS requires building a 100-byte DCS voice frame for every data packet, with the cached header embedded.

The function is deliberately sans-io: it only touches the caller-supplied scratch buffer and reads from the caller-supplied VoiceEvent / cached header. The caller is responsible for maintaining the StreamCache that holds cached headers across voice-data packets.

Structs§

CrossProtocolEvent
Broadcast envelope pushed onto the Reflector’s cross-protocol voice bus when cross_protocol_forwarding is enabled.

Enums§

TranscodeError
Errors returned by transcode_voice.
VoiceEvent
A decoded voice event ready for cross-protocol fan-out.

Functions§

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