com.google.android.exoplayer.dash.mpd.MediaPresentationDescription Java Examples
The following examples show how to use
com.google.android.exoplayer.dash.mpd.MediaPresentationDescription.
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: DashRendererBuilder.java From AndroidTvDemo with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #2
Source File: DashRendererBuilder.java From ShareBox with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #3
Source File: DashRendererBuilder.java From talk-android with MIT License | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #4
Source File: DashRendererBuilder.java From droidkaigi2016 with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #5
Source File: DashRendererBuilder.java From WliveTV with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #6
Source File: DashRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public void buildRenderers(DemoPlayer player, RendererBuilderCallback callback) { this.player = player; this.callback = callback; MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser(); manifestFetcher = new ManifestFetcher<MediaPresentationDescription>(parser, contentId, url, userAgent); manifestFetcher.singleLoad(player.getMainHandler().getLooper(), this); }
Example #7
Source File: DashChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher, MediaPresentationDescription initialManifest, int adaptationSetIndex, int[] representationIndices, DataSource dataSource, FormatEvaluator formatEvaluator, long liveEdgeLatencyUs) { this.manifestFetcher = manifestFetcher; this.currentManifest = initialManifest; this.adaptationSetIndex = adaptationSetIndex; this.representationIndices = representationIndices; this.dataSource = dataSource; this.evaluator = formatEvaluator; this.liveEdgeLatencyUs = liveEdgeLatencyUs; this.evaluation = new Evaluation(); this.headerBuilder = new StringBuilder(); psshInfo = getPsshInfo(currentManifest, adaptationSetIndex); Representation[] representations = getFilteredRepresentations(currentManifest, adaptationSetIndex, representationIndices); long periodDurationUs = (representations[0].periodDurationMs == TrackRenderer.UNKNOWN_TIME_US) ? TrackRenderer.UNKNOWN_TIME_US : representations[0].periodDurationMs * 1000; this.trackInfo = new TrackInfo(representations[0].format.mimeType, periodDurationUs); this.formats = new Format[representations.length]; this.representationHolders = new HashMap<String, RepresentationHolder>(); int maxWidth = 0; int maxHeight = 0; for (int i = 0; i < representations.length; i++) { formats[i] = representations[i].format; maxWidth = Math.max(formats[i].width, maxWidth); maxHeight = Math.max(formats[i].height, maxHeight); Extractor extractor = mimeTypeIsWebm(formats[i].mimeType) ? new WebmExtractor() : new FragmentedMp4Extractor(); representationHolders.put(formats[i].id, new RepresentationHolder(representations[i], extractor)); } this.maxWidth = maxWidth; this.maxHeight = maxHeight; Arrays.sort(formats, new DecreasingBandwidthComparator()); }
Example #8
Source File: DashChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public void continueBuffering(long playbackPositionUs) { if (manifestFetcher == null || !currentManifest.dynamic || fatalError != null) { return; } MediaPresentationDescription newManifest = manifestFetcher.getManifest(); if (currentManifest != newManifest && newManifest != null) { Representation[] newRepresentations = DashChunkSource.getFilteredRepresentations(newManifest, adaptationSetIndex, representationIndices); for (Representation representation : newRepresentations) { RepresentationHolder representationHolder = representationHolders.get(representation.format.id); DashSegmentIndex oldIndex = representationHolder.segmentIndex; DashSegmentIndex newIndex = representation.getIndex(); int newFirstSegmentNum = newIndex.getFirstSegmentNum(); int segmentNumShift = oldIndex.getSegmentNum(newIndex.getTimeUs(newFirstSegmentNum)) - newFirstSegmentNum; representationHolder.segmentNumShift += segmentNumShift; representationHolder.segmentIndex = newIndex; } currentManifest = newManifest; finishedCurrentManifest = false; } // TODO: This is a temporary hack to avoid constantly refreshing the MPD in cases where // minUpdatePeriod is set to 0. In such cases we shouldn't refresh unless there is explicit // signaling in the stream, according to: // http://azure.microsoft.com/blog/2014/09/13/dash-live-streaming-with-azure-media-service/ long minUpdatePeriod = currentManifest.minUpdatePeriod; if (minUpdatePeriod == 0) { minUpdatePeriod = 5000; } if (finishedCurrentManifest && (SystemClock.elapsedRealtime() > manifestFetcher.getManifestLoadTimestamp() + minUpdatePeriod)) { manifestFetcher.requestRefresh(); } }
Example #9
Source File: DashChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private static Map<UUID, byte[]> getPsshInfo(MediaPresentationDescription manifest, int adaptationSetIndex) { AdaptationSet adaptationSet = manifest.periods.get(0).adaptationSets.get(adaptationSetIndex); if (adaptationSet.contentProtections.isEmpty()) { return null; } else { Map<UUID, byte[]> psshInfo = new HashMap<UUID, byte[]>(); for (ContentProtection contentProtection : adaptationSet.contentProtections) { if (contentProtection.uuid != null && contentProtection.data != null) { psshInfo.put(contentProtection.uuid, contentProtection.data); } } return psshInfo.isEmpty() ? null : psshInfo; } }
Example #10
Source File: DashChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private static MediaPresentationDescription buildManifest(List<Representation> representations) { Representation firstRepresentation = representations.get(0); AdaptationSet adaptationSet = new AdaptationSet(0, AdaptationSet.TYPE_UNKNOWN, representations); Period period = new Period(null, firstRepresentation.periodStartMs, firstRepresentation.periodDurationMs, Collections.singletonList(adaptationSet)); long duration = firstRepresentation.periodDurationMs - firstRepresentation.periodStartMs; return new MediaPresentationDescription(-1, duration, -1, false, -1, -1, null, Collections.singletonList(period)); }
Example #11
Source File: DashRendererBuilder.java From droidkaigi2016 with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #12
Source File: DashRendererBuilder.java From androidtv-sample-inputs with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #13
Source File: DashRendererBuilder.java From google-media-framework-android with Apache License 2.0 | 5 votes |
@Override public void onSingleManifest(MediaPresentationDescription manifest) { if (canceled) { return; } this.manifest = manifest; if (manifest.dynamic && manifest.utcTiming != null) { UtcTimingElementResolver.resolveTimingElement(manifestDataSource, manifest.utcTiming, manifestFetcher.getManifestLoadCompleteTimestamp(), this); } else { buildRenderers(); } }
Example #14
Source File: DashChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 3 votes |
/** * Constructor to use for live streaming. * <p> * May also be used for fixed duration content, in which case the call is equivalent to calling * the other constructor, passing {@code manifestFetcher.getManifest()} is the first argument. * * @param manifestFetcher A fetcher for the manifest, which must have already successfully * completed an initial load. * @param adaptationSetIndex The index of the adaptation set that should be used. * @param representationIndices The indices of the representations within the adaptations set * that should be used. May be null if all representations within the adaptation set should * be considered. * @param dataSource A {@link DataSource} suitable for loading the media data. * @param formatEvaluator Selects from the available formats. * @param liveEdgeLatencyMs For live streams, the number of milliseconds that the playback should * lag behind the "live edge" (i.e. the end of the most recently defined media in the * manifest). Choosing a small value will minimize latency introduced by the player, however * note that the value sets an upper bound on the length of media that the player can buffer. * Hence a small value may increase the probability of rebuffering and playback failures. */ public DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher, int adaptationSetIndex, int[] representationIndices, DataSource dataSource, FormatEvaluator formatEvaluator, long liveEdgeLatencyMs) { this(manifestFetcher, manifestFetcher.getManifest(), adaptationSetIndex, representationIndices, dataSource, formatEvaluator, liveEdgeLatencyMs * 1000); }
Example #15
Source File: DashChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 2 votes |
/** * Constructor to use for fixed duration content. * * @param manifest The manifest. * @param adaptationSetIndex The index of the adaptation set that should be used. * @param representationIndices The indices of the representations within the adaptations set * that should be used. May be null if all representations within the adaptation set should * be considered. * @param dataSource A {@link DataSource} suitable for loading the media data. * @param formatEvaluator Selects from the available formats. */ public DashChunkSource(MediaPresentationDescription manifest, int adaptationSetIndex, int[] representationIndices, DataSource dataSource, FormatEvaluator formatEvaluator) { this(null, manifest, adaptationSetIndex, representationIndices, dataSource, formatEvaluator, 0); }