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


Java AdaptationSet.TYPE_VIDEO属性代码示例

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


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

示例1: selectTracks

@Override
public void selectTracks(MediaPresentationDescription manifest, int periodIndex,
    Output output) throws IOException {
  Period period = manifest.getPeriod(periodIndex);
  int adaptationSetIndex = period.getAdaptationSetIndex(adaptationSetType);
  AdaptationSet adaptationSet = period.adaptationSets.get(adaptationSetIndex);
  int[] representationIndices = getRepresentationIndices(adaptationSet, representationIds,
      canIncludeAdditionalVideoRepresentations);
  if (representationIndices.length > representationIds.length) {
    includedAdditionalVideoRepresentations = true;
  }
  if (adaptationSetType == AdaptationSet.TYPE_VIDEO) {
    output.adaptiveTrack(manifest, periodIndex, adaptationSetIndex, representationIndices);
  }
  for (int i = 0; i < representationIndices.length; i++) {
    output.fixedTrack(manifest, periodIndex, adaptationSetIndex, representationIndices[i]);
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:18,代码来源:DashTest.java

示例2: getTrackFormat

private static MediaFormat getTrackFormat(int adaptationSetType, Format format,
    String mediaMimeType, long durationUs) {
  switch (adaptationSetType) {
    case AdaptationSet.TYPE_VIDEO:
      return MediaFormat.createVideoFormat(format.id, mediaMimeType, format.bitrate,
          MediaFormat.NO_VALUE, durationUs, format.width, format.height, null);
    case AdaptationSet.TYPE_AUDIO:
      return MediaFormat.createAudioFormat(format.id, mediaMimeType, format.bitrate,
          MediaFormat.NO_VALUE, durationUs, format.audioChannels, format.audioSamplingRate, null,
          format.language);
    case AdaptationSet.TYPE_TEXT:
      return MediaFormat.createTextFormat(format.id, mediaMimeType, format.bitrate,
          durationUs, format.language);
    default:
      return null;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:17,代码来源:DashChunkSource.java

示例3: buildRenderers

@Override
public TrackRenderer[] buildRenderers(HostActivity host, ExoPlayer player, Surface surface) {
  Handler handler = new Handler();
  LogcatLogger logger = new LogcatLogger(TAG, player);
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  String userAgent = TestUtil.getUserAgent(host);

  // Build the video renderer.
  DataSource videoDataSource = new DefaultUriDataSource(host, null, userAgent);
  videoTrackSelector = new TrackSelector(AdaptationSet.TYPE_VIDEO,
      canIncludeAdditionalVideoFormats, videoFormats);
  ChunkSource videoChunkSource = new DashChunkSource(mpd, videoTrackSelector, videoDataSource,
      new FormatEvaluator.RandomEvaluator(0));
  ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl,
      VIDEO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, handler, logger, VIDEO_EVENT_ID,
      MIN_LOADABLE_RETRY_COUNT);
  DebugMediaCodecVideoTrackRenderer videoRenderer = new DebugMediaCodecVideoTrackRenderer(host,
      videoSampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
      0, handler, logger, 50);
  videoCounters = videoRenderer.codecCounters;
  player.sendMessage(videoRenderer, DebugMediaCodecVideoTrackRenderer.MSG_SET_SURFACE, surface);

  // Build the audio renderer.
  DataSource audioDataSource = new DefaultUriDataSource(host, null, userAgent);
  TrackSelector audioTrackSelector = new TrackSelector(AdaptationSet.TYPE_AUDIO, false,
      audioFormats);
  ChunkSource audioChunkSource = new DashChunkSource(mpd, audioTrackSelector, audioDataSource,
      null);
  ChunkSampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl,
      AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, handler, logger, AUDIO_EVENT_ID,
      MIN_LOADABLE_RETRY_COUNT);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(
      audioSampleSource, MediaCodecSelector.DEFAULT, handler, logger);
  audioCounters = audioRenderer.codecCounters;

  TrackRenderer[] renderers = new TrackRenderer[RENDERER_COUNT];
  renderers[VIDEO_RENDERER_INDEX] = videoRenderer;
  renderers[AUDIO_RENDERER_INDEX] = audioRenderer;
  return renderers;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:40,代码来源:DashTest.java

示例4: selectTracks

@Override
public void selectTracks(MediaPresentationDescription manifest, int periodIndex, Output output)
    throws IOException {
  Period period = manifest.getPeriod(periodIndex);
  for (int i = 0; i < period.adaptationSets.size(); i++) {
    AdaptationSet adaptationSet = period.adaptationSets.get(i);
    if (adaptationSet.type == adaptationSetType) {
      if (adaptationSetType == AdaptationSet.TYPE_VIDEO) {
        int[] representations;
        if (filterVideoRepresentations) {
          representations = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
              context, adaptationSet.representations, null,
              filterProtectedHdContent && adaptationSet.hasContentProtection());
        } else {
          representations = Util.firstIntegersArray(adaptationSet.representations.size());
        }
        int representationCount = representations.length;
        if (representationCount > 1) {
          output.adaptiveTrack(manifest, periodIndex, i, representations);
        }
        for (int j = 0; j < representationCount; j++) {
          output.fixedTrack(manifest, periodIndex, i, representations[j]);
        }
      } else {
        for (int j = 0; j < adaptationSet.representations.size(); j++) {
          output.fixedTrack(manifest, periodIndex, i, j);
        }
      }
    }
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:31,代码来源:DefaultDashTrackSelector.java

示例5: buildMpd

private static MediaPresentationDescription buildMpd(long durationMs,
    List<Representation> representations, boolean live, boolean limitTimeshiftBuffer) {
  AdaptationSet adaptationSet = new AdaptationSet(0, AdaptationSet.TYPE_VIDEO, representations);
  Period period = new Period(null, 0, Collections.singletonList(adaptationSet));
  return new MediaPresentationDescription(AVAILABILITY_START_TIME_MS, durationMs, -1, live, -1,
      (limitTimeshiftBuffer) ? LIVE_TIMESHIFT_BUFFER_DEPTH_MS : -1, null, null,
      Collections.singletonList(period));
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:8,代码来源:DashChunkSourceTest.java

示例6: buildMultiPeriodVodMpd

private static MediaPresentationDescription buildMultiPeriodVodMpd() {
  List<Period> periods = new ArrayList<>();
  long timeMs = 0;
  long periodDurationMs = VOD_DURATION_MS;
  for (int i = 0; i < 2; i++) {
    Representation representation = buildVodRepresentation(REGULAR_VIDEO);
    AdaptationSet adaptationSet = new AdaptationSet(0, AdaptationSet.TYPE_VIDEO,
        Collections.singletonList(representation));
    Period period = new Period(null, timeMs, Collections.singletonList(adaptationSet));
    periods.add(period);
    timeMs += periodDurationMs;
  }
  return buildMultiPeriodMpd(timeMs, periods, false, false);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:DashChunkSourceTest.java

示例7: buildMultiPeriodLiveMpdWithTimeline

private static MediaPresentationDescription buildMultiPeriodLiveMpdWithTimeline() {
  List<Period> periods = new ArrayList<>();
  long periodStartTimeMs = 0;
  long periodDurationMs = LIVE_DURATION_MS;
  for (int i = 0; i < MULTI_PERIOD_COUNT; i++) {
    Representation representation = buildSegmentTimelineRepresentation(LIVE_DURATION_MS, 0);
    AdaptationSet adaptationSet = new AdaptationSet(0, AdaptationSet.TYPE_VIDEO,
        Collections.singletonList(representation));
    Period period = new Period(null, periodStartTimeMs, Collections.singletonList(adaptationSet));
    periods.add(period);
    periodStartTimeMs += periodDurationMs;
  }
  return buildMultiPeriodMpd(periodDurationMs, periods, true, false);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:DashChunkSourceTest.java

示例8: buildMultiPeriodLiveMpdWithTemplate

private static MediaPresentationDescription buildMultiPeriodLiveMpdWithTemplate() {
  List<Period> periods = new ArrayList<>();
  long periodStartTimeMs = 0;
  long periodDurationMs = LIVE_DURATION_MS;
  for (int i = 0; i < MULTI_PERIOD_COUNT; i++) {
    Representation representation = buildSegmentTemplateRepresentation();
    AdaptationSet adaptationSet = new AdaptationSet(0, AdaptationSet.TYPE_VIDEO,
        Collections.singletonList(representation));
    Period period = new Period(null, periodStartTimeMs, Collections.singletonList(adaptationSet));
    periods.add(period);
    periodStartTimeMs += periodDurationMs;
  }
  return buildMultiPeriodMpd(MULTI_PERIOD_LIVE_DURATION_MS, periods, true, false);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:DashChunkSourceTest.java

示例9: testMaxVideoDimensions

public void testMaxVideoDimensions() {
  DashChunkSource chunkSource = new DashChunkSource(generateVodMpd(), AdaptationSet.TYPE_VIDEO,
      null, null, null);
  MediaFormat out = MediaFormat.createVideoFormat("video/h264", 1, 1, 1, 1, null);
  chunkSource.getMaxVideoDimensions(out);

  assertEquals(WIDE_WIDTH, out.getMaxVideoWidth());
  assertEquals(TALL_HEIGHT, out.getMaxVideoHeight());
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:9,代码来源:DashChunkSourceTest.java

示例10: testGetSeekRangeOnVod

public void testGetSeekRangeOnVod() {
  DashChunkSource chunkSource = new DashChunkSource(generateVodMpd(), AdaptationSet.TYPE_VIDEO,
      null, null, mock(FormatEvaluator.class));
  chunkSource.enable();
  TimeRange seekRange = chunkSource.getSeekRange();

  checkSeekRange(seekRange, 0, VOD_DURATION_MS * 1000);

  long[] seekRangeValuesMs = seekRange.getCurrentBoundsMs(null);
  assertEquals(0, seekRangeValuesMs[0]);
  assertEquals(VOD_DURATION_MS, seekRangeValuesMs[1]);
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:12,代码来源:DashChunkSourceTest.java

示例11: setupDashChunkSource

private DashChunkSource setupDashChunkSource(MediaPresentationDescription mpd, long periodStartMs,
    long liveEdgeLatencyMs) {
  @SuppressWarnings("unchecked")
  ManifestFetcher<MediaPresentationDescription> manifestFetcher = mock(ManifestFetcher.class);
  when(manifestFetcher.getManifest()).thenReturn(mpd);
  DashChunkSource chunkSource = new DashChunkSource(manifestFetcher, mpd,
      AdaptationSet.TYPE_VIDEO, null, mockDataSource, EVALUATOR,
      new FakeClock(AVAILABILITY_CURRENT_TIME_MS + periodStartMs), liveEdgeLatencyMs * 1000,
      AVAILABILITY_REALTIME_OFFSET_MS * 1000, false, null, null);
  chunkSource.enable();
  return chunkSource;
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:12,代码来源:DashChunkSourceTest.java

示例12: newVideoInstance

/**
 * @param context A context. May be null if {@code filterVideoRepresentations == false}.
 * @param filterVideoRepresentations Whether video representations should be filtered according to
 *     the capabilities of the device. It is strongly recommended to set this to {@code true},
 *     unless the application has already verified that all representations are playable.
 * @param filterProtectedHdContent Whether video representations that are both drm protected and
 *     high definition should be filtered when tracks are built. If
 *     {@code filterVideoRepresentations == false} then this parameter is ignored.
 */
public static DefaultDashTrackSelector newVideoInstance(Context context,
    boolean filterVideoRepresentations, boolean filterProtectedHdContent) {
  return new DefaultDashTrackSelector(AdaptationSet.TYPE_VIDEO, context,
      filterVideoRepresentations, filterProtectedHdContent);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:DefaultDashTrackSelector.java


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