com.google.android.exoplayer2.util.Util.getBytesFromHexString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中com.google.android.exoplayer2.util.Util.getBytesFromHexString()方法的一些代码示例,展示了Util.getBytesFromHexString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getBytesFromHexString()方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:getBytesFromHexString

Util.getBytesFromHexString介绍

[英]Returns a byte array containing values parsed from the hex string provided.
[中]返回一个字节数组,其中包含从提供的十六进制字符串中解析的值。

代码示例

代码示例来源:origin: google/ExoPlayer

  1. private static List<byte[]> buildCodecSpecificData(String codecSpecificDataString) {
  2. ArrayList<byte[]> csd = new ArrayList<>();
  3. if (!TextUtils.isEmpty(codecSpecificDataString)) {
  4. byte[] codecPrivateData = Util.getBytesFromHexString(codecSpecificDataString);
  5. byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData);
  6. if (split == null) {
  7. csd.add(codecPrivateData);
  8. } else {
  9. Collections.addAll(csd, split);
  10. }
  11. }
  12. return csd;
  13. }

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Thrown when a failure occurs instantiating a decoder.
  3. */
  4. public static class DecoderInitializationException extends Exception {
  5. private static final int CUSTOM_ERROR_CODE_BASE = -50000;
  6. private static final int NO_SUITABLE_DECODER_ERROR = CUSTOM_ERROR_CODE_BASE + 1;
  7. private static final int DECODER_QUERY_ERROR = CUSTOM_ERROR_CODE_BASE + 2;
  8. /**
  9. * The mime type for which a decoder was being initialized.
  10. */
  11. public final String mimeType;
  12. /**
  13. * Whether it was required that the decoder support a secure output path.
  14. */
  15. public final boolean secureDecoderRequired;
  16. /**
  17. * The name of the decoder that failed to initialize. Null if no suitable decoder was found.
  18. */
  19. public final String decoderName;
  20. /**
  21. * An optional developer-readable diagnostic information string. May be null.
  22. */
  23. public final String diagnosticInfo;
  24. /**

代码示例来源:origin: google/ExoPlayer

  1. private static void assertDiscardToSpsMatchesExpected(String input, String expectedOutput) {
  2. byte[] bitstream = Util.getBytesFromHexString(input);
  3. byte[] expectedOutputBitstream = Util.getBytesFromHexString(expectedOutput);
  4. ByteBuffer buffer = ByteBuffer.wrap(bitstream);
  5. buffer.position(buffer.limit());
  6. NalUnitUtil.discardToSps(buffer);
  7. assertThat(Arrays.copyOf(buffer.array(), buffer.position())).isEqualTo(expectedOutputBitstream);
  8. }

代码示例来源:origin: google/ExoPlayer

  1. private static void assertUnescapeMatchesExpected(String input, String expectedOutput) {
  2. byte[] bitstream = Util.getBytesFromHexString(input);
  3. byte[] expectedOutputBitstream = Util.getBytesFromHexString(expectedOutput);
  4. int count = NalUnitUtil.unescapeStream(bitstream, bitstream.length);
  5. assertThat(count).isEqualTo(expectedOutputBitstream.length);
  6. byte[] outputBitstream = new byte[count];
  7. System.arraycopy(bitstream, 0, outputBitstream, 0, count);
  8. assertThat(outputBitstream).isEqualTo(expectedOutputBitstream);
  9. }

相关文章