Skip to main content

Module pcm

Module pcm 

Source
Expand description

PCM codec: uncompressed interleaved linear PCM.

A PCM “codec” is trivial — the packet payload is the sample data. We still funnel it through Decoder / Encoder so that pipelines treat it uniformly.

Codec IDs:

  • pcm_u8 — unsigned 8-bit
  • pcm_s16le — signed 16-bit little-endian
  • pcm_s24le — signed 24-bit little-endian, packed
  • pcm_s32le — signed 32-bit little-endian
  • pcm_f32le — 32-bit IEEE float little-endian
  • pcm_f64le — 64-bit IEEE float little-endian

Asterisk-style signed-linear aliases:

  • slin, slin8, slin16, slin24, slin32, slin44, slin48, slin96, slin192 — all map onto the pcm_s16le implementation. The trailing digits only indicate the implied sample rate of the surrounding headerless .sln* container (see slin.rs); as a codec they are indistinguishable from pcm_s16le.

Functions§

codec_id_for
Return the canonical PCM codec ID for a SampleFormat. Planar formats have no direct PCM codec — the caller must convert to interleaved first.
params
Helper to build codec parameters for a PCM stream.
register
sample_format_for
Return the SampleFormat implied by a PCM codec ID.
time_base_for
Default time base for a PCM audio stream: 1 / sample_rate.