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


Java MediaChunk类代码示例

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


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

示例1: testSegmentIndexInitializationOnVod

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
public void testSegmentIndexInitializationOnVod() {
  DashChunkSource chunkSource = new DashChunkSource(buildVodMpd(),
      DefaultDashTrackSelector.newVideoInstance(null, false, false), mock(DataSource.class),
      null);
  chunkSource.prepare();
  chunkSource.enable(0);

  List<MediaChunk> queue = new ArrayList<>();
  ChunkOperationHolder out = new ChunkOperationHolder();

  // request first chunk; should get back initialization chunk
  chunkSource.getChunkOperation(queue,  0, out);

  assertNotNull(out.chunk);
  assertNotNull(((InitializationChunk) out.chunk).dataSpec);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:17,代码来源:DashChunkSourceTest.java

示例2: disable

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
@Override
public void disable(List<? extends MediaChunk> queue) {
  formatEvaluator.disable();
  if (manifestFetcher != null) {
    manifestFetcher.disable();
  }
  seekRange = null;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:9,代码来源:DashChunkSource.java

示例3: disable

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
@Override
public void disable(List<? extends MediaChunk> queue) {
  formatEvaluator.disable();
  if (manifestFetcher != null) {
    manifestFetcher.disable();
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:8,代码来源:SmoothStreamingChunkSource.java

示例4: newMediaChunk

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
private static MediaChunk newMediaChunk(Format formatInfo, Uri uri, String cacheKey,
    ChunkExtractorWrapper extractorWrapper, DrmInitData drmInitData, DataSource dataSource,
    int chunkIndex, boolean isLast, long chunkStartTimeUs, long chunkEndTimeUs,
    int trigger, MediaFormat mediaFormat) {
  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, isLast, chunkStartTimeUs, extractorWrapper, mediaFormat,
      drmInitData, true);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:13,代码来源:SmoothStreamingChunkSource.java

示例5: disable

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
@Override
public void disable(List<? extends MediaChunk> queue) {
  if (enabledTrack.isAdaptive()) {
    adaptiveFormatEvaluator.disable();
  }
  if (manifestFetcher != null) {
    manifestFetcher.disable();
  }
  periodHolders.clear();
  evaluation.format = null;
  availableRange = null;
  fatalError = null;
  enabledTrack = null;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:15,代码来源:DashChunkSource.java

示例6: disable

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
@Override
public void disable(List<? extends MediaChunk> queue) {
  if (enabledTrack.isAdaptive()) {
    adaptiveFormatEvaluator.disable();
  }
  if (manifestFetcher != null) {
    manifestFetcher.disable();
  }
  evaluation.format = null;
  fatalError = null;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:12,代码来源:SmoothStreamingChunkSource.java

示例7: newMediaChunk

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的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

示例8: checkLiveEdgeConsistency

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
private static void checkLiveEdgeConsistency(MediaPresentationDescription mpd,
    long liveEdgeLatencyMs, long seekPositionMs, long availableRangeStartMs,
    long availableRangeEndMs, long chunkStartTimeMs, long chunkEndTimeMs) {
  DashChunkSource chunkSource = buildDashChunkSource(mpd, true, liveEdgeLatencyMs);
  List<MediaChunk> queue = new ArrayList<>();
  ChunkOperationHolder out = new ChunkOperationHolder();
  checkLiveEdgeConsistency(chunkSource, queue, out, seekPositionMs, availableRangeStartMs,
      availableRangeEndMs, chunkStartTimeMs, chunkEndTimeMs);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:10,代码来源:DashChunkSourceTest.java

示例9: disable

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
@Override
public void disable(List<? extends MediaChunk> queue) {
  evaluator.disable();
  if (manifestFetcher != null) {
    manifestFetcher.disable();
  }
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:8,代码来源:DashChunkSource.java

示例10: newMediaChunk

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
private static MediaChunk newMediaChunk(Format formatInfo, Uri uri, String cacheKey,
    Extractor extractor, Map<UUID, byte[]> psshInfo, DataSource dataSource, int chunkIndex,
    boolean isLast, long chunkStartTimeUs, long nextChunkStartTimeUs, int trigger) {
  int nextChunkIndex = isLast ? -1 : chunkIndex + 1;
  long nextStartTimeUs = isLast ? -1 : nextChunkStartTimeUs;
  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 Mp4MediaChunk(dataSource, dataSpec, formatInfo, trigger, chunkStartTimeUs,
      nextStartTimeUs, nextChunkIndex, extractor, psshInfo, false, -chunkStartTimeUs);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:13,代码来源:SmoothStreamingChunkSource.java

示例11: newMediaChunk

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
private static MediaChunk newMediaChunk(Format formatInfo, Uri uri, String cacheKey,
    Extractor extractor, Map<UUID, byte[]> psshInfo, DataSource dataSource, int chunkIndex,
    boolean isLast, long chunkStartTimeUs, long nextChunkStartTimeUs, int trigger) {
  int nextChunkIndex = isLast ? -1 : chunkIndex + 1;
  long nextStartTimeUs = isLast ? -1 : nextChunkStartTimeUs;
  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, formatInfo, trigger, chunkStartTimeUs,
      nextStartTimeUs, nextChunkIndex, extractor, psshInfo, false, -chunkStartTimeUs);
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:13,代码来源:SmoothStreamingChunkSource.java

示例12: getChunkOperation

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的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

示例13: newMediaChunk

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
private static MediaChunk newMediaChunk(Format formatInfo, Uri uri, String cacheKey,
    Extractor extractor, DataSource dataSource, int chunkIndex,
    boolean isLast, long chunkStartTimeUs, long nextChunkStartTimeUs, int trigger) {
  int nextChunkIndex = isLast ? -1 : chunkIndex + 1;
  long nextStartTimeUs = isLast ? -1 : nextChunkStartTimeUs;
  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 Mp4MediaChunk(dataSource, dataSpec, formatInfo, trigger, chunkStartTimeUs,
      nextStartTimeUs, nextChunkIndex, extractor, false, -chunkStartTimeUs);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:13,代码来源:SmoothStreamingChunkSource.java

示例14: checkLiveEdgeLatency

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
private void checkLiveEdgeLatency(DashChunkSource chunkSource, List<MediaChunk> queue,
    ChunkOperationHolder out, long seekPositionMs, long seekRangeStartMs, long seekRangeEndMs,
    long chunkStartTimeMs, long chunkEndTimeMs) {
  chunkSource.getChunkOperation(queue, seekPositionMs * 1000, 0, out);
  TimeRange seekRange = chunkSource.getSeekRange();

  assertNotNull(out.chunk);
  checkSeekRange(seekRange, seekRangeStartMs * 1000, seekRangeEndMs * 1000);
  assertEquals(chunkStartTimeMs * 1000, ((MediaChunk) out.chunk).startTimeUs);
  assertEquals(chunkEndTimeMs * 1000, ((MediaChunk) out.chunk).endTimeUs);
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:12,代码来源:DashChunkSourceTest.java

示例15: disable

import com.google.android.exoplayer.chunk.MediaChunk; //导入依赖的package包/类
@Override
public void disable(List<? extends MediaChunk> queue) {
  if (manifestFetcher != null) {
    manifestFetcher.disable();
  }
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:7,代码来源:SmoothStreamingChunkSource.java


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