Decode a library track to the PCM format AirPlay/RAOP wants: 44.1 kHz, 16-bit,
stereo, little-endian, via ffmpeg. Returns the raw interleaved s16le bytes,
which AirPlay.Alac chops into 352-sample frames.
Summary
Functions
Split PCM into frames-sample stereo chunks (last one zero-padded).
Decode path to interleaved s16le stereo @44.1kHz, or {:error, reason}.
Build the ffmpeg argument list for streaming decode (used by
AirPlay.Decoder), emitting interleaved s16le stereo @44.1kHz on stdout.
Functions
@spec frames(binary(), pos_integer()) :: [binary()]
Split PCM into frames-sample stereo chunks (last one zero-padded).
Decode path to interleaved s16le stereo @44.1kHz, or {:error, reason}.
Build the ffmpeg argument list for streaming decode (used by
AirPlay.Decoder), emitting interleaved s16le stereo @44.1kHz on stdout.
Options:
:start_seconds— input seek offset (fast-ssbefore-i)
-re makes ffmpeg read its input at native rate, so it produces PCM at ~1×
real time rather than as fast as it can decode — that's the backpressure that
keeps the decoder's buffer (and the BEAM mailbox) bounded for long files.