• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Chunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer.chunk.Chunk的典型用法代码示例。如果您正苦于以下问题:Java Chunk类的具体用法?Java Chunk怎么用?Java Chunk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Chunk类属于com.google.android.exoplayer.chunk包,在下文中一共展示了Chunk类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onChunkLoadCompleted

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
@Override
public void onChunkLoadCompleted(Chunk chunk) {
  if (chunk instanceof InitializationChunk) {
    InitializationChunk initializationChunk = (InitializationChunk) chunk;
    String formatId = initializationChunk.format.id;
    RepresentationHolder representationHolder = representationHolders.get(formatId);
    if (initializationChunk.hasFormat()) {
      representationHolder.format = initializationChunk.getFormat();
    }
    if (initializationChunk.hasSeekMap()) {
      representationHolder.segmentIndex = new DashWrappingSegmentIndex(
          (ChunkIndex) initializationChunk.getSeekMap(),
          initializationChunk.dataSpec.uri.toString(),
          representationHolder.representation.periodStartMs * 1000);
    }
    // The null check avoids overwriting drmInitData obtained from the manifest with drmInitData
    // obtained from the stream, as per DASH IF Interoperability Recommendations V3.0, 7.5.3.
    if (drmInitData == null && initializationChunk.hasDrmInitData()) {
      drmInitData = initializationChunk.getDrmInitData();
    }
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:23,代码来源:DashChunkSource.java


示例2: newInitializationChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newInitializationChunk(RangedUri initializationUri, RangedUri indexUri,
    Representation representation, ChunkExtractorWrapper extractor, DataSource dataSource,
    int trigger) {
  RangedUri requestUri;
  if (initializationUri != null) {
    // It's common for initialization and index data to be stored adjacently. Attempt to merge
    // the two requests together to request both at once.
    requestUri = initializationUri.attemptMerge(indexUri);
    if (requestUri == null) {
      requestUri = initializationUri;
    }
  } else {
    requestUri = indexUri;
  }
  DataSpec dataSpec = new DataSpec(requestUri.getUri(), requestUri.start, requestUri.length,
      representation.getCacheKey());
  return new InitializationChunk(dataSource, dataSpec, trigger, representation.format, extractor);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:19,代码来源:DashChunkSource.java


示例3: onChunkLoadCompleted

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
/**
 * Invoked when the {@link HlsSampleSource} has finished loading a chunk obtained from this
 * source.
 *
 * @param chunk The chunk whose load has been completed.
 */
public void onChunkLoadCompleted(Chunk chunk) {
  if (chunk instanceof MediaPlaylistChunk) {
    MediaPlaylistChunk mediaPlaylistChunk = (MediaPlaylistChunk) chunk;
    scratchSpace = mediaPlaylistChunk.getDataHolder();
    setMediaPlaylist(mediaPlaylistChunk.variantIndex, mediaPlaylistChunk.getResult());
    if (eventHandler != null && eventListener != null) {
      final byte[] rawResponse = mediaPlaylistChunk.getRawResponse();
      eventHandler.post(new Runnable()  {
        @Override
        public void run() {
          eventListener.onMediaPlaylistLoadCompleted(rawResponse);
        }
      });
    }
  } else if (chunk instanceof EncryptionKeyChunk) {
    EncryptionKeyChunk encryptionKeyChunk = (EncryptionKeyChunk) chunk;
    scratchSpace = encryptionKeyChunk.getDataHolder();
    setEncryptionData(encryptionKeyChunk.dataSpec.uri, encryptionKeyChunk.iv,
        encryptionKeyChunk.getResult());
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:28,代码来源:HlsChunkSource.java


示例4: newInitializationChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newInitializationChunk(RangedUri initializationUri, RangedUri indexUri,
    Representation representation, ChunkExtractorWrapper extractor, DataSource dataSource,
    int manifestIndex, int trigger) {
  RangedUri requestUri;
  if (initializationUri != null) {
    // It's common for initialization and index data to be stored adjacently. Attempt to merge
    // the two requests together to request both at once.
    requestUri = initializationUri.attemptMerge(indexUri);
    if (requestUri == null) {
      requestUri = initializationUri;
    }
  } else {
    requestUri = indexUri;
  }
  DataSpec dataSpec = new DataSpec(requestUri.getUri(), requestUri.start, requestUri.length,
      representation.getCacheKey());
  return new InitializationChunk(dataSource, dataSpec, trigger, representation.format,
      extractor, manifestIndex);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:20,代码来源:DashChunkSource.java


示例5: newMediaChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
protected Chunk newMediaChunk(
    PeriodHolder periodHolder, RepresentationHolder representationHolder, DataSource dataSource,
    MediaFormat mediaFormat, ExposedTrack enabledTrack, int segmentNum, int trigger) {
  Representation representation = representationHolder.representation;
  Format format = representation.format;
  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());

  long sampleOffsetUs = periodHolder.startTimeUs - representation.presentationTimeOffsetUs;
  if (mimeTypeIsRawText(format.mimeType)) {
    return new SingleSampleMediaChunk(dataSource, dataSpec, Chunk.TRIGGER_INITIAL, format,
        startTimeUs, endTimeUs, segmentNum, enabledTrack.trackFormat, null,
        periodHolder.localIndex);
  } else {
    boolean isMediaFormatFinal = (mediaFormat != null);
    return new ContainerMediaChunk(dataSource, dataSpec, trigger, format, startTimeUs, endTimeUs,
        segmentNum, sampleOffsetUs, representationHolder.extractorWrapper, mediaFormat,
        enabledTrack.adaptiveMaxWidth, enabledTrack.adaptiveMaxHeight, periodHolder.drmInitData,
        isMediaFormatFinal, periodHolder.localIndex);
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:25,代码来源:DashChunkSource.java


示例6: onChunkLoadCompleted

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
/**
 * Invoked when the {@link HlsSampleSource} has finished loading a chunk obtained from this
 * source.
 *
 * @param chunk The chunk whose load has been completed.
 */
public void onChunkLoadCompleted(Chunk chunk) {
  if (chunk instanceof MediaPlaylistChunk) {
    MediaPlaylistChunk mediaPlaylistChunk = (MediaPlaylistChunk) chunk;
    scratchSpace = mediaPlaylistChunk.getDataHolder();
    setMediaPlaylist(mediaPlaylistChunk.variantIndex, mediaPlaylistChunk.getResult());
  } else if (chunk instanceof EncryptionKeyChunk) {
    EncryptionKeyChunk encryptionKeyChunk = (EncryptionKeyChunk) chunk;
    scratchSpace = encryptionKeyChunk.getDataHolder();
    setEncryptionData(encryptionKeyChunk.dataSpec.uri, encryptionKeyChunk.iv,
        encryptionKeyChunk.getResult());
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:19,代码来源:HlsChunkSource.java


示例7: MediaPlaylistChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
public MediaPlaylistChunk(DataSource dataSource, DataSpec dataSpec, byte[] scratchSpace,
    HlsPlaylistParser playlistParser, int variantIndex, String playlistUrl) {
  super(dataSource, dataSpec, Chunk.TYPE_MANIFEST, Chunk.TRIGGER_UNSPECIFIED, null,
      scratchSpace);
  this.variantIndex = variantIndex;
  this.playlistParser = playlistParser;
  this.playlistUrl = playlistUrl;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:9,代码来源:HlsChunkSource.java


示例8: newMediaChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newMediaChunk(RepresentationHolder representationHolder, DataSource dataSource,
    int segmentNum, int trigger) {
  Representation representation = representationHolder.representation;
  DashSegmentIndex segmentIndex = representationHolder.segmentIndex;

  long startTimeUs = segmentIndex.getTimeUs(segmentNum);
  long endTimeUs = startTimeUs + segmentIndex.getDurationUs(segmentNum);

  int absoluteSegmentNum = segmentNum + representationHolder.segmentNumShift;
  boolean isLastSegment = !currentManifest.dynamic
      && segmentNum == segmentIndex.getLastSegmentNum();

  RangedUri segmentUri = segmentIndex.getSegmentUrl(segmentNum);
  DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
      representation.getCacheKey());

  long sampleOffsetUs = representation.periodStartMs * 1000
      - representation.presentationTimeOffsetUs;
  if (representation.format.mimeType.equals(MimeTypes.TEXT_VTT)) {
    if (representationHolder.vttHeaderOffsetUs != sampleOffsetUs) {
      // Update the VTT header.
      headerBuilder.setLength(0);
      headerBuilder.append(C.WEBVTT_EXO_HEADER).append("=")
          .append(C.WEBVTT_EXO_HEADER_OFFSET).append(sampleOffsetUs)
          .append("\n");
      representationHolder.vttHeader = headerBuilder.toString().getBytes();
      representationHolder.vttHeaderOffsetUs = sampleOffsetUs;
    }
    return new SingleSampleMediaChunk(dataSource, dataSpec, Chunk.TRIGGER_INITIAL,
        representation.format, startTimeUs, endTimeUs, absoluteSegmentNum, isLastSegment,
        MediaFormat.createTextFormat(MimeTypes.TEXT_VTT), null, representationHolder.vttHeader);
  } else {
    return new ContainerMediaChunk(dataSource, dataSpec, trigger, representation.format,
        startTimeUs, endTimeUs, absoluteSegmentNum, isLastSegment, sampleOffsetUs,
        representationHolder.extractorWrapper, representationHolder.format, drmInitData, true);
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:38,代码来源:DashChunkSource.java


示例9: MediaPlaylistChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
public MediaPlaylistChunk(DataSource dataSource, DataSpec dataSpec, byte[] scratchSpace,
    HlsPlaylistParser playlistParser, int variantIndex, String playlistUrl) {
  super(dataSource, dataSpec, Chunk.TYPE_MANIFEST, Chunk.TRIGGER_UNSPECIFIED, null,
      Chunk.NO_PARENT_ID, scratchSpace);
  this.variantIndex = variantIndex;
  this.playlistParser = playlistParser;
  this.playlistUrl = playlistUrl;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:9,代码来源:HlsChunkSource.java


示例10: EncryptionKeyChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
public EncryptionKeyChunk(DataSource dataSource, DataSpec dataSpec, byte[] scratchSpace,
    String iv, int variantIndex) {
  super(dataSource, dataSpec, Chunk.TYPE_DRM, Chunk.TRIGGER_UNSPECIFIED, null,
      Chunk.NO_PARENT_ID, scratchSpace);
  this.iv = iv;
  this.variantIndex = variantIndex;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:8,代码来源:HlsChunkSource.java


示例11: onChunkLoadCompleted

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
@Override
public void onChunkLoadCompleted(Chunk chunk) {
  if (chunk instanceof InitializationChunk) {
    InitializationChunk initializationChunk = (InitializationChunk) chunk;
    String formatId = initializationChunk.format.id;
    PeriodHolder periodHolder = periodHolders.get(initializationChunk.parentId);
    if (periodHolder == null) {
      // period for this initialization chunk may no longer be on the manifest
      return;
    }

    RepresentationHolder representationHolder = periodHolder.representationHolders.get(formatId);
    if (initializationChunk.hasFormat()) {
      representationHolder.mediaFormat = initializationChunk.getFormat();
    }
    // The null check avoids overwriting an index obtained from the manifest with one obtained
    // from the stream. If the manifest defines an index then the stream shouldn't, but in cases
    // where it does we should ignore it.
    if (representationHolder.segmentIndex == null && initializationChunk.hasSeekMap()) {
      representationHolder.segmentIndex = new DashWrappingSegmentIndex(
          (ChunkIndex) initializationChunk.getSeekMap(),
          initializationChunk.dataSpec.uri.toString());
    }
    // The null check avoids overwriting drmInitData obtained from the manifest with drmInitData
    // obtained from the stream, as per DASH IF Interoperability Recommendations V3.0, 7.5.3.
    if (periodHolder.drmInitData == null && initializationChunk.hasDrmInitData()) {
      periodHolder.drmInitData = initializationChunk.getDrmInitData();
    }
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:31,代码来源:DashChunkSource.java


示例12: newMediaChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private static MediaChunk newMediaChunk(Format formatInfo, Uri uri, String cacheKey,
    ChunkExtractorWrapper extractorWrapper, DrmInitData drmInitData, DataSource dataSource,
    int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs, int trigger,
    MediaFormat mediaFormat, int adaptiveMaxWidth, int adaptiveMaxHeight) {
  long offset = 0;
  DataSpec dataSpec = new DataSpec(uri, offset, -1, 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.
  return new ContainerMediaChunk(dataSource, dataSpec, trigger, formatInfo, chunkStartTimeUs,
      chunkEndTimeUs, chunkIndex, chunkStartTimeUs, extractorWrapper, mediaFormat,
      adaptiveMaxWidth, adaptiveMaxHeight, drmInitData, true, Chunk.NO_PARENT_ID);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:13,代码来源:SmoothStreamingChunkSource.java


示例13: newInitializationChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newInitializationChunk(RangedUri initializationUri, RangedUri indexUri,
    Representation representation, Extractor extractor, DataSource dataSource,
    int trigger) {
  int expectedExtractorResult = Extractor.RESULT_END_OF_STREAM;
  long indexAnchor = 0;
  RangedUri requestUri;
  if (initializationUri != null) {
    // It's common for initialization and index data to be stored adjacently. Attempt to merge
    // the two requests together to request both at once.
    expectedExtractorResult |= Extractor.RESULT_READ_INIT;
    requestUri = initializationUri.attemptMerge(indexUri);
    if (requestUri != null) {
      expectedExtractorResult |= Extractor.RESULT_READ_INDEX;
      if (extractor.hasRelativeIndexOffsets()) {
        indexAnchor = indexUri.start + indexUri.length;
      }
    } else {
      requestUri = initializationUri;
    }
  } else {
    requestUri = indexUri;
    if (extractor.hasRelativeIndexOffsets()) {
      indexAnchor = indexUri.start + indexUri.length;
    }
    expectedExtractorResult |= Extractor.RESULT_READ_INDEX;
  }
  DataSpec dataSpec = new DataSpec(requestUri.getUri(), requestUri.start, requestUri.length,
      representation.getCacheKey());

  return new InitializationLoadable(dataSource, dataSpec, trigger, representation.format,
      extractor, expectedExtractorResult, indexAnchor);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:33,代码来源:DashChunkSource.java


示例14: newMediaChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newMediaChunk(RepresentationHolder representationHolder, DataSource dataSource,
    int segmentNum, int trigger) {
  Representation representation = representationHolder.representation;
  DashSegmentIndex segmentIndex = representationHolder.segmentIndex;

  long startTimeUs = segmentIndex.getTimeUs(segmentNum);
  long endTimeUs = startTimeUs + segmentIndex.getDurationUs(segmentNum);

  boolean isLastSegment = !currentManifest.dynamic
      && segmentNum == segmentIndex.getLastSegmentNum();
  int nextAbsoluteSegmentNum = isLastSegment ? -1
      : (representationHolder.segmentNumShift + segmentNum + 1);

  RangedUri segmentUri = segmentIndex.getSegmentUrl(segmentNum);
  DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
      representation.getCacheKey());

  long presentationTimeOffsetUs = representation.presentationTimeOffsetMs * 1000;
  if (representation.format.mimeType.equals(MimeTypes.TEXT_VTT)) {
    if (representationHolder.vttHeaderOffsetUs != presentationTimeOffsetUs) {
      // Update the VTT header.
      headerBuilder.setLength(0);
      headerBuilder.append(WebvttParser.EXO_HEADER).append("=")
          .append(WebvttParser.OFFSET).append(presentationTimeOffsetUs).append("\n");
      representationHolder.vttHeader = headerBuilder.toString().getBytes();
      representationHolder.vttHeaderOffsetUs = presentationTimeOffsetUs;
    }
    return new SingleSampleMediaChunk(dataSource, dataSpec, representation.format, 0,
        startTimeUs, endTimeUs, nextAbsoluteSegmentNum, null, representationHolder.vttHeader);
  } else {
    return new Mp4MediaChunk(dataSource, dataSpec, representation.format, trigger, startTimeUs,
        endTimeUs, nextAbsoluteSegmentNum, representationHolder.extractor, psshInfo, false,
        presentationTimeOffsetUs);
  }
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:36,代码来源:DashChunkSource.java


示例15: newMediaChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newMediaChunk(RepresentationHolder representationHolder, DataSource dataSource,
    int segmentNum, int trigger) {
  Representation representation = representationHolder.representation;
  DashSegmentIndex segmentIndex = representationHolder.segmentIndex;

  long startTimeUs = segmentIndex.getTimeUs(segmentNum);
  long endTimeUs = startTimeUs + segmentIndex.getDurationUs(segmentNum);

  boolean isLastSegment = !currentManifest.dynamic
      && segmentNum == segmentIndex.getLastSegmentNum();
  int nextAbsoluteSegmentNum = isLastSegment ? -1
      : (representationHolder.segmentNumShift + segmentNum + 1);

  RangedUri segmentUri = segmentIndex.getSegmentUrl(segmentNum);
  DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
      representation.getCacheKey());

  long presentationTimeOffsetUs = representation.presentationTimeOffsetUs;
  if (representation.format.mimeType.equals(MimeTypes.TEXT_VTT)) {
    if (representationHolder.vttHeaderOffsetUs != presentationTimeOffsetUs) {
      // Update the VTT header.
      headerBuilder.setLength(0);
      headerBuilder.append(WebvttParser.EXO_HEADER).append("=")
          .append(WebvttParser.OFFSET).append(presentationTimeOffsetUs).append("\n");
      representationHolder.vttHeader = headerBuilder.toString().getBytes();
      representationHolder.vttHeaderOffsetUs = presentationTimeOffsetUs;
    }
    return new SingleSampleMediaChunk(dataSource, dataSpec, representation.format, 0,
        startTimeUs, endTimeUs, nextAbsoluteSegmentNum, null, representationHolder.vttHeader);
  } else {
    return new ContainerMediaChunk(dataSource, dataSpec, representation.format, trigger,
        startTimeUs, endTimeUs, nextAbsoluteSegmentNum, representationHolder.extractor, psshInfo,
        false, presentationTimeOffsetUs);
  }
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:36,代码来源:DashChunkSource.java


示例16: newInitializationChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newInitializationChunk(RangedUri initializationUri, RangedUri indexUri,
    Representation representation, Extractor extractor, DataSource dataSource,
    int trigger) {
  int expectedExtractorResult = Extractor.RESULT_END_OF_STREAM;
  long indexAnchor = 0;
  RangedUri requestUri;
  if (initializationUri != null) {
    // It's common for initialization and index data to be stored adjacently. Attempt to merge
    // the two requests together to request both at once.
    expectedExtractorResult |= Extractor.RESULT_READ_INIT;
    requestUri = initializationUri.attemptMerge(indexUri);
    if (requestUri != null) {
      expectedExtractorResult |= Extractor.RESULT_READ_INDEX;
      if (extractor.hasRelativeIndexOffsets()) {
        indexAnchor = indexUri.start + indexUri.length;
      }
    } else {
      requestUri = initializationUri;
    }
  } else {
    requestUri = indexUri;
    if (extractor.hasRelativeIndexOffsets()) {
      indexAnchor = indexUri.start + indexUri.length;
    }
    expectedExtractorResult |= Extractor.RESULT_READ_INDEX;
  }
  DataSpec dataSpec = new DataSpec(requestUri.getUri(), requestUri.start, requestUri.length,
      representation.getCacheKey());
  return new InitializationLoadable(dataSource, dataSpec, trigger, representation.format,
      extractor, expectedExtractorResult, indexAnchor);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:32,代码来源:DashChunkSource.java


示例17: newMediaChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private Chunk newMediaChunk(Representation representation, DashSegmentIndex segmentIndex,
    Extractor extractor, DataSource dataSource, int segmentNum, int trigger) {
  int lastSegmentNum = segmentIndex.getLastSegmentNum();
  int nextSegmentNum = segmentNum == lastSegmentNum ? -1 : segmentNum + 1;
  long startTimeUs = segmentIndex.getTimeUs(segmentNum);
  long endTimeUs = segmentNum < lastSegmentNum ? segmentIndex.getTimeUs(segmentNum + 1)
      : startTimeUs + segmentIndex.getDurationUs(segmentNum);
  RangedUri segmentUri = segmentIndex.getSegmentUrl(segmentNum);
  DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
      representation.getCacheKey());
  return new Mp4MediaChunk(dataSource, dataSpec, representation.format, trigger, startTimeUs,
      endTimeUs, nextSegmentNum, extractor, false, 0);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:14,代码来源:DashChunkSource.java


示例18: getChunkOperation

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
@Override
public final void getChunkOperation(List<? extends MediaChunk> queue, long seekPositionUs,
    long playbackPositionUs, ChunkOperationHolder out) {
  evaluation.queueSize = queue.size();
  formatEvaluator.evaluate(queue, playbackPositionUs, formats, evaluation);
  SmoothStreamingFormat selectedFormat = (SmoothStreamingFormat) evaluation.format;
  out.queueSize = evaluation.queueSize;

  if (selectedFormat == null) {
    out.chunk = null;
    return;
  } else if (out.queueSize == queue.size() && out.chunk != null
      && out.chunk.format.id.equals(evaluation.format.id)) {
    // We already have a chunk, and the evaluation hasn't changed either the format or the size
    // of the queue. Do nothing.
    return;
  }

  int nextChunkIndex;
  if (queue.isEmpty()) {
    nextChunkIndex = streamElement.getChunkIndex(seekPositionUs);
  } else {
    nextChunkIndex = queue.get(out.queueSize - 1).nextChunkIndex;
  }

  if (nextChunkIndex == -1) {
    out.chunk = null;
    return;
  }

  boolean isLastChunk = nextChunkIndex == streamElement.chunkCount - 1;
  String requestUrl = streamElement.buildRequestUrl(selectedFormat.trackIndex,
      nextChunkIndex);
  Uri uri = Uri.parse(baseUrl + '/' + requestUrl);
  Chunk mediaChunk = newMediaChunk(selectedFormat, uri, null,
      extractors.get(Integer.parseInt(selectedFormat.id)), dataSource, nextChunkIndex,
      isLastChunk, streamElement.getStartTimeUs(nextChunkIndex),
      isLastChunk ? -1 : streamElement.getStartTimeUs(nextChunkIndex + 1), 0);
  out.chunk = mediaChunk;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:41,代码来源:SmoothStreamingChunkSource.java


示例19: maybeStartLoading

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private void maybeStartLoading() {
  long now = SystemClock.elapsedRealtime();
  long nextLoadPositionUs = getNextLoadPositionUs();
  boolean isBackedOff = currentLoadableException != null;
  boolean loadingOrBackedOff = loader.isLoading() || isBackedOff;

  // Update the control with our current state, and determine whether we're the next loader.
  boolean nextLoader = loadControl.update(this, downstreamPositionUs, nextLoadPositionUs,
      loadingOrBackedOff);

  if (isBackedOff) {
    long elapsedMillis = now - currentLoadableExceptionTimestamp;
    if (elapsedMillis >= getRetryDelayMillis(currentLoadableExceptionCount)) {
      currentLoadableException = null;
      loader.startLoading(currentLoadable, this);
    }
    return;
  }

  if (loader.isLoading() || !nextLoader) {
    return;
  }

  Chunk nextLoadable = chunkSource.getChunkOperation(previousTsLoadable, pendingResetPositionUs,
      downstreamPositionUs);
  if (nextLoadable == null) {
    return;
  }

  currentLoadStartTimeMs = now;
  currentLoadable = nextLoadable;
  if (isTsChunk(currentLoadable)) {
    TsChunk tsChunk = (TsChunk) currentLoadable;
    if (isPendingReset()) {
      pendingResetPositionUs = NO_RESET_PENDING;
    }
    HlsExtractorWrapper extractorWrapper = tsChunk.extractorWrapper;
    if (extractors.isEmpty() || extractors.getLast() != extractorWrapper) {
      extractorWrapper.init(loadControl.getAllocator());
      extractors.addLast(extractorWrapper);
    }
    notifyLoadStarted(tsChunk.dataSpec.length, tsChunk.type, tsChunk.trigger, tsChunk.format,
        tsChunk.startTimeUs, tsChunk.endTimeUs);
    currentTsLoadable = tsChunk;
  } else {
    notifyLoadStarted(currentLoadable.dataSpec.length, currentLoadable.type,
        currentLoadable.trigger, currentLoadable.format, -1, -1);
  }
  loader.startLoading(currentLoadable, this);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:51,代码来源:HlsSampleSource.java


示例20: isTsChunk

import com.google.android.exoplayer.chunk.Chunk; //导入依赖的package包/类
private boolean isTsChunk(Chunk chunk) {
  return chunk instanceof TsChunk;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:4,代码来源:HlsSampleSource.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SourceArgs类代码示例发布时间:2022-05-23
下一篇:
Java InfoTypeAndValue类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap