Skip to main content
Version: 14 Oct 2024

ml_media_crypto.h

Functions

Name
MLResultMLMediaCryptoCreate(MLUUID uuid, const MLMediaDRMByteArray data, MLHandle out_handle)
Create a MLMediaCrypto instance from a UUID.
MLResultMLMediaCryptoRelease(MLHandle media_crypto)
Release the MLMediaCrypto instance.
MLResultMLMediaCryptoIsCryptoSchemeSupported(MLUUID uuid, bool * out_supported)
Query if the given scheme identified by its UUID is supported on this device.
MLResultMLMediaCryptoRequiresSecureDecoderComponent(const char mime_type, bool out_required)
Query if the crypto scheme requires the use of a secure decoder to decode data of the given mime type.
MLResultMLMediaCryptoSetMediaDRMSession(MLHandle media_crypto, const MLMediaDRMByteArray * session_id)
Associate a #MediaDRM session with this MLMediaCrypto instance.

Functions Documentation

MLMediaCryptoCreate

MLResult MLMediaCryptoCreate(
MLUUID uuid,
const MLMediaDRMByteArray * data,
MLHandle * out_handle
)

Create a MLMediaCrypto instance from a UUID.

Parameters

MLUUIDuuidThe universal unique ID of the crypto scheme. uuid must be 16 bytes.
const MLMediaDRMByteArray *dataOpaque initialization data specific to the crypto scheme, This value must never be NULL.
MLHandle *out_handleUpon successful return will point to handle to the created MLMediaCrypto. Or else, it will point to ML_INVALID_HANDLE.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkMLMediaCrypto object was created successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaCryptoRelease

MLResult MLMediaCryptoRelease(
MLHandle media_crypto
)

Release the MLMediaCrypto instance.

Parameters

MLHandlemedia_cryptoMLHandle to the MLMediaCrypto.

Returns

MLResultMLResult_InvalidParamMLMediaCrypto object is invalid.
MLResultMLResult_OkMLMediaCrypto object was successfully destroyed.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaCryptoIsCryptoSchemeSupported

MLResult MLMediaCryptoIsCryptoSchemeSupported(
MLUUID uuid,
bool * out_supported
)

Query if the given scheme identified by its UUID is supported on this device.

Parameters

MLUUIDuuidIdentifies the universal unique ID of the crypto scheme. uuid must be 16 bytes.
bool *out_supportedOn successful return contains true or false based on whether the given crypto scheme is supported or not.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkThe query has run successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaCryptoRequiresSecureDecoderComponent

MLResult MLMediaCryptoRequiresSecureDecoderComponent(
const char * mime_type,
bool * out_required
)

Query if the crypto scheme requires the use of a secure decoder to decode data of the given mime type.

Parameters

const char *mime_typeThe MIME type of the media container, e.g. "video/mp4".
bool *out_requiredOn successful return contains true or false based on whether the given mime type requires a secure decoder.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkThe query has run successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaCryptoSetMediaDRMSession

MLResult MLMediaCryptoSetMediaDRMSession(
MLHandle media_crypto,
const MLMediaDRMByteArray * session_id
)

Associate a #MediaDRM session with this MLMediaCrypto instance.

Parameters

MLHandlemedia_cryptoMLHandle to the MLMediaCrypto.
const MLMediaDRMByteArray *session_idSession ID for the DRM session.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkMedia DRM session was set successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2017 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_media_drm.h"

ML_EXTERN_C_BEGIN

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaCryptoCreate(MLUUID uuid, const MLMediaDRMByteArray *data, MLHandle *out_handle);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaCryptoRelease(MLHandle media_crypto);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaCryptoIsCryptoSchemeSupported(MLUUID uuid, bool *out_supported);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaCryptoRequiresSecureDecoderComponent(const char *mime_type, bool *out_required);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaCryptoSetMediaDRMSession(MLHandle media_crypto, const MLMediaDRMByteArray *session_id);

ML_EXTERN_C_END