Class: shaka.codec.Flac

Members

BLOCK_HEADER_SIZE_ :number

The header of a metadata block: type and last-block flag (1 byte) and length (3 bytes).
Type:
  • number
Source:

BLOCK_SIZE_CODE_8_BITS_ :number

@const
Type:
  • number
Source:

BLOCK_SIZE_CODE_16_BITS_ :number

@const
Type:
  • number
Source:

BLOCK_SIZE_CODE_192_ :number

The block size codes of the frame header. Code 1 is 192 samples; 2 to 5 are 576 doubled each time; 6 and 7 write the size after the header, with 8 and 16 bits; 8 to 15 are 256 doubled each time.
Type:
  • number
Source:

BLOCK_SIZE_CODE_256_FIRST_ :number

@const
Type:
  • number
Source:

BLOCK_SIZE_CODE_576_FIRST_ :number

@const
Type:
  • number
Source:

BLOCK_SIZE_CODE_576_LAST_ :number

@const
Type:
  • number
Source:

BLOCK_TYPE_MASK_ :number

@const
Type:
  • number
Source:

BLOCK_TYPE_STREAM_INFO_ :number

@const
Type:
  • number
Source:

FRAME_HEADER_MIN_SIZE_ :number

The bytes of a frame header before the coded number: sync code, sizes and channel assignment.
Type:
  • number
Source:

LAST_BLOCK_FLAG_ :number

The bit of the first byte of a metadata block header that marks the last one.
Type:
  • number
Source:

MARKER_ :Array<number>

The "fLaC" marker that starts a FLAC stream.
Type:
  • Array<number>
Source:

STREAM_INFO_SIZE_ :number

@const
Type:
  • number
Source:

Methods

buildDfLa(metadatanon-null) → {Uint8Array}

Gets the payload of the dfLa box (FLAC specific box): a full box that holds the metadata blocks. Only the STREAMINFO block, which is all a decoder needs, is written, and it is marked as the last block. The metadata of a Matroska track has it with the flag cleared, when the muxer left the blocks that follow it out, and a decoder that follows the specification to the letter then looks for a block that is not there.
Parameters:
Name Type Description
metadata Uint8Array The metadata blocks, with or without the "fLaC" marker.
Source:
Returns:
Type
Uint8Array

getBlockSize(framenon-null, streamInfo) → {number}

Gets the number of samples of a FLAC frame from its header.
Parameters:
Name Type Description
frame Uint8Array
streamInfo shaka.codec.Flac.StreamInfo
Source:
Returns:
Type
number

hasMarker_(metadatanon-null) → {boolean}

Parameters:
Name Type Description
metadata Uint8Array
Source:
Returns:
Type
boolean

parseStreamInfo(metadatanon-null) → {shaka.codec.Flac.StreamInfo}

Reads the STREAMINFO block of a FLAC stream.
Parameters:
Name Type Description
metadata Uint8Array The metadata blocks, i.e. the STREAMINFO block, which comes first, and the ones that follow. A leading "fLaC" marker, as Matroska stores it, is accepted.
Source:
Returns:
Type
shaka.codec.Flac.StreamInfo

Type Definitions

StreamInfo

Type:
  • {minBlockSize: number, maxBlockSize: number, sampleRate: number, channelCount: number, bitsPerSample: number}
Source: