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


Java Extractor.RESULT_CONTINUE属性代码示例

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


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

示例1: load

@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Set the target to ourselves.
      extractorWrapper.init(this);
    }
    // Load and parse the initialization data.
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractorWrapper.read(input);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:25,代码来源:InitializationChunk.java

示例2: load

@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public final void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Set the target to ourselves.
      extractorWrapper.init(this);
    }
    // Load and parse the initialization data.
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractorWrapper.read(input);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:25,代码来源:ContainerMediaChunk.java

示例3: read

@Override
public int read(ExtractorInput input, PositionHolder seekPosition)
    throws IOException, InterruptedException {
  int currentFileSize = (int) input.getLength();

  // Increase the size of sampleData if necessary.
  if (sampleSize == sampleData.length) {
    sampleData = Arrays.copyOf(sampleData,
        (currentFileSize != C.LENGTH_UNBOUNDED ? currentFileSize : sampleData.length) * 3 / 2);
  }

  // Consume to the input.
  int bytesRead = input.read(sampleData, sampleSize, sampleData.length - sampleSize);
  if (bytesRead != C.RESULT_END_OF_INPUT) {
    sampleSize += bytesRead;
    if (currentFileSize == C.LENGTH_UNBOUNDED || sampleSize != currentFileSize) {
      return Extractor.RESULT_CONTINUE;
    }
  }

  // We've reached the end of the input, which corresponds to the end of the current file.
  processSample();
  return Extractor.RESULT_END_OF_INPUT;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:24,代码来源:WebvttExtractor.java

示例4: load

@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public final void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Set the target to ourselves.
      extractorWrapper.init(this);
    }
    // Load and parse the sample data.
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractorWrapper.read(input);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:25,代码来源:ContainerMediaChunk.java

示例5: load

@Override
public void load() throws IOException, InterruptedException {
  // If we previously fed part of this chunk to the extractor, we need to skip it this time. For
  // encrypted content we need to skip the data by reading it through the source, so as to ensure
  // correct decryption of the remainder of the chunk. For clear content, we can request the
  // remainder of the chunk directly.
  DataSpec loadDataSpec;
  boolean skipLoadedBytes;
  if (isEncrypted) {
    loadDataSpec = dataSpec;
    skipLoadedBytes = bytesLoaded != 0;
  } else {
    loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
    skipLoadedBytes = false;
  }

  try {
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (skipLoadedBytes) {
      input.skipFully(bytesLoaded);
    }
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractorWrapper.read(input);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:34,代码来源:TsChunk.java

示例6: 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:XueyanLiu,项目名称:miku,代码行数:13,代码来源:WebmExtractor.java

示例7: consumeTestData

public static void consumeTestData(Extractor extractor, byte[] data)
    throws IOException, InterruptedException {
  FakeExtractorInput input = new FakeExtractorInput.Builder().setData(data).build();
  PositionHolder seekPositionHolder = new PositionHolder();
  int readResult = Extractor.RESULT_CONTINUE;
  while (readResult != Extractor.RESULT_END_OF_INPUT) {
    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);
    }
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:TestUtil.java

示例8: consumeTestData

public static void consumeTestData(Extractor extractor, byte[] data)
    throws IOException, InterruptedException {
  ExtractorInput input = createTestExtractorInput(data);
  PositionHolder seekPositionHolder = new PositionHolder();
  int readResult = Extractor.RESULT_CONTINUE;
  while (readResult != Extractor.RESULT_END_OF_INPUT) {
    readResult = extractor.read(input, seekPositionHolder);
    if (readResult == Extractor.RESULT_SEEK) {
      input = createTestExtractorInput(data, (int) seekPositionHolder.position);
    }
  }
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:12,代码来源:TestUtil.java

示例9: read

@Override
public int read(ExtractorInput input, PositionHolder seekPosition)
    throws IOException, InterruptedException {
  long position = input.getPosition();

  if (!oggParser.readPacket(input, scratch)) {
    return Extractor.RESULT_END_OF_INPUT;
  }

  byte[] data = scratch.data;
  if (streamInfo == null) {
    streamInfo = new FlacStreamInfo(data, 17);

    byte[] metadata = Arrays.copyOfRange(data, 9, scratch.limit());
    metadata[4] = (byte) 0x80; // Set the last metadata block flag, ignore the other blocks
    List<byte[]> initializationData = Collections.singletonList(metadata);

    MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, MimeTypes.AUDIO_FLAC,
        streamInfo.bitRate(), MediaFormat.NO_VALUE, streamInfo.durationUs(),
        streamInfo.channels, streamInfo.sampleRate, initializationData, null);
    trackOutput.format(mediaFormat);

  } else if (data[0] == AUDIO_PACKET_TYPE) {
    if (!firstAudioPacketProcessed) {
      if (seekTable != null) {
        extractorOutput.seekMap(seekTable.createSeekMap(position, streamInfo.sampleRate));
        seekTable = null;
      } else {
        extractorOutput.seekMap(SeekMap.UNSEEKABLE);
      }
      firstAudioPacketProcessed = true;
    }

    trackOutput.sampleData(scratch, scratch.limit());
    scratch.setPosition(0);
    long timeUs = FlacUtil.extractSampleTimestamp(streamInfo, scratch);
    trackOutput.sampleMetadata(timeUs, C.SAMPLE_FLAG_SYNC, scratch.limit(), 0, null);

  } else if ((data[0] & 0x7F) == SEEKTABLE_PACKET_TYPE && seekTable == null) {
    seekTable = FlacSeekTable.parseSeekTable(scratch);
  }

  scratch.reset();
  return Extractor.RESULT_CONTINUE;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:45,代码来源:FlacReader.java


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