com.google.android.exoplayer2.util.Util.resolveSeekPositionUs()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(270)

本文整理了Java中com.google.android.exoplayer2.util.Util.resolveSeekPositionUs()方法的一些代码示例,展示了Util.resolveSeekPositionUs()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.resolveSeekPositionUs()方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:resolveSeekPositionUs

Util.resolveSeekPositionUs介绍

[英]Resolves a seek given the requested seek position, a SeekParameters and two candidate sync points.
[中]根据请求的寻道位置、一个寻道参数和两个候选同步点解析寻道。

代码示例

代码示例来源:origin: google/ExoPlayer

  1. @Override
  2. public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
  3. SeekMap seekMap = getPreparedState().seekMap;
  4. if (!seekMap.isSeekable()) {
  5. // Treat all seeks into non-seekable media as being to t=0.
  6. return 0;
  7. }
  8. SeekPoints seekPoints = seekMap.getSeekPoints(positionUs);
  9. return Util.resolveSeekPositionUs(
  10. positionUs, seekParameters, seekPoints.first.timeUs, seekPoints.second.timeUs);
  11. }

代码示例来源:origin: google/ExoPlayer

  1. @Override
  2. public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
  3. StreamElement streamElement = manifest.streamElements[streamElementIndex];
  4. int chunkIndex = streamElement.getChunkIndex(positionUs);
  5. long firstSyncUs = streamElement.getStartTimeUs(chunkIndex);
  6. long secondSyncUs =
  7. firstSyncUs < positionUs && chunkIndex < streamElement.chunkCount - 1
  8. ? streamElement.getStartTimeUs(chunkIndex + 1)
  9. : firstSyncUs;
  10. return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
  11. }

代码示例来源:origin: google/ExoPlayer

  1. @Override
  2. public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
  3. int chunkIndex = dataSet.getChunkIndexByPosition(positionUs);
  4. long firstSyncUs = dataSet.getStartTime(chunkIndex);
  5. long secondSyncUs =
  6. firstSyncUs < positionUs && chunkIndex < dataSet.getChunkCount() - 1
  7. ? dataSet.getStartTime(chunkIndex + 1)
  8. : firstSyncUs;
  9. return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
  10. }

代码示例来源:origin: google/ExoPlayer

  1. @Override
  2. public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
  3. // Segments are aligned across representations, so any segment index will do.
  4. for (RepresentationHolder representationHolder : representationHolders) {
  5. if (representationHolder.segmentIndex != null) {
  6. long segmentNum = representationHolder.getSegmentNum(positionUs);
  7. long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
  8. long secondSyncUs =
  9. firstSyncUs < positionUs && segmentNum < representationHolder.getSegmentCount() - 1
  10. ? representationHolder.getSegmentStartTimeUs(segmentNum + 1)
  11. : firstSyncUs;
  12. return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
  13. }
  14. }
  15. // We don't have a segment index to adjust the seek position with yet.
  16. return positionUs;
  17. }

代码示例来源:origin: google/ExoPlayer

  1. @Override
  2. public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
  3. int chunkIndex = dataSet.getChunkIndexByPosition(positionUs);
  4. long firstSyncUs = dataSet.getStartTime(chunkIndex);
  5. long secondSyncUs =
  6. firstSyncUs < positionUs && chunkIndex < dataSet.getChunkCount() - 1
  7. ? dataSet.getStartTime(chunkIndex + 1)
  8. : firstSyncUs;
  9. return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
  10. }

相关文章