Ac4Util
@UnstableApi
class Ac4Util
Utility methods for parsing AC-4 frames, which are access units in AC-4 bitstreams.
Summary
Nested types |
|---|
class Ac4Util.SyncFrameInfoHolds sample format information as presented by a syncframe header. |
Constants |
|
|---|---|
const Int |
AC40_SYNCWORD = 44096 |
const Int |
AC41_SYNCWORD = 44097 |
const Int |
The header size for AC-4 parser. |
const Int |
MAX_RATE_BYTES_PER_SECOND = 336000Maximum 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 |
getAc4SampleHeader(size: Int, buffer: ParsableByteArray!)Populates |
java-static Format! |
parseAc4AnnexEFormat(Returns the AC-4 format given |
java-static Int |
parseAc4SyncframeAudioSampleCount(buffer: ByteBuffer!)Reads the number of audio samples represented by the given AC-4 syncframe. |
java-static Ac4Util.SyncFrameInfo! |
Returns AC-4 format information given |
java-static Int |
parseAc4SyncframeSize(data: ByteArray!, syncword: Int)Returns the size in bytes of the given AC-4 syncframe. |
Constants
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.4 (ac4_dsi) and TS 103 190-2 section E.6 (ac4_dsi_v1). 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, or |
drmInitData: DrmInitData? |
|
| Returns | |
|---|---|
Format! |
The AC-4 format parsed from data in the header. |
| Throws | |
|---|---|
androidx.media3.common.ParserException |
If an unsupported container feature is encountered while parsing AC-4 Annex E. |
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 |
| 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 |