com.google.android.exoplayer2.upstream.LoaderErrorThrower Java Examples

The following examples show how to use com.google.android.exoplayer2.upstream.LoaderErrorThrower. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SsMediaPeriod.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.manifest = manifest;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  trackGroups = buildTrackGroups(manifest);
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #2
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void prepareSourceInternal(
    ExoPlayer player,
    boolean isTopLevelSource,
    @Nullable TransferListener mediaTransferListener) {
  this.mediaTransferListener = mediaTransferListener;
  if (sideloadedManifest) {
    manifestLoaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest();
  } else {
    manifestDataSource = manifestDataSourceFactory.createDataSource();
    manifestLoader = new Loader("Loader:Manifest");
    manifestLoaderErrorThrower = manifestLoader;
    manifestRefreshHandler = new Handler();
    startLoadingManifest();
  }
}
 
Example #3
Source File: DefaultDashChunkSource.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param periodIndex The index of the period in the manifest.
 * @param adaptationSetIndex The index of the adaptation set in the period.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param elapsedRealtimeOffsetMs If known, an estimate of the instantaneous difference between
 *     server-side unix time and {@link SystemClock#elapsedRealtime()} in milliseconds, specified
 *     as the server's unix time minus the local elapsed time. If unknown, set to 0.
 * @param maxSegmentsPerLoad The maximum number of segments to combine into a single request.
 *     Note that segments will only be combined if their {@link Uri}s are the same and if their
 *     data ranges are adjacent.
 * @param enableEventMessageTrack Whether the chunks generated by the source may output an event
 *     message track.
 * @param enableEventMessageTrack Whether the chunks generated by the source may output a CEA-608
 *     track.
 */
public DefaultDashChunkSource(LoaderErrorThrower manifestLoaderErrorThrower,
    DashManifest manifest, int periodIndex, int adaptationSetIndex, TrackSelection trackSelection,
    DataSource dataSource, long elapsedRealtimeOffsetMs, int maxSegmentsPerLoad,
    boolean enableEventMessageTrack, boolean enableCea608Track) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.adaptationSetIndex = adaptationSetIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;
  this.periodIndex = periodIndex;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.maxSegmentsPerLoad = maxSegmentsPerLoad;

  long periodDurationUs = manifest.getPeriodDurationUs(periodIndex);
  AdaptationSet adaptationSet = getAdaptationSet();
  List<Representation> representations = adaptationSet.representations;
  representationHolders = new RepresentationHolder[trackSelection.length()];
  for (int i = 0; i < representationHolders.length; i++) {
    Representation representation = representations.get(trackSelection.getIndexInTrackGroup(i));
    representationHolders[i] = new RepresentationHolder(periodDurationUs, representation,
        enableEventMessageTrack, enableCea608Track, adaptationSet.type);
  }
}
 
Example #4
Source File: DashMediaPeriod.java    From K-Sonic with MIT License 6 votes vote down vote up
public DashMediaPeriod(int id, DashManifest manifest, int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,  int minLoadableRetryCount,
    EventDispatcher eventDispatcher, long elapsedRealtimeOffset,
    LoaderErrorThrower manifestLoaderErrorThrower, Allocator allocator) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffset = elapsedRealtimeOffset;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  sampleStreams = newSampleStreamArray(0);
  sequenceableLoader = new CompositeSequenceableLoader(sampleStreams);
  adaptationSets = manifest.getPeriod(periodIndex).adaptationSets;
  Pair<TrackGroupArray, EmbeddedTrackInfo[]> result = buildTrackGroups(adaptationSets);
  trackGroups = result.first;
  embeddedTrackInfos = result.second;
}
 
Example #5
Source File: DefaultSsChunkSource.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param elementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param trackEncryptionBoxes Track encryption boxes for the stream.
 */
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
    int elementIndex, TrackSelection trackSelection, DataSource dataSource,
    TrackEncryptionBox[] trackEncryptionBoxes) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.elementIndex = elementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[elementIndex];

  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, format);
  }
}
 
Example #6
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void prepareSourceInternal(
    ExoPlayer player,
    boolean isTopLevelSource,
    @Nullable TransferListener mediaTransferListener) {
  this.mediaTransferListener = mediaTransferListener;
  if (sideloadedManifest) {
    manifestLoaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest();
  } else {
    manifestDataSource = manifestDataSourceFactory.createDataSource();
    manifestLoader = new Loader("Loader:Manifest");
    manifestLoaderErrorThrower = manifestLoader;
    manifestRefreshHandler = new Handler();
    startLoadingManifest();
  }
}
 
Example #7
Source File: SsMediaPeriod.java    From K-Sonic with MIT License 6 votes vote down vote up
public SsMediaPeriod(SsManifest manifest, SsChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount, EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower, Allocator allocator) {
  this.chunkSourceFactory = chunkSourceFactory;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;

  trackGroups = buildTrackGroups(manifest);
  ProtectionElement protectionElement = manifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getProtectionElementKeyId(protectionElement.data);
    trackEncryptionBoxes = new TrackEncryptionBox[] {
        new TrackEncryptionBox(true, INITIALIZATION_VECTOR_SIZE, keyId)};
  } else {
    trackEncryptionBoxes = null;
  }
  this.manifest = manifest;
  sampleStreams = newSampleStreamArray(0);
  sequenceableLoader = new CompositeSequenceableLoader(sampleStreams);
}
 
Example #8
Source File: SsMediaPeriod.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.manifest = manifest;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  trackGroups = buildTrackGroups(manifest, drmSessionManager);
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #9
Source File: SsMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.manifest = manifest;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  trackGroups = buildTrackGroups(manifest);
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #10
Source File: DefaultDashChunkSource.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public DashChunkSource createDashChunkSource(LoaderErrorThrower manifestLoaderErrorThrower,
    DashManifest manifest, int periodIndex, int adaptationSetIndex,
    TrackSelection trackSelection, long elapsedRealtimeOffsetMs,
    boolean enableEventMessageTrack, boolean enableCea608Track) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  return new DefaultDashChunkSource(manifestLoaderErrorThrower, manifest, periodIndex,
      adaptationSetIndex, trackSelection, dataSource, elapsedRealtimeOffsetMs,
      maxSegmentsPerLoad, enableEventMessageTrack, enableCea608Track);
}
 
Example #11
Source File: DefaultSsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param streamElementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 */
public DefaultSsChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest,
    int streamElementIndex,
    TrackSelection trackSelection,
    DataSource dataSource) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.streamElementIndex = streamElementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[streamElementIndex];
  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    TrackEncryptionBox[] trackEncryptionBoxes =
        format.drmInitData != null ? manifest.protectionElement.trackEncryptionBoxes : null;
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track, null);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, streamElement.type, format);
  }
}
 
Example #12
Source File: DefaultSsChunkSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param streamElementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param trackEncryptionBoxes Track encryption boxes for the stream.
 */
public DefaultSsChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest,
    int streamElementIndex,
    TrackSelection trackSelection,
    DataSource dataSource,
    TrackEncryptionBox[] trackEncryptionBoxes) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.streamElementIndex = streamElementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[streamElementIndex];
  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track, null);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, streamElement.type, format);
  }
}
 
Example #13
Source File: SsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;

  trackGroups = buildTrackGroups(manifest);
  ProtectionElement protectionElement = manifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getProtectionElementKeyId(protectionElement.data);
    // We assume pattern encryption does not apply.
    trackEncryptionBoxes = new TrackEncryptionBox[] {
        new TrackEncryptionBox(true, null, INITIALIZATION_VECTOR_SIZE, keyId, 0, 0, null)};
  } else {
    trackEncryptionBoxes = null;
  }
  this.manifest = manifest;
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #14
Source File: DefaultDashChunkSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public DashChunkSource createDashChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    DashManifest manifest,
    int periodIndex,
    int[] adaptationSetIndices,
    TrackSelection trackSelection,
    int trackType,
    long elapsedRealtimeOffsetMs,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable PlayerTrackEmsgHandler playerEmsgHandler,
    @Nullable TransferListener transferListener) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  if (transferListener != null) {
    dataSource.addTransferListener(transferListener);
  }
  return new DefaultDashChunkSource(
      manifestLoaderErrorThrower,
      manifest,
      periodIndex,
      adaptationSetIndices,
      trackSelection,
      trackType,
      dataSource,
      elapsedRealtimeOffsetMs,
      maxSegmentsPerLoad,
      enableEventMessageTrack,
      closedCaptionFormats,
      playerEmsgHandler);
}
 
Example #15
Source File: DefaultSsChunkSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
 * @param manifest The initial manifest.
 * @param streamElementIndex The index of the stream element in the manifest.
 * @param trackSelection The track selection.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 */
public DefaultSsChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest,
    int streamElementIndex,
    TrackSelection trackSelection,
    DataSource dataSource) {
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.manifest = manifest;
  this.streamElementIndex = streamElementIndex;
  this.trackSelection = trackSelection;
  this.dataSource = dataSource;

  StreamElement streamElement = manifest.streamElements[streamElementIndex];
  extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
  for (int i = 0; i < extractorWrappers.length; i++) {
    int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
    Format format = streamElement.formats[manifestTrackIndex];
    TrackEncryptionBox[] trackEncryptionBoxes =
        format.drmInitData != null ? manifest.protectionElement.trackEncryptionBoxes : null;
    int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
    Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
        C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
        trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
        | FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track, null);
    extractorWrappers[i] = new ChunkExtractorWrapper(extractor, streamElement.type, format);
  }
}
 
Example #16
Source File: DashMediaSource.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void prepareSource(ExoPlayer player, boolean isTopLevelSource, Listener listener) {
  sourceListener = listener;
  if (sideloadedManifest) {
    loaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest(false);
  } else {
    dataSource = manifestDataSourceFactory.createDataSource();
    loader = new Loader("Loader:DashMediaSource");
    loaderErrorThrower = loader;
    handler = new Handler();
    startLoadingManifest();
  }
}
 
Example #17
Source File: DefaultSsChunkSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SsChunkSource createChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest,
    int elementIndex,
    TrackSelection trackSelection,
    @Nullable TransferListener transferListener) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  if (transferListener != null) {
    dataSource.addTransferListener(transferListener);
  }
  return new DefaultSsChunkSource(
      manifestLoaderErrorThrower, manifest, elementIndex, trackSelection, dataSource);
}
 
Example #18
Source File: SsMediaSource.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void prepareSource(ExoPlayer player, boolean isTopLevelSource, Listener listener) {
  sourceListener = listener;
  if (manifest != null) {
    manifestLoaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest();
  } else {
    manifestDataSource = manifestDataSourceFactory.createDataSource();
    manifestLoader = new Loader("Loader:Manifest");
    manifestLoaderErrorThrower = manifestLoader;
    manifestRefreshHandler = new Handler();
    startLoadingManifest();
  }
}
 
Example #19
Source File: DefaultSsChunkSource.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public SsChunkSource createChunkSource(LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest, int elementIndex, TrackSelection trackSelection,
    TrackEncryptionBox[] trackEncryptionBoxes) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  return new DefaultSsChunkSource(manifestLoaderErrorThrower, manifest, elementIndex,
      trackSelection, dataSource, trackEncryptionBoxes);
}
 
Example #20
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void prepareSourceInternal(@Nullable TransferListener mediaTransferListener) {
  this.mediaTransferListener = mediaTransferListener;
  if (sideloadedManifest) {
    manifestLoaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest();
  } else {
    manifestDataSource = manifestDataSourceFactory.createDataSource();
    manifestLoader = new Loader("Loader:Manifest");
    manifestLoaderErrorThrower = manifestLoader;
    manifestRefreshHandler = new Handler();
    startLoadingManifest();
  }
}
 
Example #21
Source File: DashMediaPeriod.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffsetMs,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #22
Source File: DefaultDashChunkSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DashChunkSource createDashChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    DashManifest manifest,
    int periodIndex,
    int[] adaptationSetIndices,
    TrackSelection trackSelection,
    int trackType,
    long elapsedRealtimeOffsetMs,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable PlayerTrackEmsgHandler playerEmsgHandler,
    @Nullable TransferListener transferListener) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  if (transferListener != null) {
    dataSource.addTransferListener(transferListener);
  }
  return new DefaultDashChunkSource(
      manifestLoaderErrorThrower,
      manifest,
      periodIndex,
      adaptationSetIndices,
      trackSelection,
      trackType,
      dataSource,
      elapsedRealtimeOffsetMs,
      maxSegmentsPerLoad,
      enableEventMessageTrack,
      closedCaptionFormats,
      playerEmsgHandler);
}
 
Example #23
Source File: DefaultDashChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DashChunkSource createDashChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    DashManifest manifest,
    int periodIndex,
    int[] adaptationSetIndices,
    TrackSelection trackSelection,
    int trackType,
    long elapsedRealtimeOffsetMs,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable PlayerTrackEmsgHandler playerEmsgHandler,
    @Nullable TransferListener transferListener) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  if (transferListener != null) {
    dataSource.addTransferListener(transferListener);
  }
  return new DefaultDashChunkSource(
      manifestLoaderErrorThrower,
      manifest,
      periodIndex,
      adaptationSetIndices,
      trackSelection,
      trackType,
      dataSource,
      elapsedRealtimeOffsetMs,
      maxSegmentsPerLoad,
      enableEventMessageTrack,
      closedCaptionFormats,
      playerEmsgHandler);
}
 
Example #24
Source File: DashMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffsetMs,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #25
Source File: SsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void prepareSourceInternal(@Nullable TransferListener mediaTransferListener) {
  this.mediaTransferListener = mediaTransferListener;
  if (sideloadedManifest) {
    manifestLoaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest();
  } else {
    manifestDataSource = manifestDataSourceFactory.createDataSource();
    manifestLoader = new Loader("Loader:Manifest");
    manifestLoaderErrorThrower = manifestLoader;
    manifestRefreshHandler = new Handler();
    startLoadingManifest();
  }
}
 
Example #26
Source File: DefaultSsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SsChunkSource createChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest,
    int elementIndex,
    TrackSelection trackSelection,
    @Nullable TransferListener transferListener) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  if (transferListener != null) {
    dataSource.addTransferListener(transferListener);
  }
  return new DefaultSsChunkSource(
      manifestLoaderErrorThrower, manifest, elementIndex, trackSelection, dataSource);
}
 
Example #27
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffset,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffset = elapsedRealtimeOffset;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #28
Source File: DefaultSsChunkSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SsChunkSource createChunkSource(
    LoaderErrorThrower manifestLoaderErrorThrower,
    SsManifest manifest,
    int elementIndex,
    TrackSelection trackSelection,
    TrackEncryptionBox[] trackEncryptionBoxes,
    @Nullable TransferListener transferListener) {
  DataSource dataSource = dataSourceFactory.createDataSource();
  if (transferListener != null) {
    dataSource.addTransferListener(transferListener);
  }
  return new DefaultSsChunkSource(manifestLoaderErrorThrower, manifest, elementIndex,
      trackSelection, dataSource, trackEncryptionBoxes);
}
 
Example #29
Source File: DashMediaPeriod.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffsetMs,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result =
      buildTrackGroups(drmSessionManager, period.adaptationSets, eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #30
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
protected void prepareSourceInternal(@Nullable TransferListener mediaTransferListener) {
  this.mediaTransferListener = mediaTransferListener;
  drmSessionManager.prepare();
  if (sideloadedManifest) {
    manifestLoaderErrorThrower = new LoaderErrorThrower.Dummy();
    processManifest();
  } else {
    manifestDataSource = manifestDataSourceFactory.createDataSource();
    manifestLoader = new Loader("Loader:Manifest");
    manifestLoaderErrorThrower = manifestLoader;
    manifestRefreshHandler = new Handler();
    startLoadingManifest();
  }
}