|
Tizen HAL API
1.0
|
The Codec provides functions for codec devices.
#include <hal-codec.h>
The codec devices have various specifications and backend interfaces, so it's hard to control them using single code. The codec HAL provides common abstraction interfaces to control codec devices which are different.
Key functionalities include:
| FUNCTION | PRE-STATE | POST-STATE | SYNC TYPE |
|---|---|---|---|
| hal_codec_init() | N/A | INITIALIZED | SYNC |
| hal_codec_deinit() | INITIALIZED | N/A | SYNC |
| hal_codec_configure() | INITIALIZED | CONFIGURED | SYNC |
| hal_codec_release() | CONFIGURED | INITIALIZED | SYNC |
| hal_codec_start() | CONFIGURED | STARTED | SYNC |
| hal_codec_stop() | STARTED | CONFIGURED | SYNC |
For more information on the Codec features and the macros, see HAL Codec programming guides and tutorials.
Typedefs | |
| typedef int(* | hal_codec_message_cb )(hal_codec_message_s *message, void *user_data) |
| Callback function for notification from codec HAL. | |
| typedef struct _hal_backend_codec_funcs | hal_backend_codec_funcs |
| The structure type of the codec HAL functions. | |
Defines | |
| #define | HAL_CODEC_BUFFER_PLANE_MAX 4 |
| The maximum number of planes in buffer. | |
| #define | HAL_CODEC_CAPABILITY_MAX 8 |
| The maximum number of codec capability. | |
| #define | HAL_CODEC_CAPABILITY_FORMAT_MAX 4 |
| The maximum number of codec capability format. | |
| #define | HAL_CODEC_CAPABILITY_FEATURE_MAX 16 |
| The maximum number of codec capability feature. | |
| #define | HAL_CODEC_FEATURE_LENGTH 16 |
| The length of codec capability feature. | |
| struct hal_codec_resolution_s |
| struct hal_codec_plane_s |
The structure type of the buffer plane.
Data Fields | |
| unsigned char * | data |
| uint32_t | stride |
| uint32_t | size |
| uint32_t | bytesused |
| uint32_t hal_codec_plane_s::bytesused |
The actual data size of plane
| unsigned char* hal_codec_plane_s::data |
The data pointer of plane, it could be NULL when it's secure buffer
| uint32_t hal_codec_plane_s::size |
The size of plane
| uint32_t hal_codec_plane_s::stride |
The stride of plane
| struct hal_codec_planes_s |
The structure type of the buffer planes.
Data Fields | |
| uint32_t | num_planes |
| hal_codec_plane_s | plane [4] |
| uint32_t hal_codec_planes_s::num_planes |
The number of planes
The array of planes
| struct hal_codec_memory_s |
The structure type of the buffer memory.
Data Fields | |
| uint32_t | num_fd |
| int | fd [4] |
| int hal_codec_memory_s::fd[4] |
The fd
| uint32_t hal_codec_memory_s::num_fd |
The number of fd
| struct hal_codec_meta_s |
The structure type of the buffer meta.
Data Fields | |
| hal_codec_format_e | format |
| hal_codec_resolution_s | resolution |
| hal_codec_rotation_e | rotation |
| uint64_t | timestamp |
| uint32_t | duration |
| uint32_t | flags |
| uint32_t hal_codec_meta_s::duration |
The duration
| uint32_t hal_codec_meta_s::flags |
The flags
The format
The resolution of frame
The rotation of frame
| uint64_t hal_codec_meta_s::timestamp |
The timestamp
| struct hal_codec_buffer_s |
The structure type of the buffer.
Data Fields | |
| int | index |
| uint32_t | size |
| hal_codec_planes_s | planes |
| hal_codec_memory_s | memory |
| hal_codec_meta_s | meta |
The index of buffer
The memory of buffer for zero copy
The meta data of buffer
The planes of buffer - logical plane data
| uint32_t hal_codec_buffer_s::size |
The size of buffer
| struct hal_codec_custom_command_s |
The structure type of the codec HAL custom command.
Data Fields | |
| const char * | name |
| void * | value |
| const char* hal_codec_custom_command_s::name |
The name of custom command
The value of custom command
| struct hal_codec_batch_command_control_s |
The structure type of the codec HAL batch command.
Data Fields | |
| uint64_t | command_set_flag |
| uint64_t | bitrate |
| hal_codec_custom_command_s | custom |
The value for bitrate command
The flag for updating commands
The value for custom command
| struct hal_codec_message_s |
The structure type of the codec HAL message.
Data Fields | |
| hal_codec_message_type_e | type |
| hal_codec_error_e | error_code |
| hal_codec_buffer_s * | buffer |
| hal_codec_resolution_s | resolution |
The buffer for HAL_CODEC_MESSAGE_TYPE_INPUT_BUFFER_USED or HAL_CODEC_MESSAGE_TYPE_OUTPUT_BUFFER
The error code
The changed resolution
The type of message
| struct hal_codec_capability_feature_s |
The structure type of the codec capability feature.
Data Fields | |
| uint32_t | count |
| char | value [16][16] |
The count of feature
| char hal_codec_capability_feature_s::value[16][16] |
The value of feature
| struct hal_codec_capability_base_s |
The structure type of the codec capability base.
The max resolution
The stream format
| struct hal_codec_capability_decoder_s |
The structure type of the codec capability for decoder.
Data Fields | |
| hal_codec_capability_base_s | base |
| hal_codec_format_e | in_format |
| uint32_t | out_format_count |
| hal_codec_format_e | out_format [4] |
The base capability
The input format
The output format array
The output format count
| struct hal_codec_capability_encoder_s |
The structure type of the codec capability for encoder.
Data Fields | |
| hal_codec_capability_base_s | base |
| uint32_t | in_format_count |
| hal_codec_format_e | in_format [4] |
| hal_codec_format_e | out_format |
The base capability
The input format array
The input format count
The output format
| struct hal_codec_capability_s |
The structure type of the codec capability.
Data Fields | |
| uint32_t | decoder_count |
| hal_codec_capability_decoder_s | decoder [8] |
| uint32_t | encoder_count |
| hal_codec_capability_encoder_s | encoder [8] |
The capability for decoder
The count of capability for decoder
The capability for encoder
The count of capability for encoder
| struct _hal_backend_codec_funcs |
The structure type of the codec HAL functions.
Data Fields | |
| int(* | init )(hal_codec_type_e type, void **codec_handle) |
| int(* | deinit )(void *codec_handle) |
| int(* | configure )(void *codec_handle, int width, int height, hal_codec_format_e in_format, hal_codec_format_e out_format, bool is_secure) |
| int(* | release )(void *codec_handle) |
| int(* | start )(void *codec_handle, hal_codec_message_cb callback, void *user_data) |
| int(* | stop )(void *codec_handle) |
| int(* | flush )(void *codec_handle) |
| int(* | decode )(void *codec_handle, hal_codec_buffer_s *buffer) |
| int(* | encode )(void *codec_handle, hal_codec_buffer_s *buffer) |
| int(* | release_output_buffer )(void *codec_handle, int buffer_index) |
| int(* | get_state )(void *codec_handle, hal_codec_state_e *state) |
| int(* | set_command )(void *codec_handle, hal_codec_command_e command, void *value) |
| int(* | get_command )(void *codec_handle, hal_codec_command_e command, void **value) |
| int(* | set_batch_command )(void *codec_handle, hal_codec_batch_command_control_s *batch_command, hal_codec_command_e *error_command) |
| int(* | get_capability )(hal_codec_capability_s *capability) |
| int(* _hal_backend_codec_funcs::configure)(void *codec_handle, int width, int height, hal_codec_format_e in_format, hal_codec_format_e out_format, bool is_secure) |
Configure codec
| int(* _hal_backend_codec_funcs::decode)(void *codec_handle, hal_codec_buffer_s *buffer) |
Decode data
| int(* _hal_backend_codec_funcs::deinit)(void *codec_handle) |
Deinitialize HAL backend handle
| int(* _hal_backend_codec_funcs::encode)(void *codec_handle, hal_codec_buffer_s *buffer) |
Encode data
| int(* _hal_backend_codec_funcs::flush)(void *codec_handle) |
Flush codec
| int(* _hal_backend_codec_funcs::get_capability)(hal_codec_capability_s *capability) |
Get capability of codec (Since 1.2)
| int(* _hal_backend_codec_funcs::get_command)(void *codec_handle, hal_codec_command_e command, void **value) |
Get command for various settings
| int(* _hal_backend_codec_funcs::get_state)(void *codec_handle, hal_codec_state_e *state) |
Get state of codec
| int(* _hal_backend_codec_funcs::init)(hal_codec_type_e type, void **codec_handle) |
Initialize HAL backend handle
| int(* _hal_backend_codec_funcs::release)(void *codec_handle) |
Release codec
| int(* _hal_backend_codec_funcs::release_output_buffer)(void *codec_handle, int buffer_index) |
Release output buffer
| int(* _hal_backend_codec_funcs::set_batch_command)(void *codec_handle, hal_codec_batch_command_control_s *batch_command, hal_codec_command_e *error_command) |
Set batch command for multiple settings
| int(* _hal_backend_codec_funcs::set_command)(void *codec_handle, hal_codec_command_e command, void *value) |
Set command for various settings
| int(* _hal_backend_codec_funcs::start)(void *codec_handle, hal_codec_message_cb callback, void *user_data) |
Start codec
| int(* _hal_backend_codec_funcs::stop)(void *codec_handle) |
Stop codec
| #define HAL_CODEC_BUFFER_PLANE_MAX 4 |
The maximum number of planes in buffer.
| #define HAL_CODEC_CAPABILITY_FEATURE_MAX 16 |
The maximum number of codec capability feature.
| #define HAL_CODEC_CAPABILITY_FORMAT_MAX 4 |
The maximum number of codec capability format.
| #define HAL_CODEC_CAPABILITY_MAX 8 |
The maximum number of codec capability.
| #define HAL_CODEC_FEATURE_LENGTH 16 |
The length of codec capability feature.
| typedef struct _hal_backend_codec_funcs hal_backend_codec_funcs |
The structure type of the codec HAL functions.
| typedef int(* hal_codec_message_cb)(hal_codec_message_s *message, void *user_data) |
Callback function for notification from codec HAL.
| [in] | message | The message from codec HAL |
| [in] | user_data | The user data for callback |
Enumeration for the buffer flag.
| enum hal_codec_command_e |
| enum hal_codec_error_e |
Enumeration for the codec HAL error.
| enum hal_codec_format_e |
Enumeration for the codec HAL format.
Enumeration for the codec HAL message type.
| enum hal_codec_rotation_e |
| enum hal_codec_state_e |
| enum hal_codec_type_e |