當前位置: 首頁>>代碼示例>>Java>>正文


Java DataSource類代碼示例

本文整理匯總了Java中com.google.android.exoplayer.upstream.DataSource的典型用法代碼示例。如果您正苦於以下問題:Java DataSource類的具體用法?Java DataSource怎麽用?Java DataSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataSource類屬於com.google.android.exoplayer.upstream包,在下文中一共展示了DataSource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
開發者ID:Dreamxiaoxuan,項目名稱:AndroidTvDemo,代碼行數:27,代碼來源:ExtractorRendererBuilder.java

示例2: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(ExoPlayerHelper player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    Extractor webmExtractor = new WebmExtractor();
    Extractor mp4Extractor = new Mp4Extractor();
    DataSource dataSource = new FileDataSource();
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, webmExtractor, mp4Extractor);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
            player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource, MediaCodecSelector.DEFAULT,
            null, true, player.getMainHandler(), player);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[ExoPlayerHelper.RENDERER_COUNT];
    renderers[ExoPlayerHelper.TYPE_VIDEO] = videoRenderer;
    renderers[ExoPlayerHelper.TYPE_AUDIO] = audioRenderer;
    renderers[ExoPlayerHelper.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, null);
}
 
開發者ID:MimiReader,項目名稱:mimi-reader,代碼行數:26,代碼來源:WebmRendererBuilder.java

示例3: testSegmentIndexInitializationOnVod

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的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

示例4: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
開發者ID:vuthanhict,項目名稱:ExoPlayerController,代碼行數:26,代碼來源:ExtractorRendererBuilder.java

示例5: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(MpegTsPlayer mpegTsPlayer, DataSource dataSource,
        RendererBuilderCallback callback) {
    // Build the video and audio renderers.
    SampleExtractor extractor = dataSource == null ?
            new MpegTsSampleExtractor(mBufferManager, mBufferListener) :
            new MpegTsSampleExtractor(dataSource, mBufferManager, mBufferListener);
    SampleSource sampleSource = new MpegTsSampleSource(extractor);
    MpegTsVideoTrackRenderer videoRenderer = new MpegTsVideoTrackRenderer(mContext,
            sampleSource, mpegTsPlayer.getMainHandler(), mpegTsPlayer);
    // TODO: Only using Ac3PassthroughTrackRenderer for A/V sync issue. We will use
    // {@link Ac3TrackRenderer} when we use ExoPlayer's extractor.
    TrackRenderer audioRenderer = new Ac3PassthroughTrackRenderer(sampleSource,
            mpegTsPlayer.getMainHandler(), mpegTsPlayer);
    Cea708TextTrackRenderer textRenderer = new Cea708TextTrackRenderer(sampleSource);

    TrackRenderer[] renderers = new TrackRenderer[MpegTsPlayer.RENDERER_COUNT];
    renderers[MpegTsPlayer.TRACK_TYPE_VIDEO] = videoRenderer;
    renderers[MpegTsPlayer.TRACK_TYPE_AUDIO] = audioRenderer;
    renderers[MpegTsPlayer.TRACK_TYPE_TEXT] = textRenderer;
    callback.onRenderers(null, renderers);
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:23,代碼來源:MpegTsRendererBuilder.java

示例6: appendData

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
/**
 * Appends data to the rolling buffer.
 *
 * @param dataSource The source from which to read.
 * @param length The maximum length of the read.
 * @param allowEndOfInput True if encountering the end of the input having appended no data is
 *     allowed, and should result in {@link C#RESULT_END_OF_INPUT} being returned. False if it
 *     should be considered an error, causing an {@link EOFException} to be thrown.
 * @return The number of bytes appended, or {@link C#RESULT_END_OF_INPUT} if the input has ended.
 * @throws IOException If an error occurs reading from the source.
 */
public int appendData(DataSource dataSource, int length, boolean allowEndOfInput)
    throws IOException {
  length = prepareForAppend(length);
  int bytesAppended = dataSource.read(lastAllocation.data,
      lastAllocation.translateOffset(lastAllocationOffset), length);
  if (bytesAppended == C.RESULT_END_OF_INPUT) {
    if (allowEndOfInput) {
      return C.RESULT_END_OF_INPUT;
    }
    throw new EOFException();
  }
  lastAllocationOffset += bytesAppended;
  totalBytesWritten += bytesAppended;
  return bytesAppended;
}
 
開發者ID:XueyanLiu,項目名稱:miku,代碼行數:27,代碼來源:RollingSampleBuffer.java

示例7: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(MediaPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      null, true, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, null, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[MediaPlayer.RENDERER_COUNT];
  renderers[MediaPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[MediaPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[MediaPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(null, null, renderers, bandwidthMeter);
}
 
開發者ID:XueyanLiu,項目名稱:miku,代碼行數:26,代碼來源:ExtractorRendererBuilder.java

示例8: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
public void buildRenderers(EMExoPlayer player) {
    //Create the Sample Source to be used by the renderers
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(), player);
    DataSource dataSource = createDataSource(okHttpClient, null, userAgent);

    ExtractorSampleSource sampleSource = new ExtractorSampleSource(Uri.parse(MediaUtil.getUriWithProtocol(uri)), dataSource,
           allocator, BUFFER_SEGMENT_SIZE * BUFFER_SEGMENTS_TOTAL, player.getMainHandler(), player, 0);

    //Create the Renderers
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context, sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, MAX_JOIN_TIME, player.getMainHandler(), player, DROPPED_FRAME_NOTIFICATION_AMOUNT);
    EMMediaCodecAudioTrackRenderer audioRenderer = new EMMediaCodecAudioTrackRenderer(sampleSource, MediaCodecSelector.DEFAULT, null, true,
            player.getMainHandler(), player, AudioCapabilities.getCapabilities(context), streamType);
    TrackRenderer captionsRenderer = new TextTrackRenderer(sampleSource, player, player.getMainHandler().getLooper());


    //Create the Render list to send to the callback
    TrackRenderer[] renderers = new TrackRenderer[EMExoPlayer.RENDER_COUNT];
    renderers[EMExoPlayer.RENDER_VIDEO] = videoRenderer;
    renderers[EMExoPlayer.RENDER_AUDIO] = audioRenderer;
    renderers[EMExoPlayer.RENDER_CLOSED_CAPTION] = captionsRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
 
開發者ID:ayaseruri,項目名稱:luxunPro,代碼行數:25,代碼來源:RenderBuilder.java

示例9: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(Player player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[Player.RENDERER_COUNT];
  renderers[Player.TYPE_VIDEO] = videoRenderer;
  renderers[Player.TYPE_AUDIO] = audioRenderer;
  renderers[Player.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
開發者ID:PJakcson,項目名稱:Mediathek,代碼行數:26,代碼來源:ExtractorRendererBuilder.java

示例10: DashChunkSource

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher,
    MediaPresentationDescription initialManifest, DashTrackSelector trackSelector,
    DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator,
    Clock systemClock, long liveEdgeLatencyUs, long elapsedRealtimeOffsetUs,
    boolean startAtLiveEdge, Handler eventHandler, EventListener eventListener,
    int eventSourceId) {
  this.manifestFetcher = manifestFetcher;
  this.currentManifest = initialManifest;
  this.trackSelector = trackSelector;
  this.dataSource = dataSource;
  this.adaptiveFormatEvaluator = adaptiveFormatEvaluator;
  this.systemClock = systemClock;
  this.liveEdgeLatencyUs = liveEdgeLatencyUs;
  this.elapsedRealtimeOffsetUs = elapsedRealtimeOffsetUs;
  this.startAtLiveEdge = startAtLiveEdge;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.eventSourceId = eventSourceId;
  this.evaluation = new Evaluation();
  this.availableRangeValues = new long[2];
  periodHolders = new SparseArray<>();
  tracks = new ArrayList<>();
  live = initialManifest.dynamic;
}
 
開發者ID:asifkhan11,項目名稱:ExoPlayer-Demo,代碼行數:25,代碼來源:DashChunkSource.java

示例11: newInitializationChunk

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的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

示例12: newMediaChunk

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的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

示例13: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(DemoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
    renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:28,代碼來源:ExtractorRendererBuilder.java

示例14: buildRenderers

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
@Override
public void buildRenderers(VideoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[VideoPlayer.RENDERER_COUNT];
    renderers[VideoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[VideoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[VideoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:28,代碼來源:ExtractorRendererBuilder.java

示例15: SmoothStreamingChunkSource

import com.google.android.exoplayer.upstream.DataSource; //導入依賴的package包/類
private SmoothStreamingChunkSource(ManifestFetcher<SmoothStreamingManifest> manifestFetcher,
    SmoothStreamingManifest initialManifest, SmoothStreamingTrackSelector trackSelector,
    DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator, long liveEdgeLatencyMs) {
  this.manifestFetcher = manifestFetcher;
  this.currentManifest = initialManifest;
  this.trackSelector = trackSelector;
  this.dataSource = dataSource;
  this.adaptiveFormatEvaluator = adaptiveFormatEvaluator;
  this.liveEdgeLatencyUs = liveEdgeLatencyMs * 1000;
  evaluation = new Evaluation();
  tracks = new ArrayList<>();
  extractorWrappers = new SparseArray<>();
  mediaFormats = new SparseArray<>();
  live = initialManifest.isLive;

  ProtectionElement protectionElement = initialManifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getProtectionElementKeyId(protectionElement.data);
    trackEncryptionBoxes = new TrackEncryptionBox[1];
    trackEncryptionBoxes[0] = new TrackEncryptionBox(true, INITIALIZATION_VECTOR_SIZE, keyId);
    drmInitData = new DrmInitData.Mapped();
    drmInitData.put(protectionElement.uuid,
        new SchemeInitData(MimeTypes.VIDEO_MP4, protectionElement.data));
  } else {
    trackEncryptionBoxes = null;
    drmInitData = null;
  }
}
 
開發者ID:asifkhan11,項目名稱:ExoPlayer-Demo,代碼行數:29,代碼來源:SmoothStreamingChunkSource.java


注:本文中的com.google.android.exoplayer.upstream.DataSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。