本文整理汇总了Java中com.google.android.exoplayer2.extractor.SeekMap.Unseekable方法的典型用法代码示例。如果您正苦于以下问题:Java SeekMap.Unseekable方法的具体用法?Java SeekMap.Unseekable怎么用?Java SeekMap.Unseekable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.exoplayer2.extractor.SeekMap
的用法示例。
在下文中一共展示了SeekMap.Unseekable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSeekMap
import com.google.android.exoplayer2.extractor.SeekMap; //导入方法依赖的package包/类
/**
* Builds a {@link SeekMap} from the recently gathered Cues information.
*
* @return The built {@link SeekMap}. The returned {@link SeekMap} may be unseekable if cues
* information was missing or incomplete.
*/
private SeekMap buildSeekMap() {
if (segmentContentPosition == C.POSITION_UNSET || durationUs == C.TIME_UNSET
|| cueTimesUs == null || cueTimesUs.size() == 0
|| cueClusterPositions == null || cueClusterPositions.size() != cueTimesUs.size()) {
// Cues information is missing or incomplete.
cueTimesUs = null;
cueClusterPositions = null;
return new SeekMap.Unseekable(durationUs);
}
int cuePointsSize = cueTimesUs.size();
int[] sizes = new int[cuePointsSize];
long[] offsets = new long[cuePointsSize];
long[] durationsUs = new long[cuePointsSize];
long[] timesUs = new long[cuePointsSize];
for (int i = 0; i < cuePointsSize; i++) {
timesUs[i] = cueTimesUs.get(i);
offsets[i] = segmentContentPosition + cueClusterPositions.get(i);
}
for (int i = 0; i < cuePointsSize - 1; i++) {
sizes[i] = (int) (offsets[i + 1] - offsets[i]);
durationsUs[i] = timesUs[i + 1] - timesUs[i];
}
sizes[cuePointsSize - 1] =
(int) (segmentContentPosition + segmentContentSize - offsets[cuePointsSize - 1]);
durationsUs[cuePointsSize - 1] = durationUs - timesUs[cuePointsSize - 1];
cueTimesUs = null;
cueClusterPositions = null;
return new ChunkIndex(sizes, offsets, durationsUs, timesUs);
}
示例2: createSeekMap
import com.google.android.exoplayer2.extractor.SeekMap; //导入方法依赖的package包/类
@Override
public SeekMap createSeekMap() {
return new SeekMap.Unseekable(C.TIME_UNSET);
}