当前位置: 首页>>代码示例>>Java>>正文


Java MimeTypes.isAudio方法代码示例

本文整理汇总了Java中com.google.android.exoplayer2.util.MimeTypes.isAudio方法的典型用法代码示例。如果您正苦于以下问题:Java MimeTypes.isAudio方法的具体用法?Java MimeTypes.isAudio怎么用?Java MimeTypes.isAudio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer2.util.MimeTypes的用法示例。


在下文中一共展示了MimeTypes.isAudio方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildTrackName

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
public static String buildTrackName(Format format) {
    String trackName;
    if (MimeTypes.isVideo(format.sampleMimeType)) {
        trackName = joinWithSeparator(
                buildResolutionString(format), buildBitrateString(format));
    } else if (MimeTypes.isAudio(format.sampleMimeType)) {
        trackName = joinWithSeparator(joinWithSeparator(joinWithSeparator(joinWithSeparator(
                buildLanguageString(format), buildAudioPropertyString(format)),
                buildBitrateString(format)), buildTrackIdString(format)),
                buildSampleMimeTypeString(format));
    } else {
        trackName = joinWithSeparator(joinWithSeparator(joinWithSeparator(buildLanguageString(format),
                buildBitrateString(format)), buildTrackIdString(format)),
                buildSampleMimeTypeString(format));
    }
    return trackName.length() == 0 ? "unknown" : trackName;
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:18,代码来源:TubiQualityDialogView.java

示例2: supportsFormat

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
@Override
protected int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
    throws DecoderQueryException {
  String mimeType = format.sampleMimeType;
  if (!MimeTypes.isAudio(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  int tunnelingSupport = Util.SDK_INT >= 21 ? TUNNELING_SUPPORTED : TUNNELING_NOT_SUPPORTED;
  if (allowPassthrough(mimeType) && mediaCodecSelector.getPassthroughDecoderInfo() != null) {
    return ADAPTIVE_NOT_SEAMLESS | tunnelingSupport | FORMAT_HANDLED;
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType, false);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }
  // Note: We assume support for unknown sampleRate and channelCount.
  boolean decoderCapable = Util.SDK_INT < 21
      || ((format.sampleRate == Format.NO_VALUE
      || decoderInfo.isAudioSampleRateSupportedV21(format.sampleRate))
      && (format.channelCount == Format.NO_VALUE
      ||  decoderInfo.isAudioChannelCountSupportedV21(format.channelCount)));
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return ADAPTIVE_NOT_SEAMLESS | tunnelingSupport | formatSupport;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:25,代码来源:MediaCodecAudioRenderer.java

示例3: getSampleMimeType

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if ("stpp".equals(codecs)) {
      return MimeTypes.APPLICATION_TTML;
    } else if ("wvtt".equals(codecs)) {
      return MimeTypes.APPLICATION_MP4VTT;
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:33,代码来源:DashManifestParser.java

示例4: buildFormat

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
protected Format buildFormat(String id, String containerMimeType, int width, int height,
    float frameRate, int audioChannels, int audioSamplingRate, int bitrate, String language,
    String codecs) {
  String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
  if (sampleMimeType != null) {
    if (MimeTypes.isVideo(sampleMimeType)) {
      return Format.createVideoContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, width, height, frameRate, null);
    } else if (MimeTypes.isAudio(sampleMimeType)) {
      return Format.createAudioContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, audioChannels, audioSamplingRate, null, 0, language);
    } else if (mimeTypeIsRawText(sampleMimeType)) {
      return Format.createTextContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, 0, language);
    } else {
      return Format.createContainerFormat(id, containerMimeType, codecs, sampleMimeType, bitrate);
    }
  } else {
    return Format.createContainerFormat(id, containerMimeType, codecs, sampleMimeType, bitrate);
  }
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:22,代码来源:DashManifestParser.java

示例5: getSampleMimeType

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if ("stpp".equals(codecs)) {
      return MimeTypes.APPLICATION_TTML;
    } else if ("wvtt".equals(codecs)) {
      return MimeTypes.APPLICATION_MP4VTT;
    }
  }
  return null;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:33,代码来源:DashManifestParser.java

示例6: supportsFormat

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
@Override
protected int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
    throws DecoderQueryException {
  String mimeType = format.sampleMimeType;
  if (!MimeTypes.isAudio(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  if (allowPassthrough(mimeType) && mediaCodecSelector.getPassthroughDecoderInfo() != null) {
    return ADAPTIVE_NOT_SEAMLESS | FORMAT_HANDLED;
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType, false);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }
  // Note: We assume support for unknown sampleRate and channelCount.
  boolean decoderCapable = Util.SDK_INT < 21
      || ((format.sampleRate == Format.NO_VALUE
      || decoderInfo.isAudioSampleRateSupportedV21(format.sampleRate))
      && (format.channelCount == Format.NO_VALUE
      ||  decoderInfo.isAudioChannelCountSupportedV21(format.channelCount)));
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return ADAPTIVE_NOT_SEAMLESS | formatSupport;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:24,代码来源:MediaCodecAudioRenderer.java

示例7: buildTrackName

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
private static String buildTrackName(Format format) {
  String trackName;
  if (MimeTypes.isVideo(format.sampleMimeType)) {
    trackName = joinWithSeparator(joinWithSeparator(buildResolutionString(format),
        buildBitrateString(format)), buildTrackIdString(format));
  } else if (MimeTypes.isAudio(format.sampleMimeType)) {
    trackName = joinWithSeparator(joinWithSeparator(joinWithSeparator(buildLanguageString(format),
        buildAudioPropertyString(format)), buildBitrateString(format)),
        buildTrackIdString(format));
  } else {
    trackName = joinWithSeparator(joinWithSeparator(buildLanguageString(format),
        buildBitrateString(format)), buildTrackIdString(format));
  }
  return trackName.length() == 0 ? "unknown" : trackName;
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:16,代码来源:TrackSelectionHelper.java

示例8: maybeFinishPrepare

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
private void maybeFinishPrepare() {
  if (released || prepared || seekMap == null || !tracksBuilt) {
    return;
  }
  int trackCount = sampleQueues.size();
  for (int i = 0; i < trackCount; i++) {
    if (sampleQueues.valueAt(i).getUpstreamFormat() == null) {
      return;
    }
  }
  loadCondition.close();
  TrackGroup[] trackArray = new TrackGroup[trackCount];
  trackIsAudioVideoFlags = new boolean[trackCount];
  trackEnabledStates = new boolean[trackCount];
  durationUs = seekMap.getDurationUs();
  for (int i = 0; i < trackCount; i++) {
    Format trackFormat = sampleQueues.valueAt(i).getUpstreamFormat();
    trackArray[i] = new TrackGroup(trackFormat);
    String mimeType = trackFormat.sampleMimeType;
    boolean isAudioVideo = MimeTypes.isVideo(mimeType) || MimeTypes.isAudio(mimeType);
    trackIsAudioVideoFlags[i] = isAudioVideo;
    haveAudioVideoTracks |= isAudioVideo;
  }
  tracks = new TrackGroupArray(trackArray);
  prepared = true;
  sourceListener.onSourceInfoRefreshed(
      new SinglePeriodTimeline(durationUs, seekMap.isSeekable()), null);
  callback.onPrepared(this);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:30,代码来源:ExtractorMediaPeriod.java

示例9: getContentType

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
protected int getContentType(Format format) {
  String sampleMimeType = format.sampleMimeType;
  if (TextUtils.isEmpty(sampleMimeType)) {
    return C.TRACK_TYPE_UNKNOWN;
  } else if (MimeTypes.isVideo(sampleMimeType)) {
    return C.TRACK_TYPE_VIDEO;
  } else if (MimeTypes.isAudio(sampleMimeType)) {
    return C.TRACK_TYPE_AUDIO;
  } else if (mimeTypeIsRawText(sampleMimeType)) {
    return C.TRACK_TYPE_TEXT;
  }
  return C.TRACK_TYPE_UNKNOWN;
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:14,代码来源:DashManifestParser.java

示例10: buildFormat

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
protected Format buildFormat(String id, String containerMimeType, int width, int height,
    float frameRate, int audioChannels, int audioSamplingRate, int bitrate, String language,
    @C.SelectionFlags int selectionFlags, List<SchemeValuePair> accessibilityDescriptors,
    String codecs) {
  String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
  if (sampleMimeType != null) {
    if (MimeTypes.isVideo(sampleMimeType)) {
      return Format.createVideoContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, width, height, frameRate, null, selectionFlags);
    } else if (MimeTypes.isAudio(sampleMimeType)) {
      return Format.createAudioContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, audioChannels, audioSamplingRate, null, selectionFlags, language);
    } else if (mimeTypeIsRawText(sampleMimeType)) {
      int accessibilityChannel;
      if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) {
        accessibilityChannel = parseCea608AccessibilityChannel(accessibilityDescriptors);
      } else if (MimeTypes.APPLICATION_CEA708.equals(sampleMimeType)) {
        accessibilityChannel = parseCea708AccessibilityChannel(accessibilityDescriptors);
      } else {
        accessibilityChannel = Format.NO_VALUE;
      }
      return Format.createTextContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, selectionFlags, language, accessibilityChannel);
    }
  }
  return Format.createContainerFormat(id, containerMimeType, sampleMimeType, codecs, bitrate,
      selectionFlags, language);
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:29,代码来源:DashManifestParser.java

示例11: buildTrackName

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
private static String buildTrackName(Format format) {
    String trackName;
    if (MimeTypes.isVideo(format.sampleMimeType)) {
        trackName = joinWithSeparator(joinWithSeparator(buildResolutionString(format),
                buildBitrateString(format)), buildTrackIdString(format));
    } else if (MimeTypes.isAudio(format.sampleMimeType)) {
        trackName = joinWithSeparator(joinWithSeparator(joinWithSeparator(buildLanguageString(format),
                buildAudioPropertyString(format)), buildBitrateString(format)),
                buildTrackIdString(format));
    } else {
        trackName = joinWithSeparator(joinWithSeparator(buildLanguageString(format),
                buildBitrateString(format)), buildTrackIdString(format));
    }
    return trackName.length() == 0 ? "unknown" : trackName;
}
 
开发者ID:AndroidTips,项目名称:MDVideo,代码行数:16,代码来源:TrackSelectionHelper.java

示例12: getContentType

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
protected int getContentType(Format format) {
  String sampleMimeType = format.sampleMimeType;
  if (TextUtils.isEmpty(sampleMimeType)) {
    return C.TRACK_TYPE_UNKNOWN;
  } else if (MimeTypes.isVideo(sampleMimeType)) {
    return C.TRACK_TYPE_VIDEO;
  } else if (MimeTypes.isAudio(sampleMimeType)) {
    return C.TRACK_TYPE_AUDIO;
  } else if (mimeTypeIsRawText(sampleMimeType)
      || MimeTypes.APPLICATION_RAWCC.equals(format.containerMimeType)) {
    return C.TRACK_TYPE_TEXT;
  }
  return C.TRACK_TYPE_UNKNOWN;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:15,代码来源:DashManifestParser.java

示例13: supportsFormat

import com.google.android.exoplayer2.util.MimeTypes; //导入方法依赖的package包/类
@Override
public int supportsFormat(Format format) {
  if (!FfmpegLibrary.isAvailable()) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  String mimeType = format.sampleMimeType;
  return FfmpegLibrary.supportsFormat(mimeType) ? FORMAT_HANDLED
      : MimeTypes.isAudio(mimeType) ? FORMAT_UNSUPPORTED_SUBTYPE : FORMAT_UNSUPPORTED_TYPE;
}
 
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:10,代码来源:FfmpegAudioRenderer.java


注:本文中的com.google.android.exoplayer2.util.MimeTypes.isAudio方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。