@UnstableApi
class PsshAtomUtil


Utility methods for handling PSSH atoms.

Summary

Nested types

A class representing the mp4 PSSH Atom as specified in ISO/IEC 23001-7.

Public functions

java-static ByteArray<Byte>!
buildPsshAtom(systemId: UUID!, data: ByteArray?)

Builds a version 0 PSSH atom for a given system id, containing the given data.

java-static ByteArray<Byte>!
buildPsshAtom(systemId: UUID!, keyIds: Array<UUID!>?, data: ByteArray?)

Builds a PSSH atom for the given system id, containing the given key ids and data.

java-static Boolean

Returns whether the data is a valid PSSH atom.

java-static PsshAtomUtil.PsshAtom?

Parses a PSSH atom.

java-static ByteArray<Byte>?

Parses the scheme specific data from a PSSH atom.

java-static UUID?

Parses the UUID from a PSSH atom.

java-static Int

Parses the version from a PSSH atom.

Public functions

buildPsshAtom

java-static fun buildPsshAtom(systemId: UUID!, data: ByteArray?): ByteArray<Byte>!

Builds a version 0 PSSH atom for a given system id, containing the given data.

Parameters
systemId: UUID!

The system id of the scheme.

data: ByteArray?

The scheme specific data.

Returns
ByteArray<Byte>!

The PSSH atom.

buildPsshAtom

java-static fun buildPsshAtom(systemId: UUID!, keyIds: Array<UUID!>?, data: ByteArray?): ByteArray<Byte>!

Builds a PSSH atom for the given system id, containing the given key ids and data.

Parameters
systemId: UUID!

The system id of the scheme.

keyIds: Array<UUID!>?

The key ids for a version 1 PSSH atom, or null for a version 0 PSSH atom.

data: ByteArray?

The scheme specific data.

Returns
ByteArray<Byte>!

The PSSH atom.

isPsshAtom

java-static fun isPsshAtom(data: ByteArray!): Boolean

Returns whether the data is a valid PSSH atom.

Parameters
data: ByteArray!

The data to parse.

Returns
Boolean

Whether the data is a valid PSSH atom.

parsePsshAtom

java-static fun parsePsshAtom(atom: ByteArray!): PsshAtomUtil.PsshAtom?

Parses a PSSH atom. Version 0 and 1 PSSH atoms are supported.

Parameters
atom: ByteArray!

The atom to parse.

Returns
PsshAtomUtil.PsshAtom?

The parsed PSSH atom. Null if the input is not a valid PSSH atom, or if the PSSH atom has an unsupported version.

parseSchemeSpecificData

java-static fun parseSchemeSpecificData(atom: ByteArray!, uuid: UUID!): ByteArray<Byte>?

Parses the scheme specific data from a PSSH atom. Version 0 and 1 PSSH atoms are supported.

The scheme specific data is only parsed if the data is a valid PSSH atom matching the given UUID, or if the data is a valid PSSH atom of any type in the case that the passed UUID is null.

Parameters
atom: ByteArray!

The atom to parse.

uuid: UUID!

The required UUID of the PSSH atom, or null to accept any UUID.

Returns
ByteArray<Byte>?

The parsed scheme specific data. Null if the input is not a valid PSSH atom, or if the PSSH atom has an unsupported version, or if the PSSH atom does not match the passed UUID.

parseUuid

java-static fun parseUuid(atom: ByteArray!): UUID?

Parses the UUID from a PSSH atom. Version 0 and 1 PSSH atoms are supported.

The UUID is only parsed if the data is a valid PSSH atom.

Parameters
atom: ByteArray!

The atom to parse.

Returns
UUID?

The parsed UUID. Null if the input is not a valid PSSH atom, or if the PSSH atom has an unsupported version.

parseVersion

java-static fun parseVersion(atom: ByteArray!): Int

Parses the version from a PSSH atom. Version 0 and 1 PSSH atoms are supported.

The version is only parsed if the data is a valid PSSH atom.

Parameters
atom: ByteArray!

The atom to parse.

Returns
Int

The parsed version. -1 if the input is not a valid PSSH atom, or if the PSSH atom has an unsupported version.