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

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

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

Util.getCodecsOfType介绍

[英]Returns a copy of codecs without the codecs whose track type doesn't match trackType.
[中]返回一个编解码器的副本,其中不包含其曲目类型与trackType不匹配的编解码器。

代码示例

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

  1. private static Format deriveVideoFormat(Format variantFormat) {
  2. String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
  3. String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
  4. return Format.createVideoContainerFormat(
  5. variantFormat.id,
  6. variantFormat.label,
  7. variantFormat.containerMimeType,
  8. sampleMimeType,
  9. codecs,
  10. variantFormat.bitrate,
  11. variantFormat.width,
  12. variantFormat.height,
  13. variantFormat.frameRate,
  14. /* initializationData= */ null,
  15. variantFormat.selectionFlags);
  16. }

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

  1. @Test
  2. public void testGetCodecsOfType() {
  3. assertThat(getCodecsOfType(null, C.TRACK_TYPE_VIDEO)).isNull();
  4. assertThat(getCodecsOfType("avc1.64001e,vp9.63.1", C.TRACK_TYPE_AUDIO)).isNull();
  5. assertThat(getCodecsOfType(" vp9.63.1, ec-3 ", C.TRACK_TYPE_AUDIO)).isEqualTo("ec-3");
  6. assertThat(getCodecsOfType("avc1.61e, vp9.63.1, ec-3 ", C.TRACK_TYPE_VIDEO))
  7. .isEqualTo("avc1.61e,vp9.63.1");
  8. assertThat(getCodecsOfType("avc1.61e, vp9.63.1, ec-3 ", C.TRACK_TYPE_VIDEO))
  9. .isEqualTo("avc1.61e,vp9.63.1");
  10. assertThat(getCodecsOfType("invalidCodec1, invalidCodec2 ", C.TRACK_TYPE_AUDIO)).isNull();
  11. }

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

  1. label = mediaTagFormat.label;
  2. } else {
  3. codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_AUDIO);
  4. if (isPrimaryTrackInVariant) {
  5. channelCount = variantFormat.channelCount;

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

  1. HlsUrl variant = selectedVariants.get(i);
  2. Format format = variant.format;
  3. if (format.height > 0 || Util.getCodecsOfType(format.codecs, C.TRACK_TYPE_VIDEO) != null) {
  4. definiteVideoVariants.add(variant);
  5. } else if (Util.getCodecsOfType(format.codecs, C.TRACK_TYPE_AUDIO) != null) {
  6. definiteAudioOnlyVariants.add(variant);
  7. sampleStreamWrappers[0] = sampleStreamWrapper;
  8. if (allowChunklessPreparation && codecs != null) {
  9. boolean variantsContainVideoCodecs = Util.getCodecsOfType(codecs, C.TRACK_TYPE_VIDEO) != null;
  10. boolean variantsContainAudioCodecs = Util.getCodecsOfType(codecs, C.TRACK_TYPE_AUDIO) != null;
  11. List<TrackGroup> muxedTrackGroups = new ArrayList<>();
  12. if (variantsContainVideoCodecs) {

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

  1. String codecs = Util.getCodecsOfType(playlistFormat.codecs, sampleTrackType);
  2. String mimeType = MimeTypes.getMediaMimeType(codecs);
  3. if (mimeType == null) {

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

  1. audioGroupIdToCodecs.put(audioGroupId, Util.getCodecsOfType(codecs, C.TRACK_TYPE_AUDIO));

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

  1. String codecsOfType = Util.getCodecsOfType(manifestFormat.codecs, trackType);
  2. if (Util.splitCodecs(codecsOfType).length == 1) {
  3. codecs = codecsOfType;

相关文章