Java 类com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.EventDispatcher 实例源码

项目:Exoplayer2Radio    文件:HlsSampleStreamWrapper.java   
/**
 * @param trackType The type of the track. One of the {@link C} {@code TRACK_TYPE_*} constants.
 * @param callback A callback for the wrapper.
 * @param chunkSource A {@link HlsChunkSource} from which chunks to load are obtained.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param positionUs The position from which to start loading media.
 * @param muxedAudioFormat Optional muxed audio {@link Format} as defined by the master playlist.
 * @param minLoadableRetryCount The minimum number of times that the source should retry a load
 *     before propagating an error.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public HlsSampleStreamWrapper(int trackType, Callback callback, HlsChunkSource chunkSource,
    Allocator allocator, long positionUs, Format muxedAudioFormat, int minLoadableRetryCount,
    EventDispatcher eventDispatcher) {
  this.trackType = trackType;
  this.callback = callback;
  this.chunkSource = chunkSource;
  this.allocator = allocator;
  this.muxedAudioFormat = muxedAudioFormat;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  loader = new Loader("Loader:HlsSampleStreamWrapper");
  nextChunkHolder = new HlsChunkSource.HlsChunkHolder();
  sampleQueues = new SparseArray<>();
  mediaChunks = new LinkedList<>();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  handler = new Handler();
  lastSeekPositionUs = positionUs;
  pendingResetPositionUs = positionUs;
}
项目:K-Sonic    文件:HlsSampleStreamWrapper.java   
/**
 * @param trackType The type of the track. One of the {@link C} {@code TRACK_TYPE_*} constants.
 * @param callback A callback for the wrapper.
 * @param chunkSource A {@link HlsChunkSource} from which chunks to load are obtained.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param positionUs The position from which to start loading media.
 * @param muxedAudioFormat Optional muxed audio {@link Format} as defined by the master playlist.
 * @param minLoadableRetryCount The minimum number of times that the source should retry a load
 *     before propagating an error.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public HlsSampleStreamWrapper(int trackType, Callback callback, HlsChunkSource chunkSource,
    Allocator allocator, long positionUs, Format muxedAudioFormat, int minLoadableRetryCount,
    EventDispatcher eventDispatcher) {
  this.trackType = trackType;
  this.callback = callback;
  this.chunkSource = chunkSource;
  this.allocator = allocator;
  this.muxedAudioFormat = muxedAudioFormat;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  loader = new Loader("Loader:HlsSampleStreamWrapper");
  nextChunkHolder = new HlsChunkSource.HlsChunkHolder();
  sampleQueues = new SparseArray<>();
  mediaChunks = new LinkedList<>();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  handler = new Handler();
  lastSeekPositionUs = positionUs;
  pendingResetPositionUs = positionUs;
}
项目:K-Sonic    文件:DashMediaPeriod.java   
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;
}
项目:K-Sonic    文件:SsMediaSource.java   
private SsMediaSource(SsManifest manifest, Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory, SsManifestParser manifestParser,
    SsChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
    long livePresentationDelayMs, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null
      : Util.toLowerInvariant(manifestUri.getLastPathSegment()).equals("manifest") ? manifestUri
          : Uri.withAppendedPath(manifestUri, "Manifest");
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.eventDispatcher = new EventDispatcher(eventHandler, eventListener);
  mediaPeriods = new ArrayList<>();
}
项目:K-Sonic    文件:SsMediaPeriod.java   
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);
}
项目:videoPickPlayer    文件:HlsMediaPeriod.java   
public HlsMediaPeriod(Uri manifestUri, DataSource.Factory dataSourceFactory,
    int minLoadableRetryCount, EventDispatcher eventDispatcher,
    MediaSource.Listener sourceListener, Allocator allocator,
    long positionUs) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.sourceListener = sourceListener;
  this.allocator = allocator;
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  manifestParser = new HlsPlaylistParser();
  continueLoadingHandler = new Handler();
  manifestFetcher = new Loader("Loader:ManifestFetcher");
  preparePositionUs = positionUs;
  continueLoadingRunnable = new Runnable() {
    @Override
    public void run() {
      callback.onContinueLoadingRequested(HlsMediaPeriod.this);
    }
  };
}
项目:videoPickPlayer    文件:HlsSampleStreamWrapper.java   
/**
 * @param trackType The type of the track. One of the {@link C} {@code TRACK_TYPE_*} constants.
 * @param callback A callback for the wrapper.
 * @param chunkSource A {@link HlsChunkSource} from which chunks to load are obtained.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param positionUs The position from which to start loading media.
 * @param muxedAudioFormat If HLS master playlist indicates that the stream contains muxed audio,
 *     this is the audio {@link Format} as defined by the playlist.
 * @param muxedCaptionFormat If HLS master playlist indicates that the stream contains muxed
 *     captions, this is the audio {@link Format} as defined by the playlist.
 * @param minLoadableRetryCount The minimum number of times that the source should retry a load
 *     before propagating an error.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public HlsSampleStreamWrapper(int trackType, Callback callback, HlsChunkSource chunkSource,
    Allocator allocator, long positionUs, Format muxedAudioFormat, Format muxedCaptionFormat,
    int minLoadableRetryCount, EventDispatcher eventDispatcher) {
  this.trackType = trackType;
  this.callback = callback;
  this.chunkSource = chunkSource;
  this.allocator = allocator;
  this.muxedAudioFormat = muxedAudioFormat;
  this.muxedCaptionFormat = muxedCaptionFormat;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  loader = new Loader("Loader:HlsSampleStreamWrapper");
  nextChunkHolder = new HlsChunkSource.HlsChunkHolder();
  sampleQueues = new SparseArray<>();
  mediaChunks = new LinkedList<>();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  handler = new Handler();
  lastSeekPositionUs = positionUs;
  pendingResetPositionUs = positionUs;
}
项目:videoPickPlayer    文件:ChunkSampleStream.java   
/**
 * @param trackType The type of the track. One of the {@link C} {@code TRACK_TYPE_*} constants.
 * @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
 * @param callback An {@link Callback} for the stream.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 * @param positionUs The position from which to start loading media.
 * @param minLoadableRetryCount The minimum number of times that the source should retry a load
 *     before propagating an error.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public ChunkSampleStream(int trackType, T chunkSource,
    SequenceableLoader.Callback<ChunkSampleStream<T>> callback, Allocator allocator,
    long positionUs, int minLoadableRetryCount, EventDispatcher eventDispatcher) {
  this.trackType = trackType;
  this.chunkSource = chunkSource;
  this.callback = callback;
  this.eventDispatcher = eventDispatcher;
  this.minLoadableRetryCount = minLoadableRetryCount;
  loader = new Loader("Loader:ChunkSampleStream");
  nextChunkHolder = new ChunkHolder();
  mediaChunks = new LinkedList<>();
  readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
  sampleQueue = new DefaultTrackOutput(allocator);
  lastSeekPositionUs = positionUs;
  pendingResetPositionUs = positionUs;
}
项目:videoPickPlayer    文件:DashMediaPeriod.java   
public DashMediaPeriod(int id, DashManifest manifest, int index,
    DashChunkSource.Factory chunkSourceFactory,  int minLoadableRetryCount,
    EventDispatcher eventDispatcher, long elapsedRealtimeOffset,
    LoaderErrorThrower manifestLoaderErrorThrower, Allocator allocator) {
  this.id = id;
  this.manifest = manifest;
  this.index = index;
  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);
  period = manifest.getPeriod(index);
  trackGroups = buildTrackGroups(period);
}
项目:videoPickPlayer    文件:SsMediaPeriod.java   
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);
}
项目:Exoplayer2Radio    文件:HlsPlaylistTracker.java   
/**
 * @param initialPlaylistUri Uri for the initial playlist of the stream. Can refer a media
 *     playlist or a master playlist.
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param minRetryCount The minimum number of times the load must be retried before blacklisting a
 *     playlist.
 * @param primaryPlaylistListener A callback for the primary playlist change events.
 */
public HlsPlaylistTracker(Uri initialPlaylistUri, HlsDataSourceFactory dataSourceFactory,
    EventDispatcher eventDispatcher, int minRetryCount,
    PrimaryPlaylistListener primaryPlaylistListener) {
  this.initialPlaylistUri = initialPlaylistUri;
  this.dataSourceFactory = dataSourceFactory;
  this.eventDispatcher = eventDispatcher;
  this.minRetryCount = minRetryCount;
  this.primaryPlaylistListener = primaryPlaylistListener;
  listeners = new ArrayList<>();
  initialPlaylistLoader = new Loader("HlsPlaylistTracker:MasterPlaylist");
  playlistParser = new HlsPlaylistParser();
  playlistBundles = new IdentityHashMap<>();
  playlistRefreshHandler = new Handler();
}
项目:Exoplayer2Radio    文件:HlsMediaSource.java   
public HlsMediaSource(Uri manifestUri, HlsDataSourceFactory dataSourceFactory,
    int minLoadableRetryCount, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
}
项目:Exoplayer2Radio    文件:HlsMediaPeriod.java   
public HlsMediaPeriod(HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory,
    int minLoadableRetryCount, EventDispatcher eventDispatcher, Allocator allocator,
    long positionUs) {
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  continueLoadingHandler = new Handler();
  preparePositionUs = positionUs;
}
项目:Exoplayer2Radio    文件:ChunkSampleStream.java   
/**
 * @param primaryTrackType The type of the primary track. One of the {@link C}
 *     {@code TRACK_TYPE_*} constants.
 * @param embeddedTrackTypes The types of any embedded tracks, or null.
 * @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
 * @param callback An {@link Callback} for the stream.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 * @param positionUs The position from which to start loading media.
 * @param minLoadableRetryCount The minimum number of times that the source should retry a load
 *     before propagating an error.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public ChunkSampleStream(int primaryTrackType, int[] embeddedTrackTypes, T chunkSource,
    Callback<ChunkSampleStream<T>> callback, Allocator allocator, long positionUs,
    int minLoadableRetryCount, EventDispatcher eventDispatcher) {
  this.primaryTrackType = primaryTrackType;
  this.embeddedTrackTypes = embeddedTrackTypes;
  this.chunkSource = chunkSource;
  this.callback = callback;
  this.eventDispatcher = eventDispatcher;
  this.minLoadableRetryCount = minLoadableRetryCount;
  loader = new Loader("Loader:ChunkSampleStream");
  nextChunkHolder = new ChunkHolder();
  mediaChunks = new LinkedList<>();
  readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);

  int embeddedTrackCount = embeddedTrackTypes == null ? 0 : embeddedTrackTypes.length;
  embeddedSampleQueues = new DefaultTrackOutput[embeddedTrackCount];
  embeddedTracksSelected = new boolean[embeddedTrackCount];
  int[] trackTypes = new int[1 + embeddedTrackCount];
  DefaultTrackOutput[] sampleQueues = new DefaultTrackOutput[1 + embeddedTrackCount];

  primarySampleQueue = new DefaultTrackOutput(allocator);
  trackTypes[0] = primaryTrackType;
  sampleQueues[0] = primarySampleQueue;

  for (int i = 0; i < embeddedTrackCount; i++) {
    DefaultTrackOutput trackOutput = new DefaultTrackOutput(allocator);
    embeddedSampleQueues[i] = trackOutput;
    sampleQueues[i + 1] = trackOutput;
    trackTypes[i + 1] = embeddedTrackTypes[i];
  }

  mediaChunkOutput = new BaseMediaChunkOutput(trackTypes, sampleQueues);
  pendingResetPositionUs = positionUs;
  lastSeekPositionUs = positionUs;
}
项目:K-Sonic    文件:HlsPlaylistTracker.java   
/**
 * @param initialPlaylistUri Uri for the initial playlist of the stream. Can refer a media
 *     playlist or a master playlist.
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param minRetryCount The minimum number of times the load must be retried before blacklisting a
 *     playlist.
 * @param primaryPlaylistListener A callback for the primary playlist change events.
 */
public HlsPlaylistTracker(Uri initialPlaylistUri, HlsDataSourceFactory dataSourceFactory,
    EventDispatcher eventDispatcher, int minRetryCount,
    PrimaryPlaylistListener primaryPlaylistListener) {
  this.initialPlaylistUri = initialPlaylistUri;
  this.dataSourceFactory = dataSourceFactory;
  this.eventDispatcher = eventDispatcher;
  this.minRetryCount = minRetryCount;
  this.primaryPlaylistListener = primaryPlaylistListener;
  listeners = new ArrayList<>();
  initialPlaylistLoader = new Loader("HlsPlaylistTracker:MasterPlaylist");
  playlistParser = new HlsPlaylistParser();
  playlistBundles = new IdentityHashMap<>();
  playlistRefreshHandler = new Handler();
}
项目:K-Sonic    文件:HlsMediaSource.java   
public HlsMediaSource(Uri manifestUri, HlsDataSourceFactory dataSourceFactory,
    int minLoadableRetryCount, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
}
项目:K-Sonic    文件:HlsMediaPeriod.java   
public HlsMediaPeriod(HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory,
    int minLoadableRetryCount, EventDispatcher eventDispatcher, Allocator allocator,
    long positionUs) {
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  continueLoadingHandler = new Handler();
  preparePositionUs = positionUs;
}
项目:K-Sonic    文件:ChunkSampleStream.java   
/**
 * @param primaryTrackType The type of the primary track. One of the {@link C}
 *     {@code TRACK_TYPE_*} constants.
 * @param embeddedTrackTypes The types of any embedded tracks, or null.
 * @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
 * @param callback An {@link Callback} for the stream.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 * @param positionUs The position from which to start loading media.
 * @param minLoadableRetryCount The minimum number of times that the source should retry a load
 *     before propagating an error.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public ChunkSampleStream(int primaryTrackType, int[] embeddedTrackTypes, T chunkSource,
    Callback<ChunkSampleStream<T>> callback, Allocator allocator, long positionUs,
    int minLoadableRetryCount, EventDispatcher eventDispatcher) {
  this.primaryTrackType = primaryTrackType;
  this.embeddedTrackTypes = embeddedTrackTypes;
  this.chunkSource = chunkSource;
  this.callback = callback;
  this.eventDispatcher = eventDispatcher;
  this.minLoadableRetryCount = minLoadableRetryCount;
  loader = new Loader("Loader:ChunkSampleStream");
  nextChunkHolder = new ChunkHolder();
  mediaChunks = new LinkedList<>();
  readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);

  int embeddedTrackCount = embeddedTrackTypes == null ? 0 : embeddedTrackTypes.length;
  embeddedSampleQueues = new DefaultTrackOutput[embeddedTrackCount];
  embeddedTracksSelected = new boolean[embeddedTrackCount];
  int[] trackTypes = new int[1 + embeddedTrackCount];
  DefaultTrackOutput[] sampleQueues = new DefaultTrackOutput[1 + embeddedTrackCount];

  primarySampleQueue = new DefaultTrackOutput(allocator);
  trackTypes[0] = primaryTrackType;
  sampleQueues[0] = primarySampleQueue;

  for (int i = 0; i < embeddedTrackCount; i++) {
    DefaultTrackOutput trackOutput = new DefaultTrackOutput(allocator);
    embeddedSampleQueues[i] = trackOutput;
    sampleQueues[i + 1] = trackOutput;
    trackTypes[i + 1] = embeddedTrackTypes[i];
  }

  mediaChunkOutput = new BaseMediaChunkOutput(trackTypes, sampleQueues);
  pendingResetPositionUs = positionUs;
  lastSeekPositionUs = positionUs;
}
项目:K-Sonic    文件:DashMediaSource.java   
private DashMediaSource(DashManifest manifest, Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory, DashManifestParser manifestParser,
    DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
    long livePresentationDelayMs, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  this.manifest = manifest;
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  sideloadedManifest = manifest != null;
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  if (sideloadedManifest) {
    Assertions.checkState(!manifest.dynamic);
    manifestCallback = null;
    refreshManifestRunnable = null;
    simulateManifestRefreshRunnable = null;
  } else {
    manifestCallback = new ManifestCallback();
    refreshManifestRunnable = new Runnable() {
      @Override
      public void run() {
        startLoadingManifest();
      }
    };
    simulateManifestRefreshRunnable = new Runnable() {
      @Override
      public void run() {
        processManifest(false);
      }
    };
  }
}
项目:K-Sonic    文件:DashMediaSource.java   
@Override
public MediaPeriod createPeriod(int periodIndex, Allocator allocator, long positionUs) {
  EventDispatcher periodEventDispatcher = eventDispatcher.copyWithMediaTimeOffsetMs(
      manifest.getPeriod(periodIndex).startMs);
  DashMediaPeriod mediaPeriod = new DashMediaPeriod(firstPeriodId + periodIndex, manifest,
      periodIndex, chunkSourceFactory, minLoadableRetryCount, periodEventDispatcher,
      elapsedRealtimeOffsetMs, loaderErrorThrower, allocator);
  periodsById.put(mediaPeriod.id, mediaPeriod);
  return mediaPeriod;
}
项目:videoPickPlayer    文件:HlsMediaSource.java   
public HlsMediaSource(Uri manifestUri, DataSource.Factory dataSourceFactory,
    int minLoadableRetryCount, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
}
项目:videoPickPlayer    文件:DashMediaSource.java   
public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory,
    DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
    long livePresentationDelayMs, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
  manifestParser = new DashManifestParser(generateContentId());
  manifestCallback = new ManifestCallback();
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  refreshManifestRunnable = new Runnable() {
    @Override
    public void run() {
      startLoadingManifest();
    }
  };
  simulateManifestRefreshRunnable = new Runnable() {
    @Override
    public void run() {
      processManifest();
    }
  };
}
项目:videoPickPlayer    文件:SsMediaSource.java   
public SsMediaSource(Uri manifestUri, DataSource.Factory dataSourceFactory,
    SsChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
    long livePresentationDelayMs, Handler eventHandler,
    AdaptiveMediaSourceEventListener eventListener) {
  this.manifestUri = Util.toLowerInvariant(manifestUri.getLastPathSegment()).equals("manifest")
      ? manifestUri : Uri.withAppendedPath(manifestUri, "Manifest");
  this.dataSourceFactory = dataSourceFactory;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.eventDispatcher = new EventDispatcher(eventHandler, eventListener);
  manifestParser = new SsManifestParser();
  mediaPeriods = new ArrayList<>();
}