private ChunkSampleStream<DashChunkSource> buildSampleStream(int adaptationSetIndex, TrackSelection selection, long positionUs) { AdaptationSet adaptationSet = adaptationSets.get(adaptationSetIndex); int embeddedTrackCount = 0; int[] embeddedTrackTypes = new int[2]; boolean enableEventMessageTrack = hasEventMessageTrack(adaptationSet); if (enableEventMessageTrack) { embeddedTrackTypes[embeddedTrackCount++] = C.TRACK_TYPE_METADATA; } boolean enableCea608Track = hasCea608Track(adaptationSet); if (enableCea608Track) { embeddedTrackTypes[embeddedTrackCount++] = C.TRACK_TYPE_TEXT; } if (embeddedTrackCount < embeddedTrackTypes.length) { embeddedTrackTypes = Arrays.copyOf(embeddedTrackTypes, embeddedTrackCount); } DashChunkSource chunkSource = chunkSourceFactory.createDashChunkSource( manifestLoaderErrorThrower, manifest, periodIndex, adaptationSetIndex, selection, elapsedRealtimeOffset, enableEventMessageTrack, enableCea608Track); ChunkSampleStream<DashChunkSource> stream = new ChunkSampleStream<>(adaptationSet.type, embeddedTrackTypes, chunkSource, this, allocator, positionUs, minLoadableRetryCount, eventDispatcher); return stream; }
@Override @SuppressWarnings("unchecked") public long selectTracks(TrackSelection[] selections, boolean[] mayRetainStreamFlags, SampleStream[] streams, boolean[] streamResetFlags, long positionUs) { long returnPositionUs = super.selectTracks(selections, mayRetainStreamFlags, streams, streamResetFlags, positionUs); List<ChunkSampleStream<FakeChunkSource>> validStreams = new ArrayList<>(); for (SampleStream stream : streams) { if (stream != null) { validStreams.add((ChunkSampleStream<FakeChunkSource>) stream); } } this.sampleStreams = validStreams.toArray(new ChunkSampleStream[validStreams.size()]); this.sequenceableLoader = new CompositeSequenceableLoader(sampleStreams); return returnPositionUs; }
private ChunkSampleStream<DashChunkSource> buildSampleStream(TrackGroupInfo trackGroupInfo, TrackSelection selection, long positionUs) { int embeddedTrackCount = 0; int[] embeddedTrackTypes = new int[2]; boolean enableEventMessageTrack = trackGroupInfo.hasEmbeddedEventMessageTrack; if (enableEventMessageTrack) { embeddedTrackTypes[embeddedTrackCount++] = C.TRACK_TYPE_METADATA; } boolean enableCea608Track = trackGroupInfo.hasEmbeddedCea608Track; if (enableCea608Track) { embeddedTrackTypes[embeddedTrackCount++] = C.TRACK_TYPE_TEXT; } if (embeddedTrackCount < embeddedTrackTypes.length) { embeddedTrackTypes = Arrays.copyOf(embeddedTrackTypes, embeddedTrackCount); } DashChunkSource chunkSource = chunkSourceFactory.createDashChunkSource( manifestLoaderErrorThrower, manifest, periodIndex, trackGroupInfo.adaptationSetIndices, selection, trackGroupInfo.trackType, elapsedRealtimeOffset, enableEventMessageTrack, enableCea608Track); ChunkSampleStream<DashChunkSource> stream = new ChunkSampleStream<>(trackGroupInfo.trackType, embeddedTrackTypes, chunkSource, this, allocator, positionUs, minLoadableRetryCount, eventDispatcher); return stream; }
public void updateManifest(DashManifest manifest, int periodIndex) { this.manifest = manifest; this.periodIndex = periodIndex; adaptationSets = manifest.getPeriod(periodIndex).adaptationSets; if (sampleStreams != null) { for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { sampleStream.getChunkSource().updateManifest(manifest, periodIndex); } callback.onContinueLoadingRequested(this); } }
@Override public long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { long rendererBufferedPositionUs = sampleStream.getBufferedPositionUs(); if (rendererBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, rendererBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; }
@Override public long seekToUs(long positionUs) { for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { sampleStream.seekToUs(positionUs); } return positionUs; }
public void updateManifest(SsManifest manifest) { this.manifest = manifest; for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) { sampleStream.getChunkSource().updateManifest(manifest); } callback.onContinueLoadingRequested(this); }
@Override public long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) { long rendererBufferedPositionUs = sampleStream.getBufferedPositionUs(); if (rendererBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, rendererBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; }
@Override public long seekToUs(long positionUs) { for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) { sampleStream.seekToUs(positionUs); } return positionUs; }
private ChunkSampleStream<SsChunkSource> buildSampleStream(TrackSelection selection, long positionUs) { int streamElementIndex = trackGroups.indexOf(selection.getTrackGroup()); SsChunkSource chunkSource = chunkSourceFactory.createChunkSource(manifestLoaderErrorThrower, manifest, streamElementIndex, selection, trackEncryptionBoxes); return new ChunkSampleStream<>(manifest.streamElements[streamElementIndex].type, null, chunkSource, this, allocator, positionUs, minLoadableRetryCount, eventDispatcher); }
public void updateManifest(DashManifest manifest, int index) { this.manifest = manifest; this.index = index; period = manifest.getPeriod(index); if (sampleStreams != null) { for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { sampleStream.getChunkSource().updateManifest(manifest, index); } callback.onContinueLoadingRequested(this); } }
private ChunkSampleStream<DashChunkSource> buildSampleStream(TrackSelection selection, long positionUs) { int adaptationSetIndex = trackGroups.indexOf(selection.getTrackGroup()); AdaptationSet adaptationSet = period.adaptationSets.get(adaptationSetIndex); DashChunkSource chunkSource = chunkSourceFactory.createDashChunkSource( manifestLoaderErrorThrower, manifest, index, adaptationSetIndex, selection, elapsedRealtimeOffset); return new ChunkSampleStream<>(adaptationSet.type, chunkSource, this, allocator, positionUs, minLoadableRetryCount, eventDispatcher); }
private ChunkSampleStream<SsChunkSource> buildSampleStream(TrackSelection selection, long positionUs) { int streamElementIndex = trackGroups.indexOf(selection.getTrackGroup()); SsChunkSource chunkSource = chunkSourceFactory.createChunkSource(manifestLoaderErrorThrower, manifest, streamElementIndex, selection, trackEncryptionBoxes); return new ChunkSampleStream<>(manifest.streamElements[streamElementIndex].type, chunkSource, this, allocator, positionUs, minLoadableRetryCount, eventDispatcher); }
@Override public void release() { super.release(); for (ChunkSampleStream<FakeChunkSource> sampleStream : sampleStreams) { sampleStream.release(); } }
@Override public long seekToUs(long positionUs) { for (ChunkSampleStream<FakeChunkSource> sampleStream : sampleStreams) { sampleStream.seekToUs(positionUs); } return super.seekToUs(positionUs); }
@Override protected SampleStream createSampleStream(TrackSelection trackSelection) { FakeChunkSource chunkSource = chunkSourceFactory.createChunkSource(trackSelection, durationUs); return new ChunkSampleStream<>( MimeTypes.getTrackType(trackSelection.getSelectedFormat().sampleMimeType), null, chunkSource, this, allocator, 0, 3, eventDispatcher); }
public void updateManifest(DashManifest manifest, int periodIndex) { this.manifest = manifest; this.periodIndex = periodIndex; if (sampleStreams != null) { for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { sampleStream.getChunkSource().updateManifest(manifest, periodIndex); } callback.onContinueLoadingRequested(this); } }
public void release() { for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { sampleStream.release(); } }
@Override public void discardBuffer(long positionUs) { for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) { sampleStream.discardUnselectedEmbeddedTracksTo(positionUs); } }
@Override public void onContinueLoadingRequested(ChunkSampleStream<DashChunkSource> sampleStream) { callback.onContinueLoadingRequested(this); }
@SuppressWarnings("unchecked") private static ChunkSampleStream<DashChunkSource>[] newSampleStreamArray(int length) { return new ChunkSampleStream[length]; }
public void release() { for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) { sampleStream.release(); } }
@Override public void onContinueLoadingRequested(ChunkSampleStream<SsChunkSource> sampleStream) { callback.onContinueLoadingRequested(this); }
@SuppressWarnings("unchecked") private static ChunkSampleStream<SsChunkSource>[] newSampleStreamArray(int length) { return new ChunkSampleStream[length]; }
@Override public void onContinueLoadingRequested(ChunkSampleStream<FakeChunkSource> source) { callback.onContinueLoadingRequested(this); }