Class DrmInitData
java.lang.Object
com.castlabs.sdk.base.subtitles.utilities.DrmInitData
- All Implemented Interfaces:
Parcelable
,Comparator<DrmInitData.SchemeData>
public final class DrmInitData
extends Object
implements Comparator<DrmInitData.SchemeData>, Parcelable
Initialization data for one or more DRM schemes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Scheme initialization data.Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Parcelable.Creator<DrmInitData>
final int
Number ofDrmInitData.SchemeData
s.final String
The protection scheme type, or null if not applicable or unknown.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorsConstructorDescriptionDrmInitData
(DrmInitData.SchemeData... schemeDatas) DrmInitData
(String schemeType, DrmInitData.SchemeData... schemeDatas) DrmInitData
(String schemeType, List<DrmInitData.SchemeData> schemeDatas) DrmInitData
(List<DrmInitData.SchemeData> schemeDatas) -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(DrmInitData.SchemeData first, DrmInitData.SchemeData second) copyWithSchemeType
(String schemeType) Returns a copy with the specified protection scheme type.static DrmInitData
createSessionCreationData
(DrmInitData manifestData, DrmInitData mediaData) MergesDrmInitData
obtained from a media manifest and a media stream.int
boolean
get
(int index) Retrieves theDrmInitData.SchemeData
at a given index.Deprecated.boolean
hasEqualSchemeDatas
(DrmInitData other) Returns whether the DrmInitData has equalDrmInitData.SchemeData
s to the one provided.int
hashCode()
boolean
hasMatchingSchemeData
(DrmInitData other) Returns whether the DrmInitData has at least one equalDrmInitData.SchemeData
to the one provided.merge
(DrmInitData drmInitData) Returns an instance containing theschemeDatas
from both this andother
.void
writeToParcel
(Parcel dest, int flags) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
schemeType
The protection scheme type, or null if not applicable or unknown. -
schemeDataCount
public final int schemeDataCountNumber ofDrmInitData.SchemeData
s. -
CREATOR
-
-
Constructor Details
-
DrmInitData
- Parameters:
schemeDatas
- Scheme initialization data for possibly multiple DRM schemes.
-
DrmInitData
- Parameters:
schemeType
- SeeschemeType
.schemeDatas
- Scheme initialization data for possibly multiple DRM schemes.
-
DrmInitData
- Parameters:
schemeDatas
- Scheme initialization data for possibly multiple DRM schemes.
-
DrmInitData
- Parameters:
schemeType
- SeeschemeType
.schemeDatas
- Scheme initialization data for possibly multiple DRM schemes.
-
-
Method Details
-
createSessionCreationData
@Nullable public static DrmInitData createSessionCreationData(@Nullable DrmInitData manifestData, @Nullable DrmInitData mediaData) MergesDrmInitData
obtained from a media manifest and a media stream.The result is generated as follows.
- Include all
DrmInitData.SchemeData
s frommanifestData
whereDrmInitData.SchemeData.hasData()
is true. - Include all
DrmInitData.SchemeData
s inmediaData
whereDrmInitData.SchemeData.hasData()
is true and for which we did not include an entry from the manifest targeting the same UUID. - If available, the scheme type from the manifest is used. If not, the scheme type from the media is used.
- Parameters:
manifestData
- DRM session acquisition data obtained from the manifest.mediaData
- DRM session acquisition data obtained from the media.- Returns:
- A
DrmInitData
obtained from merging a media manifest and a media stream.
- Include all
-
get
Deprecated.Useget(int)
andDrmInitData.SchemeData.matches(UUID)
instead.Retrieves data for a given DRM scheme, specified by its UUID.- Parameters:
uuid
- The DRM scheme's UUID.- Returns:
- The initialization data for the scheme, or null if the scheme is not supported.
-
get
Retrieves theDrmInitData.SchemeData
at a given index.- Parameters:
index
- The index of the scheme to return. Must not exceedschemeDataCount
.- Returns:
- The
DrmInitData.SchemeData
at the specified index.
-
copyWithSchemeType
Returns a copy with the specified protection scheme type.- Parameters:
schemeType
- A protection scheme type. May be null.- Returns:
- A copy with the specified protection scheme type.
-
merge
Returns an instance containing theschemeDatas
from both this andother
. TheschemeType
of the instances being merged must either match, or at least one scheme type must benull
.- Parameters:
drmInitData
- The instance to merge.- Returns:
- The merged result.
-
hashCode
public int hashCode() -
equals
- Specified by:
equals
in interfaceComparator<DrmInitData.SchemeData>
- Overrides:
equals
in classObject
-
hasEqualSchemeDatas
Returns whether the DrmInitData has equalDrmInitData.SchemeData
s to the one provided.- Parameters:
other
- other DrmInitData which to compare the schemeDatas to- Returns:
- true if the underlying schemeDatas are equal
-
hasMatchingSchemeData
Returns whether the DrmInitData has at least one equalDrmInitData.SchemeData
to the one provided.- Parameters:
other
- other DrmInitData which to compare the schemeDatas to- Returns:
- true if at least one of the underlying schemeDatas are equal
-
compare
- Specified by:
compare
in interfaceComparator<DrmInitData.SchemeData>
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in interfaceParcelable
-
get(int)
andDrmInitData.SchemeData.matches(UUID)
instead.