DtsUtil
@UnstableApi
class DtsUtil
Utility methods for parsing DTS frames.
Summary
Nested types |
|---|
@DocumentedThe possible MIME types for DTS that can be used. |
class DtsUtil.DtsHeaderInformation parsed from a DTS frame header. |
@DocumentedFrame types for a DTS stream. |
Constants |
|
|---|---|
const Int |
DTS_EXPRESS_MAX_RATE_BITS_PER_SECOND = 768000Maximum bit-rate for a DTS Express audio stream, in bits per second. |
const Int |
DTS_HD_MAX_RATE_BYTES_PER_SECOND = 2250000Maximum rate for a DTS-HD audio stream, in bytes per second. |
const Int |
DTS_MAX_RATE_BYTES_PER_SECOND = 192000Maximum rate for a DTS audio stream, in bytes per second. |
const Int |
FRAME_TYPE_CORE = 1Represents a DTS core frame. |
const Int |
Represents a DTS extension substream frame. |
const Int |
Represents a DTS UHD non-sync frame. |
const Int |
Represents a DTS UHD sync frame. |
const Int |
Represents a DTS frame for which type is unknown. |
Public functions |
|
|---|---|
java-static Int |
getDtsFrameSize(data: ByteArray!)Returns the size in bytes of the given DTS Core frame. |
java-static Int |
@DtsUtil.FrameTypeReturns the |
java-static Boolean |
isSampleDtsHd(input: ExtractorInput!, sampleSize: Int)Returns whether the sample data at the current |
java-static Int |
parseDtsAudioSampleCount(buffer: ByteBuffer!)Like |
java-static Int |
parseDtsAudioSampleCount(data: ByteArray!)Returns the number of audio samples represented by the given DTS Core frame. |
java-static Format! |
parseDtsFormat(Returns the DTS format given |
java-static DtsUtil.DtsHeader! |
parseDtsHdHeader(header: ByteArray!)Parses the |
java-static Int |
parseDtsHdHeaderSize(headerPrefix: ByteArray!)Returns the size of the extension substream header in a DTS-HD frame according to ETSI TS 102 114 V1.6.1 (2019-08), Section 7.5.2. |
java-static DtsUtil.DtsHeader! |
parseDtsUhdHeader(header: ByteArray!, uhdAudioChunkId: AtomicInteger!)Parses the |
java-static Int |
parseDtsUhdHeaderSize(headerPrefix: ByteArray!)Returns the size of frame header in a DTS-UHD(Profile 2) frame according to ETSI TS 103 491 V1.2.1 (2019-05), Section 6.4.3. |
Constants
DTS_EXPRESS_MAX_RATE_BITS_PER_SECOND
const val DTS_EXPRESS_MAX_RATE_BITS_PER_SECOND = 768000: Int
Maximum bit-rate for a DTS Express audio stream, in bits per second.
DTS_HD_MAX_RATE_BYTES_PER_SECOND
const val DTS_HD_MAX_RATE_BYTES_PER_SECOND = 2250000: Int
Maximum rate for a DTS-HD audio stream, in bytes per second.
DTS_MAX_RATE_BYTES_PER_SECOND
const val DTS_MAX_RATE_BYTES_PER_SECOND = 192000: Int
Maximum rate for a DTS audio stream, in bytes per second.
DTS allows an 'open' bitrate, but we assume the maximum listed value: 1536 kbit/s.
FRAME_TYPE_EXTENSION_SUBSTREAM
const val FRAME_TYPE_EXTENSION_SUBSTREAM = 2: Int
Represents a DTS extension substream frame.
FRAME_TYPE_UHD_NON_SYNC
const val FRAME_TYPE_UHD_NON_SYNC = 4: Int
Represents a DTS UHD non-sync frame.
FRAME_TYPE_UNKNOWN
const val FRAME_TYPE_UNKNOWN = 0: Int
Represents a DTS frame for which type is unknown.
Public functions
getDtsFrameSize
java-static fun getDtsFrameSize(data: ByteArray!): Int
Returns the size in bytes of the given DTS Core frame.
| Parameters | |
|---|---|
data: ByteArray! |
The frame to parse. |
| Returns | |
|---|---|
Int |
The frame's size in bytes. |
getFrameType
@DtsUtil.FrameType
java-static fun getFrameType(word: Int): Int
Returns the FrameType if word is a DTS sync word, otherwise FRAME_TYPE_UNKNOWN.
isSampleDtsHd
java-static fun isSampleDtsHd(input: ExtractorInput!, sampleSize: Int): Boolean
Returns whether the sample data at the current ExtractorInput is a DTS-HD sample.
| Throws | |
|---|---|
java.io.IOException |
parseDtsAudioSampleCount
java-static fun parseDtsAudioSampleCount(buffer: ByteBuffer!): Int
Like parseDtsAudioSampleCount but reads from a ByteBuffer. The buffer's position is not modified.
| Parameters | |
|---|---|
buffer: ByteBuffer! |
The |
| Returns | |
|---|---|
Int |
The number of audio samples represented by the syncframe. |
parseDtsAudioSampleCount
java-static fun parseDtsAudioSampleCount(data: ByteArray!): Int
Returns the number of audio samples represented by the given DTS Core frame.
| Parameters | |
|---|---|
data: ByteArray! |
The frame to parse. |
| Returns | |
|---|---|
Int |
The number of audio samples represented by the frame. |
parseDtsFormat
java-static fun parseDtsFormat(
frame: ByteArray!,
trackId: String?,
language: String?,
@C.RoleFlags roleFlags: Int,
containerMimeType: String!,
drmInitData: DrmInitData?
): Format!
Returns the DTS format given data containing the DTS Core frame according to ETSI TS 102 114 V1.6.1 (2019-08) subsections 5.3/5.4.
| Parameters | |
|---|---|
frame: ByteArray! |
The DTS Core frame to parse. |
trackId: String? |
The track identifier to set on the format. |
language: String? |
The language to set on the format. |
@C.RoleFlags roleFlags: Int |
The role flags to set on the format. |
containerMimeType: String! |
The MIME type of the container to set on the format. |
drmInitData: DrmInitData? |
|
| Returns | |
|---|---|
Format! |
The DTS format parsed from data in the header. |
parseDtsHdHeader
java-static fun parseDtsHdHeader(header: ByteArray!): DtsUtil.DtsHeader!
Parses the DtsHeader data from the extension substream header of a DTS-HD frame according to ETSI TS 102 114 V1.6.1 (2019-08), Section 7.5.2.
| Parameters | |
|---|---|
header: ByteArray! |
The DTS-HD extension substream header to parse. |
| Returns | |
|---|---|
DtsUtil.DtsHeader! |
The |
parseDtsHdHeaderSize
java-static fun parseDtsHdHeaderSize(headerPrefix: ByteArray!): Int
Returns the size of the extension substream header in a DTS-HD frame according to ETSI TS 102 114 V1.6.1 (2019-08), Section 7.5.2.
| Parameters | |
|---|---|
headerPrefix: ByteArray! |
A byte array containing at least the first 55 bits of a DTS-HD frame. |
| Returns | |
|---|---|
Int |
Size of the DTS-HD frame header in bytes. |
parseDtsUhdHeader
java-static fun parseDtsUhdHeader(header: ByteArray!, uhdAudioChunkId: AtomicInteger!): DtsUtil.DtsHeader!
Parses the DtsHeader data from the headers of a DTS-UHD(Profile 2) frame according to ETSI TS 103 491 V1.2.1 (2019-05), Section 6.4.3.
| Parameters | |
|---|---|
header: ByteArray! |
The DTS-UHD header to parse. |
uhdAudioChunkId: AtomicInteger! |
An |
| Returns | |
|---|---|
DtsUtil.DtsHeader! |
The |
parseDtsUhdHeaderSize
java-static fun parseDtsUhdHeaderSize(headerPrefix: ByteArray!): Int
Returns the size of frame header in a DTS-UHD(Profile 2) frame according to ETSI TS 103 491 V1.2.1 (2019-05), Section 6.4.3.
| Parameters | |
|---|---|
headerPrefix: ByteArray! |
A byte array containing at least the first 47 bits of a DTS-UHD frame. |
| Returns | |
|---|---|
Int |
Size of the DTS-UHD frame header in bytes. |