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


Java C.SELECTION_FLAG_DEFAULT属性代码示例

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


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

示例1: getAudioTrackScore

private static int getAudioTrackScore(int formatSupport, String preferredLanguage,
    Format format) {
  boolean isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
  int trackScore;
  if (formatHasLanguage(format, preferredLanguage)) {
    if (isDefault) {
      trackScore = 4;
    } else {
      trackScore = 3;
    }
  } else if (isDefault) {
    trackScore = 2;
  } else {
    trackScore = 1;
  }
  if (isSupported(formatSupport, false)) {
    trackScore += WITHIN_RENDERER_CAPABILITIES_BONUS;
  }
  return trackScore;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:20,代码来源:DefaultTrackSelector.java

示例2: selectOtherTrack

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,代码行数:27,代码来源:DefaultTrackSelector.java

示例3: parseSelectionFlags

@C.SelectionFlags
private static int parseSelectionFlags(String line) {
  return (parseBooleanAttribute(line, REGEX_DEFAULT, false) ? C.SELECTION_FLAG_DEFAULT : 0)
      | (parseBooleanAttribute(line, REGEX_FORCED, false) ? C.SELECTION_FLAG_FORCED : 0)
      | (parseBooleanAttribute(line, REGEX_AUTOSELECT, false) ? C.SELECTION_FLAG_AUTOSELECT : 0);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:6,代码来源:HlsPlaylistParser.java

示例4: selectTextTrack

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,代码行数:52,代码来源:DefaultTrackSelector.java


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