Java Code Examples for com.google.android.exoplayer2.RendererCapabilities#ADAPTIVE_SEAMLESS

The following examples show how to use com.google.android.exoplayer2.RendererCapabilities#ADAPTIVE_SEAMLESS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MappingTrackSelector.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the extent to which a renderer supports adaptation between specified tracks within a
 * {@link TrackGroup}.
 *
 * @param rendererIndex The renderer index.
 * @param groupIndex The index of the track group.
 * @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS}, {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
 */
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
  int handledTrackCount = 0;
  int adaptiveSupport = RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean multipleMimeTypes = false;
  String firstSampleMimeType = null;
  for (int i = 0; i < trackIndices.length; i++) {
    int trackIndex = trackIndices[i];
    String sampleMimeType =
        rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType;
    if (handledTrackCount++ == 0) {
      firstSampleMimeType = sampleMimeType;
    } else {
      multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
    }
    adaptiveSupport =
        Math.min(
            adaptiveSupport,
            rendererFormatSupports[rendererIndex][groupIndex][i]
                & RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
  }
  return multipleMimeTypes
      ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex])
      : adaptiveSupport;
}
 
Example 2
Source File: EventLogger.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static String getAdaptiveSupportString(
    int trackCount, @AdaptiveSupport int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      throw new IllegalStateException();
  }
}
 
Example 3
Source File: MappingTrackSelector.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the extent to which a renderer supports adaptation between specified tracks within a
 * {@link TrackGroup}.
 *
 * @param rendererIndex The renderer index.
 * @param groupIndex The index of the track group.
 * @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS}, {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
 */
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
  int handledTrackCount = 0;
  int adaptiveSupport = RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean multipleMimeTypes = false;
  String firstSampleMimeType = null;
  for (int i = 0; i < trackIndices.length; i++) {
    int trackIndex = trackIndices[i];
    String sampleMimeType =
        rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType;
    if (handledTrackCount++ == 0) {
      firstSampleMimeType = sampleMimeType;
    } else {
      multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
    }
    adaptiveSupport =
        Math.min(
            adaptiveSupport,
            rendererFormatSupports[rendererIndex][groupIndex][i]
                & RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
  }
  return multipleMimeTypes
      ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex])
      : adaptiveSupport;
}
 
Example 4
Source File: MappingTrackSelector.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * Returns the extent to which the renderer supports adaptation between specified tracks within
 * a {@link TrackGroup}.
 *
 * @param rendererIndex The renderer index.
 * @param groupIndex The index of the group.
 * @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS},
 *     {@link RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and
 *     {@link RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
 */
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
  int handledTrackCount = 0;
  int adaptiveSupport = RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean multipleMimeTypes = false;
  String firstSampleMimeType = null;
  for (int i = 0; i < trackIndices.length; i++) {
    int trackIndex = trackIndices[i];
    String sampleMimeType = trackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex)
        .sampleMimeType;
    if (handledTrackCount++ == 0) {
      firstSampleMimeType = sampleMimeType;
    } else {
      multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
    }
    adaptiveSupport = Math.min(adaptiveSupport, formatSupport[rendererIndex][groupIndex][i]
        & RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
  }
  return multipleMimeTypes
      ? Math.min(adaptiveSupport, mixedMimeTypeAdaptiveSupport[rendererIndex])
      : adaptiveSupport;
}
 
Example 5
Source File: DefaultTrackSelector.java    From K-Sonic with MIT License 6 votes vote down vote up
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;
}
 
Example 6
Source File: MappingTrackSelector.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the extent to which a renderer supports adaptation between specified tracks within a
 * {@link TrackGroup}.
 *
 * @param rendererIndex The renderer index.
 * @param groupIndex The index of the track group.
 * @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS}, {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
 */
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
  int handledTrackCount = 0;
  int adaptiveSupport = RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean multipleMimeTypes = false;
  String firstSampleMimeType = null;
  for (int i = 0; i < trackIndices.length; i++) {
    int trackIndex = trackIndices[i];
    String sampleMimeType =
        rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType;
    if (handledTrackCount++ == 0) {
      firstSampleMimeType = sampleMimeType;
    } else {
      multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
    }
    adaptiveSupport =
        Math.min(
            adaptiveSupport,
            rendererFormatSupports[rendererIndex][groupIndex][i]
                & RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
  }
  return multipleMimeTypes
      ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex])
      : adaptiveSupport;
}
 
Example 7
Source File: MappingTrackSelector.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the extent to which a renderer supports adaptation between specified tracks within a
 * {@link TrackGroup}.
 *
 * @param rendererIndex The renderer index.
 * @param groupIndex The index of the track group.
 * @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS}, {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and {@link
 *     RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
 */
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
  int handledTrackCount = 0;
  int adaptiveSupport = RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean multipleMimeTypes = false;
  String firstSampleMimeType = null;
  for (int i = 0; i < trackIndices.length; i++) {
    int trackIndex = trackIndices[i];
    String sampleMimeType =
        rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType;
    if (handledTrackCount++ == 0) {
      firstSampleMimeType = sampleMimeType;
    } else {
      multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
    }
    adaptiveSupport =
        Math.min(
            adaptiveSupport,
            rendererFormatSupports[rendererIndex][groupIndex][i]
                & RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
  }
  return multipleMimeTypes
      ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex])
      : adaptiveSupport;
}
 
Example 8
Source File: EventLogger.java    From evercam-android with GNU Affero General Public License v3.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      return "?";
  }
}
 
Example 9
Source File: DefaultTrackSelector.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Nullable
private static TrackSelection.Definition selectAdaptiveVideoTrack(
    TrackGroupArray groups,
    @Capabilities int[][] formatSupport,
    @AdaptiveSupport int mixedMimeTypeAdaptationSupports,
    Parameters params) {
  int requiredAdaptiveSupport =
      params.allowVideoNonSeamlessAdaptiveness
          ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
          : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes =
      params.allowVideoMixedMimeTypeAdaptiveness
          && (mixedMimeTypeAdaptationSupports & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks =
        getAdaptiveVideoTracksForGroup(
            group,
            formatSupport[i],
            allowMixedMimeTypes,
            requiredAdaptiveSupport,
            params.maxVideoWidth,
            params.maxVideoHeight,
            params.maxVideoFrameRate,
            params.maxVideoBitrate,
            params.viewportWidth,
            params.viewportHeight,
            params.viewportOrientationMayChange);
    if (adaptiveTracks.length > 0) {
      return new TrackSelection.Definition(group, adaptiveTracks);
    }
  }
  return null;
}
 
Example 10
Source File: EventLogger.java    From K-Sonic with MIT License 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      return "?";
  }
}
 
Example 11
Source File: EventLogger.java    From TigerVideo with Apache License 2.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
    if (trackCount < 2) {
        return "N/A";
    }
    switch (adaptiveSupport) {
        case RendererCapabilities.ADAPTIVE_SEAMLESS:
            return "YES";
        case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
            return "YES_NOT_SEAMLESS";
        case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
            return "NO";
        default:
            return "?";
    }
}
 
Example 12
Source File: DefaultTrackSelector.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
private static TrackSelection.Definition selectAdaptiveVideoTrack(
    TrackGroupArray groups,
    int[][] formatSupport,
    int mixedMimeTypeAdaptationSupports,
    Parameters params) {
  int requiredAdaptiveSupport =
      params.allowVideoNonSeamlessAdaptiveness
          ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
          : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes =
      params.allowVideoMixedMimeTypeAdaptiveness
          && (mixedMimeTypeAdaptationSupports & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks =
        getAdaptiveVideoTracksForGroup(
            group,
            formatSupport[i],
            allowMixedMimeTypes,
            requiredAdaptiveSupport,
            params.maxVideoWidth,
            params.maxVideoHeight,
            params.maxVideoFrameRate,
            params.maxVideoBitrate,
            params.viewportWidth,
            params.viewportHeight,
            params.viewportOrientationMayChange);
    if (adaptiveTracks.length > 0) {
      return new TrackSelection.Definition(group, adaptiveTracks);
    }
  }
  return null;
}
 
Example 13
Source File: EventLogger.java    From mimi-reader with Apache License 2.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
    if (trackCount < 2) {
        return "N/A";
    }
    switch (adaptiveSupport) {
        case RendererCapabilities.ADAPTIVE_SEAMLESS:
            return "YES";
        case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
            return "YES_NOT_SEAMLESS";
        case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
            return "NO";
        default:
            return "?";
    }
}
 
Example 14
Source File: EventLogger.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      return "?";
  }
}
 
Example 15
Source File: EventLogger.java    From ExoPlayer-Offline with Apache License 2.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      return "?";
  }
}
 
Example 16
Source File: EventLogger.java    From TubiPlayer with MIT License 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
    if (trackCount < 2) {
        return "N/A";
    }
    switch (adaptiveSupport) {
        case RendererCapabilities.ADAPTIVE_SEAMLESS:
            return "YES";
        case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
            return "YES_NOT_SEAMLESS";
        case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
            return "NO";
        default:
            return "?";
    }
}
 
Example 17
Source File: DefaultTrackSelector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static @Nullable TrackSelection selectAdaptiveVideoTrack(
    TrackGroupArray groups,
    int[][] formatSupport,
    int mixedMimeTypeAdaptationSupports,
    Parameters params,
    TrackSelection.Factory adaptiveTrackSelectionFactory,
    BandwidthMeter bandwidthMeter)
    throws ExoPlaybackException {
  int requiredAdaptiveSupport = params.allowNonSeamlessAdaptiveness
      ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
      : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes =
      params.allowMixedMimeAdaptiveness
          && (mixedMimeTypeAdaptationSupports & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
        allowMixedMimeTypes, requiredAdaptiveSupport, params.maxVideoWidth, params.maxVideoHeight,
        params.maxVideoBitrate, params.viewportWidth, params.viewportHeight,
        params.viewportOrientationMayChange);
    if (adaptiveTracks.length > 0) {
      return Assertions.checkNotNull(adaptiveTrackSelectionFactory)
          .createTrackSelection(group, bandwidthMeter, adaptiveTracks);
    }
  }
  return null;
}
 
Example 18
Source File: EventLogger.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      return "?";
  }
}
 
Example 19
Source File: EventLogger.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
  if (trackCount < 2) {
    return "N/A";
  }
  switch (adaptiveSupport) {
    case RendererCapabilities.ADAPTIVE_SEAMLESS:
      return "YES";
    case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
      return "YES_NOT_SEAMLESS";
    case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
      return "NO";
    default:
      return "?";
  }
}
 
Example 20
Source File: DefaultTrackSelector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static @Nullable TrackSelection selectAdaptiveVideoTrack(
    TrackGroupArray groups,
    int[][] formatSupport,
    int mixedMimeTypeAdaptationSupports,
    Parameters params,
    TrackSelection.Factory adaptiveTrackSelectionFactory,
    BandwidthMeter bandwidthMeter)
    throws ExoPlaybackException {
  int requiredAdaptiveSupport = params.allowNonSeamlessAdaptiveness
      ? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
      : RendererCapabilities.ADAPTIVE_SEAMLESS;
  boolean allowMixedMimeTypes =
      params.allowMixedMimeAdaptiveness
          && (mixedMimeTypeAdaptationSupports & requiredAdaptiveSupport) != 0;
  for (int i = 0; i < groups.length; i++) {
    TrackGroup group = groups.get(i);
    int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
        allowMixedMimeTypes, requiredAdaptiveSupport, params.maxVideoWidth, params.maxVideoHeight,
        params.maxVideoBitrate, params.viewportWidth, params.viewportHeight,
        params.viewportOrientationMayChange);
    if (adaptiveTracks.length > 0) {
      return Assertions.checkNotNull(adaptiveTrackSelectionFactory)
          .createTrackSelection(group, bandwidthMeter, adaptiveTracks);
    }
  }
  return null;
}