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


Java Extractor.RESULT_SEEK属性代码示例

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


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

示例1: consumeTestData

private static void consumeTestData(Extractor extractor, FakeExtractorInput input, long timeUs,
    FakeExtractorOutput output, boolean retryFromStartIfLive)
    throws IOException, InterruptedException {
  extractor.seek(input.getPosition(), timeUs);
  PositionHolder seekPositionHolder = new PositionHolder();
  int readResult = Extractor.RESULT_CONTINUE;
  while (readResult != Extractor.RESULT_END_OF_INPUT) {
    try {
      // Extractor.read should not read seekPositionHolder.position. Set it to a value that's
      // likely to cause test failure if a read does occur.
      seekPositionHolder.position = Long.MIN_VALUE;
      readResult = extractor.read(input, seekPositionHolder);
      if (readResult == Extractor.RESULT_SEEK) {
        long seekPosition = seekPositionHolder.position;
        Assertions.checkState(0 <= seekPosition && seekPosition <= Integer.MAX_VALUE);
        input.setPosition((int) seekPosition);
      }
    } catch (SimulatedIOException e) {
      if (!retryFromStartIfLive) {
        continue;
      }
      boolean isOnDemand = input.getLength() != C.LENGTH_UNSET
          || (output.seekMap != null && output.seekMap.getDurationUs() != C.TIME_UNSET);
      if (isOnDemand) {
        continue;
      }
      input.setPosition(0);
      for (int i = 0; i < output.numberOfTracks; i++) {
        output.trackOutputs.valueAt(i).clear();
      }
      extractor.seek(0, 0);
    }
  }
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:34,代码来源:TestUtil.java

示例2: readPayload

private int readPayload(ExtractorInput input, PositionHolder seekPosition)
    throws IOException, InterruptedException {
  long position = oggSeeker.read(input);
  if (position >= 0) {
    seekPosition.position = position;
    return Extractor.RESULT_SEEK;
  } else if (position < -1) {
    onSeekEnd(-(position + 2));
  }
  if (!seekMapSet) {
    SeekMap seekMap = oggSeeker.createSeekMap();
    extractorOutput.seekMap(seekMap);
    seekMapSet = true;
  }

  if (lengthOfReadPacket > 0 || oggPacket.populate(input)) {
    lengthOfReadPacket = 0;
    ParsableByteArray payload = oggPacket.getPayload();
    long granulesInPacket = preparePayload(payload);
    if (granulesInPacket >= 0 && currentGranule + granulesInPacket >= targetGranule) {
      // calculate time and send payload data to codec
      long timeUs = convertGranuleToTime(currentGranule);
      trackOutput.sampleData(payload, payload.limit());
      trackOutput.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, payload.limit(), 0, null);
      targetGranule = -1;
    }
    currentGranule += granulesInPacket;
  } else {
    state = STATE_END_OF_INPUT;
    return Extractor.RESULT_END_OF_INPUT;
  }
  return Extractor.RESULT_CONTINUE;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:33,代码来源:StreamReader.java

示例3: read

@Override
public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException,
    InterruptedException {
  sampleRead = false;
  boolean continueReading = true;
  while (continueReading && !sampleRead) {
    continueReading = reader.read(input);
    if (continueReading && maybeSeekForCues(seekPosition, input.getPosition())) {
      return Extractor.RESULT_SEEK;
    }
  }
  return continueReading ? Extractor.RESULT_CONTINUE : Extractor.RESULT_END_OF_INPUT;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:13,代码来源:MatroskaExtractor.java

示例4: readPayload

private int readPayload(ExtractorInput input, PositionHolder seekPosition)
    throws IOException, InterruptedException {
  long position = oggSeeker.read(input);
  if (position >= 0) {
    seekPosition.position = position;
    return Extractor.RESULT_SEEK;
  } else if (position < -1) {
    onSeekEnd(-position - 2);
  }
  if (!seekMapSet) {
    SeekMap seekMap = oggSeeker.createSeekMap();
    extractorOutput.seekMap(seekMap);
    seekMapSet = true;
  }

  if (lengthOfReadPacket > 0 || oggPacket.populate(input)) {
    lengthOfReadPacket = 0;
    ParsableByteArray payload = oggPacket.getPayload();
    long granulesInPacket = preparePayload(payload);
    if (granulesInPacket >= 0 && currentGranule + granulesInPacket >= targetGranule) {
      // calculate time and send payload data to codec
      long timeUs = convertGranuleToTime(currentGranule);
      trackOutput.sampleData(payload, payload.limit());
      trackOutput.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, payload.limit(), 0, null);
      targetGranule = -1;
    }
    currentGranule += granulesInPacket;
  } else {
    state = STATE_END_OF_INPUT;
    return Extractor.RESULT_END_OF_INPUT;
  }
  return Extractor.RESULT_CONTINUE;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:33,代码来源:StreamReader.java


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