# FlacStreamMetadata

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/FlacStreamMetadata.java+class:androidx.media3.extractor.FlacStreamMetadata)

*** ** * ** ***

<br />

```
@UnstableApi
class FlacStreamMetadata
```

<br />

*** ** * ** ***

Holder for FLAC metadata.

See the following sections of RFC 9639:

- [8.2 Streaminfo](https://www.rfc-editor.org/rfc/rfc9639.html#name-streaminfo)
- [8.5 Seek Table](https://www.rfc-editor.org/rfc/rfc9639.html#name-seek-table)
- [8.6 Vorbis Comment](https://www.rfc-editor.org/rfc/rfc9639.html#name-vorbis-comment)
- [8.8 Picture](https://www.rfc-editor.org/rfc/rfc9639.html#name-picture)

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata.SeekTable` A FLAC seek table. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#NOT_IN_LOOKUP_TABLE() = -1` Indicates that a value is not in the corresponding lookup table. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#FlacStreamMetadata(byte[],int)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Parses binary FLAC stream info metadata. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#FlacStreamMetadata(int,int,int,int,int,int,int,long,java.util.ArrayList<java.lang.String>,java.util.ArrayList<androidx.media3.extractor.metadata.flac.PictureFrame>)( minBlockSizeSamples: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxBlockSizeSamples: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minFrameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxFrameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sampleRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, channels: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bitsPerSample: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, totalSamples: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, vorbisComments: https://developer.android.com/reference/java/util/ArrayList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!, pictureFrames: https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/kotlin/androidx/media3/extractor/metadata/flac/PictureFrame!>! )` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#copyWithPictureFrames(java.util.List<androidx.media3.extractor.metadata.flac.PictureFrame>)(pictureFrames: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/extractor/metadata/flac/PictureFrame!>!)` Returns a copy of `this` with the given picture frames added to the metadata. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#copyWithSeekTable(androidx.media3.extractor.FlacStreamMetadata.SeekTable)(seekTable: https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata.SeekTable?)` Returns a copy of `this` with the seek table replaced by the one given. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#copyWithVorbisComments(java.util.List<java.lang.String>)(vorbisComments: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!)` Returns a copy of `this` with the given Vorbis comments added to the metadata. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getApproxBytesPerFrame()()` Returns the approximate number of bytes per frame for the current FLAC stream. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getDecodedBitrate()()` Returns the bitrate of the stream after it's decoded into PCM. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getDurationUs()()` Returns the duration of the FLAC stream in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the total number of samples if unknown. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getFormat(byte[],androidx.media3.common.Metadata)( streamMarkerAndInfoBlock: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, id3Metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata? )` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` extracted from the FLAC stream metadata. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getMaxDecodedFrameSize()()` Returns the maximum size for a decoded frame from the FLAC stream. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getMetadataCopyWithAppendedEntriesFrom(androidx.media3.common.Metadata)(other: https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata?)` Returns a copy of the content metadata with entries from `other` appended. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#getSampleNumber(long)(timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the sample number of the sample at a given time. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#bitsPerSample()` Number of bits per sample. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#bitsPerSampleLookupKey()` Lookup key corresponding to the number of bits per sample of the stream, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#NOT_IN_LOOKUP_TABLE()` if it is not in the lookup table. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#channels()` Number of audio channels. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#maxBlockSizeSamples()` Maximum number of samples per block. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#maxFrameSize()` Maximum frame size in bytes, or 0 if the value is unknown. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#minBlockSizeSamples()` Minimum number of samples per block. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#minFrameSize()` Minimum frame size in bytes, or 0 if the value is unknown. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#sampleRate()` Sample rate in Hertz. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#sampleRateLookupKey()` Lookup key corresponding to the stream sample rate, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#NOT_IN_LOOKUP_TABLE()` if it is not in the lookup table. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata.SeekTable?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#seekTable()` Seek table, or `null` if it is not provided. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#totalSamples()` 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<Byte>!, offset: Int)
```

Parses binary FLAC stream info metadata.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | An array containing binary FLAC stream info block. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | 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 `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the total number of samples if unknown.

### getFormat

```
fun getFormat(
    streamMarkerAndInfoBlock: ByteArray<Byte>!,
    id3Metadata: Metadata?
): Format!
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | An array containing the FLAC stream marker followed by the stream info block. |
| `id3Metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata?` | The ID3 metadata of the stream, or `null` if there is no such data. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The extracted `https://developer.android.com/reference/kotlin/androidx/media3/common/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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Time position in microseconds in the FLAC stream. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The sample number corresponding to the time position. |

## Public properties

### bitsPerSample

```
val bitsPerSample: Int
```

Number of bits per sample.

### bitsPerSampleLookupKey

```
val bitsPerSampleLookupKey: Int
```

Lookup key corresponding to the number of bits per sample of the stream, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#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 channels: Int
```

Number of audio channels.

### maxBlockSizeSamples

```
val maxBlockSizeSamples: Int
```

Maximum number of samples per block.

### maxFrameSize

```
val maxFrameSize: Int
```

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

### minBlockSizeSamples

```
val minBlockSizeSamples: Int
```

Minimum number of samples per block.

### minFrameSize

```
val minFrameSize: Int
```

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

### sampleRate

```
val sampleRate: Int
```

Sample rate in Hertz.

### sampleRateLookupKey

```
val sampleRateLookupKey: Int
```

Lookup key corresponding to the stream sample rate, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/FlacStreamMetadata#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 seekTable: FlacStreamMetadata.SeekTable?
```

Seek table, or `null` if it is not provided.

### totalSamples

```
val totalSamples: Long
```

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