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


Java MimeTypes.isVideo方法代码示例

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


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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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.isVideo(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  boolean requiresSecureDecryption = false;
  DrmInitData drmInitData = format.drmInitData;
  if (drmInitData != null) {
    for (int i = 0; i < drmInitData.schemeDataCount; i++) {
      requiresSecureDecryption |= drmInitData.get(i).requiresSecureDecryption;
    }
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType,
      requiresSecureDecryption);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }

  boolean decoderCapable = decoderInfo.isCodecSupported(format.codecs);
  if (decoderCapable && format.width > 0 && format.height > 0) {
    if (Util.SDK_INT >= 21) {
      decoderCapable = decoderInfo.isVideoSizeAndRateSupportedV21(format.width, format.height,
          format.frameRate);
    } else {
      decoderCapable = format.width * format.height <= MediaCodecUtil.maxH264DecodableFrameSize();
      if (!decoderCapable) {
        Log.d(TAG, "FalseCheck [legacyFrameSize, " + format.width + "x" + format.height + "] ["
            + Util.DEVICE_DEBUG_INFO + "]");
      }
    }
  }

  int adaptiveSupport = decoderInfo.adaptive ? ADAPTIVE_SEAMLESS : ADAPTIVE_NOT_SEAMLESS;
  int tunnelingSupport = decoderInfo.tunneling ? TUNNELING_SUPPORTED : TUNNELING_NOT_SUPPORTED;
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return adaptiveSupport | tunnelingSupport | formatSupport;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:40,代码来源:MediaCodecVideoRenderer.java

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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.isVideo(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  boolean requiresSecureDecryption = false;
  DrmInitData drmInitData = format.drmInitData;
  if (drmInitData != null) {
    for (int i = 0; i < drmInitData.schemeDataCount; i++) {
      requiresSecureDecryption |= drmInitData.get(i).requiresSecureDecryption;
    }
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType,
      requiresSecureDecryption);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }

  boolean decoderCapable = decoderInfo.isCodecSupported(format.codecs);
  if (decoderCapable && format.width > 0 && format.height > 0) {
    if (Util.SDK_INT >= 21) {
      if (format.frameRate > 0) {
        decoderCapable = decoderInfo.isVideoSizeAndRateSupportedV21(format.width, format.height,
            format.frameRate);
      } else {
        decoderCapable = decoderInfo.isVideoSizeSupportedV21(format.width, format.height);
      }
    } else {
      decoderCapable = format.width * format.height <= MediaCodecUtil.maxH264DecodableFrameSize();
    }
  }

  int adaptiveSupport = decoderInfo.adaptive ? ADAPTIVE_SEAMLESS : ADAPTIVE_NOT_SEAMLESS;
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return adaptiveSupport | formatSupport;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:39,代码来源:MediaCodecVideoRenderer.java


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