Java 类com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo 实例源码

项目:ExoPlayer-Offline    文件:TrackSelectionHelper.java   
/**
 * Shows the selection dialog for a given renderer.
 *
 * @param activity The parent activity.
 * @param title The dialog's title.
 * @param trackInfo The current track information.
 * @param rendererIndex The index of the renderer.
 */
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
    int rendererIndex) {
  this.trackInfo = trackInfo;
  this.rendererIndex = rendererIndex;

  trackGroups = trackInfo.getTrackGroups(rendererIndex);
  trackGroupsAdaptive = new boolean[trackGroups.length];
  for (int i = 0; i < trackGroups.length; i++) {
    trackGroupsAdaptive[i] = adaptiveVideoTrackSelectionFactory != null
        && trackInfo.getAdaptiveSupport(rendererIndex, i, false)
            != RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
        && trackGroups.get(i).length > 1;
  }
  isDisabled = selector.getRendererDisabled(rendererIndex);
  override = selector.getSelectionOverride(rendererIndex, trackGroups);

  AlertDialog.Builder builder = new AlertDialog.Builder(activity);
  builder.setTitle(title)
      .setView(buildView(builder.getContext()))
      .setPositiveButton(android.R.string.ok, this)
      .setNegativeButton(android.R.string.cancel, null)
      .create()
      .show();
}
项目:MDVideo    文件:TrackSelectionHelper.java   
/**
 * Shows the selection dialog for a given renderer.
 *
 * @param activity      The parent activity.
 * @param title         The dialog's title.
 * @param trackInfo     The current track information.
 * @param rendererIndex The index of the renderer.
 */
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
                                int rendererIndex) {
    this.trackInfo = trackInfo;
    this.rendererIndex = rendererIndex;

    trackGroups = trackInfo.getTrackGroups(rendererIndex);
    trackGroupsAdaptive = new boolean[trackGroups.length];
    for (int i = 0; i < trackGroups.length; i++) {
        trackGroupsAdaptive[i] = adaptiveVideoTrackSelectionFactory != null
                && trackInfo.getAdaptiveSupport(rendererIndex, i, false)
                != RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
                && trackGroups.get(i).length > 1;
    }
    isDisabled = selector.getRendererDisabled(rendererIndex);
    override = selector.getSelectionOverride(rendererIndex, trackGroups);

    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(title)
            .setView(buildView(LayoutInflater.from(builder.getContext())))
            .setPositiveButton(android.R.string.ok, this)
            .setNegativeButton(android.R.string.cancel, null)
            .create()
            .show();
}
项目:Komica    文件:TrackSelectionHelper.java   
/**
 * Shows the selection dialog for a given renderer.
 *
 * @param activity The parent activity.
 * @param title The dialog's title.
 * @param trackInfo The current track information.
 * @param rendererIndex The index of the renderer.
 */
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
                                int rendererIndex) {
  this.trackInfo = trackInfo;
  this.rendererIndex = rendererIndex;

  trackGroups = trackInfo.getTrackGroups(rendererIndex);
  trackGroupsAdaptive = new boolean[trackGroups.length];
  for (int i = 0; i < trackGroups.length; i++) {
    trackGroupsAdaptive[i] = adaptiveVideoTrackSelectionFactory != null
        && trackInfo.getAdaptiveSupport(rendererIndex, i, false)
            != RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
        && trackGroups.get(i).length > 1;
  }
  isDisabled = selector.getRendererDisabled(rendererIndex);
  override = selector.getSelectionOverride(rendererIndex, trackGroups);

  AlertDialog.Builder builder = new AlertDialog.Builder(activity);
  builder.setTitle(title)
      .setView(buildView(builder.getContext()))
      .setPositiveButton(android.R.string.ok, this)
      .setNegativeButton(android.R.string.cancel, null)
      .create()
      .show();
}
项目:transistor    文件:TrackSelectionHelper.java   
/**
 * Shows the selection dialog for a given renderer.
 *
 * @param activity The parent activity.
 * @param title The dialog's title.
 * @param trackInfo The current track information.
 * @param rendererIndex The index of the renderer.
 */
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
    int rendererIndex) {
  this.trackInfo = trackInfo;
  this.rendererIndex = rendererIndex;

  trackGroups = trackInfo.getTrackGroups(rendererIndex);
  trackGroupsAdaptive = new boolean[trackGroups.length];
  for (int i = 0; i < trackGroups.length; i++) {
    trackGroupsAdaptive[i] = adaptiveTrackSelectionFactory != null
        && trackInfo.getAdaptiveSupport(rendererIndex, i, false)
            != RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
        && trackGroups.get(i).length > 1;
  }
  isDisabled = selector.getRendererDisabled(rendererIndex);
  override = selector.getSelectionOverride(rendererIndex, trackGroups);

  AlertDialog.Builder builder = new AlertDialog.Builder(activity);
  builder.setTitle(title)
      .setView(buildView(builder.getContext()))
      .setPositiveButton(android.R.string.ok, this)
      .setNegativeButton(android.R.string.cancel, null)
      .create()
      .show();
}
项目:transistor    文件:PlayerActivity.java   
@Override
@SuppressWarnings("ReferenceEquality")
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
  updateButtonVisibilities();
  if (trackGroups != lastSeenTrackGroupArray) {
    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo != null) {
      if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
          == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
        showToast(R.string.error_unsupported_video);
      }
      if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
          == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
        showToast(R.string.error_unsupported_audio);
      }
    }
    lastSeenTrackGroupArray = trackGroups;
  }
}
项目:ExoPlayer-Offline    文件:PlayerActivity.java   
@Override
public void onClick(View view) {
    if (view == retryButton) {
        initializePlayer();
    } else if (view.getParent() == debugRootView) {
        MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
        if (mappedTrackInfo != null) {
            trackSelectionHelper.showSelectionDialog(this, ((Button) view).getText(),
                    trackSelector.getCurrentMappedTrackInfo(), (int) view.getTag());
        }
    }
}
项目:ExoPlayer-Offline    文件:PlayerActivity.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    updateButtonVisibilities();
    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo != null) {
        if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
                == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
            showToast(R.string.error_unsupported_video);
        }
        if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
                == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
            showToast(R.string.error_unsupported_audio);
        }
    }
}
项目:ExoPlayer-Offline    文件:PlayerActivity.java   
private void updateButtonVisibilities() {
    debugRootView.removeAllViews();

    retryButton.setVisibility(playerNeedsSource ? View.VISIBLE : View.GONE);
    debugRootView.addView(retryButton);

    if (player == null) {
        return;
    }

    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo == null) {
        return;
    }

    for (int i = 0; i < mappedTrackInfo.length; i++) {
        TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i);
        if (trackGroups.length != 0) {
            Button button = new Button(this);
            int label;
            switch (player.getRendererType(i)) {
                case C.TRACK_TYPE_AUDIO:
                    label = R.string.audio;
                    break;
                case C.TRACK_TYPE_VIDEO:
                    label = R.string.video;
                    break;
                case C.TRACK_TYPE_TEXT:
                    label = R.string.text;
                    break;
                default:
                    continue;
            }
            button.setText(label);
            button.setTag(i);
            button.setOnClickListener(this);
            debugRootView.addView(button, debugRootView.getChildCount() - 1);
        }
    }
}
项目:MDVideo    文件:PlayerActivityV2.java   
@Override
    public void onTrackSelectionsChanged(TrackSelections<? extends MappedTrackInfo> trackSelections) {
//        updateButtonVisibilities();
        MappedTrackInfo trackInfo = trackSelections.info;
        if (trackInfo.hasOnlyUnplayableTracks(C.TRACK_TYPE_VIDEO)) {
            showToast(R.string.error_unsupported_video);
        }
        if (trackInfo.hasOnlyUnplayableTracks(C.TRACK_TYPE_AUDIO)) {
            showToast(R.string.error_unsupported_audio);
        }
    }
项目:videoPickPlayer    文件:MappingTrackSelector.java   
/**
 * @param rendererTrackTypes The track type supported by each renderer.
 * @param trackGroups The {@link TrackGroupArray}s for each renderer.
 * @param mixedMimeTypeAdaptiveSupport The result of
 *     {@link RendererCapabilities#supportsMixedMimeTypeAdaptation()} for each renderer.
 * @param formatSupport The result of {@link RendererCapabilities#supportsFormat} for each
 *     track, indexed by renderer index, group index and track index (in that order).
 * @param unassociatedTrackGroups Contains {@link TrackGroup}s not associated with any renderer.
 */
/* package */ MappedTrackInfo(int[] rendererTrackTypes,
    TrackGroupArray[] trackGroups, int[] mixedMimeTypeAdaptiveSupport,
    int[][][] formatSupport, TrackGroupArray unassociatedTrackGroups) {
  this.rendererTrackTypes = rendererTrackTypes;
  this.trackGroups = trackGroups;
  this.formatSupport = formatSupport;
  this.mixedMimeTypeAdaptiveSupport = mixedMimeTypeAdaptiveSupport;
  this.unassociatedTrackGroups = unassociatedTrackGroups;
  this.rendererCount = trackGroups.length;
}
项目:Komica    文件:PlayerActivity.java   
@Override
public void onClick(View view) {
  if (view == retryButton) {
    initializePlayer();
  } else if (view.getParent() == debugRootView) {
    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo != null) {
      trackSelectionHelper.showSelectionDialog(this, ((Button) view).getText(),
          trackSelector.getCurrentMappedTrackInfo(), (int) view.getTag());
    }
  }
}
项目:Komica    文件:PlayerActivity.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
  updateButtonVisibilities();
  MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
  if (mappedTrackInfo != null) {
    if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
        == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
      showToast(R.string.error_unsupported_video);
    }
    if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
        == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
      showToast(R.string.error_unsupported_audio);
    }
  }
}
项目:Komica    文件:PlayerActivity.java   
private void updateButtonVisibilities() {
  debugRootView.removeAllViews();

  retryButton.setVisibility(playerNeedsSource ? View.VISIBLE : View.GONE);
  debugRootView.addView(retryButton);

  if (player == null) {
    return;
  }

  MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
  if (mappedTrackInfo == null) {
    return;
  }

  for (int i = 0; i < mappedTrackInfo.length; i++) {
    TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i);
    if (trackGroups.length != 0) {
      Button button = new Button(this);
      int label;
      switch (player.getRendererType(i)) {
        case C.TRACK_TYPE_AUDIO:
          label = R.string.audio;
          break;
        case C.TRACK_TYPE_VIDEO:
          label = R.string.video;
          break;
        case C.TRACK_TYPE_TEXT:
          label = R.string.text;
          break;
        default:
          continue;
      }
      button.setText(label);
      button.setTag(i);
      button.setOnClickListener(this);
      debugRootView.addView(button, debugRootView.getChildCount() - 1);
    }
  }
}
项目:transistor    文件:PlayerActivity.java   
@Override
public void onClick(View view) {
  if (view == retryButton) {
    initializePlayer();
  } else if (view.getParent() == debugRootView) {
    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo != null) {
      trackSelectionHelper.showSelectionDialog(
          this, ((Button) view).getText(), mappedTrackInfo, (int) view.getTag());
    }
  }
}
项目:transistor    文件:PlayerActivity.java   
private void updateButtonVisibilities() {
  debugRootView.removeAllViews();

  retryButton.setVisibility(inErrorState ? View.VISIBLE : View.GONE);
  debugRootView.addView(retryButton);

  if (player == null) {
    return;
  }

  MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
  if (mappedTrackInfo == null) {
    return;
  }

  for (int i = 0; i < mappedTrackInfo.length; i++) {
    TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i);
    if (trackGroups.length != 0) {
      Button button = new Button(this);
      int label;
      switch (player.getRendererType(i)) {
        case C.TRACK_TYPE_AUDIO:
          label = R.string.audio;
          break;
        case C.TRACK_TYPE_VIDEO:
          label = R.string.video;
          break;
        case C.TRACK_TYPE_TEXT:
          label = R.string.text;
          break;
        default:
          continue;
      }
      button.setText(label);
      button.setTag(i);
      button.setOnClickListener(this);
      debugRootView.addView(button, debugRootView.getChildCount() - 1);
    }
  }
}