Flags to provide additional information, if it is a release memory or not.
agm_extern_alloc_buff_info
Members
int
unique handle identifying extern mem allocation
uint32_t
size of external allocation
uint32_t
offset of buffer within extern allocation
agm_buff
Members
uint64_t
timestamp in micro-secs
uint32_t
bitmasked flags for e.g.
uint32_t
size of buffer in bytes
uint8_t *
data buffer
uint32_t
size of metadata blob
uint8_t *
Blob for metadata.
struct agm_extern_alloc_buff_info
holds info for extern buff
agm_session_aac_dec
AAC decoder parameters.Members
uint16_t
AAC format flag.
uint16_t
AAC obj type.
uint16_t
AAC obj type.
uint16_t
PCE bits size.
uint32_t
Sample rate.
agm_session_aac_enc_cfg
AAC encoder parameters.Members
uint16_t
AAC encoder mode.
uint16_t
AAC format flag.
agm_session_aac_enc
Members
uint32_t
uint32_t
struct agm_session_aac_enc_cfg
agm_session_flac_dec
FLAC decoder parameters.Members
uint16_t
Number of channels.
uint16_t
Sample size.
uint16_t
Minimum block size.
uint16_t
Maximum block size.
uint32_t
Sample rate.
uint32_t
Minimum frame size.
uint32_t
Maximum frame size.
agm_session_alac_dec
ALAC decoder parameters.Members
uint32_t
Frame length.
uint8_t
Version.
uint8_t
bit depth
uint8_t
tuning parameters
uint8_t
tuning parameters
uint8_t
tuning parameters
uint8_t
Number of channels.
uint16_t
Max run.
uint32_t
Max Frame bytes.
uint32_t
avg bit rate
uint32_t
sample rate
uint32_t
Channel layout tag.
agm_session_ape_dec
APE decoder parameters.Members
uint16_t
Version.
uint16_t
Compression Level.
uint32_t
Format flags.
uint32_t
Blocks per frame.
uint32_t
Final frame blocks.
uint32_t
Total frames.
uint16_t
Bit width.
uint16_t
Number of channels.
uint32_t
Sample rate.
uint32_t
Seek table present.
agm_session_wma_dec
WMA decoder parameters.Members
uint16_t
Format Tag.
uint16_t
Number of channels.
uint32_t
Sample rate.
uint32_t
Avg bytes per sec.
uint16_t
Block align.
uint16_t
Bits per sample.
uint32_t
Channel mask.
uint16_t
Encoder options.
uint16_t
reserved
agm_session_wmapro_dec
WMA Pro decoder parameters.Members
uint16_t
Format Tag.
uint16_t
Number of channels.
uint32_t
Sample rate.
uint32_t
Avg bytes per sec.
uint16_t
Block align.
uint16_t
Bits per sample.
uint32_t
Channel mask.
uint16_t
Encoder options.
uint16_t
Adv encoder options.
uint32_t
Adv encoder options2.
agm_session_opus_dec
OPUS decoder parameters.Members
uint16_t
uint16_t
uint8_t
uint8_t
uint16_t
uint32_t
uint16_t
uint8_t
uint8_t
uint8_t
uint8_t
uint8_t
agm_session_codec
Session encoder/decoder parameters.Members
struct agm_session_aac_dec
AAC decoder config.
struct agm_session_aac_enc
AAC encoder config.
struct agm_session_flac_dec
Flac decoder config.
struct agm_session_alac_dec
Alac decoder config.
struct agm_session_ape_dec
APE decoder config.
struct agm_session_wma_dec
WMA decoder config.
struct agm_session_wmapro_dec
WMAPro decoder config.
struct agm_session_opus_dec
OPUS decoder config.
agm_buf_info
Shared memory buffer info 211.Members
int32_t
int32_t
int32_t
int32_t
agm_media_config
Media Config.Members
uint32_t
sample rate
uint32_t
number of channels
enum agm_media_format
format
uint32_t
data format
agm_group_media_config
Members
struct agm_media_config
uint32_t
slot_mask for TDM
aif_info
AIF Info.Members
char
AIF name
enum direction
direction
agm_session_config
Session Config.Members
enum direction
TX or RX.
enum agm_session_mode
indicates mode of agm sesison, non-tunnel, or hostless
uint32_t
start_threshold: number of buffers * buffer size
uint32_t
stop_th6reshold: number of buffers * buffer size
union agm_session_codec
codec configuration
enum agm_data_mode
compress format ID
uint32_t
pass session specific flags e.g enable inband SRCM event
agm_buffer_config
Buffer Config.Members
uint32_t
number of buffers
size_t
size of each buffer
size_t
max metadata size a client attaches to a buffer
agm_module_id_iid_map
Maps the modules instance id to module id for a single module.Members
uint32_t
module id
uint32_t
globally unique module instance id
agm_tag_info
Structure which holds tag and corresponding modules tagged with tag id.Members
uint32_t
tag id
uint32_t
number of modules matching the tag_id
struct agm_module_id_iid_map
agm_module_id_iid_map list
agm_tag_module_info_list
Structure which holds tag info of a given graph.Members
uint32_t
number of tags
uint8_t
variable payload of type struct agm_tag_module_info
agm_tag_config
Structure which holds tag config for setparams.Members
uint32_t
tag id
uint32_t
num of tag key values
struct agm_key_value
tag key vector
agm_cal_config
Members
uint32_t
num of tag key values
struct agm_key_value
tag key vector
agm_acdb_param
Members
bool
uint32_t
uint32_t
number of ckv or tkv
uint32_t
kv size + payload size
uint8_t
kv + payload
agm_acdb_tunnel_param
Members
bool
uint32_t
uint32_t
number of gkv
uint32_t
number of ckv or tkv
uint32_t
gkv size + t/ckv size + payload size
uint8_t
gkv + t/ckv + payload
agm_event_read_write_done_payload
Members
uint32_t
tag that was used to read/write this buffer
uint32_t
data buffer status as defined in ar_osal_error.h
uint32_t
meta-data status as defined in ar_osal_error.h
struct agm_buff
buffer that was passed to agm_read/agm_write
agm_event_reg_cfg
Event registration structure.Members
uint32_t
Valid instance ID of module.
uint32_t
Valid event ID of the module.
uint32_t
Size of the event config data based upon the module_instance_id/event_id combination.
uint8_t
1 - to register the event 0 - to de-register the event
uint8_t
module specifc event registration payload
agm_event_cb_params
data that will be passed to client in the event callbackMembers
uint32_t
identifies the module which generated event
uint32_t
size of payload below
uint32_t
payload associated with the event if any
uint8_t
agm_dump_info
Data passed by the client when requesting dump.Members
int32_t
identifies the signal received by client
uint32_t
identifies client uid
uint32_t
Functions
agm_init
Initialize agm.
int agm_init()
Returns0 on success, error code on failure.
agm_deinit
De-Initialize agm.
int agm_deinit()
Returns0 on success, error code on failure.
agm_aif_set_media_config
Set media configuration for an audio interface.
int agm_aif_set_media_config(uint32_t aif_id, struct agm_media_config *media_config)
Parameters
uint32_t
Valid audio interface id
struct agm_media_config *
valid media configuration for the audio interafce.
Returns0 on success, error code on failure. If the audio interface is already in use and the new media_config is different from previous, api will return failure.
agm_aif_set_metadata
Set metadata for an audio interface.
int agm_aif_set_metadata(uint32_t aif_id, uint32_t size, uint8_t *metadata)
Parameters
uint32_t
Valid audio interface id
uint32_t
size of metadata in bytes
uint8_t *
valid metadata for the audio interface.
Returns0 on success, error code on failure. If the audio interface is already in use and the new meta data is set, api will return failure.
agm_session_set_metadata
Set metadata for the session.
int agm_session_set_metadata(uint32_t session_id, uint32_t size, uint8_t *metadata)
Parameters
uint32_t
Valid audio session id
uint32_t
size of metadata in bytes
uint8_t *
valid metadata for the session.
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_session_aif_set_metadata
Set metadata for the session, audio intf pair.
int agm_session_aif_set_metadata(uint32_t session_id, uint32_t aif_id, uint32_t size, uint8_t *metadata)
Parameters
uint32_t
Valid session id
uint32_t
Valid audio interface id
uint32_t
size of metadata in bytes
uint8_t *
valid metadata for the session and audio_intf.
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_session_aif_connect
Set metadata for the session, audio intf pair.
int agm_session_aif_connect(uint32_t session_id, uint32_t aif_id, bool state)
Parameters
uint32_t
Valid audio session id
uint32_t
Valid audio interface id
bool
Connect or Disconnect AIF to Session
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_session_aif_get_tag_module_info
Set metadata for the session, audio intf pair.
int agm_session_aif_get_tag_module_info(uint32_t session_id, uint32_t aif_id, void *payload, size_t *size)
Parameters
uint32_t
Valid audio session id
uint32_t
Valid audio interface id
void *
payload containing tag module info list in the graph. The memory for this pointer is allocated by client.
size_t *
size of the payload. if the value of size is zero, AGM will update required module info list of a given graph. if size equal or greater than the required size, AGM will copy the module info.
Returns0 on success, error code on failure.
agm_aif_set_params
Set parameters for modules in audio interface.
int agm_aif_set_params(uint32_t aif_id, void *payload, size_t size)
Parameters
uint32_t
Valid audio interface id
void *
payload
size_t
payload size in bytes
Returns0 on success, error code on failure.
agm_session_aif_set_params
Set parameters for modules in b/w stream and audio interface.
int agm_session_aif_set_params(uint32_t session_id, uint32_t aif_id, void *payload, size_t size)
Parameters
uint32_t
Valid audio session id
uint32_t
Valid audio interface id
void *
payload
size_t
payload size in bytes
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_session_aif_set_cal
Set calibration for modules in b/w stream and audio interface.
int agm_session_aif_set_cal(uint32_t session_id, uint32_t aif_id, struct agm_cal_config *cal_config)
Parameters
uint32_t
Valid audio session id
uint32_t
Valid audio interface id
struct agm_cal_config *
calibration key vector
Returns0 on success, error code on failure.
agm_session_set_params
Set parameters for modules in stream.
int agm_session_set_params(uint32_t session_id, void *payload, size_t size)
Parameters
uint32_t
Valid audio session id
void *
payload
size_t
payload size in bytes
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_session_get_params
Get parameters of the modules of a given session.
int agm_session_get_params(uint32_t session_id, void *payload, size_t size)
Parameters
uint32_t
Valid audio session id
void *
payload
size_t
payload size in bytes
Returns0 on success, error code on failure. If the session is not opened, api will return failure.
agm_get_params_from_acdb_tunnel
Get parameters for modules at acdb without session.
int agm_get_params_from_acdb_tunnel(void *payload, size_t *size)
Parameters
void *
payload with tag and calibration date
size_t *
size of payload
Returns0 on success, error code on failure.
agm_set_params_with_tag
Set parameters for modules in b/w stream and audio interface.
int agm_set_params_with_tag(uint32_t session_id, uint32_t aif_id, struct agm_tag_config *tag_config)
Parameters
uint32_t
Valid audio session id
uint32_t
valid audio interface id
struct agm_tag_config *
tag config structure with tag id and tag key vector
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_set_params_with_tag_to_acdb
Set parameters for modules in b/w stream and audio interface.
int agm_set_params_with_tag_to_acdb(uint32_t session_id, uint32_t aif_id, void *payload, size_t size)
Parameters
uint32_t
Valid audio session id
uint32_t
valid audio interface id
void *
payload with tag and calibration date
size_t
size of payload
Returns0 on success, error code on failure. If the session is already opened and the new meta data is set, api will return failure.
agm_set_params_to_acdb_tunnel
Set parameters for modules at acdb without session.
int agm_set_params_to_acdb_tunnel(void *payload, size_t size)
Parameters
void *
payload with tag and calibration date
size_t
size of payload
Returns0 on success, error code on failure.
agm_session_register_cb
Open the session with specified session id.
int agm_session_register_cb(uint32_t session_id, agm_event_cb cb, enum event_type evt_type, void *client_data)
Parameters
uint32_t
Valid audio session id
agm_event_cb
callback function to be invoked when an event occurs.
enum event_type
event type that
void *
client data.
Returns0 on success, error code otherwise
agm_session_register_for_events
Register for events from Modules.Not needed for data path events.
int agm_session_register_for_events(uint32_t session_id, struct agm_event_reg_cfg *evt_reg_cfg)
Parameters
uint32_t
Valid audio session id
event specific configuration.
Returns0 on success, error code otherwise
agm_session_open
Open the session with specified session id.
int agm_session_open(uint32_t session_id, enum agm_session_mode sess_mode, uint64_t *handle)
Parameters
uint32_t
Valid audio session id
enum agm_session_mode
Mode in which this agm session is to be opened
uint64_t *
updated with valid session handle if the operation is successful.
Valid session handle obtained from agm_session_open
struct agm_session_config *
valid stream configuration of the sessions
struct agm_media_config *
valid media configuration of the session.
struct agm_buffer_config *
buffer configuration for the session. Null if hostless
Returns0 on success, error code otherwise
agm_session_close
Close the session.
int agm_session_close(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_prepare
prepare the session.
int agm_session_prepare(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_start
Start the session.
int agm_session_start(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_stop
Stop the session.session must be in started/paused state before stopping.
int agm_session_stop(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_pause
Pause the session.session must be in started state before resuming.
int agm_session_pause(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_flush
flush the session.session must be in pause state before flushing.
int agm_session_flush(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_sessionid_flush
flush the session.session must be in pause state before flushing.
int agm_sessionid_flush(uint32_t session_id)
Parameters
uint32_t
Valid audio session id
Returns0 on success, error code otherwise
agm_session_resume
Resume the session.session must be in paused state before resuming.
int agm_session_resume(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_suspend
suspend the session.session must be in started state before suspending.
int agm_session_suspend(uint64_t hndl)
Parameters
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_session_read
Read data buffers.from session.
int agm_session_read(uint64_t handle, void *buff, size_t *count)
Parameters
uint64_t
session handle returned from agm_session_open
void *
buffer where data will be copied to
size_t *
number of bytes requested to fill into the buffer. AGM will update the count with actual number of bytes filled.
Returns0 on success, error code otherwise
agm_session_write
Write data buffers.to session.
int agm_session_write(uint64_t hndl, void *buff, size_t *count)
Parameters
session handle returned from agm_session_open
void *
buffer where data will be copied from
size_t *
actual number of bytes in the buffer. AGM will update the count with number of bytes consumed/written.
Returns0 on success, error code otherwise
agm_get_hw_processed_buff_cnt
Get count of Buffer processed by h/w.
size_t agm_get_hw_processed_buff_cnt(uint64_t hndl, enum direction dir)
Parameters
session handle returned from agm_session_open
enum direction
indicates whether to return the write or read buffer count
Returns: An increasing count of buffers, value wraps back to zero once it reaches SIZE_MAX
agm_get_aif_info_list
Get list of AIF info objects.
int agm_get_aif_info_list(struct aif_info *aif_list, size_t *num_aif_info)
Parameters
struct aif_info *
list of aif_info objects
size_t *
number of aif info items in the list. if num_aif_info value is listed as zero, AGM will update num_aif_info with the number of aif info items in AGM. if num_aif_info is greater than zero, AGM will copy client specified num_aif_info of items into aif_list.
Returns: 0 on success, error code otherwise
agm_session_set_loopback
Set loopback between capture and playback sessions.
int agm_session_set_loopback(uint32_t capture_session_id, uint32_t playback_session_id, bool state)
Parameters
uint32_t
: a non zero capture session id
uint32_t
playback session id.
bool
: flag to indicate to enable(true) or disable(false) loopback
Returns: 0 on success, error code otherwise
agm_session_set_ec_ref
Set ec reference on capture session.
int agm_session_set_ec_ref(uint32_t capture_session_id, uint32_t aif_id, bool state)
Parameters
uint32_t
: a non zero capture session id
uint32_t
aif_id on RX path.
bool
: flag to indicate to enable(true) or disable(false) ec_ref
Returns: 0 on success, error code otherwise
agm_session_eos
send eos of the session.
int agm_session_eos(uint64_t handle)
Parameters
uint64_t
Valid session handle obtained from agm_session_open
Returns0 on success, error code otherwise
agm_get_session_time
get timestamp of the session.
int agm_get_session_time(uint64_t handle, uint64_t *timestamp)
Parameters
uint64_t
Valid session handle obtained from agm_session_open
uint64_t *
updated with valid timestamp if the operation is successful.
Returns0 on success, error code otherwise
agm_get_buffer_timestamp
get timestamp of last read buffer.
int agm_get_buffer_timestamp(uint32_t session_id, uint64_t *timestamp)
Parameters
uint32_t
Valid audio session id
uint64_t *
updated with valid timestamp if the operation is successful.
Returns0 on success, error code otherwise
agm_session_get_buf_info
Get shared memory buf_info of a given session.
int agm_session_get_buf_info(uint32_t session_id, struct agm_buf_info *buf_info, uint32_t flag)
Parameters
uint32_t
Valid audio session id
struct agm_buf_info *
agm_buf_info structure with dma_buf_fd
struct agm_buf_info *
flag to determine data buf/pos buf
Returns0 on success, error code on failure. If the session is not opened, api will return failure.
agm_register_service_crash_callback
This api is a no-op if agm runs in clients context.In scenarios where AGM runs in its own process context and clients talk to AGM over IPC, this api could be used by clients to register a callback with the agm client wrapper implentation, which is then responsible to trigger this callback when the agm service crashes. Once the callback is invoked clients then can decide on the approach they want to take with respect to clean up of the agm sesisons
int agm_register_service_crash_callback(agm_service_crash_cb cb, uint64_t cookie)
Parameters
Callback passed by clients
uint64_t
Cookie that client expect to be passed during the invocation of the callback.
Returns0 on success, error code otherwise
agm_set_gapless_session_metadata
set gapless metadata of the session.
int agm_set_gapless_session_metadata(uint64_t handle, enum agm_gapless_silence_type type, uint32_t silence)
Parameters
uint64_t
Valid session handle obtained from agm_session_open
enum agm_gapless_silence_type
Silence Type (Initial or Trailing)
uint32_t
Initial/Trailing silence samples to be removed
Returns0 on success, error code otherwise
agm_session_write_with_metadata
Write data buffers with metadata to session.
int agm_session_write_with_metadata(uint64_t hndl, struct agm_buff *buff, size_t *consumed_size)
Parameters
session handle returned from agm_session_open
struct agm_buff *
agm_buffer where data will be copied from
size: Actual number of bytes that were consumed by AGM
Returns0 on success, error code otherwise
agm_session_read_with_metadata
Read data buffers with metadata to session.
int agm_session_read_with_metadata(uint64_t hndl, struct agm_buff *buff, uint32_t *captured_size)
Parameters
session handle returned from agm_session_open
struct agm_buff *
agm_buffer where data will be copied to
uint32_t *
Actual number of bytes that were captured
Returns0 on success, error code otherwise
agm_session_set_non_tunnel_mode_config
Helps set config for non tunnel mode (rx and tx path)
int agm_get_group_aif_info_list(struct aif_info *aif_list, size_t *num_groups)
Parameters
struct aif_info *
list of group aif_info objects
size_t *
number of group aif items in the list. if num_groups value is listed as zero, AGM will update num_groups with the number of group aif items in AGM. if num_groups is greater than zero, AGM will copy client specified num_groups of items into aif_list.
Returns: 0 on success, error code otherwise
agm_aif_group_set_media_config
Set media configuration for a group AIF.
int agm_aif_group_set_media_config(uint32_t aif_group_id, struct agm_group_media_config *media_config)
Parameters
uint32_t
Valid group id
struct agm_group_media_config *
valid media configuration for the audio interafce.
Returns0 on success, error code on failure. If the audio interface is already in use and the new media_config is different from previous, api will return failure.
agm_session_write_datapath_params
Write buffers containing codec params to session on datapath.
int agm_session_write_datapath_params(uint32_t session_id, struct agm_buff *buff)
Parameters
uint32_t
Valid audio session id
struct agm_buff *
agm_buffer where data will be copied from
Returns0 on success, error code otherwise
agm_dump
Dump AGM information based on client.
int agm_dump(struct agm_dump_info *dump_info)
Parameters
struct agm_dump_info *
dump information populated by the client to facilitate dump
Returns0 on success, error code on failure.
agm_cshm_alloc
Allocate shared memory and map it with SPF.
int agm_cshm_alloc(uint32_t size, agm_cshm_info *info)