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
packetin place tonew_lenbytes by adding opus padding (no re-encode). No-op if alreadynew_len; errors ifnew_lenis smaller. - parse_
packet - Split
datainto its frames. Returns (toc, frame byte-ranges, packet_offset).self_delimitedparses 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.