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


Java DecoderInputBuffer.clear方法代码示例

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


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

示例1: readData

import com.google.android.exoplayer2.decoder.DecoderInputBuffer; //导入方法依赖的package包/类
@Override
public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer,
    boolean requireFormat) {
  if (pendingDiscontinuity) {
    return C.RESULT_NOTHING_READ;
  }
  if (sentEos) {
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    return C.RESULT_BUFFER_READ;
  }
  int result = stream.readData(formatHolder, buffer, requireFormat);
  // TODO: Clear gapless playback metadata if a format was read (if applicable).
  if (endUs != C.TIME_END_OF_SOURCE && ((result == C.RESULT_BUFFER_READ
      && buffer.timeUs >= endUs) || (result == C.RESULT_NOTHING_READ
      && mediaPeriod.getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
    buffer.clear();
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    sentEos = true;
    return C.RESULT_BUFFER_READ;
  }
  if (result == C.RESULT_BUFFER_READ && !buffer.isEndOfStream()) {
    buffer.timeUs -= startUs;
  }
  return result;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:26,代码来源:ClippingMediaPeriod.java

示例2: readData

import com.google.android.exoplayer2.decoder.DecoderInputBuffer; //导入方法依赖的package包/类
@Override
public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer,
    boolean requireFormat) {
  if (pendingDiscontinuity) {
    return C.RESULT_NOTHING_READ;
  }
  if (sentEos) {
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    return C.RESULT_BUFFER_READ;
  }
  int result = stream.readData(formatHolder, buffer, requireFormat);
  if (result == C.RESULT_FORMAT_READ) {
    // Clear gapless playback metadata if the start/end points don't match the media.
    Format format = formatHolder.format;
    int encoderDelay = startUs != 0 ? 0 : format.encoderDelay;
    int encoderPadding = endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
    formatHolder.format = format.copyWithGaplessInfo(encoderDelay, encoderPadding);
    return C.RESULT_FORMAT_READ;
  }
  if (endUs != C.TIME_END_OF_SOURCE
      && ((result == C.RESULT_BUFFER_READ && buffer.timeUs >= endUs)
          || (result == C.RESULT_NOTHING_READ
              && getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
    buffer.clear();
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    sentEos = true;
    return C.RESULT_BUFFER_READ;
  }
  if (result == C.RESULT_BUFFER_READ && !buffer.isEndOfStream()) {
    buffer.timeUs -= startUs;
  }
  return result;
}
 
开发者ID:y20k,项目名称:transistor,代码行数:34,代码来源:ClippingMediaPeriod.java


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