com.google.android.exoplayer2.Format Java Examples
The following examples show how to use
com.google.android.exoplayer2.Format.
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: HlsChunkSource.java From K-Sonic with MIT License | 6 votes |
/** * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param variants The available variants. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If * multiple {@link HlsChunkSource}s are used for a single playback, they should all share the * same provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. */ public HlsChunkSource(HlsPlaylistTracker playlistTracker, HlsUrl[] variants, HlsDataSourceFactory dataSourceFactory, TimestampAdjusterProvider timestampAdjusterProvider, List<Format> muxedCaptionFormats) { this.playlistTracker = playlistTracker; this.variants = variants; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; Format[] variantFormats = new Format[variants.length]; int[] initialTrackSelection = new int[variants.length]; for (int i = 0; i < variants.length; i++) { variantFormats[i] = variants[i].format; initialTrackSelection[i] = i; } mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(variantFormats); trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #2
Source File: Ac3Util.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the AC-3 format given {@code data} containing the AC3SpecificBox according to ETSI TS * 102 366 Annex F. The reading position of {@code data} will be modified. * * @param data The AC3SpecificBox to parse. * @param trackId The track identifier to set on the format. * @param language The language to set on the format. * @param drmInitData {@link DrmInitData} to be included in the format. * @return The AC-3 format parsed from data in the header. */ public static Format parseAc3AnnexFFormat( ParsableByteArray data, String trackId, String language, DrmInitData drmInitData) { int fscod = (data.readUnsignedByte() & 0xC0) >> 6; int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod]; int nextByte = data.readUnsignedByte(); int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x38) >> 3]; if ((nextByte & 0x04) != 0) { // lfeon channelCount++; } return Format.createAudioSampleFormat( trackId, MimeTypes.AUDIO_AC3, /* codecs= */ null, Format.NO_VALUE, Format.NO_VALUE, channelCount, sampleRate, /* initializationData= */ null, drmInitData, /* selectionFlags= */ 0, language); }
Example #3
Source File: AdaptiveTrackSelection.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Computes the ideal selected index ignoring buffer health. * * @param nowMs The current time in the timebase of {@link Clock#elapsedRealtime()}, or {@link * Long#MIN_VALUE} to ignore blacklisting. */ private int determineIdealSelectedIndex(long nowMs) { long effectiveBitrate = (long) (bandwidthMeter.getBitrateEstimate() * bandwidthFraction); int lowestBitrateNonBlacklistedIndex = 0; for (int i = 0; i < length; i++) { if (nowMs == Long.MIN_VALUE || !isBlacklisted(i, nowMs)) { Format format = getFormat(i); if (Math.round(format.bitrate * playbackSpeed) <= effectiveBitrate) { return i; } else { lowestBitrateNonBlacklistedIndex = i; } } } return lowestBitrateNonBlacklistedIndex; }
Example #4
Source File: UserDataReader.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void createTracks( ExtractorOutput extractorOutput, TsPayloadReader.TrackIdGenerator idGenerator) { for (int i = 0; i < outputs.length; i++) { idGenerator.generateNewId(); TrackOutput output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_TEXT); Format channelFormat = closedCaptionFormats.get(i); String channelMimeType = channelFormat.sampleMimeType; Assertions.checkArgument( MimeTypes.APPLICATION_CEA608.equals(channelMimeType) || MimeTypes.APPLICATION_CEA708.equals(channelMimeType), "Invalid closed caption mime type provided: " + channelMimeType); output.format( Format.createTextSampleFormat( idGenerator.getFormatId(), channelMimeType, /* codecs= */ null, /* bitrate= */ Format.NO_VALUE, channelFormat.selectionFlags, channelFormat.language, channelFormat.accessibilityChannel, /* drmInitData= */ null, Format.OFFSET_SAMPLE_RELATIVE, channelFormat.initializationData)); outputs[i] = output; } }
Example #5
Source File: SsManifestParser.java From K-Sonic with MIT License | 6 votes |
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException { type = parseType(parser); putNormalizedAttribute(KEY_TYPE, type); if (type == C.TRACK_TYPE_TEXT) { subType = parseRequiredString(parser, KEY_SUB_TYPE); } else { subType = parser.getAttributeValue(null, KEY_SUB_TYPE); } name = parser.getAttributeValue(null, KEY_NAME); url = parseRequiredString(parser, KEY_URL); maxWidth = parseInt(parser, KEY_MAX_WIDTH, Format.NO_VALUE); maxHeight = parseInt(parser, KEY_MAX_HEIGHT, Format.NO_VALUE); displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, Format.NO_VALUE); displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, Format.NO_VALUE); language = parser.getAttributeValue(null, KEY_LANGUAGE); putNormalizedAttribute(KEY_LANGUAGE, language); timescale = parseInt(parser, KEY_TIME_SCALE, -1); if (timescale == -1) { timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE); } startTimes = new ArrayList<>(); }
Example #6
Source File: FlacExtractor.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private static void outputFormat( FlacStreamMetadata streamMetadata, @Nullable Metadata metadata, TrackOutput output) { Format mediaFormat = Format.createAudioSampleFormat( /* id= */ null, MimeTypes.AUDIO_RAW, /* codecs= */ null, streamMetadata.bitRate(), streamMetadata.maxDecodedFrameSize(), streamMetadata.channels, streamMetadata.sampleRate, getPcmEncoding(streamMetadata.bitsPerSample), /* encoderDelay= */ 0, /* encoderPadding= */ 0, /* initializationData= */ null, /* drmInitData= */ null, /* selectionFlags= */ 0, /* language= */ null, metadata); output.format(mediaFormat); }
Example #7
Source File: HlsMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static Format deriveVideoFormat(Format variantFormat) { String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO); String sampleMimeType = MimeTypes.getMediaMimeType(codecs); return Format.createVideoContainerFormat( variantFormat.id, variantFormat.label, variantFormat.containerMimeType, sampleMimeType, codecs, variantFormat.bitrate, variantFormat.width, variantFormat.height, variantFormat.frameRate, /* initializationData= */ null, variantFormat.selectionFlags); }
Example #8
Source File: DefaultDashChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
RepresentationHolder( long periodDurationUs, int trackType, Representation representation, boolean enableEventMessageTrack, List<Format> closedCaptionFormats, TrackOutput playerEmsgTrackOutput) { this( periodDurationUs, representation, createExtractorWrapper( trackType, representation, enableEventMessageTrack, closedCaptionFormats, playerEmsgTrackOutput), /* segmentNumShift= */ 0, representation.getIndex()); }
Example #9
Source File: SsManifest.java From Telegram with GNU General Public License v2.0 | 6 votes |
public StreamElement(String baseUri, String chunkTemplate, int type, String subType, long timescale, String name, int maxWidth, int maxHeight, int displayWidth, int displayHeight, String language, Format[] formats, List<Long> chunkStartTimes, long lastChunkDuration) { this( baseUri, chunkTemplate, type, subType, timescale, name, maxWidth, maxHeight, displayWidth, displayHeight, language, formats, chunkStartTimes, Util.scaleLargeTimestamps(chunkStartTimes, C.MICROS_PER_SECOND, timescale), Util.scaleLargeTimestamp(lastChunkDuration, C.MICROS_PER_SECOND, timescale)); }
Example #10
Source File: DashManifestParser.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
protected static int parseCea608AccessibilityChannel( List<Descriptor> accessibilityDescriptors) { for (int i = 0; i < accessibilityDescriptors.size(); i++) { Descriptor descriptor = accessibilityDescriptors.get(i); if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri) && descriptor.value != null) { Matcher accessibilityValueMatcher = CEA_608_ACCESSIBILITY_PATTERN.matcher(descriptor.value); if (accessibilityValueMatcher.matches()) { return Integer.parseInt(accessibilityValueMatcher.group(1)); } else { Log.w(TAG, "Unable to parse CEA-608 channel number from: " + descriptor.value); } } } return Format.NO_VALUE; }
Example #11
Source File: FfmpegDecoder.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FfmpegDecoder( int numInputBuffers, int numOutputBuffers, int initialInputBufferSize, Format format, boolean outputFloat) throws FfmpegDecoderException { super(new DecoderInputBuffer[numInputBuffers], new SimpleOutputBuffer[numOutputBuffers]); Assertions.checkNotNull(format.sampleMimeType); codecName = Assertions.checkNotNull( FfmpegLibrary.getCodecName(format.sampleMimeType, format.pcmEncoding)); extraData = getExtraData(format.sampleMimeType, format.initializationData); encoding = outputFloat ? C.ENCODING_PCM_FLOAT : C.ENCODING_PCM_16BIT; outputBufferSize = outputFloat ? OUTPUT_BUFFER_SIZE_32BIT : OUTPUT_BUFFER_SIZE_16BIT; nativeContext = ffmpegInitialize(codecName, extraData, outputFloat, format.sampleRate, format.channelCount); if (nativeContext == 0) { throw new FfmpegDecoderException("Initialization failed."); } setInitialInputBufferSize(initialInputBufferSize); }
Example #12
Source File: SsManifest.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public StreamElement(String baseUri, String chunkTemplate, int type, String subType, long timescale, String name, int maxWidth, int maxHeight, int displayWidth, int displayHeight, String language, Format[] formats, List<Long> chunkStartTimes, long lastChunkDuration) { this( baseUri, chunkTemplate, type, subType, timescale, name, maxWidth, maxHeight, displayWidth, displayHeight, language, formats, chunkStartTimes, Util.scaleLargeTimestamps(chunkStartTimes, C.MICROS_PER_SECOND, timescale), Util.scaleLargeTimestamp(lastChunkDuration, C.MICROS_PER_SECOND, timescale)); }
Example #13
Source File: SoftVideoRenderer.java From DanDanPlayForAndroid with MIT License | 6 votes |
@Override public int supportsFormat(Format format) { if (!DecoderSoLibrary.isAvailable() || !(MimeTypes.VIDEO_MP4.equalsIgnoreCase(format.sampleMimeType) || MimeTypes.VIDEO_H264.equalsIgnoreCase(format.sampleMimeType) || MimeTypes.VIDEO_H265.equalsIgnoreCase(format.sampleMimeType) || MimeTypes.VIDEO_MPEG.equalsIgnoreCase(format.sampleMimeType) || MimeTypes.VIDEO_MPEG2.equalsIgnoreCase(format.sampleMimeType)) ) { return FORMAT_UNSUPPORTED_TYPE; } else if (!supportsFormatDrm(drmSessionManager, format.drmInitData)) { return FORMAT_UNSUPPORTED_DRM; } // ffmpeg解码需要 if (format.initializationData == null || format.initializationData.size() <= 0) { return FORMAT_EXCEEDS_CAPABILITIES; } return FORMAT_HANDLED | ADAPTIVE_SEAMLESS; }
Example #14
Source File: MetadataDecoderFactory.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public MetadataDecoder createDecoder(Format format) { switch (format.sampleMimeType) { case MimeTypes.APPLICATION_ID3: return new Id3Decoder(); case MimeTypes.APPLICATION_EMSG: return new EventMessageDecoder(); case MimeTypes.APPLICATION_SCTE35: return new SpliceInfoDecoder(); case MimeTypes.APPLICATION_ICY: return new IcyDecoder(); default: throw new IllegalArgumentException( "Attempted to create decoder for unsupported format"); } }
Example #15
Source File: AudioTagPayloadReader.java From LiveVideoBroadcaster with Apache License 2.0 | 6 votes |
@Override protected boolean parseHeader(ParsableByteArray data) throws UnsupportedFormatException { if (!hasParsedAudioDataHeader) { int header = data.readUnsignedByte(); audioFormat = (header >> 4) & 0x0F; // TODO: Add support for MP3. if (audioFormat == AUDIO_FORMAT_ALAW || audioFormat == AUDIO_FORMAT_ULAW) { String type = audioFormat == AUDIO_FORMAT_ALAW ? MimeTypes.AUDIO_ALAW : MimeTypes.AUDIO_ULAW; int pcmEncoding = (header & 0x01) == 1 ? C.ENCODING_PCM_16BIT : C.ENCODING_PCM_8BIT; Format format = Format.createAudioSampleFormat(null, type, null, Format.NO_VALUE, Format.NO_VALUE, 1, 8000, pcmEncoding, null, null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat != AUDIO_FORMAT_AAC) { throw new UnsupportedFormatException("Audio format not supported: " + audioFormat); } hasParsedAudioDataHeader = true; } else { // Skip header if it was parsed previously. data.skipBytes(1); } return true; }
Example #16
Source File: BaseTrackSelection.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * @param group The {@link TrackGroup}. Must not be null. * @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be * null or empty. May be in any order. */ public BaseTrackSelection(TrackGroup group, int... tracks) { Assertions.checkState(tracks.length > 0); this.group = Assertions.checkNotNull(group); this.length = tracks.length; // Set the formats, sorted in order of decreasing bandwidth. formats = new Format[length]; for (int i = 0; i < tracks.length; i++) { formats[i] = group.getFormat(tracks[i]); } Arrays.sort(formats, new DecreasingBandwidthComparator()); // Set the format indices in the same order. this.tracks = new int[length]; for (int i = 0; i < length; i++) { this.tracks[i] = group.indexOf(formats[i]); } blacklistUntilTimes = new long[length]; }
Example #17
Source File: SpliceInfoSectionReader.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void consume(ParsableByteArray sectionData) { if (!formatDeclared) { if (timestampAdjuster.getTimestampOffsetUs() == C.TIME_UNSET) { // There is not enough information to initialize the timestamp adjuster. return; } output.format(Format.createSampleFormat(null, MimeTypes.APPLICATION_SCTE35, timestampAdjuster.getTimestampOffsetUs())); formatDeclared = true; } int sampleSize = sectionData.bytesLeft(); output.sampleData(sectionData, sampleSize); output.sampleMetadata(timestampAdjuster.getLastAdjustedTimestampUs(), C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null); }
Example #18
Source File: FfmpegAudioRenderer.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private boolean shouldUseFloatOutput(Format inputFormat) { Assertions.checkNotNull(inputFormat.sampleMimeType); if (!enableFloatOutput || !supportsOutput(inputFormat.channelCount, C.ENCODING_PCM_FLOAT)) { return false; } switch (inputFormat.sampleMimeType) { case MimeTypes.AUDIO_RAW: // For raw audio, output in 32-bit float encoding if the bit depth is > 16-bit. return inputFormat.pcmEncoding == C.ENCODING_PCM_24BIT || inputFormat.pcmEncoding == C.ENCODING_PCM_32BIT || inputFormat.pcmEncoding == C.ENCODING_PCM_FLOAT; case MimeTypes.AUDIO_AC3: // AC-3 is always 16-bit, so there is no point outputting in 32-bit float encoding. return false; default: // For all other formats, assume that it's worth using 32-bit float encoding. return true; } }
Example #19
Source File: Util.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the frame size for audio with {@code channelCount} channels in the specified encoding. * * @param pcmEncoding The encoding of the audio data. * @param channelCount The channel count. * @return The size of one audio frame in bytes. */ public static int getPcmFrameSize(@C.PcmEncoding int pcmEncoding, int channelCount) { switch (pcmEncoding) { case C.ENCODING_PCM_8BIT: return channelCount; case C.ENCODING_PCM_16BIT: return channelCount * 2; case C.ENCODING_PCM_24BIT: return channelCount * 3; case C.ENCODING_PCM_32BIT: case C.ENCODING_PCM_FLOAT: return channelCount * 4; case C.ENCODING_INVALID: case Format.NO_VALUE: default: throw new IllegalArgumentException(); } }
Example #20
Source File: Ac3Reader.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Parses the sample header. */ @SuppressWarnings("ReferenceEquality") private void parseHeader() { headerScratchBits.setPosition(0); SyncFrameInfo frameInfo = Ac3Util.parseAc3SyncframeInfo(headerScratchBits); if (format == null || frameInfo.channelCount != format.channelCount || frameInfo.sampleRate != format.sampleRate || frameInfo.mimeType != format.sampleMimeType) { format = Format.createAudioSampleFormat(trackFormatId, frameInfo.mimeType, null, Format.NO_VALUE, Format.NO_VALUE, frameInfo.channelCount, frameInfo.sampleRate, null, null, 0, language); output.format(format); } sampleSize = frameInfo.frameSize; // In this class a sample is an access unit (syncframe in AC-3), but the MediaFormat sample rate // specifies the number of PCM audio samples per second. sampleDurationUs = C.MICROS_PER_SECOND * frameInfo.sampleCount / format.sampleRate; }
Example #21
Source File: FragmentedMp4Extractor.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param flags Flags that control the extractor's behavior. * @param timestampAdjuster Adjusts sample timestamps. May be null if no adjustment is needed. * @param sideloadedTrack Sideloaded track information, in the case that the extractor will not * receive a moov box in the input data. Null if a moov box is expected. * @param sideloadedDrmInitData The {@link DrmInitData} to use for encrypted tracks. If null, the * pssh boxes (if present) will be used. * @param closedCaptionFormats For tracks that contain SEI messages, the formats of the closed * caption channels to expose. * @param additionalEmsgTrackOutput An extra track output that will receive all emsg messages * targeting the player, even if {@link #FLAG_ENABLE_EMSG_TRACK} is not set. Null if special * handling of emsg messages for players is not required. */ public FragmentedMp4Extractor( @Flags int flags, @Nullable TimestampAdjuster timestampAdjuster, @Nullable Track sideloadedTrack, @Nullable DrmInitData sideloadedDrmInitData, List<Format> closedCaptionFormats, @Nullable TrackOutput additionalEmsgTrackOutput) { this.flags = flags | (sideloadedTrack != null ? FLAG_SIDELOADED : 0); this.timestampAdjuster = timestampAdjuster; this.sideloadedTrack = sideloadedTrack; this.sideloadedDrmInitData = sideloadedDrmInitData; this.closedCaptionFormats = Collections.unmodifiableList(closedCaptionFormats); this.additionalEmsgTrackOutput = additionalEmsgTrackOutput; atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE); nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE); nalPrefix = new ParsableByteArray(5); nalBuffer = new ParsableByteArray(); extendedTypeScratch = new byte[16]; containerAtoms = new ArrayDeque<>(); pendingMetadataSampleInfos = new ArrayDeque<>(); trackBundles = new SparseArray<>(); durationUs = C.TIME_UNSET; pendingSeekTimeUs = C.TIME_UNSET; segmentIndexEarliestPresentationTimeUs = C.TIME_UNSET; enterReadingAtomHeaderState(); }
Example #22
Source File: SampleQueue.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * Adjusts a {@link Format} to incorporate a sample offset into {@link Format#subsampleOffsetUs}. * * @param format The {@link Format} to adjust. * @param sampleOffsetUs The offset to apply. * @return The adjusted {@link Format}. */ private static Format getAdjustedSampleFormat(Format format, long sampleOffsetUs) { if (format == null) { return null; } if (sampleOffsetUs != 0 && format.subsampleOffsetUs != Format.OFFSET_SAMPLE_RELATIVE) { format = format.copyWithSubsampleOffsetUs(format.subsampleOffsetUs + sampleOffsetUs); } return format; }
Example #23
Source File: MediaCodecSelector.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public List<MediaCodecInfo> getDecoderInfos(Format format, boolean requiresSecureDecoder) throws DecoderQueryException { List<MediaCodecInfo> decoderInfos = MediaCodecUtil.getDecoderInfos(format.sampleMimeType, requiresSecureDecoder); return decoderInfos.isEmpty() ? Collections.emptyList() : Collections.singletonList(decoderInfos.get(0)); }
Example #24
Source File: PlaybackStatsListener.java From MediaSDK with Apache License 2.0 | 5 votes |
private void maybeUpdateAudioFormat(EventTime eventTime, @Nullable Format newFormat) { if (Util.areEqual(currentAudioFormat, newFormat)) { return; } maybeRecordAudioFormatTime(eventTime.realtimeMs); if (newFormat != null && initialAudioFormatBitrate == C.LENGTH_UNSET && newFormat.bitrate != Format.NO_VALUE) { initialAudioFormatBitrate = newFormat.bitrate; } currentAudioFormat = newFormat; if (keepHistory) { audioFormatHistory.add(Pair.create(eventTime, currentAudioFormat)); } }
Example #25
Source File: MediaCodecRenderer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DecoderInitializationException(Format format, Throwable cause, boolean secureDecoderRequired, String decoderName) { this( "Decoder init failed: " + decoderName + ", " + format, cause, format.sampleMimeType, secureDecoderRequired, decoderName, Util.SDK_INT >= 21 ? getDiagnosticInfoV21(cause) : null, /* fallbackDecoderInitializationException= */ null); }
Example #26
Source File: Chunk.java From K-Sonic with MIT License | 5 votes |
/** * @param dataSource The source from which the data should be loaded. * @param dataSpec Defines the data to be loaded. * @param type See {@link #type}. * @param trackFormat See {@link #trackFormat}. * @param trackSelectionReason See {@link #trackSelectionReason}. * @param trackSelectionData See {@link #trackSelectionData}. * @param startTimeUs See {@link #startTimeUs}. * @param endTimeUs See {@link #endTimeUs}. */ public Chunk(DataSource dataSource, DataSpec dataSpec, int type, Format trackFormat, int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs) { this.dataSource = Assertions.checkNotNull(dataSource); this.dataSpec = Assertions.checkNotNull(dataSpec); this.type = type; this.trackFormat = trackFormat; this.trackSelectionReason = trackSelectionReason; this.trackSelectionData = trackSelectionData; this.startTimeUs = startTimeUs; this.endTimeUs = endTimeUs; }
Example #27
Source File: SsManifestParser.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public Object build() { Format[] formatArray = new Format[formats.size()]; formats.toArray(formatArray); return new StreamElement(baseUri, url, type, subType, timescale, name, maxWidth, maxHeight, displayWidth, displayHeight, language, formatArray, startTimes, lastChunkDuration); }
Example #28
Source File: ExoPlayerHelper.java From ExoPlayer-Wrapper with Apache License 2.0 | 5 votes |
private MediaSource addSubTitlesToMediaSource(MediaSource mediaSource, String subTitlesUrl) { Format textFormat = Format.createTextSampleFormat(null, MimeTypes.APPLICATION_SUBRIP, null, Format.NO_VALUE, Format.NO_VALUE, "en", Format.NO_VALUE, null); Uri uri = Uri.parse(subTitlesUrl); MediaSource subtitleSource = new SingleSampleMediaSource.Factory(mDataSourceFactory) .createMediaSource(uri, textFormat, C.TIME_UNSET); return new MergingMediaSource(mediaSource, subtitleSource); }
Example #29
Source File: MediaSourceEventListener.java From MediaSDK with Apache License 2.0 | 5 votes |
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */ public void loadCanceled( DataSpec dataSpec, Uri uri, Map<String, List<String>> responseHeaders, int dataType, int trackType, @Nullable Format trackFormat, int trackSelectionReason, @Nullable Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs, long elapsedRealtimeMs, long loadDurationMs, long bytesLoaded) { loadCanceled( new LoadEventInfo( dataSpec, uri, responseHeaders, elapsedRealtimeMs, loadDurationMs, bytesLoaded), new MediaLoadData( dataType, trackType, trackFormat, trackSelectionReason, trackSelectionData, adjustMediaTime(mediaStartTimeUs), adjustMediaTime(mediaEndTimeUs))); }
Example #30
Source File: Representation.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * @param revisionId Identifies the revision of the content. * @param format The format of the representation. * @param baseUrl The base URL of the representation. * @param segmentBase The segment base underlying the representation. * @param inbandEventStreams The in-band event streams in the representation. May be null. */ public MultiSegmentRepresentation( long revisionId, Format format, String baseUrl, MultiSegmentBase segmentBase, List<Descriptor> inbandEventStreams) { super(revisionId, format, baseUrl, segmentBase, inbandEventStreams); this.segmentBase = segmentBase; }