@UnstableApi
class Ac4Util


Utility methods for parsing AC-4 frames, which are access units in AC-4 bitstreams.

Summary

Nested types

Holds sample format information as presented by a syncframe header.

Constants

const Int
const Int
const Int

The header size for AC-4 parser.

const Int

Maximum rate for an AC-4 audio stream, in bytes per second.

const Int

The AC-4 sync frame header size for extractor.

Public functions

java-static Unit

Populates buffer with an AC-4 sample header for a sample of the specified size.

java-static Format!
parseAc4AnnexEFormat(
    data: ParsableByteArray!,
    trackId: String!,
    language: String!,
    drmInitData: DrmInitData?
)

Returns the AC-4 format given data containing the AC4SpecificBox according to ETSI TS 103 190-1 Annex E.

java-static Int

Reads the number of audio samples represented by the given AC-4 syncframe.

java-static Ac4Util.SyncFrameInfo!

Returns AC-4 format information given data containing a syncframe.

java-static Int
parseAc4SyncframeSize(data: ByteArray!, syncword: Int)

Returns the size in bytes of the given AC-4 syncframe.

Constants

AC40_SYNCWORD

const val AC40_SYNCWORD = 44096: Int

AC41_SYNCWORD

const val AC41_SYNCWORD = 44097: Int

HEADER_SIZE_FOR_PARSER

const val HEADER_SIZE_FOR_PARSER = 16: Int

The header size for AC-4 parser. Only needs to be as big as we need to read, not the full header size.

MAX_RATE_BYTES_PER_SECOND

const val MAX_RATE_BYTES_PER_SECOND = 336000: Int

Maximum rate for an AC-4 audio stream, in bytes per second.

SAMPLE_HEADER_SIZE

const val SAMPLE_HEADER_SIZE = 7: Int

The AC-4 sync frame header size for extractor. The seven bytes are 0xAC, 0x40, 0xFF, 0xFF, sizeByte1, sizeByte2, sizeByte3. See ETSI TS 103 190-1 V1.3.1, Annex G

Public functions

getAc4SampleHeader

java-static fun getAc4SampleHeader(size: Int, buffer: ParsableByteArray!): Unit

Populates buffer with an AC-4 sample header for a sample of the specified size.

parseAc4AnnexEFormat

java-static fun parseAc4AnnexEFormat(
    data: ParsableByteArray!,
    trackId: String!,
    language: String!,
    drmInitData: DrmInitData?
): Format!

Returns the AC-4 format given data containing the AC4SpecificBox according to ETSI TS 103 190-1 Annex E. The reading position of data will be modified.

Parameters
data: ParsableByteArray!

The AC4SpecificBox to parse.

trackId: String!

The track identifier to set on the format.

language: String!

The language to set on the format.

drmInitData: DrmInitData?

DrmInitData to be included in the format.

Returns
Format!

The AC-4 format parsed from data in the header.

parseAc4SyncframeAudioSampleCount

java-static fun parseAc4SyncframeAudioSampleCount(buffer: ByteBuffer!): Int

Reads the number of audio samples represented by the given AC-4 syncframe. The buffer's position is not modified.

Parameters
buffer: ByteBuffer!

The ByteBuffer from which to read the syncframe.

Returns
Int

The number of audio samples represented by the syncframe.

parseAc4SyncframeInfo

java-static fun parseAc4SyncframeInfo(data: ParsableBitArray!): Ac4Util.SyncFrameInfo!

Returns AC-4 format information given data containing a syncframe. The reading position of data will be modified.

Parameters
data: ParsableBitArray!

The data to parse, positioned at the start of the syncframe.

Returns
Ac4Util.SyncFrameInfo!

The AC-4 format data parsed from the header.

parseAc4SyncframeSize

java-static fun parseAc4SyncframeSize(data: ByteArray!, syncword: Int): Int

Returns the size in bytes of the given AC-4 syncframe.

Parameters
data: ByteArray!

The syncframe to parse.

syncword: Int

The syncword value for the syncframe.

Returns
Int

The syncframe size in bytes, or LENGTH_UNSET if the input is invalid.