com.google.android.exoplayer2.metadata.icy.IcyHeaders Java Examples
The following examples show how to use
com.google.android.exoplayer2.metadata.icy.IcyHeaders.
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: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 5 votes |
private static Map<String, String> createIcyMetadataHeaders() { Map<String, String> headers = new HashMap<>(); headers.put( IcyHeaders.REQUEST_HEADER_ENABLE_METADATA_NAME, IcyHeaders.REQUEST_HEADER_ENABLE_METADATA_VALUE); return Collections.unmodifiableMap(headers); }
Example #2
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 #3
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 #4
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); }