public final class FlacStreamMetadata extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
FlacStreamMetadata.SeekTable |
A FLAC seek table.
|
Modifier and Type | Field | Description |
---|---|---|
int |
bitsPerSample |
Number of bits per sample.
|
int |
bitsPerSampleLookupKey |
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 |
channels |
Number of audio channels.
|
int |
maxBlockSizeSamples |
Maximum number of samples per block.
|
int |
maxFrameSize |
Maximum frame size in bytes, or 0 if the value is unknown.
|
int |
minBlockSizeSamples |
Minimum number of samples per block.
|
int |
minFrameSize |
Minimum frame size in bytes, or 0 if the value is unknown.
|
static int |
NOT_IN_LOOKUP_TABLE |
Indicates that a value is not in the corresponding lookup table.
|
int |
sampleRate |
Sample rate in Hertz.
|
int |
sampleRateLookupKey |
Lookup key corresponding to the stream sample rate, or
NOT_IN_LOOKUP_TABLE if it is
not in the lookup table. |
FlacStreamMetadata.SeekTable |
seekTable |
Seek table, or
null if it is not provided. |
long |
totalSamples |
Total number of samples, or 0 if the value is unknown.
|
Constructor | Description |
---|---|
FlacStreamMetadata(byte[] data,
int offset) |
Parses binary FLAC stream info metadata.
|
FlacStreamMetadata(int minBlockSizeSamples,
int maxBlockSizeSamples,
int minFrameSize,
int maxFrameSize,
int sampleRate,
int channels,
int bitsPerSample,
long totalSamples,
ArrayList<String> vorbisComments,
ArrayList<PictureFrame> pictureFrames) |
Modifier and Type | Method | Description |
---|---|---|
FlacStreamMetadata |
copyWithPictureFrames(List<PictureFrame> pictureFrames) |
Returns a copy of
this with the given picture frames added to the metadata. |
FlacStreamMetadata |
copyWithSeekTable(FlacStreamMetadata.SeekTable seekTable) |
Returns a copy of
this with the seek table replaced by the one given. |
FlacStreamMetadata |
copyWithVorbisComments(List<String> vorbisComments) |
Returns a copy of
this with the given Vorbis comments added to the metadata. |
long |
getApproxBytesPerFrame() |
Returns the approximate number of bytes per frame for the current FLAC stream.
|
int |
getDecodedBitrate() |
Returns the bitrate of the stream after it's decoded into PCM.
|
long |
getDurationUs() |
Returns the duration of the FLAC stream in microseconds, or
C.TIME_UNSET if the total
number of samples if unknown. |
Format |
getFormat(byte[] streamMarkerAndInfoBlock,
Metadata id3Metadata) |
Returns a
Format extracted from the FLAC stream metadata. |
int |
getMaxDecodedFrameSize() |
Returns the maximum size for a decoded frame from the FLAC stream.
|
Metadata |
getMetadataCopyWithAppendedEntriesFrom(Metadata other) |
Returns a copy of the content metadata with entries from
other appended. |
long |
getSampleNumber(long timeUs) |
Returns the sample number of the sample at a given time.
|
public static final int NOT_IN_LOOKUP_TABLE
public final int minBlockSizeSamples
public final int maxBlockSizeSamples
public final int minFrameSize
public final int maxFrameSize
public final int sampleRate
public final int sampleRateLookupKey
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.
public final int channels
public final int bitsPerSample
public final int bitsPerSampleLookupKey
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.
public final long totalSamples
@Nullable public final FlacStreamMetadata.SeekTable seekTable
null
if it is not provided.public FlacStreamMetadata(byte[] data, int offset)
data
- An array containing binary FLAC stream info block.offset
- 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).public FlacStreamMetadata(int minBlockSizeSamples, int maxBlockSizeSamples, int minFrameSize, int maxFrameSize, int sampleRate, int channels, int bitsPerSample, long totalSamples, ArrayList<String> vorbisComments, ArrayList<PictureFrame> pictureFrames)
public int getMaxDecodedFrameSize()
public int getDecodedBitrate()
public long getDurationUs()
C.TIME_UNSET
if the total
number of samples if unknown.public long getSampleNumber(long timeUs)
timeUs
- Time position in microseconds in the FLAC stream.public long getApproxBytesPerFrame()
public Format getFormat(byte[] streamMarkerAndInfoBlock, @Nullable Metadata id3Metadata)
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.
streamMarkerAndInfoBlock
- An array containing the FLAC stream marker followed by the
stream info block.id3Metadata
- The ID3 metadata of the stream, or null
if there is no such data.Format
.@Nullable public Metadata getMetadataCopyWithAppendedEntriesFrom(@Nullable Metadata other)
other
appended.public FlacStreamMetadata copyWithSeekTable(@Nullable FlacStreamMetadata.SeekTable seekTable)
this
with the seek table replaced by the one given.public FlacStreamMetadata copyWithVorbisComments(List<String> vorbisComments)
this
with the given Vorbis comments added to the metadata.public FlacStreamMetadata copyWithPictureFrames(List<PictureFrame> pictureFrames)
this
with the given picture frames added to the metadata.