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


Java Representation.getIndex方法代码示例

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


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

示例1: updateRepresentationIndependentProperties

import com.google.android.exoplayer.dash.mpd.Representation; //导入方法依赖的package包/类
private void updateRepresentationIndependentProperties(long periodDurationUs,
    Representation arbitaryRepresentation) {
  DashSegmentIndex segmentIndex = arbitaryRepresentation.getIndex();
  if (segmentIndex != null) {
    int firstSegmentNum = segmentIndex.getFirstSegmentNum();
    int lastSegmentNum = segmentIndex.getLastSegmentNum(periodDurationUs);
    indexIsUnbounded = lastSegmentNum == DashSegmentIndex.INDEX_UNBOUNDED;
    indexIsExplicit = segmentIndex.isExplicit();
    availableStartTimeUs = startTimeUs + segmentIndex.getTimeUs(firstSegmentNum);
    if (!indexIsUnbounded) {
      availableEndTimeUs = startTimeUs + segmentIndex.getTimeUs(lastSegmentNum)
          + segmentIndex.getDurationUs(lastSegmentNum, periodDurationUs);
    }
  } else {
    indexIsUnbounded = false;
    indexIsExplicit = true;
    availableStartTimeUs = startTimeUs;
    availableEndTimeUs = startTimeUs + periodDurationUs;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:21,代码来源:DashChunkSource.java

示例2: RepresentationHolder

import com.google.android.exoplayer.dash.mpd.Representation; //导入方法依赖的package包/类
public RepresentationHolder(long periodStartTimeUs, long periodDurationUs,
    Representation representation) {
  this.periodStartTimeUs = periodStartTimeUs;
  this.periodDurationUs = periodDurationUs;
  this.representation = representation;
  String mimeType = representation.format.mimeType;
  mimeTypeIsRawText = mimeTypeIsRawText(mimeType);
  extractorWrapper = mimeTypeIsRawText ? null : new ChunkExtractorWrapper(
      mimeTypeIsWebm(mimeType) ? new WebmExtractor() : new FragmentedMp4Extractor());
  segmentIndex = representation.getIndex();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:12,代码来源:DashChunkSource.java

示例3: updateRepresentation

import com.google.android.exoplayer.dash.mpd.Representation; //导入方法依赖的package包/类
public void updateRepresentation(long newPeriodDurationUs, Representation newRepresentation)
    throws BehindLiveWindowException{
  DashSegmentIndex oldIndex = representation.getIndex();
  DashSegmentIndex newIndex = newRepresentation.getIndex();

  periodDurationUs = newPeriodDurationUs;
  representation = newRepresentation;
  if (oldIndex == null) {
    // Segment numbers cannot shift if the index isn't defined by the manifest.
    return;
  }

  segmentIndex = newIndex;
  if (!oldIndex.isExplicit()) {
    // Segment numbers cannot shift if the index isn't explicit.
    return;
  }

  int oldIndexLastSegmentNum = oldIndex.getLastSegmentNum(periodDurationUs);
  long oldIndexEndTimeUs = oldIndex.getTimeUs(oldIndexLastSegmentNum)
      + oldIndex.getDurationUs(oldIndexLastSegmentNum, periodDurationUs);
  int newIndexFirstSegmentNum = newIndex.getFirstSegmentNum();
  long newIndexStartTimeUs = newIndex.getTimeUs(newIndexFirstSegmentNum);
  if (oldIndexEndTimeUs == newIndexStartTimeUs) {
    // The new index continues where the old one ended, with no overlap.
    segmentNumShift += oldIndex.getLastSegmentNum(periodDurationUs) + 1
        - newIndexFirstSegmentNum;
  } else if (oldIndexEndTimeUs < newIndexStartTimeUs) {
    // There's a gap between the old index and the new one which means we've slipped behind the
    // live window and can't proceed.
    throw new BehindLiveWindowException();
  } else {
    // The new index overlaps with the old one.
    segmentNumShift += oldIndex.getSegmentNum(newIndexStartTimeUs, periodDurationUs)
        - newIndexFirstSegmentNum;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:38,代码来源:DashChunkSource.java

示例4: continueBuffering

import com.google.android.exoplayer.dash.mpd.Representation; //导入方法依赖的package包/类
@Override
public void continueBuffering(long playbackPositionUs) {
  if (manifestFetcher == null || !currentManifest.dynamic || fatalError != null) {
    return;
  }

  MediaPresentationDescription newManifest = manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    Representation[] newRepresentations = DashChunkSource.getFilteredRepresentations(newManifest,
        adaptationSetIndex, representationIndices);
    for (Representation representation : newRepresentations) {
      RepresentationHolder representationHolder =
          representationHolders.get(representation.format.id);
      DashSegmentIndex oldIndex = representationHolder.segmentIndex;
      DashSegmentIndex newIndex = representation.getIndex();
      int newFirstSegmentNum = newIndex.getFirstSegmentNum();
      int segmentNumShift = oldIndex.getSegmentNum(newIndex.getTimeUs(newFirstSegmentNum))
          - newFirstSegmentNum;
      representationHolder.segmentNumShift += segmentNumShift;
      representationHolder.segmentIndex = newIndex;
    }
    currentManifest = newManifest;
    finishedCurrentManifest = false;
  }

  // TODO: This is a temporary hack to avoid constantly refreshing the MPD in cases where
  // minUpdatePeriod is set to 0. In such cases we shouldn't refresh unless there is explicit
  // signaling in the stream, according to:
  // http://azure.microsoft.com/blog/2014/09/13/dash-live-streaming-with-azure-media-service/
  long minUpdatePeriod = currentManifest.minUpdatePeriod;
  if (minUpdatePeriod == 0) {
    minUpdatePeriod = 5000;
  }

  if (finishedCurrentManifest && (SystemClock.elapsedRealtime()
      > manifestFetcher.getManifestLoadTimestamp() + minUpdatePeriod)) {
    manifestFetcher.requestRefresh();
  }
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:40,代码来源:DashChunkSource.java

示例5: RepresentationHolder

import com.google.android.exoplayer.dash.mpd.Representation; //导入方法依赖的package包/类
public RepresentationHolder(Representation representation,
    ChunkExtractorWrapper extractorWrapper) {
  this.representation = representation;
  this.extractorWrapper = extractorWrapper;
  this.segmentIndex = representation.getIndex();
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:7,代码来源:DashChunkSource.java

示例6: RepresentationHolder

import com.google.android.exoplayer.dash.mpd.Representation; //导入方法依赖的package包/类
public RepresentationHolder(Representation representation, Extractor extractor) {
  this.representation = representation;
  this.extractor = extractor;
  this.segmentIndex = representation.getIndex();
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:6,代码来源:DashChunkSource.java


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