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


Java TrackSelection.getIndexInTrackGroup方法代碼示例

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


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

示例1: DefaultSsChunkSource

import com.google.android.exoplayer2.trackselection.TrackSelection; //導入方法依賴的package包/類
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param elementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param trackEncryptionBoxes Track encryption boxes for the stream.
 */
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
    int elementIndex, TrackSelection trackSelection, DataSource dataSource,
    TrackEncryptionBox[] trackEncryptionBoxes) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.elementIndex = elementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[elementIndex];

  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, format);
  }
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:34,代碼來源:DefaultSsChunkSource.java

示例2: DefaultSsChunkSource

import com.google.android.exoplayer2.trackselection.TrackSelection; //導入方法依賴的package包/類
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param elementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param trackEncryptionBoxes Track encryption boxes for the stream.
 */
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
    int elementIndex, TrackSelection trackSelection, DataSource dataSource,
    TrackEncryptionBox[] trackEncryptionBoxes) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.elementIndex = elementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[elementIndex];

  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, track, null);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, format, false, false);
  }
}
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:34,代碼來源:DefaultSsChunkSource.java

示例3: selectTracks

import com.google.android.exoplayer2.trackselection.TrackSelection; //導入方法依賴的package包/類
@Override
public long selectTracks(TrackSelection[] selections, boolean[] mayRetainStreamFlags,
    SampleStream[] streams, boolean[] streamResetFlags, long positionUs) {
  Assert.assertTrue(preparedPeriod);
  int rendererCount = selections.length;
  for (int i = 0; i < rendererCount; i++) {
    if (streams[i] != null && (selections[i] == null || !mayRetainStreamFlags[i])) {
      streams[i] = null;
    }
    if (streams[i] == null && selections[i] != null) {
      TrackSelection selection = selections[i];
      Assert.assertTrue(1 <= selection.length());
      TrackGroup trackGroup = selection.getTrackGroup();
      Assert.assertTrue(trackGroupArray.indexOf(trackGroup) != C.INDEX_UNSET);
      int indexInTrackGroup = selection.getIndexInTrackGroup(selection.getSelectedIndex());
      Assert.assertTrue(0 <= indexInTrackGroup);
      Assert.assertTrue(indexInTrackGroup < trackGroup.length);
      streams[i] = createSampleStream(selection);
      streamResetFlags[i] = true;
    }
  }
  return positionUs;
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:24,代碼來源:FakeMediaPeriod.java

示例4: DefaultSsChunkSource

import com.google.android.exoplayer2.trackselection.TrackSelection; //導入方法依賴的package包/類
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param elementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param trackEncryptionBoxes Track encryption boxes for the stream.
 */
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
    int elementIndex, TrackSelection trackSelection, DataSource dataSource,
    TrackEncryptionBox[] trackEncryptionBoxes) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.elementIndex = elementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[elementIndex];

  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track, null);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, streamElement.type, format);
  }
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:34,代碼來源:DefaultSsChunkSource.java


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