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


Java TrackGroupArray.get方法代碼示例

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


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

示例1: selectAdaptiveVideoTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
    TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
    int maxVideoBitrate, boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness,
    int viewportWidth, int viewportHeight, boolean orientationMayChange,
    TrackSelection.Factory adaptiveTrackSelectionFactory) throws ExoPlaybackException {
  int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
      ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
      : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
      && (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
        allowMixedMimeTypes, requiredAdaptiveSupport, maxVideoWidth, maxVideoHeight,
        maxVideoBitrate, viewportWidth, viewportHeight, orientationMayChange);
    if (adaptiveTracks.length > 0) {
      return adaptiveTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
    }
  }
  return null;
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:22,代碼來源:DefaultTrackSelector.java

示例2: getSubtitleTracks

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
public List<PlayerSubtitleTrack> getSubtitleTracks(RendererTypeRequester rendererTypeRequester) {
    TrackGroupArray trackGroups = trackSelector.trackGroups(TEXT, rendererTypeRequester);

    List<PlayerSubtitleTrack> subtitleTracks = new ArrayList<>();

    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
        TrackGroup trackGroup = trackGroups.get(groupIndex);

        for (int formatIndex = 0; formatIndex < trackGroup.length; formatIndex++) {
            Format format = trackGroup.getFormat(formatIndex);
            PlayerSubtitleTrack playerSubtitleTrack = new PlayerSubtitleTrack(
                    groupIndex,
                    formatIndex,
                    format.id,
                    format.language,
                    format.sampleMimeType,
                    format.channelCount,
                    format.bitrate
            );
            subtitleTracks.add(playerSubtitleTrack);
        }
    }

    return subtitleTracks;
}
 
開發者ID:novoda,項目名稱:no-player,代碼行數:26,代碼來源:ExoPlayerSubtitleTrackSelector.java

示例3: selectAdaptiveVideoTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
    TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
    int maxVideoBitrate, boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness,
    int viewportWidth, int viewportHeight, boolean orientationMayChange,
    TrackSelection.Factory adaptiveVideoTrackSelectionFactory) throws ExoPlaybackException {
  int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
      ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
      : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
      && (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks = getAdaptiveTracksForGroup(group, formatSupport[i],
        allowMixedMimeTypes, requiredAdaptiveSupport, maxVideoWidth, maxVideoHeight,
        maxVideoBitrate, viewportWidth, viewportHeight, orientationMayChange);
    if (adaptiveTracks.length > 0) {
      return adaptiveVideoTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
    }
  }
  return null;
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:22,代碼來源:DefaultTrackSelector.java

示例4: selectAdaptiveVideoTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
    TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
    boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness, int viewportWidth,
    int viewportHeight, boolean orientationMayChange,
    TrackSelection.Factory adaptiveVideoTrackSelectionFactory) throws ExoPlaybackException {
  int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
      ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
      : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
      && (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks = getAdaptiveTracksForGroup(group, formatSupport[i],
        allowMixedMimeTypes, requiredAdaptiveSupport, maxVideoWidth, maxVideoHeight,
        viewportWidth, viewportHeight, orientationMayChange);
    if (adaptiveTracks.length > 0) {
      return adaptiveVideoTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
    }
  }
  return null;
}
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:22,代碼來源:DefaultTrackSelector.java

示例5: selectOtherTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
protected TrackSelection selectOtherTrack(int trackType, TrackGroupArray groups,
    int[][] formatSupport) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedTrackScore = 0;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex])) {
        Format format = trackGroup.getFormat(trackIndex);
        boolean isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
        int trackScore = isDefault ? 2 : 1;
        if (trackScore > selectedTrackScore) {
          selectedGroup = trackGroup;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:25,代碼來源:DefaultTrackSelector.java

示例6: selectAudioTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
protected TrackSelection selectAudioTrack(TrackGroupArray groups, int[][] formatSupport,
    String preferredAudioLanguage, boolean exceedRendererCapabilitiesIfNecessary,
    boolean allowMixedMimeAdaptiveness, TrackSelection.Factory adaptiveTrackSelectionFactory) {
  int selectedGroupIndex = C.INDEX_UNSET;
  int selectedTrackIndex = C.INDEX_UNSET;
  int selectedTrackScore = 0;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex], exceedRendererCapabilitiesIfNecessary)) {
        Format format = trackGroup.getFormat(trackIndex);
        int trackScore = getAudioTrackScore(trackFormatSupport[trackIndex],
            preferredAudioLanguage, format);
        if (trackScore > selectedTrackScore) {
          selectedGroupIndex = groupIndex;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
        }
      }
    }
  }

  if (selectedGroupIndex == C.INDEX_UNSET) {
    return null;
  }

  TrackGroup selectedGroup = groups.get(selectedGroupIndex);
  if (adaptiveTrackSelectionFactory != null) {
    // If the group of the track with the highest score allows it, try to enable adaptation.
    int[] adaptiveTracks = getAdaptiveAudioTracks(selectedGroup,
        formatSupport[selectedGroupIndex], allowMixedMimeAdaptiveness);
    if (adaptiveTracks.length > 0) {
      return adaptiveTrackSelectionFactory.createTrackSelection(selectedGroup,
          adaptiveTracks);
    }
  }
  return new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:40,代碼來源:DefaultTrackSelector.java

示例7: selectOtherTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
protected TrackSelection selectOtherTrack(int trackType, TrackGroupArray groups,
    int[][] formatSupport, boolean exceedRendererCapabilitiesIfNecessary) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedTrackScore = 0;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex], exceedRendererCapabilitiesIfNecessary)) {
        Format format = trackGroup.getFormat(trackIndex);
        boolean isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
        int trackScore = isDefault ? 2 : 1;
        if (isSupported(trackFormatSupport[trackIndex], false)) {
          trackScore += WITHIN_RENDERER_CAPABILITIES_BONUS;
        }
        if (trackScore > selectedTrackScore) {
          selectedGroup = trackGroup;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:28,代碼來源:DefaultTrackSelector.java

示例8: getAudioTracks

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
public AudioTracks getAudioTracks(RendererTypeRequester rendererTypeRequester) {
    TrackGroupArray trackGroups = trackSelector.trackGroups(AUDIO, rendererTypeRequester);

    List<PlayerAudioTrack> audioTracks = new ArrayList<>();

    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
        if (trackSelector.supportsTrackSwitching(AUDIO, rendererTypeRequester, trackGroups, groupIndex)) {
            TrackGroup trackGroup = trackGroups.get(groupIndex);

            for (int formatIndex = 0; formatIndex < trackGroup.length; formatIndex++) {
                Format format = trackGroup.getFormat(formatIndex);

                PlayerAudioTrack playerAudioTrack = new PlayerAudioTrack(
                        groupIndex,
                        formatIndex,
                        format.id,
                        format.language,
                        format.sampleMimeType,
                        format.channelCount,
                        format.bitrate,
                        AudioTrackType.from(format.selectionFlags)
                );
                audioTracks.add(playerAudioTrack);
            }
        }
    }

    return AudioTracks.from(audioTracks);
}
 
開發者ID:novoda,項目名稱:no-player,代碼行數:30,代碼來源:ExoPlayerAudioTrackSelector.java

示例9: supportsTrackSwitching

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
boolean supportsTrackSwitching(TrackType trackType,
                               RendererTypeRequester rendererTypeRequester,
                               TrackGroupArray trackGroups,
                               int groupIndex) {
    Optional<Integer> audioRendererIndex = rendererTrackIndexExtractor.extract(trackType, mappedTrackInfoLength(), rendererTypeRequester);
    return audioRendererIndex.isPresent()
            && trackGroups.get(groupIndex).length > 0
            && trackInfo().getAdaptiveSupport(audioRendererIndex.get(), groupIndex, false) != RendererCapabilities.ADAPTIVE_NOT_SUPPORTED;
}
 
開發者ID:novoda,項目名稱:no-player,代碼行數:10,代碼來源:ExoPlayerTrackSelector.java

示例10: getVideoTracks

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
public List<PlayerVideoTrack> getVideoTracks(RendererTypeRequester rendererTypeRequester, ContentType contentType) {
    TrackGroupArray trackGroups = trackSelector.trackGroups(VIDEO, rendererTypeRequester);

    List<PlayerVideoTrack> videoTracks = new ArrayList<>();

    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
        TrackGroup trackGroup = trackGroups.get(groupIndex);

        for (int formatIndex = 0; formatIndex < trackGroup.length; formatIndex++) {
            Format format = trackGroup.getFormat(formatIndex);

            PlayerVideoTrack playerVideoTrack = new PlayerVideoTrack(
                    groupIndex,
                    formatIndex,
                    format.id,
                    contentType,
                    format.width,
                    format.height,
                    (int) format.frameRate,
                    format.bitrate
            );

            videoTracks.add(playerVideoTrack);
        }
    }

    return videoTracks;
}
 
開發者ID:novoda,項目名稱:no-player,代碼行數:29,代碼來源:ExoPlayerVideoTrackSelector.java

示例11: selectAudioTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
protected TrackSelection selectAudioTrack(TrackGroupArray groups, int[][] formatSupport,
    String preferredAudioLanguage, boolean exceedRendererCapabilitiesIfNecessary) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedTrackScore = 0;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex], exceedRendererCapabilitiesIfNecessary)) {
        Format format = trackGroup.getFormat(trackIndex);
        boolean isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
        int trackScore;
        if (formatHasLanguage(format, preferredAudioLanguage)) {
          if (isDefault) {
            trackScore = 4;
          } else {
            trackScore = 3;
          }
        } else if (isDefault) {
          trackScore = 2;
        } else {
          trackScore = 1;
        }
        if (isSupported(trackFormatSupport[trackIndex], false)) {
          trackScore += WITHIN_RENDERER_CAPABILITIES_BONUS;
        }
        if (trackScore > selectedTrackScore) {
          selectedGroup = trackGroup;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:39,代碼來源:DefaultTrackSelector.java

示例12: selectFixedVideoTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
private static TrackSelection selectFixedVideoTrack(TrackGroupArray groups,
    int[][] formatSupport, int maxVideoWidth, int maxVideoHeight, int viewportWidth,
    int viewportHeight, boolean orientationMayChange, boolean exceedConstraintsIfNecessary) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedPixelCount = Format.NO_VALUE;
  boolean selectedIsWithinConstraints = false;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup group = groups.get(groupIndex);
    List<Integer> selectedTrackIndices = getViewportFilteredTrackIndices(group, viewportWidth,
        viewportHeight, orientationMayChange);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex])) {
        Format format = group.getFormat(trackIndex);
        boolean isWithinConstraints = selectedTrackIndices.contains(trackIndex)
            && (format.width == Format.NO_VALUE || format.width <= maxVideoWidth)
            && (format.height == Format.NO_VALUE || format.height <= maxVideoHeight);
        int pixelCount = format.getPixelCount();
        boolean selectTrack;
        if (selectedIsWithinConstraints) {
          selectTrack = isWithinConstraints
              && comparePixelCounts(pixelCount, selectedPixelCount) > 0;
        } else {
          selectTrack = isWithinConstraints || (exceedConstraintsIfNecessary
              && (selectedGroup == null
              || comparePixelCounts(pixelCount, selectedPixelCount) < 0));
        }
        if (selectTrack) {
          selectedGroup = group;
          selectedTrackIndex = trackIndex;
          selectedPixelCount = pixelCount;
          selectedIsWithinConstraints = isWithinConstraints;
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:41,代碼來源:DefaultTrackSelector.java

示例13: selectAudioTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
protected TrackSelection selectAudioTrack(TrackGroupArray groups, int[][] formatSupport,
    String preferredAudioLanguage) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedTrackScore = 0;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex])) {
        Format format = trackGroup.getFormat(trackIndex);
        boolean isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
        int trackScore;
        if (formatHasLanguage(format, preferredAudioLanguage)) {
          if (isDefault) {
            trackScore = 4;
          } else {
            trackScore = 3;
          }
        } else if (isDefault) {
          trackScore = 2;
        } else {
          trackScore = 1;
        }
        if (trackScore > selectedTrackScore) {
          selectedGroup = trackGroup;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:36,代碼來源:DefaultTrackSelector.java

示例14: selectFixedVideoTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
private static TrackSelection selectFixedVideoTrack(TrackGroupArray groups,
    int[][] formatSupport, int maxVideoWidth, int maxVideoHeight, int maxVideoBitrate,
    int viewportWidth, int viewportHeight, boolean orientationMayChange,
    boolean exceedConstraintsIfNecessary, boolean exceedRendererCapabilitiesIfNecessary) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedTrackScore = 0;
  int selectedBitrate = Format.NO_VALUE;
  int selectedPixelCount = Format.NO_VALUE;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    List<Integer> selectedTrackIndices = getViewportFilteredTrackIndices(trackGroup,
        viewportWidth, viewportHeight, orientationMayChange);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex], exceedRendererCapabilitiesIfNecessary)) {
        Format format = trackGroup.getFormat(trackIndex);
        boolean isWithinConstraints = selectedTrackIndices.contains(trackIndex)
            && (format.width == Format.NO_VALUE || format.width <= maxVideoWidth)
            && (format.height == Format.NO_VALUE || format.height <= maxVideoHeight)
            && (format.bitrate == Format.NO_VALUE || format.bitrate <= maxVideoBitrate);
        if (!isWithinConstraints && !exceedConstraintsIfNecessary) {
          // Track should not be selected.
          continue;
        }
        int trackScore = isWithinConstraints ? 2 : 1;
        if (isSupported(trackFormatSupport[trackIndex], false)) {
          trackScore += WITHIN_RENDERER_CAPABILITIES_BONUS;
        }
        boolean selectTrack = trackScore > selectedTrackScore;
        if (trackScore == selectedTrackScore) {
          // Use the pixel count as a tie breaker (or bitrate if pixel counts are tied). If we're
          // within constraints prefer a higher pixel count (or bitrate), else prefer a lower
          // count (or bitrate). If still tied then prefer the first track (i.e. the one that's
          // already selected).
          int comparisonResult;
          int formatPixelCount = format.getPixelCount();
          if (formatPixelCount != selectedPixelCount) {
            comparisonResult = compareFormatValues(format.getPixelCount(), selectedPixelCount);
          } else {
            comparisonResult = compareFormatValues(format.bitrate, selectedBitrate);
          }
          selectTrack = isWithinConstraints ? comparisonResult > 0 : comparisonResult < 0;
        }
        if (selectTrack) {
          selectedGroup = trackGroup;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
          selectedBitrate = format.bitrate;
          selectedPixelCount = format.getPixelCount();
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:58,代碼來源:DefaultTrackSelector.java

示例15: selectTextTrack

import com.google.android.exoplayer2.source.TrackGroupArray; //導入方法依賴的package包/類
protected TrackSelection selectTextTrack(TrackGroupArray groups, int[][] formatSupport,
    String preferredTextLanguage, String preferredAudioLanguage,
    boolean exceedRendererCapabilitiesIfNecessary) {
  TrackGroup selectedGroup = null;
  int selectedTrackIndex = 0;
  int selectedTrackScore = 0;
  for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
    TrackGroup trackGroup = groups.get(groupIndex);
    int[] trackFormatSupport = formatSupport[groupIndex];
    for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
      if (isSupported(trackFormatSupport[trackIndex], exceedRendererCapabilitiesIfNecessary)) {
        Format format = trackGroup.getFormat(trackIndex);
        boolean isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
        boolean isForced = (format.selectionFlags & C.SELECTION_FLAG_FORCED) != 0;
        int trackScore;
        if (formatHasLanguage(format, preferredTextLanguage)) {
          if (isDefault) {
            trackScore = 6;
          } else if (!isForced) {
            // Prefer non-forced to forced if a preferred text language has been specified. Where
            // both are provided the non-forced track will usually contain the forced subtitles as
            // a subset.
            trackScore = 5;
          } else {
            trackScore = 4;
          }
        } else if (isDefault) {
          trackScore = 3;
        } else if (isForced) {
          if (formatHasLanguage(format, preferredAudioLanguage)) {
            trackScore = 2;
          } else {
            trackScore = 1;
          }
        } else {
          // Track should not be selected.
          continue;
        }
        if (isSupported(trackFormatSupport[trackIndex], false)) {
          trackScore += WITHIN_RENDERER_CAPABILITIES_BONUS;
        }
        if (trackScore > selectedTrackScore) {
          selectedGroup = trackGroup;
          selectedTrackIndex = trackIndex;
          selectedTrackScore = trackScore;
        }
      }
    }
  }
  return selectedGroup == null ? null
      : new FixedTrackSelection(selectedGroup, selectedTrackIndex);
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:53,代碼來源:DefaultTrackSelector.java


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