@UnstableApi
public final class DrmInitData implements Comparator, Parcelable


Initialization data for one or more DRM schemes.

Summary

Nested types

public final class DrmInitData.SchemeData implements Parcelable

Scheme initialization data.

Constants

static final Parcelable.Creator<DrmInitData>

Public fields

final int

Number of SchemeDatas.

final @Nullable String

The protection scheme type, or null if not applicable or unknown.

Public constructors

DrmInitData(DrmInitData.SchemeData[] schemeDatas)
DrmInitData(
    @Nullable String schemeType,
    DrmInitData.SchemeData[] schemeDatas
)
DrmInitData(
    @Nullable String schemeType,
    List<DrmInitData.SchemeData> schemeDatas
)

Public methods

int
DrmInitData

Returns a copy with the specified protection scheme type.

static @Nullable DrmInitData
createSessionCreationData(
    @Nullable DrmInitData manifestData,
    @Nullable DrmInitData mediaData
)

Merges DrmInitData obtained from a media manifest and a media stream.

int
boolean
DrmInitData.SchemeData
get(int index)

Retrieves the SchemeData at a given index.

int
DrmInitData
merge(DrmInitData drmInitData)

Returns an instance containing the schemeDatas from both this and other.

void
writeToParcel(Parcel dest, int flags)

Inherited Constants

From android.os.Parcelable
static final int
static final int

Inherited methods

From java.util.Comparator
static Comparator<T>
<T, U> comparing(
    Function<T, U> keyExtractor,
    Comparator<U> keyComparator
)
static Comparator<T>
<T> comparingDouble(ToDoubleFunction<T> keyExtractor)
static Comparator<T>
<T> comparingInt(ToIntFunction<T> keyExtractor)
static Comparator<T>
<T> comparingLong(ToLongFunction<T> keyExtractor)
static Comparator<T>
<T extends Comparable<T>> naturalOrder()
static Comparator<T>
<T> nullsFirst(Comparator<T> comparator)
static Comparator<T>
<T> nullsLast(Comparator<T> comparator)
static Comparator<T>
<T extends Comparable<T>> reverseOrder()
Comparator<T>
Comparator<T>
Comparator<T>
Comparator<T>
Comparator<T>

Constants

CREATOR

public static final Parcelable.Creator<DrmInitDataCREATOR

Public fields

schemeDataCount

public final int schemeDataCount

Number of SchemeDatas.

schemeType

public final @Nullable String schemeType

The protection scheme type, or null if not applicable or unknown.

Public constructors

DrmInitData

public DrmInitData(DrmInitData.SchemeData[] schemeDatas)
Parameters
DrmInitData.SchemeData[] schemeDatas

Scheme initialization data for possibly multiple DRM schemes.

DrmInitData

public DrmInitData(List<DrmInitData.SchemeData> schemeDatas)
Parameters
List<DrmInitData.SchemeData> schemeDatas

Scheme initialization data for possibly multiple DRM schemes.

DrmInitData

public DrmInitData(
    @Nullable String schemeType,
    DrmInitData.SchemeData[] schemeDatas
)
Parameters
@Nullable String schemeType

See schemeType.

DrmInitData.SchemeData[] schemeDatas

Scheme initialization data for possibly multiple DRM schemes.

DrmInitData

public DrmInitData(
    @Nullable String schemeType,
    List<DrmInitData.SchemeData> schemeDatas
)
Parameters
@Nullable String schemeType

See schemeType.

List<DrmInitData.SchemeData> schemeDatas

Scheme initialization data for possibly multiple DRM schemes.

Public methods

compare

public int compare(DrmInitData.SchemeData first, DrmInitData.SchemeData second)

copyWithSchemeType

public DrmInitData copyWithSchemeType(@Nullable String schemeType)

Returns a copy with the specified protection scheme type.

Parameters
@Nullable String schemeType

A protection scheme type. May be null.

Returns
DrmInitData

A copy with the specified protection scheme type.

createSessionCreationData

public static @Nullable DrmInitData createSessionCreationData(
    @Nullable DrmInitData manifestData,
    @Nullable DrmInitData mediaData
)

Merges DrmInitData obtained from a media manifest and a media stream.

The result is generated as follows.

  1. Include all SchemeDatas from manifestData where hasData is true.
  2. Include all SchemeDatas in mediaData where hasData is true and for which we did not include an entry from the manifest targeting the same UUID.
  3. If available, the scheme type from the manifest is used. If not, the scheme type from the media is used.
Parameters
@Nullable DrmInitData manifestData

DRM session acquisition data obtained from the manifest.

@Nullable DrmInitData mediaData

DRM session acquisition data obtained from the media.

Returns
@Nullable DrmInitData

A DrmInitData obtained from merging a media manifest and a media stream.

describeContents

public int describeContents()

equals

public boolean equals(@Nullable Object obj)

get

public DrmInitData.SchemeData get(int index)

Retrieves the SchemeData at a given index.

Parameters
int index

The index of the scheme to return. Must not exceed schemeDataCount.

Returns
DrmInitData.SchemeData

The SchemeData at the specified index.

hashCode

public int hashCode()

merge

public DrmInitData merge(DrmInitData drmInitData)

Returns an instance containing the schemeDatas from both this and other. The schemeType of the instances being merged must either match, or at least one scheme type must be null.

Parameters
DrmInitData drmInitData

The instance to merge.

Returns
DrmInitData

The merged result.

writeToParcel

public void writeToParcel(Parcel dest, int flags)