public class CodecSpecificUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CodecSpecificUtil.DecoderQueryException
Thrown when an error occurs querying the device for its underlying media capabilities.
|
Modifier and Type | Field and Description |
---|---|
static int |
AUD_NAL_UNIT_TYPE |
static int |
AVCProfileHigh |
static int |
AVCProfileHigh10 |
static int |
AVCProfileHigh422 |
static int |
AVCProfileHigh444 |
static int |
IDR_NAL_UNIT_TYPE |
static int |
PPS_NAL_UNIT_TYPE |
static int |
SPS_NAL_UNIT_TYPE |
Modifier and Type | Method and Description |
---|---|
static byte[] |
buildAudioSpecificConfig(int sampleRate,
int numChannels)
Builds a simple HE-AAC LC AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
|
static byte[] |
buildAudioSpecificConfig(int audioObjectType,
int sampleRateIndex,
int channelConfig)
Builds a simple AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
|
static byte[] |
buildNalUnit(byte[] data,
int offset,
int length)
Constructs a NAL unit consisting of the NAL start code followed by the specified data.
|
static int |
findLastNalUnit(byte[] data,
int nalUnitType,
int offset) |
static int |
findNalStartCodeReverse(byte[] data,
int index)
Finds the previous occurrence of the NAL start code from a given index.
|
static int |
findNextNalUnit(byte[] data,
int nalUnitType,
int offset) |
static DecoderInfo |
getDecoderInfo(java.lang.String mimeType,
boolean secure)
Get information about the decoder that will be used for a given mime type.
|
static int |
getIDRNALUnitPosition(byte[] data,
int offset) |
static |
getSPSAndPPSNALUnits(byte[] data) |
static |
parseAudioSpecificConfig(byte[] audioSpecificConfig)
Parses an AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
|
static |
parseSpsNalUnit(byte[] spsNalUnit)
Parses an SPS NAL unit.
|
static byte[][] |
splitNalUnits(byte[] data)
Splits an array of NAL units.
|
static void |
warmCodec(java.lang.String mimeType,
boolean secure)
Optional call to warm the codec cache for a given mime type.
|
public static final int IDR_NAL_UNIT_TYPE
public static final int SPS_NAL_UNIT_TYPE
public static final int PPS_NAL_UNIT_TYPE
public static final int AUD_NAL_UNIT_TYPE
public static final int AVCProfileHigh
public static final int AVCProfileHigh10
public static final int AVCProfileHigh422
public static final int AVCProfileHigh444
public staticparseAudioSpecificConfig(byte[] audioSpecificConfig)
audioSpecificConfig
- public static byte[] buildAudioSpecificConfig(int audioObjectType, int sampleRateIndex, int channelConfig)
audioObjectType
- The audio object type.sampleRateIndex
- The sample rate index.channelConfig
- The channel configuration.public static byte[] buildAudioSpecificConfig(int sampleRate, int numChannels)
sampleRate
- The sample rate in Hz.numChannels
- The number of channelspublic static byte[] buildNalUnit(byte[] data, int offset, int length)
data
- An array containing the data that should follow the NAL start code.offset
- The start offset into data
.length
- The number of bytes to copy from data
public static byte[][] splitNalUnits(byte[] data)
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.
data
- An array of data.public static int findNextNalUnit(byte[] data, int nalUnitType, int offset)
public static int findLastNalUnit(byte[] data, int nalUnitType, int offset)
public static int getIDRNALUnitPosition(byte[] data, int offset)
public staticgetSPSAndPPSNALUnits(byte[] data)
public static int findNalStartCodeReverse(byte[] data, int index)
data
- The data in which to search.index
- The first index to test.public staticparseSpsNalUnit(byte[] spsNalUnit)
spsNalUnit
- The NAL unit.CodecProfileLevel
. Null if the input data was not an SPS NAL unit.public static DecoderInfo getDecoderInfo(java.lang.String mimeType, boolean secure) throws CodecSpecificUtil.DecoderQueryException
mimeType
- The mime type.secure
- Whether the decoder is required to support secure decryption. Always pass false
unless secure decryption really is required.CodecSpecificUtil.DecoderQueryException
public static void warmCodec(java.lang.String mimeType, boolean secure)
Calling this method may speed up subsequent calls to getDecoderInfo(String, boolean)
.
mimeType
- The mime type.secure
- Whether the decoder is required to support secure decryption. Always pass false
unless secure decryption really is required.