本文整理汇总了Java中com.google.android.exoplayer2.util.MimeTypes.getMediaMimeType方法的典型用法代码示例。如果您正苦于以下问题:Java MimeTypes.getMediaMimeType方法的具体用法?Java MimeTypes.getMediaMimeType怎么用?Java MimeTypes.getMediaMimeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.exoplayer2.util.MimeTypes
的用法示例。
在下文中一共展示了MimeTypes.getMediaMimeType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCodecSupported
import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
/**
* Whether the decoder supports the given {@code codec}. If there is insufficient information to
* decide, returns true.
*
* @param codec Codec string as defined in RFC 6381.
* @return True if the given codec is supported by the decoder.
*/
public boolean isCodecSupported(String codec) {
if (codec == null || mimeType == null) {
return true;
}
String codecMimeType = MimeTypes.getMediaMimeType(codec);
if (codecMimeType == null) {
return true;
}
if (!mimeType.equals(codecMimeType)) {
return false;
}
Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(codec);
if (codecProfileAndLevel == null) {
// If we don't know any better, we assume that the profile and level are supported.
return true;
}
for (CodecProfileLevel capabilities : getProfileLevels()) {
if (capabilities.profile == codecProfileAndLevel.first
&& capabilities.level >= codecProfileAndLevel.second) {
return true;
}
}
return false;
}
示例2: isCodecSupported
import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
/**
* Whether the decoder supports the given {@code codec}. If there is insufficient information to
* decide, returns true.
*
* @param codec Codec string as defined in RFC 6381.
* @return True if the given codec is supported by the decoder.
*/
public boolean isCodecSupported(String codec) {
if (codec == null || mimeType == null) {
return true;
}
String codecMimeType = MimeTypes.getMediaMimeType(codec);
if (codecMimeType == null) {
return true;
}
if (!mimeType.equals(codecMimeType)) {
logNoSupport("codec.mime " + codec + ", " + codecMimeType);
return false;
}
Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(codec);
if (codecProfileAndLevel == null) {
// If we don't know any better, we assume that the profile and level are supported.
return true;
}
for (CodecProfileLevel capabilities : getProfileLevels()) {
if (capabilities.profile == codecProfileAndLevel.first
&& capabilities.level >= codecProfileAndLevel.second) {
return true;
}
}
logNoSupport("codec.profileLevel, " + codec + ", " + codecMimeType);
return false;
}