YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.codec.OpusHeader Class Reference

The CodecHeader of the codec opus as the Snapcast server writes it: 12 bytes, little endian: the magic 0x4F505553, the sample rate, the bits per sample and the channels. More...

Collaboration diagram for de.yaacc.multiroom.codec.OpusHeader:
Collaboration graph

Public Member Functions

int getSampleRate ()
 
int getBitsPerSample ()
 
int getChannels ()
 
byte[] toOpusHead ()
 The OpusHead of RFC 7845 for the platform decoder (csd-0): version 1, the channels, pre-skip 0 (the packets are played as they come, as the Snapcast client does), the input rate, no gain, channel mapping family 0.
 

Static Public Member Functions

static OpusHeader parse (byte[] header) throws StreamFormatException
 
static byte[] build (long sampleRate, int bitsPerSample, int channels)
 The 12 bytes for these values (no check: the reader decides what it accepts).
 
static byte[] nanosLittleEndian (long nanos)
 A number of nanoseconds as 8 bytes little endian, the form of csd-1 (pre-skip) and csd-2 (pre-roll).
 

Static Public Attributes

static final int LENGTH = 12
 

Detailed Description

The CodecHeader of the codec opus as the Snapcast server writes it: 12 bytes, little endian: the magic 0x4F505553, the sample rate, the bits per sample and the channels.

A chunk is one Opus packet. The encoder of Snapcast always writes 48000, 16 and 2; the platform decoder outputs 48000 Hz 16 bit, so this is the format that is accepted (mono too: a packet may hold one channel).

Member Function Documentation

◆ parse()

static OpusHeader de.yaacc.multiroom.codec.OpusHeader.parse ( byte[] header) throws StreamFormatException
static
Exceptions
StreamFormatExceptionBAD_LENGTH for another length than 12, MALFORMED for another magic number, UNSUPPORTED_FORMAT for a format other than 48000 Hz, 16 bit, one or two channels

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