CodecSpecificDataUtil

@UnstableApi
class CodecSpecificDataUtil


Provides utilities for handling various types of codec-specific data.

Summary

Public functions

java-static String!
buildAvcCodecString(
    profileIdc: Int,
    constraintsFlagsAndReservedZero2Bits: Int,
    levelIdc: Int
)

Builds an RFC 6381 AVC codec string using the provided parameters.

java-static (Mutable)List<ByteArray<Byte>!>!

Returns initialization data for formats with MIME type APPLICATION_CEA708.

java-static String!
buildHevcCodecString(
    generalProfileSpace: Int,
    generalTierFlag: Boolean,
    generalProfileIdc: Int,
    generalProfileCompatibilityFlags: Int,
    constraintBytes: IntArray!,
    generalLevelIdc: Int
)

Builds an RFC 6381 HEVC codec string using the provided parameters.

java-static ByteArray<Byte>!
buildNalUnit(data: ByteArray!, offset: Int, length: Int)

Constructs a NAL unit consisting of the NAL start code followed by the specified data.

java-static Pair<Int!, Int!>!

Parses an MPEG-4 Visual configuration information, as defined in ISO/IEC14496-2.

java-static Pair<Int!, Int!>!
parseAlacAudioSpecificConfig(audioSpecificConfig: ByteArray!)

Parses an ALAC AudioSpecificConfig (i.e. an ALACSpecificConfig).

java-static Boolean
parseCea708InitializationData(
    initializationData: (Mutable)List<ByteArray!>!
)

Returns whether the CEA-708 closed caption service with the given initialization data is formatted for displays with 16:9 aspect ratio.

java-static Array<ByteArray<Byte>!>?

Splits an array of NAL units.

Public functions

buildAvcCodecString

java-static fun buildAvcCodecString(
    profileIdc: Int,
    constraintsFlagsAndReservedZero2Bits: Int,
    levelIdc: Int
): String!

Builds an RFC 6381 AVC codec string using the provided parameters.

Parameters
profileIdc: Int

The encoding profile.

constraintsFlagsAndReservedZero2Bits: Int

The constraint flags followed by the reserved zero 2 bits, all contained in the least significant byte of the integer.

levelIdc: Int

The encoding level.

Returns
String!

An RFC 6381 AVC codec string built using the provided parameters.

buildCea708InitializationData

java-static fun buildCea708InitializationData(isWideAspectRatio: Boolean): (Mutable)List<ByteArray<Byte>!>!

Returns initialization data for formats with MIME type APPLICATION_CEA708.

Parameters
isWideAspectRatio: Boolean

Whether the CEA-708 closed caption service is formatted for displays with 16:9 aspect ratio.

Returns
(Mutable)List<ByteArray<Byte>!>!

Initialization data for formats with MIME type APPLICATION_CEA708.

buildHevcCodecString

java-static fun buildHevcCodecString(
    generalProfileSpace: Int,
    generalTierFlag: Boolean,
    generalProfileIdc: Int,
    generalProfileCompatibilityFlags: Int,
    constraintBytes: IntArray!,
    generalLevelIdc: Int
): String!

Builds an RFC 6381 HEVC codec string using the provided parameters.

buildNalUnit

java-static fun buildNalUnit(data: ByteArray!, offset: Int, length: Int): ByteArray<Byte>!

Constructs a NAL unit consisting of the NAL start code followed by the specified data.

Parameters
data: ByteArray!

An array containing the data that should follow the NAL start code.

offset: Int

The start offset into data.

length: Int

The number of bytes to copy from data

Returns
ByteArray<Byte>!

The constructed NAL unit.

getVideoResolutionFromMpeg4VideoConfig

java-static fun getVideoResolutionFromMpeg4VideoConfig(videoSpecificConfig: ByteArray!): Pair<Int!, Int!>!

Parses an MPEG-4 Visual configuration information, as defined in ISO/IEC14496-2.

Parameters
videoSpecificConfig: ByteArray!

A byte array containing the MPEG-4 Visual configuration information to parse.

Returns
Pair<Int!, Int!>!

A pair of the video's width and height.

parseAlacAudioSpecificConfig

java-static fun parseAlacAudioSpecificConfig(audioSpecificConfig: ByteArray!): Pair<Int!, Int!>!

Parses an ALAC AudioSpecificConfig (i.e. an ALACSpecificConfig).

Parameters
audioSpecificConfig: ByteArray!

A byte array containing the AudioSpecificConfig to parse.

Returns
Pair<Int!, Int!>!

A pair consisting of the sample rate in Hz and the channel count.

parseCea708InitializationData

java-static fun parseCea708InitializationData(
    initializationData: (Mutable)List<ByteArray!>!
): Boolean

Returns whether the CEA-708 closed caption service with the given initialization data is formatted for displays with 16:9 aspect ratio.

Parameters
initializationData: (Mutable)List<ByteArray!>!

The initialization data to parse.

Returns
Boolean

Whether the CEA-708 closed caption service is formatted for displays with 16:9 aspect ratio.

splitNalUnits

java-static fun splitNalUnits(data: ByteArray!): Array<ByteArray<Byte>!>?

Splits an array of NAL units.

If the input consists of NAL start code delimited units, then the returned array consists of the split NAL units, each of which is still prefixed with the NAL start code. For any other input, null is returned.

Parameters
data: ByteArray!

An array of data.

Returns
Array<ByteArray<Byte>!>?

The individual NAL units, or null if the input did not consist of NAL start code delimited units.