public class MediaPresentationDescriptionParser extends DefaultHandler implements UriLoadable.Parser<MediaPresentationDescription>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MediaPresentationDescriptionParser.ContentProtectionsBuilder
Builds a list of
ContentProtection elements for an AdaptationSet. |
| Constructor and Description |
|---|
MediaPresentationDescriptionParser()
Equivalent to calling
new MediaPresentationDescriptionParser(null). |
MediaPresentationDescriptionParser(String contentId) |
| Modifier and Type | Method and Description |
|---|---|
protected AdaptationSet |
buildAdaptationSet(int id,
int contentType,
List<Representation> representations,
List<ContentProtection> contentProtections) |
protected ContentProtection |
buildContentProtection(String schemeIdUri,
UUID uuid,
DrmInitData.SchemeInitData data) |
protected Format |
buildFormat(String id,
String mimeType,
int width,
int height,
float frameRate,
int audioChannels,
int audioSamplingRate,
int bandwidth,
String language,
String codecs) |
protected MediaPresentationDescription |
buildMediaPresentationDescription(long availabilityStartTime,
long durationMs,
long minBufferTimeMs,
boolean dynamic,
long minUpdateTimeMs,
long timeShiftBufferDepthMs,
UtcTimingElement utcTiming,
String location,
List<Period> periods) |
protected Period |
buildPeriod(String id,
long startMs,
List<AdaptationSet> adaptationSets) |
protected RangedUri |
buildRangedUri(String urlText,
long rangeStart,
long rangeLength) |
protected Representation |
buildRepresentation(String contentId,
int revisionId,
Format format,
SegmentBase segmentBase,
String baseUrl) |
protected SegmentBase.SegmentList |
buildSegmentList(RangedUri initialization,
long timescale,
long presentationTimeOffset,
int startNumber,
long duration,
List<SegmentBase.SegmentTimelineElement> timeline,
List<RangedUri> segments) |
protected SegmentBase.SegmentTemplate |
buildSegmentTemplate(RangedUri initialization,
long timescale,
long presentationTimeOffset,
int startNumber,
long duration,
List<SegmentBase.SegmentTimelineElement> timeline,
UrlTemplate initializationTemplate,
UrlTemplate mediaTemplate) |
protected SegmentBase.SegmentTimelineElement |
buildSegmentTimelineElement(long elapsedTime,
long duration) |
protected SegmentBase.SingleSegmentBase |
buildSingleSegmentBase(RangedUri initialization,
long timescale,
long presentationTimeOffset,
long indexStart,
long indexLength) |
protected UtcTimingElement |
buildUtcTimingElement(String schemeIdUri,
String value) |
protected int |
getContentType(Representation representation) |
MediaPresentationDescription |
parse(String connectionUrl,
InputStream inputStream)
Parses an object from a response.
|
protected AdaptationSet |
parseAdaptationSet(XmlPullParser xpp,
String baseUrl,
SegmentBase segmentBase) |
protected void |
parseAdaptationSetChild(XmlPullParser xpp)
Parses children of AdaptationSet elements not specifically parsed elsewhere.
|
protected int |
parseAudioChannelConfiguration(XmlPullParser xpp) |
protected static String |
parseBaseUrl(XmlPullParser xpp,
String parentBaseUrl) |
protected ContentProtection |
parseContentProtection(XmlPullParser xpp)
Parses a
ContentProtection element. |
protected int |
parseContentType(XmlPullParser xpp) |
protected static long |
parseDateTime(XmlPullParser xpp,
String name,
long defaultValue) |
protected static long |
parseDuration(XmlPullParser xpp,
String name,
long defaultValue) |
protected static float |
parseFrameRate(XmlPullParser xpp,
float defaultValue) |
protected RangedUri |
parseInitialization(XmlPullParser xpp) |
protected static int |
parseInt(XmlPullParser xpp,
String name) |
protected static int |
parseInt(XmlPullParser xpp,
String name,
int defaultValue) |
protected static long |
parseLong(XmlPullParser xpp,
String name) |
protected static long |
parseLong(XmlPullParser xpp,
String name,
long defaultValue) |
protected MediaPresentationDescription |
parseMediaPresentationDescription(XmlPullParser xpp,
String baseUrl) |
protected Pair<Period,Long> |
parsePeriod(XmlPullParser xpp,
String baseUrl,
long defaultStartMs) |
protected RangedUri |
parseRangedUrl(XmlPullParser xpp,
String urlAttribute,
String rangeAttribute) |
protected Representation |
parseRepresentation(XmlPullParser xpp,
String baseUrl,
String adaptationSetMimeType,
String adaptationSetCodecs,
int adaptationSetWidth,
int adaptationSetHeight,
float adaptationSetFrameRate,
int adaptationSetAudioChannels,
int adaptationSetAudioSamplingRate,
String adaptationSetLanguage,
SegmentBase segmentBase,
MediaPresentationDescriptionParser.ContentProtectionsBuilder contentProtectionsBuilder) |
protected SegmentBase.SingleSegmentBase |
parseSegmentBase(XmlPullParser xpp,
SegmentBase.SingleSegmentBase parent) |
protected SegmentBase.SegmentList |
parseSegmentList(XmlPullParser xpp,
SegmentBase.SegmentList parent) |
protected SegmentBase.SegmentTemplate |
parseSegmentTemplate(XmlPullParser xpp,
SegmentBase.SegmentTemplate parent) |
protected List<SegmentBase.SegmentTimelineElement> |
parseSegmentTimeline(XmlPullParser xpp) |
protected RangedUri |
parseSegmentUrl(XmlPullParser xpp) |
protected static String |
parseString(XmlPullParser xpp,
String name,
String defaultValue) |
protected UrlTemplate |
parseUrlTemplate(XmlPullParser xpp,
String name,
UrlTemplate defaultValue) |
protected UtcTimingElement |
parseUtcTiming(XmlPullParser xpp) |
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warningpublic MediaPresentationDescriptionParser()
new MediaPresentationDescriptionParser(null).public MediaPresentationDescriptionParser(String contentId)
contentId - An optional content identifier to include in the parsed manifest.public MediaPresentationDescription parse(String connectionUrl, InputStream inputStream) throws IOException, ParserException
UriLoadable.Parserparse in interface UriLoadable.Parser<MediaPresentationDescription>connectionUrl - The source of the response, after any redirection.inputStream - An InputStream from which the response data can be read.ParserException - If an error occurs parsing the data.IOException - If an error occurs reading data from the stream.protected MediaPresentationDescription parseMediaPresentationDescription(XmlPullParser xpp, String baseUrl) throws XmlPullParserException, IOException, ParseException
protected MediaPresentationDescription buildMediaPresentationDescription(long availabilityStartTime, long durationMs, long minBufferTimeMs, boolean dynamic, long minUpdateTimeMs, long timeShiftBufferDepthMs, UtcTimingElement utcTiming, String location, List<Period> periods)
protected UtcTimingElement parseUtcTiming(XmlPullParser xpp)
protected UtcTimingElement buildUtcTimingElement(String schemeIdUri, String value)
protected Pair<Period,Long> parsePeriod(XmlPullParser xpp, String baseUrl, long defaultStartMs) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected Period buildPeriod(String id, long startMs, List<AdaptationSet> adaptationSets)
protected AdaptationSet parseAdaptationSet(XmlPullParser xpp, String baseUrl, SegmentBase segmentBase) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected AdaptationSet buildAdaptationSet(int id, int contentType, List<Representation> representations, List<ContentProtection> contentProtections)
protected int parseContentType(XmlPullParser xpp)
protected int getContentType(Representation representation)
protected ContentProtection parseContentProtection(XmlPullParser xpp) throws XmlPullParserException, IOException
ContentProtection element.ContentProtection element, or null if the element is unsupported.XmlPullParserException - If an error occurs parsing the element.IOException - If an error occurs reading the element.protected ContentProtection buildContentProtection(String schemeIdUri, UUID uuid, DrmInitData.SchemeInitData data)
protected void parseAdaptationSetChild(XmlPullParser xpp) throws XmlPullParserException, IOException
xpp - The XmpPullParser from which the AdaptationSet child should be parsed.XmlPullParserException - If an error occurs parsing the element.IOException - If an error occurs reading the element.protected Representation parseRepresentation(XmlPullParser xpp, String baseUrl, String adaptationSetMimeType, String adaptationSetCodecs, int adaptationSetWidth, int adaptationSetHeight, float adaptationSetFrameRate, int adaptationSetAudioChannels, int adaptationSetAudioSamplingRate, String adaptationSetLanguage, SegmentBase segmentBase, MediaPresentationDescriptionParser.ContentProtectionsBuilder contentProtectionsBuilder) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected Format buildFormat(String id, String mimeType, int width, int height, float frameRate, int audioChannels, int audioSamplingRate, int bandwidth, String language, String codecs)
protected Representation buildRepresentation(String contentId, int revisionId, Format format, SegmentBase segmentBase, String baseUrl)
protected SegmentBase.SingleSegmentBase parseSegmentBase(XmlPullParser xpp, SegmentBase.SingleSegmentBase parent) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected SegmentBase.SingleSegmentBase buildSingleSegmentBase(RangedUri initialization, long timescale, long presentationTimeOffset, long indexStart, long indexLength)
protected SegmentBase.SegmentList parseSegmentList(XmlPullParser xpp, SegmentBase.SegmentList parent) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected SegmentBase.SegmentList buildSegmentList(RangedUri initialization, long timescale, long presentationTimeOffset, int startNumber, long duration, List<SegmentBase.SegmentTimelineElement> timeline, List<RangedUri> segments)
protected SegmentBase.SegmentTemplate parseSegmentTemplate(XmlPullParser xpp, SegmentBase.SegmentTemplate parent) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected SegmentBase.SegmentTemplate buildSegmentTemplate(RangedUri initialization, long timescale, long presentationTimeOffset, int startNumber, long duration, List<SegmentBase.SegmentTimelineElement> timeline, UrlTemplate initializationTemplate, UrlTemplate mediaTemplate)
protected List<SegmentBase.SegmentTimelineElement> parseSegmentTimeline(XmlPullParser xpp) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected SegmentBase.SegmentTimelineElement buildSegmentTimelineElement(long elapsedTime, long duration)
protected UrlTemplate parseUrlTemplate(XmlPullParser xpp, String name, UrlTemplate defaultValue)
protected RangedUri parseInitialization(XmlPullParser xpp)
protected RangedUri parseSegmentUrl(XmlPullParser xpp)
protected RangedUri parseRangedUrl(XmlPullParser xpp, String urlAttribute, String rangeAttribute)
protected RangedUri buildRangedUri(String urlText, long rangeStart, long rangeLength)
protected int parseAudioChannelConfiguration(XmlPullParser xpp) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected static float parseFrameRate(XmlPullParser xpp, float defaultValue)
protected static long parseDuration(XmlPullParser xpp, String name, long defaultValue)
protected static long parseDateTime(XmlPullParser xpp, String name, long defaultValue) throws ParseException
ParseExceptionprotected static String parseBaseUrl(XmlPullParser xpp, String parentBaseUrl) throws XmlPullParserException, IOException
XmlPullParserExceptionIOExceptionprotected static int parseInt(XmlPullParser xpp, String name)
protected static int parseInt(XmlPullParser xpp, String name, int defaultValue)
protected static long parseLong(XmlPullParser xpp, String name)
protected static long parseLong(XmlPullParser xpp, String name, long defaultValue)
protected static String parseString(XmlPullParser xpp, String name, String defaultValue)