本文整理了Java中com.google.android.exoplayer2.util.Util.getBytesFromHexString()
方法的一些代码示例,展示了Util.getBytesFromHexString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getBytesFromHexString()
方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:getBytesFromHexString
[英]Returns a byte array containing values parsed from the hex string provided.
[中]返回一个字节数组,其中包含从提供的十六进制字符串中解析的值。
代码示例来源:origin: google/ExoPlayer
private static List<byte[]> buildCodecSpecificData(String codecSpecificDataString) {
ArrayList<byte[]> csd = new ArrayList<>();
if (!TextUtils.isEmpty(codecSpecificDataString)) {
byte[] codecPrivateData = Util.getBytesFromHexString(codecSpecificDataString);
byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData);
if (split == null) {
csd.add(codecPrivateData);
} else {
Collections.addAll(csd, split);
}
}
return csd;
}
代码示例来源:origin: google/ExoPlayer
/**
* Thrown when a failure occurs instantiating a decoder.
*/
public static class DecoderInitializationException extends Exception {
private static final int CUSTOM_ERROR_CODE_BASE = -50000;
private static final int NO_SUITABLE_DECODER_ERROR = CUSTOM_ERROR_CODE_BASE + 1;
private static final int DECODER_QUERY_ERROR = CUSTOM_ERROR_CODE_BASE + 2;
/**
* The mime type for which a decoder was being initialized.
*/
public final String mimeType;
/**
* Whether it was required that the decoder support a secure output path.
*/
public final boolean secureDecoderRequired;
/**
* The name of the decoder that failed to initialize. Null if no suitable decoder was found.
*/
public final String decoderName;
/**
* An optional developer-readable diagnostic information string. May be null.
*/
public final String diagnosticInfo;
/**
代码示例来源:origin: google/ExoPlayer
private static void assertDiscardToSpsMatchesExpected(String input, String expectedOutput) {
byte[] bitstream = Util.getBytesFromHexString(input);
byte[] expectedOutputBitstream = Util.getBytesFromHexString(expectedOutput);
ByteBuffer buffer = ByteBuffer.wrap(bitstream);
buffer.position(buffer.limit());
NalUnitUtil.discardToSps(buffer);
assertThat(Arrays.copyOf(buffer.array(), buffer.position())).isEqualTo(expectedOutputBitstream);
}
代码示例来源:origin: google/ExoPlayer
private static void assertUnescapeMatchesExpected(String input, String expectedOutput) {
byte[] bitstream = Util.getBytesFromHexString(input);
byte[] expectedOutputBitstream = Util.getBytesFromHexString(expectedOutput);
int count = NalUnitUtil.unescapeStream(bitstream, bitstream.length);
assertThat(count).isEqualTo(expectedOutputBitstream.length);
byte[] outputBitstream = new byte[count];
System.arraycopy(bitstream, 0, outputBitstream, 0, count);
assertThat(outputBitstream).isEqualTo(expectedOutputBitstream);
}
内容来源于网络,如有侵权,请联系作者删除!