Class PsshAtomUtil


  • @Deprecated
    public final class PsshAtomUtil
    extends Object
    Deprecated.
    com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    Utility methods for handling PSSH atoms.
    • Method Detail

      • buildPsshAtom

        public static byte[] buildPsshAtom​(UUID systemId,
                                           @Nullable
                                           byte[] data)
        Deprecated.
        Builds a version 0 PSSH atom for a given system id, containing the given data.
        Parameters:
        systemId - The system id of the scheme.
        data - The scheme specific data.
        Returns:
        The PSSH atom.
      • buildPsshAtom

        public static byte[] buildPsshAtom​(UUID systemId,
                                           @Nullable
                                           UUID[] keyIds,
                                           @Nullable
                                           byte[] data)
        Deprecated.
        Builds a PSSH atom for the given system id, containing the given key ids and data.
        Parameters:
        systemId - The system id of the scheme.
        keyIds - The key ids for a version 1 PSSH atom, or null for a version 0 PSSH atom.
        data - The scheme specific data.
        Returns:
        The PSSH atom.
      • isPsshAtom

        public static boolean isPsshAtom​(byte[] data)
        Deprecated.
        Returns whether the data is a valid PSSH atom.
        Parameters:
        data - The data to parse.
        Returns:
        Whether the data is a valid PSSH atom.
      • parseUuid

        @Nullable
        public static UUID parseUuid​(byte[] atom)
        Deprecated.
        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 - The atom to parse.
        Returns:
        The parsed UUID. Null if the input is not a valid PSSH atom, or if the PSSH atom has an unsupported version.
      • parseVersion

        public static int parseVersion​(byte[] atom)
        Deprecated.
        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 - The atom to parse.
        Returns:
        The parsed version. -1 if the input is not a valid PSSH atom, or if the PSSH atom has an unsupported version.
      • parseSchemeSpecificData

        @Nullable
        public static byte[] parseSchemeSpecificData​(byte[] atom,
                                                     UUID uuid)
        Deprecated.
        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 - The atom to parse.
        uuid - The required UUID of the PSSH atom, or null to accept any UUID.
        Returns:
        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.