本文整理汇总了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;
}
}
示例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();
}
示例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;
}
}
示例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();
}
}
示例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();
}
示例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();
}