CodecSpecificDataUtil
@UnstableApi
class CodecSpecificDataUtil
Provides utilities for handling various types of codec-specific data.
Summary
Public functions |
|
|---|---|
java-static String! |
buildApvCodecString(initializationData: ByteArray!)Returns an APV codec string based on the provided initialization data. |
java-static String! |
buildAvcCodecString(Builds an RFC 6381 AVC codec string using the provided parameters. |
java-static (Mutable)List<ByteArray<Byte>!>! |
buildCea708InitializationData(isWideAspectRatio: Boolean)Returns initialization data for formats with MIME type |
java-static String! |
buildDolbyVisionCodecString(profile: Int, level: Int)Builds a Dolby Vision codec string using profile and level. |
java-static ByteArray<Byte>! |
buildDolbyVisionInitializationData(profile: Int, level: Int)Returns initialization data for Dolby Vision according to Dolby Vision ISO MediaFormat (section 2.2) specification. |
java-static String! |
buildH263CodecString(profile: Int, level: Int)Builds an RFC 6381 H263 codec string using profile and level. |
java-static String! |
buildHevcCodecString(Builds an RFC 6381 HEVC codec string using the provided parameters. |
java-static String? |
buildIamfCodecString(initializationData: ByteArray!)Builds an RFC 6381 IAMF codec string from the given |
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 ImmutableList<ByteArray<Byte>!>! |
buildVp9CodecPrivateInitializationData(Returns initialization data in CodecPrivate format of VP9. |
java-static Int |
dolbyVisionConstantToLevelNumber(levelConstant: Int)Returns Dolby Vision level number corresponding to the level constant. |
java-static Int |
dolbyVisionConstantToProfileNumber(profileConstant: Int)Returns Dolby Vision profile number corresponding to the profile constant. |
java-static Pair<Int!, Int!>? |
getCodecProfileAndLevel(format: Format!)Returns profile and level (as defined by |
java-static Pair<Int!, Int!>? |
getHevcProfileAndLevel(Returns Hevc profile and level corresponding to the codec description string (as defined by RFC 6381) and it |
java-static Pair<Int!, Int!>! |
getVideoResolutionFromMpeg4VideoConfig(videoSpecificConfig: ByteArray!)Parses an MPEG-4 Visual configuration information, as defined in ISO/IEC14496-2. |
java-static ByteBuffer! |
getVorbisInitializationData(format: Format!)Creates the Vorbis initialization data (CodecPrivate). |
java-static IntArray<Int>! |
parseAlacAudioSpecificConfig(audioSpecificConfig: ByteArray!)Parses an ALAC AudioSpecificConfig (i.e. an ALACSpecificConfig). |
java-static Boolean |
parseCea708InitializationData(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>!>? |
splitNalUnits(data: ByteArray!)Splits an array of NAL units. |
Public functions
buildApvCodecString
java-static fun buildApvCodecString(initializationData: ByteArray!): String!
Returns an APV codec string based on the provided initialization data.
Reference: Codecs Parameter in APV ISO Base Media File Format
| Parameters | |
|---|---|
initializationData: ByteArray! |
The initialization data containing profile, level, and band information. |
| Returns | |
|---|---|
String! |
The generated APV codec string. |
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 |
buildDolbyVisionCodecString
java-static fun buildDolbyVisionCodecString(profile: Int, level: Int): String!
Builds a Dolby Vision codec string using profile and level.
Reference: href="https://professionalsupport.dolby.com/s/article/What-is-Dolby-Vision-Profile?language=en_US", >, Dolby Vision Profile and Level (section 2.3)
buildDolbyVisionInitializationData
java-static fun buildDolbyVisionInitializationData(profile: Int, level: Int): ByteArray<Byte>!
Returns initialization data for Dolby Vision according to Dolby Vision ISO MediaFormat (section 2.2) specification.
buildH263CodecString
java-static fun buildH263CodecString(profile: Int, level: Int): String!
Builds an RFC 6381 H263 codec string using profile and level.
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.
buildIamfCodecString
java-static fun buildIamfCodecString(initializationData: ByteArray!): String?
Builds an RFC 6381 IAMF codec string from the given initializationData.
The format is defined by the IAMF Codec Parameters String specification.
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.
buildVp9CodecPrivateInitializationData
java-static fun buildVp9CodecPrivateInitializationData(
profile: Byte,
level: Byte,
bitDepth: Byte,
chromaSubsampling: Byte
): ImmutableList<ByteArray<Byte>!>!
Returns initialization data in CodecPrivate format of VP9.
Each feature of VP9 CodecPrivate is defined by the binary format of ID (1 byte), length (1 byte), and data (1 byte). See href="https://www.webmproject.org/docs/container/#vp9-codec-feature-metadata-codecprivate", >, CodecPrivate format of VP9 for more details.
dolbyVisionConstantToLevelNumber
java-static fun dolbyVisionConstantToLevelNumber(levelConstant: Int): Int
Returns Dolby Vision level number corresponding to the level constant.
| Parameters | |
|---|---|
levelConstant: Int |
The Dolby Vision level constant. |
| Returns | |
|---|---|
Int |
The Dolby Vision level number. |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the level constant is not recognized. |
dolbyVisionConstantToProfileNumber
java-static fun dolbyVisionConstantToProfileNumber(profileConstant: Int): Int
Returns Dolby Vision profile number corresponding to the profile constant.
| Parameters | |
|---|---|
profileConstant: Int |
The Dolby Vision profile constant. |
| Returns | |
|---|---|
Int |
The Dolby Vision profile number. |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the profile constant is not recognized. |
getCodecProfileAndLevel
java-static fun getCodecProfileAndLevel(format: Format!): Pair<Int!, Int!>?
Returns profile and level (as defined by MediaCodecInfo.CodecProfileLevel) corresponding to the codec description string (as defined by RFC 6381) of the given format.
| Parameters | |
|---|---|
format: Format! |
Media format with a codec description string, as defined by RFC 6381. |
getHevcProfileAndLevel
java-static fun getHevcProfileAndLevel(
codec: String!,
parts: Array<String!>!,
colorInfo: ColorInfo?
): Pair<Int!, Int!>?
Returns Hevc profile and level corresponding to the codec description string (as defined by RFC 6381) and it ColorInfo.
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. |
getVorbisInitializationData
java-static fun getVorbisInitializationData(format: Format!): ByteBuffer!
Creates the Vorbis initialization data (CodecPrivate).
The format is as follows:
- Byte 1: The number of packets minus one. This is 2 for Vorbis, representing the Identification, Comment, and Setup headers.
- Bytes 2..n: The lengths of the first two packets (Identification and Comment headers), encoded using Xiph lacing. The length of the final packet (Setup header) is not explicitly stored.
- Bytes n+1 onwards: The Vorbis identification header, Vorbis comment header and the codec setup header.
| Returns | |
|---|---|
ByteBuffer! |
A |
parseAlacAudioSpecificConfig
java-static fun parseAlacAudioSpecificConfig(audioSpecificConfig: ByteArray!): IntArray<Int>!
Parses an ALAC AudioSpecificConfig (i.e. an ALACSpecificConfig).
| Parameters | |
|---|---|
audioSpecificConfig: ByteArray! |
A byte array containing the AudioSpecificConfig to parse. |
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.
| 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. |