YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.audio.FlacEncoder Class Reference

A FLAC encoder for the stream to a Sendspin player (issue #325, task 11.3): 16 bit stereo PCM in, one complete FLAC frame per chunk out, and the codec_header (fLaC marker and STREAMINFO) that stream/start carries. More...

Collaboration diagram for de.yaacc.audio.FlacEncoder:
Collaboration graph

Public Member Functions

 FlacEncoder (int sampleRate)
 
byte[] encode (byte[] pcm, int offset, int length)
 Encodes length bytes of 16 bit little endian stereo PCM (a whole number of frames) as one FLAC frame.
 

Static Public Member Functions

static byte[] streamHeader (int sampleRate, int blockFrames)
 The codec header of the stream: the fLaC marker and the STREAMINFO block (34 bytes), as the specification of Sendspin demands for the codec flac.
 

Detailed Description

A FLAC encoder for the stream to a Sendspin player (issue #325, task 11.3): 16 bit stereo PCM in, one complete FLAC frame per chunk out, and the codec_header (fLaC marker and STREAMINFO) that stream/start carries.

Written for what the hub needs and nothing more: fixed blocks (the chunk of the stream), the fixed predictors of order 0 to 4, a constant or a verbatim subframe where that is smaller, Rice coding with partitions, and the four channel assignments (independent, left/side, right/side, mid/side) of which the smallest is taken for every frame. Lossless; no state between frames except the frame number.

The format is the one of the FLAC specification (RFC 9639): frame header with a CRC-8, subframes, CRC-16 of the frame. An instance is for one stream and one thread.

Member Function Documentation

◆ streamHeader()

static byte[] de.yaacc.audio.FlacEncoder.streamHeader ( int sampleRate,
int blockFrames )
static

The codec header of the stream: the fLaC marker and the STREAMINFO block (34 bytes), as the specification of Sendspin demands for the codec flac.

Sizes and the number of samples are unknown (0) in a stream; the checksum of the audio is unset.


The documentation for this class was generated from the following file: