Class Ac4Util
- java.lang.Object
-
- com.google.android.exoplayer2.audio.Ac4Util
-
public final class Ac4Util extends Object
Utility methods for parsing AC-4 frames, which are access units in AC-4 bitstreams.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Ac4Util.SyncFrameInfo
Holds sample format information as presented by a syncframe header.
-
Field Summary
Fields Modifier and Type Field Description static int
AC40_SYNCWORD
static int
AC41_SYNCWORD
static int
HEADER_SIZE_FOR_PARSER
The header size for AC-4 parser.static int
MAX_RATE_BYTES_PER_SECOND
Maximum rate for an AC-4 audio stream, in bytes per second.static int
SAMPLE_HEADER_SIZE
The AC-4 sync frame header size for extractor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
getAc4SampleHeader(int size, ParsableByteArray buffer)
Populatesbuffer
with an AC-4 sample header for a sample of the specified size.static Format
parseAc4AnnexEFormat(ParsableByteArray data, String trackId, String language, DrmInitData drmInitData)
Returns the AC-4 format givendata
containing the AC4SpecificBox according to ETSI TS 103 190-1 Annex E.static int
parseAc4SyncframeAudioSampleCount(ByteBuffer buffer)
Reads the number of audio samples represented by the given AC-4 syncframe.static Ac4Util.SyncFrameInfo
parseAc4SyncframeInfo(ParsableBitArray data)
Returns AC-4 format information givendata
containing a syncframe.static int
parseAc4SyncframeSize(byte[] data, int syncword)
Returns the size in bytes of the given AC-4 syncframe.
-
-
-
Field Detail
-
AC40_SYNCWORD
public static final int AC40_SYNCWORD
- See Also:
- Constant Field Values
-
AC41_SYNCWORD
public static final int AC41_SYNCWORD
- See Also:
- Constant Field Values
-
MAX_RATE_BYTES_PER_SECOND
public static final int MAX_RATE_BYTES_PER_SECOND
Maximum rate for an AC-4 audio stream, in bytes per second.- See Also:
- Constant Field Values
-
SAMPLE_HEADER_SIZE
public static final int SAMPLE_HEADER_SIZE
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- See Also:
- Constant Field Values
-
HEADER_SIZE_FOR_PARSER
public static final int HEADER_SIZE_FOR_PARSER
The header size for AC-4 parser. Only needs to be as big as we need to read, not the full header size.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseAc4AnnexEFormat
public static Format parseAc4AnnexEFormat(ParsableByteArray data, String trackId, String language, @Nullable DrmInitData drmInitData)
Returns the AC-4 format givendata
containing the AC4SpecificBox according to ETSI TS 103 190-1 Annex E. The reading position ofdata
will be modified.- Parameters:
data
- The AC4SpecificBox to parse.trackId
- The track identifier to set on the format.language
- The language to set on the format.drmInitData
-DrmInitData
to be included in the format.- Returns:
- The AC-4 format parsed from data in the header.
-
parseAc4SyncframeInfo
public static Ac4Util.SyncFrameInfo parseAc4SyncframeInfo(ParsableBitArray data)
Returns AC-4 format information givendata
containing a syncframe. The reading position ofdata
will be modified.- Parameters:
data
- The data to parse, positioned at the start of the syncframe.- Returns:
- The AC-4 format data parsed from the header.
-
parseAc4SyncframeSize
public static int parseAc4SyncframeSize(byte[] data, int syncword)
Returns the size in bytes of the given AC-4 syncframe.- Parameters:
data
- The syncframe to parse.syncword
- The syncword value for the syncframe.- Returns:
- The syncframe size in bytes, or
C.LENGTH_UNSET
if the input is invalid.
-
parseAc4SyncframeAudioSampleCount
public static int parseAc4SyncframeAudioSampleCount(ByteBuffer buffer)
Reads the number of audio samples represented by the given AC-4 syncframe. The buffer's position is not modified.- Parameters:
buffer
- TheByteBuffer
from which to read the syncframe.- Returns:
- The number of audio samples represented by the syncframe.
-
getAc4SampleHeader
public static void getAc4SampleHeader(int size, ParsableByteArray buffer)
Populatesbuffer
with an AC-4 sample header for a sample of the specified size.
-
-