|
Tizen HAL API
1.0
|
The DRM provides functions for drm devices.
#include <hal-drm.h>
The drm devices have various specifications, so it's hard to control them using single code. The drm HAL provides common abstraction interfaces to control drm devices which are different.
The DRM HAL allows creation of components required in secure playback including:
| FUNCTION | PRE-STATE | POST-STATE | SYNC TYPE |
|---|---|---|---|
| hal_drm_init() | NONE | INITIALIZED | SYNC |
| hal_drm_deinit() | INITIALIZED | NONE | SYNC |
For more information on the DRM features and the macros, see HAL DRM programming guides and tutorials.
Typedefs | |
| typedef enum hal_drm_error | hal_drm_error_e |
| Enumeration for the DRM error. | |
| typedef enum hal_drm_state | hal_drm_state_e |
| Enumeration for the DRM state. | |
| typedef enum hal_drm_command | hal_drm_command_e |
| Enumeration for the DRM command. | |
| typedef struct hal_drm_batch_command_control | hal_drm_batch_command_control_s |
| The structure type of batch command. | |
| typedef enum hal_drm_message_type | hal_drm_message_type_e |
| Enumeration for the DRM message type. | |
| typedef struct hal_drm_message | hal_drm_message_s |
| The structure type of the DRM message. | |
| typedef int(* | hal_drm_message_cb )(hal_drm_message_s *message, void *user_data) |
| Callback function for notification from DRM HAL. | |
| typedef enum hal_drm_media_type | hal_drm_media_type_e |
| Enumeration for encrypted content media type. | |
| typedef enum hal_drm_cipher_phase | hal_drm_cipher_phase_e |
| Enumeration for cipher phase. | |
| typedef struct _hal_backend_drm_funcs | hal_backend_drm_funcs |
| The structure type of the DRM HAL functions. | |
| struct hal_drm_custom_command_s |
The structure type of the DRM HAL custom command.
Data Fields | |
| const char * | name |
| void * | value |
| const char* hal_drm_custom_command_s::name |
The name of custom command
The value of custom command
| struct hal_drm_batch_command_control |
The structure type of batch command.
Data Fields | |
| uint64_t | command_set_flag |
| hal_drm_custom_command_s | custom |
flag for updating commands
The value for custom command
| struct hal_drm_message |
The structure type of the DRM message.
Data Fields | |
| hal_drm_message_type_e | type |
| const char * | license_request |
| hal_drm_error_e | error_code |
The error code
| const char* hal_drm_message::license_request |
The license request message
The type of message
| struct hal_drm_data_s |
Serialized byte data with specific size.
Data Fields | |
| uint32_t | size |
| unsigned char * | data |
| unsigned char* hal_drm_data_s::data |
The pointer of byte data array
| uint32_t hal_drm_data_s::size |
The size of data
| struct hal_drm_key_info_s |
The key id that indicates decryption key and status of decryption key.
Data Fields | |
| hal_drm_data_s | key_id |
| hal_drm_key_status_e | status |
Status of decryption key indicated by key_id
| struct hal_drm_key_info_list_s |
The set of key status information.
Data Fields | |
| uint32_t | num_of_key_infos |
| hal_drm_key_info_s * | key_infos |
Key ID and key status
The number of key information
| struct hal_drm_crypto_info_s |
The structure type of crypto information for decryption.
Data Fields | |
| hal_drm_cipher_algorithm_e | algorithm |
| hal_drm_media_type_e | type |
| hal_drm_cipher_phase_e | phase |
| unsigned char * | key_id |
| uint32_t | key_id_size |
| unsigned char * | iv |
| uint32_t | iv_size |
Cipher algorithm
| unsigned char* hal_drm_crypto_info_s::iv |
The IV(Initialization Vector) for block cipher modes of operation
| uint32_t hal_drm_crypto_info_s::iv_size |
The size of IV
| unsigned char* hal_drm_crypto_info_s::key_id |
The Key ID
| uint32_t hal_drm_crypto_info_s::key_id_size |
The size of Key ID
Cipher phase
Media type
| struct hal_drm_subsample_s |
The structure type of subsample.
Data Fields | |
| uint32_t | bytes_of_clear_data |
| uint32_t | bytes_of_protected_data |
The size of clear data(BytesOfClearData in CENC specification)
The size of protected data(BytesOfProtectedData in CENC specification)
| struct hal_drm_protection_pattern_s |
The structure type of protection pattern information for pattern encryption.
Data Fields | |
| bool | use_pattern |
| uint32_t | crypt_byte_block |
| uint32_t | skip_byte_block |
If use_pattern is true, count of the encrypted blocks in the protection pattern
If use_pattern is true, count of the unencrypted blocks in the protection pattern
true if cbcs pattern scheme is used, otherwise false
| struct hal_drm_buffer_s |
The structure type of DRM buffer.
Data Fields | |
| int | index |
| bool | is_secure |
| uint32_t | size |
| unsigned char * | data |
| int | fd |
| int | secure_handle |
| int * | split_offsets |
| uint32_t | num_of_subsamples |
| hal_drm_subsample_s * | subsamples |
| hal_drm_protection_pattern_s | pattern_encryption |
| unsigned char* hal_drm_buffer_s::data |
The pointer of data buffer
The fd(file descriptor) of data buffer. When fd is not used, it will be set -1
The index of buffer
The flag which indicates the real data is managed in secure world or not
| uint32_t hal_drm_buffer_s::num_of_subsamples |
The number of subsamples
The information of pattern encryption
The secure handle of data buffer. When handle is not used, it will be set 0
| uint32_t hal_drm_buffer_s::size |
The size of data buffer
Sample offset. Nullable. If used, -1 terminated int array. The max number of split_offsets are 15
The subsamples in CENC(Common Encryption)
| struct _hal_backend_drm_funcs |
The structure type of the DRM HAL functions.
Data Fields | |
| int(* | init )(void **drm_handle) |
| int(* | deinit )(void *drm_handle) |
| int(* | set_message_callback )(void *drm_handle, hal_drm_message_cb callback, void *user_data) |
| int(* | get_cdm_version )(void *drm_handle, char **version) |
| int(* | session_create )(void *drm_handle, hal_drm_session_type_e type, hal_drm_data_s **session_id) |
| int(* | session_load )(void *drm_handle, hal_drm_data_s *session_id) |
| int(* | session_generate_request )(void *drm_handle, hal_drm_data_s *session_id, hal_drm_init_data_type_e type, hal_drm_data_s *init_data, hal_drm_data_s **request) |
| int(* | session_update )(void *drm_handle, hal_drm_data_s *session_id, hal_drm_data_s *license) |
| int(* | session_get_expiration )(void *drm_handle, hal_drm_data_s *session_id, int64_t *expiration) |
| int(* | session_get_key_infos )(void *drm_handle, hal_drm_data_s *session_id, hal_drm_key_info_list_s **key_info_list) |
| int(* | session_close )(void *drm_handle, hal_drm_data_s *session_id) |
| int(* | session_remove )(void *drm_handle, hal_drm_data_s *session_id) |
| int(* | get_provisioning_request )(void *drm_handle, hal_drm_data_s **request) |
| int(* | set_provisioning_response )(void *drm_handle, hal_drm_data_s *response) |
| int(* | get_service_certificate_request )(void *drm_handle, hal_drm_data_s **request) |
| int(* | load_service_certificate_response )(void *drm_handle, hal_drm_data_s *response, hal_drm_data_s **certificate) |
| int(* | set_service_certificate )(void *drm_handle, hal_drm_data_s *certificate) |
| int(* | allocate_output_buffer )(void *drm_handle, uint32_t size, bool is_secure, hal_drm_buffer_s **buffer) |
| int(* | release_output_buffer )(void *drm_handle, hal_drm_buffer_s *buffer) |
| int(* | release_data )(void *drm_handle, hal_drm_data_s *data) |
| int(* | release_key_info_list )(void *drm_handle, hal_drm_key_info_list_s *key_info_list) |
| int(* | decrypt )(void *drm_handle, hal_drm_buffer_s *input, hal_drm_crypto_info_s *decrypt_info, hal_drm_buffer_s *output) |
| int(* | set_command )(void *drm_handle, hal_drm_command_e command, void *value) |
| int(* | get_command )(void *drm_handle, hal_drm_command_e command, void **value) |
| int(* | set_batch_command )(void *drm_handle, hal_drm_batch_command_control_s *batch_command, hal_drm_command_e *error_command) |
| int(* _hal_backend_drm_funcs::allocate_output_buffer)(void *drm_handle, uint32_t size, bool is_secure, hal_drm_buffer_s **buffer) |
Allocates drm output buffer
| int(* _hal_backend_drm_funcs::decrypt)(void *drm_handle, hal_drm_buffer_s *input, hal_drm_crypto_info_s *decrypt_info, hal_drm_buffer_s *output) |
Decrypts encrypted data
| int(* _hal_backend_drm_funcs::deinit)(void *drm_handle) |
Deinitializes DRM HAL backend handle
| int(* _hal_backend_drm_funcs::get_cdm_version)(void *drm_handle, char **version) |
Gets the cdm version
| int(* _hal_backend_drm_funcs::get_command)(void *drm_handle, hal_drm_command_e command, void **value) |
Gets the current value of command
| int(* _hal_backend_drm_funcs::get_provisioning_request)(void *drm_handle, hal_drm_data_s **request) |
Gets the provisioning request message
| int(* _hal_backend_drm_funcs::get_service_certificate_request)(void *drm_handle, hal_drm_data_s **request) |
Gets the service certificate request
| int(* _hal_backend_drm_funcs::init)(void **drm_handle) |
Initializes DRM HAL backend handle
| int(* _hal_backend_drm_funcs::load_service_certificate_response)(void *drm_handle, hal_drm_data_s *response, hal_drm_data_s **certificate) |
Loads the service certificate response
| int(* _hal_backend_drm_funcs::release_data)(void *drm_handle, hal_drm_data_s *data) |
Releases hal_drm_data_s type data
| int(* _hal_backend_drm_funcs::release_key_info_list)(void *drm_handle, hal_drm_key_info_list_s *key_info_list) |
Releases hal_drm_key_info_list_s type data
| int(* _hal_backend_drm_funcs::release_output_buffer)(void *drm_handle, hal_drm_buffer_s *buffer) |
Releases drm output buffer
| int(* _hal_backend_drm_funcs::session_close)(void *drm_handle, hal_drm_data_s *session_id) |
Closes session
| int(* _hal_backend_drm_funcs::session_create)(void *drm_handle, hal_drm_session_type_e type, hal_drm_data_s **session_id) |
Creates session
| int(* _hal_backend_drm_funcs::session_generate_request)(void *drm_handle, hal_drm_data_s *session_id, hal_drm_init_data_type_e type, hal_drm_data_s *init_data, hal_drm_data_s **request) |
Generates request
| int(* _hal_backend_drm_funcs::session_get_expiration)(void *drm_handle, hal_drm_data_s *session_id, int64_t *expiration) |
Gets the key expiration
| int(* _hal_backend_drm_funcs::session_get_key_infos)(void *drm_handle, hal_drm_data_s *session_id, hal_drm_key_info_list_s **key_info_list) |
Gets the key information including key id and key status
| int(* _hal_backend_drm_funcs::session_load)(void *drm_handle, hal_drm_data_s *session_id) |
Loads session
| int(* _hal_backend_drm_funcs::session_remove)(void *drm_handle, hal_drm_data_s *session_id) |
Removes session
| int(* _hal_backend_drm_funcs::session_update)(void *drm_handle, hal_drm_data_s *session_id, hal_drm_data_s *license) |
Updates session
| int(* _hal_backend_drm_funcs::set_batch_command)(void *drm_handle, hal_drm_batch_command_control_s *batch_command, hal_drm_command_e *error_command) |
Sets a set of commands
| int(* _hal_backend_drm_funcs::set_command)(void *drm_handle, hal_drm_command_e command, void *value) |
Sets the various command and value
| int(* _hal_backend_drm_funcs::set_message_callback)(void *drm_handle, hal_drm_message_cb callback, void *user_data) |
Sets a callback of message
| int(* _hal_backend_drm_funcs::set_provisioning_response)(void *drm_handle, hal_drm_data_s *response) |
Sets the provisioning response message
| int(* _hal_backend_drm_funcs::set_service_certificate)(void *drm_handle, hal_drm_data_s *certificate) |
Sets the service certificate
| typedef struct _hal_backend_drm_funcs hal_backend_drm_funcs |
The structure type of the DRM HAL functions.
| typedef struct hal_drm_batch_command_control hal_drm_batch_command_control_s |
The structure type of batch command.
| typedef enum hal_drm_cipher_phase hal_drm_cipher_phase_e |
Enumeration for cipher phase.
| typedef enum hal_drm_command hal_drm_command_e |
Enumeration for the DRM command.
| typedef enum hal_drm_error hal_drm_error_e |
Enumeration for the DRM error.
| typedef enum hal_drm_media_type hal_drm_media_type_e |
Enumeration for encrypted content media type.
| typedef int(* hal_drm_message_cb)(hal_drm_message_s *message, void *user_data) |
Callback function for notification from DRM HAL.
| [in] | message | The message from DRM HAL |
| [in] | user_data | The user data for callback |
| typedef struct hal_drm_message hal_drm_message_s |
The structure type of the DRM message.
| typedef enum hal_drm_message_type hal_drm_message_type_e |
Enumeration for the DRM message type.
| typedef enum hal_drm_state hal_drm_state_e |
Enumeration for the DRM state.
Enumeration for cipher algorithm.
| enum hal_drm_cipher_phase |
| enum hal_drm_command |
| enum hal_drm_error |
Enumeration for the DRM error.
| enum hal_drm_key_status_e |
The status of decryption key.
| enum hal_drm_media_type |
Enumeration for encrypted content media type.
| enum hal_drm_message_type |
| enum hal_drm_state |