FileDocCategorySizeDatePackage
MediaCrypto.javaAPI DocAndroid 5.1 API2947Thu Mar 12 22:22:30 GMT 2015android.media

MediaCrypto

public final class MediaCrypto extends Object
MediaCrypto class can be used in conjunction with {@link android.media.MediaCodec} to decode encrypted media data. Crypto schemes are assigned 16 byte UUIDs, the method {@link #isCryptoSchemeSupported} can be used to query if a given scheme is supported on the device.

Fields Summary
private long
mNativeContext
Constructors Summary
public MediaCrypto(UUID uuid, byte[] initData)
Instantiate a MediaCrypto object using opaque, crypto scheme specific data.

param
uuid The UUID of the crypto scheme.
param
initData Opaque initialization data specific to the crypto scheme.

        native_setup(getByteArrayFromUUID(uuid), initData);
    
Methods Summary
protected voidfinalize()

        native_finalize();
    
private static final byte[]getByteArrayFromUUID(java.util.UUID uuid)

        long msb = uuid.getMostSignificantBits();
        long lsb = uuid.getLeastSignificantBits();

        byte[] uuidBytes = new byte[16];
        for (int i = 0; i < 8; ++i) {
            uuidBytes[i] = (byte)(msb >>> (8 * (7 - i)));
            uuidBytes[8 + i] = (byte)(lsb >>> (8 * (7 - i)));
        }

        return uuidBytes;
    
public static final booleanisCryptoSchemeSupported(java.util.UUID uuid)
Query if the given scheme identified by its UUID is supported on this device.

param
uuid The UUID of the crypto scheme.

        return isCryptoSchemeSupportedNative(getByteArrayFromUUID(uuid));
    
private static final native booleanisCryptoSchemeSupportedNative(byte[] uuid)

private final native voidnative_finalize()

private static final native voidnative_init()

private final native voidnative_setup(byte[] uuid, byte[] initData)

public final native voidrelease()

public final native booleanrequiresSecureDecoderComponent(java.lang.String mime)
Query if the crypto scheme requires the use of a secure decoder to decode data of the given mime type.

param
mime The mime type of the media data