Package com.castlabs.android.player
Class MPDParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.google.android.exoplayer2.source.dash.manifest.DashManifestParser
com.castlabs.android.player.MPDParser
- All Implemented Interfaces:
com.google.android.exoplayer2.upstream.ParsingLoadable.Parser<com.google.android.exoplayer2.source.dash.manifest.DashManifest>,ContentHandler,DTDHandler,EntityResolver,ErrorHandler
public class MPDParser
extends com.google.android.exoplayer2.source.dash.manifest.DashManifestParser
Extends the default ExoPlayer DASH Manifest parsers.
The extension correctly parses the channel count for dolby tracks
The mspr:pro content protection entries are parsed and scheme data
are initialized for it.
The extension merges video adaptation sets when requested.
We avoid an
IllegalStateException to be raised when representations contain
inconsistent ContentProtection entries. This happens with eDash packager when using different
keys for HD and SD. We work around the issue by falling back to the first ContentProtection
that we found for a given schemeId.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.android.exoplayer2.source.dash.manifest.DashManifestParser
com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.PeriodUrlInfo -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMPDParser(boolean prescan, boolean mergeVideoAdaptationSets) Creates a new MPDParser instance.MPDParser(boolean prescan, boolean mergeVideoAdaptationSets, long minManifestUpdatePeriodMs, long availabilityStartTimeOffsetOverwriteMs) Creates a new MPDParser instance with manifest update period and availability start time offset.MPDParser(boolean prescan, boolean mergeVideoAdaptationSets, long minManifestUpdatePeriodMs, long availabilityStartTimeOffsetOverwriteMs, long subtitleSubSampleOffsetUs) Creates a new MPDParser instance with manifest update period, availability start time offset, and subtitle offset. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.android.exoplayer2.source.dash.manifest.DashManifestparse(Uri uri, InputStream inputStream) Parses a DASH manifest from the given input stream.Methods inherited from class com.google.android.exoplayer2.source.dash.manifest.DashManifestParser
maybeSkipTagMethods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
-
Field Details
-
SCHEME_ID_URL_SET_SWITCHING
Scheme ID for adaptation set switching- See Also:
-
-
Constructor Details
-
MPDParser
public MPDParser(boolean prescan, boolean mergeVideoAdaptationSets) Creates a new MPDParser instance.- Parameters:
prescan- Whether to prescan the manifest for content protection and base URLsmergeVideoAdaptationSets- Whether to merge video adaptation sets
-
MPDParser
public MPDParser(boolean prescan, boolean mergeVideoAdaptationSets, long minManifestUpdatePeriodMs, long availabilityStartTimeOffsetOverwriteMs) Creates a new MPDParser instance with manifest update period and availability start time offset.- Parameters:
prescan- Whether to prescan the manifest for content protection and base URLsmergeVideoAdaptationSets- Whether to merge video adaptation setsminManifestUpdatePeriodMs- Minimum manifest update period in millisecondsavailabilityStartTimeOffsetOverwriteMs- Override for availability start time offset in milliseconds
-
MPDParser
public MPDParser(boolean prescan, boolean mergeVideoAdaptationSets, long minManifestUpdatePeriodMs, long availabilityStartTimeOffsetOverwriteMs, long subtitleSubSampleOffsetUs) Creates a new MPDParser instance with manifest update period, availability start time offset, and subtitle offset.- Parameters:
prescan- Whether to prescan the manifest for content protection and base URLsmergeVideoAdaptationSets- Whether to merge video adaptation setsminManifestUpdatePeriodMs- Minimum manifest update period in millisecondsavailabilityStartTimeOffsetOverwriteMs- Override for availability start time offset in millisecondssubtitleSubSampleOffsetUs- Subtitle subsample offset in microseconds
-
-
Method Details
-
parse
@NonNull public com.google.android.exoplayer2.source.dash.manifest.DashManifest parse(Uri uri, InputStream inputStream) throws IOException Parses a DASH manifest from the given input stream.- Specified by:
parsein interfacecom.google.android.exoplayer2.upstream.ParsingLoadable.Parser<com.google.android.exoplayer2.source.dash.manifest.DashManifest>- Overrides:
parsein classcom.google.android.exoplayer2.source.dash.manifest.DashManifestParser- Parameters:
uri- The URI of the manifestinputStream- The input stream containing the manifest- Returns:
- The parsed DASH manifest
- Throws:
IOException- If an error occurs while reading the input stream
-