Java Code Examples for com.google.android.exoplayer2.C#DATA_TYPE_MEDIA
The following examples show how to use
com.google.android.exoplayer2.C#DATA_TYPE_MEDIA .
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: MediaChunk.java From MediaSDK with Apache License 2.0 | 5 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs The start time of the media contained by the chunk, in microseconds. * @param endTimeUs The end time of the media contained by the chunk, in microseconds. * @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known. */ public MediaChunk( DataSource dataSource, DataSpec dataSpec, Format trackFormat, int trackSelectionReason, @Nullable Object trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex) { super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trackFormat, trackSelectionReason, trackSelectionData, startTimeUs, endTimeUs); Assertions.checkNotNull(trackFormat); this.chunkIndex = chunkIndex; }
Example 2
Source File: MediaChunk.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs The start time of the media contained by the chunk, in microseconds. * @param endTimeUs The end time of the media contained by the chunk, in microseconds. * @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known. */ public MediaChunk( DataSource dataSource, DataSpec dataSpec, Format trackFormat, int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex) { super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trackFormat, trackSelectionReason, trackSelectionData, startTimeUs, endTimeUs); Assertions.checkNotNull(trackFormat); this.chunkIndex = chunkIndex; }
Example 3
Source File: MediaChunk.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs The start time of the media contained by the chunk, in microseconds. * @param endTimeUs The end time of the media contained by the chunk, in microseconds. * @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known. */ public MediaChunk( DataSource dataSource, DataSpec dataSpec, Format trackFormat, int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex) { super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trackFormat, trackSelectionReason, trackSelectionData, startTimeUs, endTimeUs); Assertions.checkNotNull(trackFormat); this.chunkIndex = chunkIndex; }
Example 4
Source File: MediaChunk.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs The start time of the media contained by the chunk, in microseconds. * @param endTimeUs The end time of the media contained by the chunk, in microseconds. * @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known. */ public MediaChunk( DataSource dataSource, DataSpec dataSpec, Format trackFormat, int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex) { super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trackFormat, trackSelectionReason, trackSelectionData, startTimeUs, endTimeUs); Assertions.checkNotNull(trackFormat); this.chunkIndex = chunkIndex; }
Example 5
Source File: MediaChunk.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs The start time of the media contained by the chunk, in microseconds. * @param endTimeUs The end time of the media contained by the chunk, in microseconds. * @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known. */ public MediaChunk( DataSource dataSource, DataSpec dataSpec, Format trackFormat, int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex) { super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trackFormat, trackSelectionReason, trackSelectionData, startTimeUs, endTimeUs); Assertions.checkNotNull(trackFormat); this.chunkIndex = chunkIndex; }
Example 6
Source File: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 4 votes |
/** * @param uri The {@link Uri} of the media stream. * @param dataSource The data source to read the media. * @param extractors The extractors to use to read the data source. * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}. * @param eventDispatcher A dispatcher to notify of events. * @param listener A listener to notify when information about the period changes. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache * indexing. May be null. * @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between each * invocation of {@link Callback#onContinueLoadingRequested(SequenceableLoader)}. */ // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, DrmSessionManager<?> drmSessionManager, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.drmSessionManager = drmSessionManager; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
Example 7
Source File: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 4 votes |
private void maybeFinishPrepare() { SeekMap seekMap = this.seekMap; if (released || prepared || !sampleQueuesBuilt || seekMap == null) { return; } for (SampleQueue sampleQueue : sampleQueues) { if (sampleQueue.getUpstreamFormat() == null) { return; } } loadCondition.close(); int trackCount = sampleQueues.length; TrackGroup[] trackArray = new TrackGroup[trackCount]; boolean[] trackIsAudioVideoFlags = new boolean[trackCount]; durationUs = seekMap.getDurationUs(); for (int i = 0; i < trackCount; i++) { Format trackFormat = sampleQueues[i].getUpstreamFormat(); String mimeType = trackFormat.sampleMimeType; boolean isAudio = MimeTypes.isAudio(mimeType); boolean isAudioVideo = isAudio || MimeTypes.isVideo(mimeType); trackIsAudioVideoFlags[i] = isAudioVideo; haveAudioVideoTracks |= isAudioVideo; IcyHeaders icyHeaders = this.icyHeaders; if (icyHeaders != null) { if (isAudio || sampleQueueTrackIds[i].isIcyTrack) { Metadata metadata = trackFormat.metadata; trackFormat = trackFormat.copyWithMetadata( metadata == null ? new Metadata(icyHeaders) : metadata.copyWithAppendedEntries(icyHeaders)); } if (isAudio && trackFormat.bitrate == Format.NO_VALUE && icyHeaders.bitrate != Format.NO_VALUE) { trackFormat = trackFormat.copyWithBitrate(icyHeaders.bitrate); } } trackArray[i] = new TrackGroup(trackFormat); } isLive = length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET; dataType = isLive ? C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE : C.DATA_TYPE_MEDIA; preparedState = new PreparedState(seekMap, new TrackGroupArray(trackArray), trackIsAudioVideoFlags); prepared = true; listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable(), isLive); Assertions.checkNotNull(callback).onPrepared(this); }
Example 8
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
/** * @param uri The {@link Uri} of the media stream. * @param dataSource The data source to read the media. * @param extractors The extractors to use to read the data source. * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}. * @param eventDispatcher A dispatcher to notify of events. * @param listener A listener to notify when information about the period changes. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache * indexing. May be null. * @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between each * invocation of {@link Callback#onContinueLoadingRequested(SequenceableLoader)}. */ // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
Example 9
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void maybeFinishPrepare() { SeekMap seekMap = this.seekMap; if (released || prepared || !sampleQueuesBuilt || seekMap == null) { return; } for (SampleQueue sampleQueue : sampleQueues) { if (sampleQueue.getUpstreamFormat() == null) { return; } } loadCondition.close(); int trackCount = sampleQueues.length; TrackGroup[] trackArray = new TrackGroup[trackCount]; boolean[] trackIsAudioVideoFlags = new boolean[trackCount]; durationUs = seekMap.getDurationUs(); for (int i = 0; i < trackCount; i++) { Format trackFormat = sampleQueues[i].getUpstreamFormat(); String mimeType = trackFormat.sampleMimeType; boolean isAudio = MimeTypes.isAudio(mimeType); boolean isAudioVideo = isAudio || MimeTypes.isVideo(mimeType); trackIsAudioVideoFlags[i] = isAudioVideo; haveAudioVideoTracks |= isAudioVideo; IcyHeaders icyHeaders = this.icyHeaders; if (icyHeaders != null) { if (isAudio || sampleQueueTrackIds[i].isIcyTrack) { Metadata metadata = trackFormat.metadata; trackFormat = trackFormat.copyWithMetadata( metadata == null ? new Metadata(icyHeaders) : metadata.copyWithAppendedEntries(icyHeaders)); } if (isAudio && trackFormat.bitrate == Format.NO_VALUE && icyHeaders.bitrate != Format.NO_VALUE) { trackFormat = trackFormat.copyWithBitrate(icyHeaders.bitrate); } } trackArray[i] = new TrackGroup(trackFormat); } dataType = length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET ? C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE : C.DATA_TYPE_MEDIA; preparedState = new PreparedState(seekMap, new TrackGroupArray(trackArray), trackIsAudioVideoFlags); prepared = true; listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable()); Assertions.checkNotNull(callback).onPrepared(this); }
Example 10
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 4 votes |
/** * @param uri The {@link Uri} of the media stream. * @param dataSource The data source to read the media. * @param extractors The extractors to use to read the data source. * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}. * @param eventDispatcher A dispatcher to notify of events. * @param listener A listener to notify when information about the period changes. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache * indexing. May be null. * @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between each * invocation of {@link Callback#onContinueLoadingRequested(SequenceableLoader)}. */ // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
Example 11
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void maybeFinishPrepare() { SeekMap seekMap = this.seekMap; if (released || prepared || !sampleQueuesBuilt || seekMap == null) { return; } for (SampleQueue sampleQueue : sampleQueues) { if (sampleQueue.getUpstreamFormat() == null) { return; } } loadCondition.close(); int trackCount = sampleQueues.length; TrackGroup[] trackArray = new TrackGroup[trackCount]; boolean[] trackIsAudioVideoFlags = new boolean[trackCount]; durationUs = seekMap.getDurationUs(); for (int i = 0; i < trackCount; i++) { Format trackFormat = sampleQueues[i].getUpstreamFormat(); String mimeType = trackFormat.sampleMimeType; boolean isAudio = MimeTypes.isAudio(mimeType); boolean isAudioVideo = isAudio || MimeTypes.isVideo(mimeType); trackIsAudioVideoFlags[i] = isAudioVideo; haveAudioVideoTracks |= isAudioVideo; IcyHeaders icyHeaders = this.icyHeaders; if (icyHeaders != null) { if (isAudio || sampleQueueTrackIds[i].isIcyTrack) { Metadata metadata = trackFormat.metadata; trackFormat = trackFormat.copyWithMetadata( metadata == null ? new Metadata(icyHeaders) : metadata.copyWithAppendedEntries(icyHeaders)); } if (isAudio && trackFormat.bitrate == Format.NO_VALUE && icyHeaders.bitrate != Format.NO_VALUE) { trackFormat = trackFormat.copyWithBitrate(icyHeaders.bitrate); } } trackArray[i] = new TrackGroup(trackFormat); } dataType = length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET ? C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE : C.DATA_TYPE_MEDIA; preparedState = new PreparedState(seekMap, new TrackGroupArray(trackArray), trackIsAudioVideoFlags); prepared = true; listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable()); Assertions.checkNotNull(callback).onPrepared(this); }
Example 12
Source File: MediaChunk.java From K-Sonic with MIT License | 3 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs The start time of the media contained by the chunk, in microseconds. * @param endTimeUs The end time of the media contained by the chunk, in microseconds. * @param chunkIndex The index of the chunk. */ public MediaChunk(DataSource dataSource, DataSpec dataSpec, Format trackFormat, int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs, int chunkIndex) { super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trackFormat, trackSelectionReason, trackSelectionData, startTimeUs, endTimeUs); Assertions.checkNotNull(trackFormat); this.chunkIndex = chunkIndex; }