Java 类com.google.android.exoplayer2.source.chunk.ContainerMediaChunk 实例源码

项目:videoPickPlayer    文件:DefaultDashChunkSource.java   
private Chunk newMediaChunk(RepresentationHolder representationHolder, DataSource dataSource,
    Format trackFormat, int trackSelectionReason,
    Object trackSelectionData, Format sampleFormat, int segmentNum) {
  Representation representation = representationHolder.representation;
  long startTimeUs = representationHolder.getSegmentStartTimeUs(segmentNum);
  long endTimeUs = representationHolder.getSegmentEndTimeUs(segmentNum);
  RangedUri segmentUri = representationHolder.getSegmentUrl(segmentNum);
  DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
      representation.getCacheKey());

  if (representationHolder.extractorWrapper == null) {
    return new SingleSampleMediaChunk(dataSource, dataSpec, trackFormat, trackSelectionReason,
        trackSelectionData, startTimeUs, endTimeUs, segmentNum, trackFormat);
  } else {
    long sampleOffsetUs = -representation.presentationTimeOffsetUs;
    return new ContainerMediaChunk(dataSource, dataSpec, trackFormat, trackSelectionReason,
        trackSelectionData, startTimeUs, endTimeUs, segmentNum, sampleOffsetUs,
        representationHolder.extractorWrapper, sampleFormat);
  }
}
项目:K-Sonic    文件:DefaultSsChunkSource.java   
private static MediaChunk newMediaChunk(Format format, DataSource dataSource, Uri uri,
    String cacheKey, int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs,
    int trackSelectionReason, Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) {
  DataSpec dataSpec = new DataSpec(uri, 0, C.LENGTH_UNSET, cacheKey);
  // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk.
  // To convert them the absolute timestamps, we need to set sampleOffsetUs to chunkStartTimeUs.
  long sampleOffsetUs = chunkStartTimeUs;
  return new ContainerMediaChunk(dataSource, dataSpec, format, trackSelectionReason,
      trackSelectionData, chunkStartTimeUs, chunkEndTimeUs, chunkIndex, 1, sampleOffsetUs,
      extractorWrapper);
}
项目:videoPickPlayer    文件:DefaultSsChunkSource.java   
private static MediaChunk newMediaChunk(Format format, DataSource dataSource, Uri uri,
    String cacheKey, int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs,
    int trackSelectionReason, Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) {
  DataSpec dataSpec = new DataSpec(uri, 0, C.LENGTH_UNSET, cacheKey);
  // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk.
  // To convert them the absolute timestamps, we need to set sampleOffsetUs to chunkStartTimeUs.
  long sampleOffsetUs = chunkStartTimeUs;
  return new ContainerMediaChunk(dataSource, dataSpec, format, trackSelectionReason,
      trackSelectionData, chunkStartTimeUs, chunkEndTimeUs, chunkIndex, sampleOffsetUs,
      extractorWrapper, format);
}
项目:transistor    文件:DefaultSsChunkSource.java   
private static MediaChunk newMediaChunk(Format format, DataSource dataSource, Uri uri,
    String cacheKey, int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs,
    int trackSelectionReason, Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) {
  DataSpec dataSpec = new DataSpec(uri, 0, C.LENGTH_UNSET, cacheKey);
  // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk.
  // To convert them the absolute timestamps, we need to set sampleOffsetUs to chunkStartTimeUs.
  long sampleOffsetUs = chunkStartTimeUs;
  return new ContainerMediaChunk(dataSource, dataSpec, format, trackSelectionReason,
      trackSelectionData, chunkStartTimeUs, chunkEndTimeUs, chunkIndex, 1, sampleOffsetUs,
      extractorWrapper);
}