Skip to main content
Header: service/inc/public/agm/agm_api.h

Structures

agm_key_value

A single entry of a Key Vector. Members
uint32_t
key
uint32_t
value

prop_data

Members
uint32_t
uint32_t
uint32_t

agm_cshm_info

Members
uint32_t
memID of the memory allocated
agm_cshm_type
type of the memory allocated
int64_t
fd of the memory allocated
uint32_t

agm_msg_config

Members
uint32_t
memID of the memory allocated
uint32_t
offset of memory allocated
uint32_t
Size of the chunk of memory.
uint32_t
module ID to which msg is sent
uint32_t
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 callback Members
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.
Returns 0 on success, error code on failure.

agm_deinit

De-Initialize agm.
Returns 0 on success, error code on failure.

agm_aif_set_media_config

Set media configuration for an audio interface.
Parameters
uint32_t
  • Valid audio interface id
struct agm_media_config *
  • valid media configuration for the audio interafce.
Returns 0 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.
Parameters
uint32_t
  • Valid audio interface id
uint32_t
  • size of metadata in bytes
uint8_t *
  • valid metadata for the audio interface.
Returns 0 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.
Parameters
uint32_t
  • Valid audio session id
uint32_t
  • size of metadata in bytes
uint8_t *
  • valid metadata for the session.
Returns 0 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.
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.
Returns 0 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.
Parameters
uint32_t
  • Valid audio session id
uint32_t
  • Valid audio interface id
bool
  • Connect or Disconnect AIF to Session
Returns 0 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.
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.
Returns 0 on success, error code on failure.

agm_aif_set_params

Set parameters for modules in audio interface.
Parameters
uint32_t
  • Valid audio interface id
void *
  • payload
size_t
  • payload size in bytes
Returns 0 on success, error code on failure.

agm_session_aif_set_params

Set parameters for modules in b/w stream and audio interface.
Parameters
uint32_t
  • Valid audio session id
uint32_t
  • Valid audio interface id
void *
  • payload
size_t
  • payload size in bytes
Returns 0 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.
Parameters
uint32_t
  • Valid audio session id
uint32_t
  • Valid audio interface id
struct agm_cal_config *
  • calibration key vector
Returns 0 on success, error code on failure.

agm_session_set_params

Set parameters for modules in stream.
Parameters
uint32_t
  • Valid audio session id
void *
  • payload
size_t
  • payload size in bytes
Returns 0 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.
Parameters
uint32_t
  • Valid audio session id
void *
  • payload
size_t
  • payload size in bytes
Returns 0 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.
Parameters
void *
  • payload with tag and calibration date
size_t *
  • size of payload
Returns 0 on success, error code on failure.

agm_set_params_with_tag

Set parameters for modules in b/w stream and audio interface.
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
Returns 0 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.
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
Returns 0 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.
Parameters
void *
  • payload with tag and calibration date
size_t
  • size of payload
Returns 0 on success, error code on failure.

agm_session_register_cb

Open the session with specified session id.
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.
Returns 0 on success, error code otherwise

agm_session_register_for_events

Register for events from Modules. Not needed for data path events.
Parameters
uint32_t
  • Valid audio session id
  • event specific configuration.
Returns 0 on success, error code otherwise

agm_session_open

Open the session with specified session id.
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.
Returns 0 on success, error code otherwise

agm_session_set_config

Set Session config.
Parameters
  • 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
Returns 0 on success, error code otherwise

agm_session_close

Close the session.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_prepare

prepare the session.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_start

Start the session.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_stop

Stop the session. session must be in started/paused state before stopping.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_pause

Pause the session. session must be in started state before resuming.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_flush

flush the session. session must be in pause state before flushing.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_sessionid_flush

flush the session. session must be in pause state before flushing.
Parameters
uint32_t
  • Valid audio session id
Returns 0 on success, error code otherwise

agm_session_resume

Resume the session. session must be in paused state before resuming.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_suspend

suspend the session. session must be in started state before suspending.
Parameters
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_session_read

Read data buffers.from session.
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.
Returns 0 on success, error code otherwise

agm_session_write

Write data buffers.to session.
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.
Returns 0 on success, error code otherwise

agm_get_hw_processed_buff_cnt

Get count of Buffer processed by h/w.
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.
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.
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.
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.
Parameters
uint64_t
  • Valid session handle obtained from agm_session_open
Returns 0 on success, error code otherwise

agm_get_session_time

get timestamp of the session.
Parameters
uint64_t
  • Valid session handle obtained from agm_session_open
uint64_t *
  • updated with valid timestamp if the operation is successful.
Returns 0 on success, error code otherwise

agm_get_buffer_timestamp

get timestamp of last read buffer.
Parameters
uint32_t
  • Valid audio session id
uint64_t *
  • updated with valid timestamp if the operation is successful.
Returns 0 on success, error code otherwise

agm_session_get_buf_info

Get shared memory buf_info of a given session.
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
Returns 0 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
Parameters
  • Callback passed by clients
  • Cookie that client expect to be passed during the invocation of the callback.
Returns 0 on success, error code otherwise

agm_set_gapless_session_metadata

set gapless metadata of the session.
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
Returns 0 on success, error code otherwise

agm_session_write_with_metadata

Write data buffers with metadata to session.
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
Returns 0 on success, error code otherwise

agm_session_read_with_metadata

Read data buffers with metadata to session.
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
Returns 0 on success, error code otherwise

agm_session_set_non_tunnel_mode_config

Helps set config for non tunnel mode (rx and tx path)
Parameters
session handle returned from agm_session_open
struct agm_session_config *
  • valid stream configuration of the sessions
struct agm_media_config *
  • valid media configuration of the input data.
struct agm_buffer_config *
  • buffer configuration for the input data path.
struct agm_media_config *
  • valid media configuration of the output data.
struct agm_buffer_config *
  • buffer configuration for the output data path.
Returns 0 on success, error code otherwise

agm_get_group_aif_info_list

Get list of group AIF objects.
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.
Parameters
uint32_t
  • Valid group id
struct agm_group_media_config *
  • valid media configuration for the audio interafce.
Returns 0 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.
Parameters
uint32_t
  • Valid audio session id
struct agm_buff *
agm_buffer where data will be copied from
Returns 0 on success, error code otherwise

agm_dump

Dump AGM information based on client.
Parameters
struct agm_dump_info *
  • dump information populated by the client to facilitate dump
Returns 0 on success, error code on failure.

agm_cshm_alloc

Allocate shared memory and map it with SPF.
Parameters
uint32_t
  • Size of memory to alloc in bytes.
info - Info regarding the allocated shared memory
Returns 0 on success, error code on failure.

agm_cshm_msg

Send a Global MSG to a module.
Parameters
uint32_t
  • Valid mem_id returned as part of agm_cshm_alloc.
uint32_t
  • Offset from the beginning of allocted memory.
uint32_t
  • Length of the memory for module to use.
uint32_t
  • Module Instance ID of the module for which this MSG is intented.
uint32_t
  • Flag conveying additional info regarding the MSG.
Returns 0 on success, error code on failure.

agm_cshm_dealloc

Unmap the shared memory with SPF and Deallocate it.
Parameters
uint32_t
  • Valid mem_id returned as part of agm_cshm_alloc.
Returns 0 on success, error code on failure.

Type Definitions

agm_event_cb

Callback function signature for events to client.

agm_service_crash_cb

Callback function signature for crash notification to clients.

Enumerations

agm_media_format

Bit formats.

Values

agm_data_format

Data format MUST stay in sync with media_fmt_api.h.

Values

agm_data_mode

AGM data modes.

Values

agm_session_mode

AGM session modes.

Values

agm_cshm_type

Values

agm_gapless_silence_type

Gapless playback Silence type.

Values

buf_flag

Flag to determine data buf or postion buf.

Values

direction

Session Direction.

Values

event_type

Event types.

Values

agm_event_id

Data Events that will be notified to client from AGM.

Values

Macros

AGM_BUFF_FLAG_EOS

used to indicate a given buffer is the final buffer, client will get notified once the buffer has been rendered

AGM_BUFF_FLAG_TS_VALID

true if buffer is marked as EOF

AGM_BUFF_FLAG_EOF

true if buffer contains media format

AGM_BUFF_FLAG_MEDIA_FORMAT

AGM_SESSION_FLAG_INBAND_SRCM

AIF_NAME_MAX_LEN

MAX length of the AIF Name.