FlacStreamMetadata


@UnstableApi
class FlacStreamMetadata


Holder for FLAC metadata.

See the following spec references:

Summary

Nested types

A FLAC seek table.

Constants

const Int

Indicates that a value is not in the corresponding lookup table.

Public constructors

FlacStreamMetadata(data: ByteArray!, offset: Int)

Parses binary FLAC stream info metadata.

FlacStreamMetadata(
    minBlockSizeSamples: Int,
    maxBlockSizeSamples: Int,
    minFrameSize: Int,
    maxFrameSize: Int,
    sampleRate: Int,
    channels: Int,
    bitsPerSample: Int,
    totalSamples: Long,
    vorbisComments: ArrayList<String!>!,
    pictureFrames: ArrayList<PictureFrame!>!
)

Public functions

FlacStreamMetadata!

Returns a copy of this with the given picture frames added to the metadata.

FlacStreamMetadata!

Returns a copy of this with the seek table replaced by the one given.

FlacStreamMetadata!

Returns a copy of this with the given Vorbis comments added to the metadata.

Long

Returns the approximate number of bytes per frame for the current FLAC stream.

Int

Returns the bitrate of the stream after it's decoded into PCM.

Long

Returns the duration of the FLAC stream in microseconds, or TIME_UNSET if the total number of samples if unknown.

Format!
getFormat(streamMarkerAndInfoBlock: ByteArray!, id3Metadata: Metadata?)

Returns a Format extracted from the FLAC stream metadata.

Int

Returns the maximum size for a decoded frame from the FLAC stream.

Metadata?

Returns a copy of the content metadata with entries from other appended.

Long

Returns the sample number of the sample at a given time.

Public properties

Int

Number of bits per sample.

Int

Lookup key corresponding to the number of bits per sample of the stream, or NOT_IN_LOOKUP_TABLE if it is not in the lookup table.

Int

Number of audio channels.

Int

Maximum number of samples per block.

Int

Maximum frame size in bytes, or 0 if the value is unknown.

Int

Minimum number of samples per block.

Int

Minimum frame size in bytes, or 0 if the value is unknown.

Int

Sample rate in Hertz.

Int

Lookup key corresponding to the stream sample rate, or NOT_IN_LOOKUP_TABLE if it is not in the lookup table.

FlacStreamMetadata.SeekTable?

Seek table, or null if it is not provided.

Long

Total number of samples, or 0 if the value is unknown.

Constants

NOT_IN_LOOKUP_TABLE

const val NOT_IN_LOOKUP_TABLE = -1: Int

Indicates that a value is not in the corresponding lookup table.

Public constructors

FlacStreamMetadata

FlacStreamMetadata(data: ByteArray!, offset: Int)

Parses binary FLAC stream info metadata.

Parameters
data: ByteArray!

An array containing binary FLAC stream info block.

offset: Int

The offset of the stream info block in data, excluding the header (i.e. the offset points to the first byte of the minimum block size).

FlacStreamMetadata

FlacStreamMetadata(
    minBlockSizeSamples: Int,
    maxBlockSizeSamples: Int,
    minFrameSize: Int,
    maxFrameSize: Int,
    sampleRate: Int,
    channels: Int,
    bitsPerSample: Int,
    totalSamples: Long,
    vorbisComments: ArrayList<String!>!,
    pictureFrames: ArrayList<PictureFrame!>!
)

Public functions

copyWithPictureFrames

fun copyWithPictureFrames(pictureFrames: (Mutable)List<PictureFrame!>!): FlacStreamMetadata!

Returns a copy of this with the given picture frames added to the metadata.

copyWithSeekTable

fun copyWithSeekTable(seekTable: FlacStreamMetadata.SeekTable?): FlacStreamMetadata!

Returns a copy of this with the seek table replaced by the one given.

copyWithVorbisComments

fun copyWithVorbisComments(vorbisComments: (Mutable)List<String!>!): FlacStreamMetadata!

Returns a copy of this with the given Vorbis comments added to the metadata.

getApproxBytesPerFrame

fun getApproxBytesPerFrame(): Long

Returns the approximate number of bytes per frame for the current FLAC stream.

getDecodedBitrate

fun getDecodedBitrate(): Int

Returns the bitrate of the stream after it's decoded into PCM.

getDurationUs

fun getDurationUs(): Long

Returns the duration of the FLAC stream in microseconds, or TIME_UNSET if the total number of samples if unknown.

getFormat

fun getFormat(streamMarkerAndInfoBlock: ByteArray!, id3Metadata: Metadata?): Format!

Returns a Format extracted from the FLAC stream metadata.

streamMarkerAndInfoBlock is updated to set the bit corresponding to the stream info last metadata block flag to true.

Parameters
streamMarkerAndInfoBlock: ByteArray!

An array containing the FLAC stream marker followed by the stream info block.

id3Metadata: Metadata?

The ID3 metadata of the stream, or null if there is no such data.

Returns
Format!

The extracted Format.

getMaxDecodedFrameSize

fun getMaxDecodedFrameSize(): Int

Returns the maximum size for a decoded frame from the FLAC stream.

getMetadataCopyWithAppendedEntriesFrom

fun getMetadataCopyWithAppendedEntriesFrom(other: Metadata?): Metadata?

Returns a copy of the content metadata with entries from other appended.

getSampleNumber

fun getSampleNumber(timeUs: Long): Long

Returns the sample number of the sample at a given time.

Parameters
timeUs: Long

Time position in microseconds in the FLAC stream.

Returns
Long

The sample number corresponding to the time position.

Public properties

bitsPerSample

val bitsPerSampleInt

Number of bits per sample.

bitsPerSampleLookupKey

val bitsPerSampleLookupKeyInt

Lookup key corresponding to the number of bits per sample of the stream, or NOT_IN_LOOKUP_TABLE if it is not in the lookup table.

This key is used to indicate the number of bits per sample in the frame header for the most common values.

The sample size lookup table is described in https://xiph.org/flac/format.html#frame_header.

channels

val channelsInt

Number of audio channels.

maxBlockSizeSamples

val maxBlockSizeSamplesInt

Maximum number of samples per block.

maxFrameSize

val maxFrameSizeInt

Maximum frame size in bytes, or 0 if the value is unknown.

minBlockSizeSamples

val minBlockSizeSamplesInt

Minimum number of samples per block.

minFrameSize

val minFrameSizeInt

Minimum frame size in bytes, or 0 if the value is unknown.

sampleRate

val sampleRateInt

Sample rate in Hertz.

sampleRateLookupKey

val sampleRateLookupKeyInt

Lookup key corresponding to the stream sample rate, or NOT_IN_LOOKUP_TABLE if it is not in the lookup table.

This key is used to indicate the sample rate in the frame header for the most common values.

The sample rate lookup table is described in https://xiph.org/flac/format.html#frame_header.

seekTable

val seekTableFlacStreamMetadata.SeekTable?

Seek table, or null if it is not provided.

totalSamples

val totalSamplesLong

Total number of samples, or 0 if the value is unknown.