當前位置: 首頁>>代碼示例>>Java>>正文


Java Util.toArray方法代碼示例

本文整理匯總了Java中com.google.android.exoplayer2.util.Util.toArray方法的典型用法代碼示例。如果您正苦於以下問題:Java Util.toArray方法的具體用法?Java Util.toArray怎麽用?Java Util.toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.exoplayer2.util.Util的用法示例。


在下文中一共展示了Util.toArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getVideoTrackIndices

import com.google.android.exoplayer2.util.Util; //導入方法依賴的package包/類
private static int[] getVideoTrackIndices(TrackGroup trackGroup, int[] formatSupport,
    String[] formatIds, boolean canIncludeAdditionalFormats) {
  List<Integer> trackIndices = new ArrayList<>();

  // Always select explicitly listed representations.
  for (String formatId : formatIds) {
    int trackIndex = getTrackIndex(trackGroup, formatId);
    Log.d(TAG, "Adding base video format: "
        + Format.toLogString(trackGroup.getFormat(trackIndex)));
    trackIndices.add(trackIndex);
  }

  // Select additional video representations, if supported by the device.
  if (canIncludeAdditionalFormats) {
    for (int i = 0; i < trackGroup.length; i++) {
      if (!trackIndices.contains(i) && isFormatHandled(formatSupport[i])) {
        Log.d(TAG, "Adding extra video format: "
            + Format.toLogString(trackGroup.getFormat(i)));
        trackIndices.add(i);
      }
    }
  }

  int[] trackIndicesArray = Util.toArray(trackIndices);
  Arrays.sort(trackIndicesArray);
  return trackIndicesArray;
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:28,代碼來源:DashTest.java

示例2: getAdaptiveVideoTracksForGroup

import com.google.android.exoplayer2.util.Util; //導入方法依賴的package包/類
private static int[] getAdaptiveVideoTracksForGroup(TrackGroup group, int[] formatSupport,
    boolean allowMixedMimeTypes, int requiredAdaptiveSupport, int maxVideoWidth,
    int maxVideoHeight, int maxVideoBitrate, int viewportWidth, int viewportHeight,
    boolean orientationMayChange) {
  if (group.length < 2) {
    return NO_TRACKS;
  }

  List<Integer> selectedTrackIndices = getViewportFilteredTrackIndices(group, viewportWidth,
      viewportHeight, orientationMayChange);
  if (selectedTrackIndices.size() < 2) {
    return NO_TRACKS;
  }

  String selectedMimeType = null;
  if (!allowMixedMimeTypes) {
    // Select the mime type for which we have the most adaptive tracks.
    HashSet<String> seenMimeTypes = new HashSet<>();
    int selectedMimeTypeTrackCount = 0;
    for (int i = 0; i < selectedTrackIndices.size(); i++) {
      int trackIndex = selectedTrackIndices.get(i);
      String sampleMimeType = group.getFormat(trackIndex).sampleMimeType;
      if (seenMimeTypes.add(sampleMimeType)) {
        int countForMimeType = getAdaptiveVideoTrackCountForMimeType(group, formatSupport,
            requiredAdaptiveSupport, sampleMimeType, maxVideoWidth, maxVideoHeight,
            maxVideoBitrate, selectedTrackIndices);
        if (countForMimeType > selectedMimeTypeTrackCount) {
          selectedMimeType = sampleMimeType;
          selectedMimeTypeTrackCount = countForMimeType;
        }
      }
    }
  }

  // Filter by the selected mime type.
  filterAdaptiveVideoTrackCountForMimeType(group, formatSupport, requiredAdaptiveSupport,
      selectedMimeType, maxVideoWidth, maxVideoHeight, maxVideoBitrate, selectedTrackIndices);

  return selectedTrackIndices.size() < 2 ? NO_TRACKS : Util.toArray(selectedTrackIndices);
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:41,代碼來源:DefaultTrackSelector.java


注:本文中的com.google.android.exoplayer2.util.Util.toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。