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

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

本文整理了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

private static Format deriveVideoFormat(Format variantFormat) {
 String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
 String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
 return Format.createVideoContainerFormat(
   variantFormat.id,
   variantFormat.label,
   variantFormat.containerMimeType,
   sampleMimeType,
   codecs,
   variantFormat.bitrate,
   variantFormat.width,
   variantFormat.height,
   variantFormat.frameRate,
   /* initializationData= */ null,
   variantFormat.selectionFlags);
}

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

@Test
public void testGetCodecsOfType() {
 assertThat(getCodecsOfType(null, C.TRACK_TYPE_VIDEO)).isNull();
 assertThat(getCodecsOfType("avc1.64001e,vp9.63.1", C.TRACK_TYPE_AUDIO)).isNull();
 assertThat(getCodecsOfType(" vp9.63.1, ec-3 ", C.TRACK_TYPE_AUDIO)).isEqualTo("ec-3");
 assertThat(getCodecsOfType("avc1.61e, vp9.63.1, ec-3 ", C.TRACK_TYPE_VIDEO))
   .isEqualTo("avc1.61e,vp9.63.1");
 assertThat(getCodecsOfType("avc1.61e, vp9.63.1, ec-3 ", C.TRACK_TYPE_VIDEO))
   .isEqualTo("avc1.61e,vp9.63.1");
 assertThat(getCodecsOfType("invalidCodec1, invalidCodec2 ", C.TRACK_TYPE_AUDIO)).isNull();
}

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

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

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

HlsUrl variant = selectedVariants.get(i);
 Format format = variant.format;
 if (format.height > 0 || Util.getCodecsOfType(format.codecs, C.TRACK_TYPE_VIDEO) != null) {
  definiteVideoVariants.add(variant);
 } else if (Util.getCodecsOfType(format.codecs, C.TRACK_TYPE_AUDIO) != null) {
  definiteAudioOnlyVariants.add(variant);
sampleStreamWrappers[0] = sampleStreamWrapper;
if (allowChunklessPreparation && codecs != null) {
 boolean variantsContainVideoCodecs = Util.getCodecsOfType(codecs, C.TRACK_TYPE_VIDEO) != null;
 boolean variantsContainAudioCodecs = Util.getCodecsOfType(codecs, C.TRACK_TYPE_AUDIO) != null;
 List<TrackGroup> muxedTrackGroups = new ArrayList<>();
 if (variantsContainVideoCodecs) {

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

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

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

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

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

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

相关文章