Skip to main content

Module repacketizer

Module repacketizer 

Source
Expand description

Port of libopus src/repacketizer.c + the packet helpers from src/opus.c: split Opus packets into frames and recombine/re-frame/pad them WITHOUT re-encoding. Used to merge several packets into a longer one, split a multi-frame packet, or pad a packet to a target size (e.g. for CBR transport). All frames in a repacketizer must share the same TOC config (mode/bandwidth/frame-size); only the code (0..3) and framing change.

Structs§

Repacketizer
opus_repacketizer: accumulate frames from one or more same-config packets, then emit them as a single re-framed packet.

Functions§

nb_frames
opus_packet_get_nb_frames.
pad_packet
opus_packet_pad: grow packet in place to new_len bytes by adding opus padding (no re-encode). No-op if already new_len; errors if new_len is smaller.
parse_packet
Split data into its frames. Returns (toc, frame byte-ranges, packet_offset). self_delimited parses the trailing length prefix used by multistream.
samples_per_frame
opus_packet_get_samples_per_frame(toc, Fs).
unpad_packet
opus_packet_unpad: strip opus padding, returning the minimal packet.