Audio Element
The basic building block for the application programmer developing with ADF is the audio_element
object. Every decoder, encoder, filter, input stream, or output stream is in fact an Audio Element.
This API has been designed and then used to implement Audio Elements provided by ADF.
The general functionality of an Element is to take some data on input, processes it, and output to the next. Each Element is run as a separate task. To enable control on particular stages of the data lifecycle from the input, during processing and up to the output, the audio_element
object provides possibility to trigger callbacks per stage. There are seven types of available callback functions: open, seek, process, close, destroy, read and write, and they are defined in audio_element_cfg_t
. Particular Elements typically use a subset of all available callbacks. For instance the MP3 Decoder is using open, process, close and destroy callback functions.
The available Audio Element types intended for development with this API are listed in description of audio_common.h header file under audio_element_type_t
enumerator.
API Reference
Header File
Functions
-
audio_element_handle_t audio_element_init(audio_element_cfg_t *config)
Initialize audio element with config.
- Parameters
config – The configuration
- Returns
audio_elemenent handle object
NULL
-
esp_err_t audio_element_deinit(audio_element_handle_t el)
Destroy audio element handle object, stop, clear, deletel all.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_setdata(audio_element_handle_t el, void *data)
Set context data to element handle object. It can be retrieved by calling
audio_element_getdata
.- Parameters
el – [in] The audio element handle
data – The data pointer
- Returns
ESP_OK
ESP_FAIL
-
void *audio_element_getdata(audio_element_handle_t el)
Get context data from element handle object.
- Parameters
el – [in] The audio element handle
- Returns
data pointer
-
esp_err_t audio_element_set_tag(audio_element_handle_t el, const char *tag)
Set elemenet tag name, or clear if tag = NULL.
- Parameters
el – [in] The audio element handle
tag – [in] The tag name pointer
- Returns
ESP_OK
ESP_FAIL
-
char *audio_element_get_tag(audio_element_handle_t el)
Get element tag name.
- Parameters
el – [in] The audio element handle
- Returns
Element tag name pointer
-
esp_err_t audio_element_setinfo(audio_element_handle_t el, audio_element_info_t *info)
Set audio element infomation.
- Parameters
el – [in] The audio element handle
info – The information pointer
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_getinfo(audio_element_handle_t el, audio_element_info_t *info)
Get audio element infomation.
- Parameters
el – [in] The audio element handle
info – The information pointer
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_uri(audio_element_handle_t el, const char *uri)
Set audio element URI.
- Parameters
el – [in] The audio element handle
uri – [in] The uri pointer
- Returns
ESP_OK
ESP_FAIL
-
char *audio_element_get_uri(audio_element_handle_t el)
Get audio element URI.
- Parameters
el – [in] The audio element handle
- Returns
URI pointer
-
esp_err_t audio_element_run(audio_element_handle_t el)
Start Audio Element. With this function, audio_element will start as freeRTOS task, and put the task into ‘PAUSED’ state. Note: Element does not actually start when this function returns.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_terminate(audio_element_handle_t el)
Terminate Audio Element. With this function, audio_element will exit the task function. Note: this API only sends request. It does not actually terminate immediately when this function returns.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_terminate_with_ticks(audio_element_handle_t el, TickType_t ticks_to_wait)
Terminate Audio Element with specific ticks for timeout. With this function, audio_element will exit the task function. Note: this API only sends request. It does not actually terminate immediately when this function returns.
- Parameters
el – [in] The audio element handle
ticks_to_wait – [in] The maximum amount of time to blocking
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_stop(audio_element_handle_t el)
Request stop of the Audio Element. After receiving the stop request, the element will ignore the actions being performed (read/write, wait for the ringbuffer …) and close the task, reset the state variables. Note: this API only sends requests, Element does not actually stop when this function returns.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_wait_for_stop(audio_element_handle_t el)
After the
audio_element_stop
function is called, the Element task will perform some abort procedures. This function will be blocked (Time is DEFAULT_MAX_WAIT_TIME) until Element Task has done and exit.- Parameters
el – [in] The audio element handle
- Returns
ESP_OK, Success
ESP_FAIL, The state is not AEL_STATE_RUNNING
ESP_ERR_TIMEOUT, Timeout
-
esp_err_t audio_element_wait_for_stop_ms(audio_element_handle_t el, TickType_t ticks_to_wait)
After the
audio_element_stop
function is called, the Element task will perform some abort procedures. The maximum amount of time should block waiting for Element task has stopped.- Parameters
el – [in] The audio element handle
ticks_to_wait – [in] The maximum amount of time to wait for stop
- Returns
ESP_OK, Success
ESP_FAIL, The state is not AEL_STATE_RUNNING
ESP_ERR_TIMEOUT, Timeout
-
esp_err_t audio_element_pause(audio_element_handle_t el)
Request audio Element enter ‘PAUSE’ state. In this state, the task will wait for any event.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_resume(audio_element_handle_t el, float wait_for_rb_threshold, TickType_t timeout)
Request audio Element enter ‘RUNNING’ state. In this state, the task listens to events and invokes the callback functions. At the same time it will wait until the size/total_size of the output ringbuffer is greater than or equal to
wait_for_rb_threshold
. If the timeout period has been exceeded and ringbuffer output has not yet reachedwait_for_rb_threshold
then the function will return.- Parameters
el – [in] The audio element handle
wait_for_rb_threshold – [in] The wait for rb threshold (0 .. 1)
timeout – [in] The timeout
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_msg_set_listener(audio_element_handle_t el, audio_event_iface_handle_t listener)
This function will add a
listener
to listen to all events from audio elementel
. Any event from el->external_event will be send to thelistener
.- Parameters
el – The audio element handle
listener – The event will be listen to
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_event_callback(audio_element_handle_t el, event_cb_func cb_func, void *ctx)
This function will add a
callback
to be called from audio elementel
. Any event to caller will cause to call callback function.- Parameters
el – The audio element handle
cb_func – The callback function
ctx – Caller context
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_msg_remove_listener(audio_element_handle_t el, audio_event_iface_handle_t listener)
Remove listener out of el. No new events will be sent to the listener.
- Parameters
el – [in] The audio element handle
listener – The listener
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_input_ringbuf(audio_element_handle_t el, ringbuf_handle_t rb)
Set Element input ringbuffer.
- Parameters
el – [in] The audio element handle
rb – [in] The ringbuffer handle
- Returns
ESP_OK
ESP_FAIL
-
ringbuf_handle_t audio_element_get_input_ringbuf(audio_element_handle_t el)
Get Element input ringbuffer.
- Parameters
el – [in] The audio element handle
- Returns
ringbuf_handle_t
-
esp_err_t audio_element_set_output_ringbuf(audio_element_handle_t el, ringbuf_handle_t rb)
Set Element output ringbuffer.
- Parameters
el – [in] The audio element handle
rb – [in] The ringbuffer handle
- Returns
ESP_OK
ESP_FAIL
-
ringbuf_handle_t audio_element_get_output_ringbuf(audio_element_handle_t el)
Get Element output ringbuffer.
- Parameters
el – [in] The audio element handle
- Returns
ringbuf_handle_t
-
audio_element_state_t audio_element_get_state(audio_element_handle_t el)
Get current Element state.
- Parameters
el – [in] The audio element handle
- Returns
audio_element_state_t
-
esp_err_t audio_element_abort_input_ringbuf(audio_element_handle_t el)
If the element is requesting data from the input ringbuffer, this function forces it to abort.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_abort_output_ringbuf(audio_element_handle_t el)
If the element is waiting to write data to the ringbuffer output, this function forces it to abort.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_wait_for_buffer(audio_element_handle_t el, int size_expect, TickType_t timeout)
This function will wait until the sizeof the output ringbuffer is greater than or equal to
size_expect
. If the timeout period has been exceeded and ringbuffer output has not yet reachedsize_expect
then the function will returnESP_FAIL
- Parameters
el – [in] The audio element handle
size_expect – [in] The size expect
timeout – [in] The timeout
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_report_status(audio_element_handle_t el, audio_element_status_t status)
Element will sendout event (status) to event by this function.
- Parameters
el – [in] The audio element handle
status – [in] The status
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_report_info(audio_element_handle_t el)
Element will sendout event (information) to event by this function.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_report_codec_fmt(audio_element_handle_t el)
Element will sendout event (codec format) to event by this function.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_report_pos(audio_element_handle_t el)
Element will sendout event with a duplicate information by this function.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
ESP_ERR_NO_MEM
-
esp_err_t audio_element_set_input_timeout(audio_element_handle_t el, TickType_t timeout)
Set input read timeout (default is
portMAX_DELAY
).- Parameters
el – [in] The audio element handle
timeout – [in] The timeout
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_output_timeout(audio_element_handle_t el, TickType_t timeout)
Set output read timeout (default is
portMAX_DELAY
).- Parameters
el – [in] The audio element handle
timeout – [in] The timeout
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_reset_input_ringbuf(audio_element_handle_t el)
Reset inputbuffer.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_finish_state(audio_element_handle_t el)
Set element finish state.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_change_cmd(audio_element_handle_t el, audio_element_msg_cmd_t cmd)
Change element running state with specific command.
- Parameters
el – [in] The audio element handle
cmd – [in] Specific command from audio_element_msg_cmd_t
- Returns
ESP_OK
ESP_FAIL
ESP_ERR_INVALID_ARG Element handle is null
-
esp_err_t audio_element_reset_output_ringbuf(audio_element_handle_t el)
Reset outputbuffer.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
audio_element_err_t audio_element_input(audio_element_handle_t el, char *buffer, int wanted_size)
Call this function to provide Element input data. Depending on setup using ringbuffer or function callback, Element invokes read ringbuffer, or calls read callback funtion.
- Parameters
el – [in] The audio element handle
buffer – The buffer pointer
wanted_size – [in] The wanted size
- Returns
> 0 number of bytes produced
<=0 audio_element_err_t
-
audio_element_err_t audio_element_output(audio_element_handle_t el, char *buffer, int write_size)
Call this function to sendout Element output data. Depending on setup using ringbuffer or function callback, Element will invoke write to ringbuffer, or call write callback funtion.
- Parameters
el – [in] The audio element handle
buffer – The buffer pointer
write_size – [in] The write size
- Returns
> 0 number of bytes written
<=0 audio_element_err_t
-
esp_err_t audio_element_set_read_cb(audio_element_handle_t el, stream_func fn, void *context)
This API allows the application to set a read callback for the first audio_element in the pipeline for allowing the pipeline to interface with other systems. The callback is invoked every time the audio element requires data to be processed.
- Parameters
el – [in] The audio element handle
fn – [in] Callback read function. The callback function should return number of bytes read or -1 in case of error in reading. Note that the callback function may decide to block and that may block the entire pipeline.
context – [in] An optional context which will be passed to callback function on every invocation
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_write_cb(audio_element_handle_t el, stream_func fn, void *context)
This API allows the application to set a write callback for the last audio_element in the pipeline for allowing the pipeline to interface with other systems. The callback is invoked every time the audio element has a processed data that needs to be passed forward.
- Parameters
el – [in] The audio element
fn – [in] Callback write function The callback function should return number of bytes written or -1 in case of error in writing. Note that the callback function may decide to block and that may block the entire pipeline.
context – [in] An optional context which will be passed to callback function on every invocation
- Returns
ESP_OK
ESP_FAIL
-
stream_func audio_element_get_write_cb(audio_element_handle_t el)
Get callback write function that register to the element.
- Parameters
el – [in] The audio element
- Returns
Callback write function pointer
NULL Failed
-
stream_func audio_element_get_read_cb(audio_element_handle_t el)
Get callback read function that register to the element.
- Parameters
el – [in] The audio element
- Returns
Callback read function pointer
NULL Failed
-
QueueHandle_t audio_element_get_event_queue(audio_element_handle_t el)
Get External queue of Emitter. We can read any event that has been send out of Element from this
QueueHandle_t
.- Parameters
el – [in] The audio element handle
- Returns
QueueHandle_t
-
esp_err_t audio_element_set_ringbuf_done(audio_element_handle_t el)
Set inputbuffer and outputbuffer have finished.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_reset_state(audio_element_handle_t el)
Enforce ‘AEL_STATE_INIT’ state.
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
int audio_element_get_output_ringbuf_size(audio_element_handle_t el)
Get Element output ringbuffer size.
- Parameters
el – [in] The audio element handle
- Returns
=0: Parameter NULL
>0: Size of ringbuffer
-
esp_err_t audio_element_set_output_ringbuf_size(audio_element_handle_t el, int rb_size)
Set Element output ringbuffer size.
- Parameters
el – [in] The audio element handle
rb_size – [in] Size of the ringbuffer
- Returns
ESP_OK
ESP_FAIL
-
int audio_element_multi_input(audio_element_handle_t el, char *buffer, int wanted_size, int index, TickType_t ticks_to_wait)
Call this function to read data from multi input ringbuffer by given index.
- Parameters
el – The audio element handle
buffer – The buffer pointer
wanted_size – The wanted size
index – The index of multi input ringbuffer, start from
0
, should be less thanNUMBER_OF_MULTI_RINGBUF
ticks_to_wait – Timeout of ringbuffer
- Returns
ESP_ERR_INVALID_SIZE
Others are same as the
rb_read
-
int audio_element_multi_output(audio_element_handle_t el, char *buffer, int wanted_size, TickType_t ticks_to_wait)
Call this function write data by multi output ringbuffer.
- Parameters
el – [in] The audio element handle
buffer – The buffer pointer
wanted_size – [in] The wanted size
ticks_to_wait – Timeout of ringbuffer
- Returns
The return value is same as the
rb_write
-
esp_err_t audio_element_set_multi_input_ringbuf(audio_element_handle_t el, ringbuf_handle_t rb, int index)
Set multi input ringbuffer Element.
- Parameters
el – [in] The audio element handle
rb – [in] The ringbuffer handle
index – [in] Index of multi ringbuffer, starts from
0
, should be less thanNUMBER_OF_MULTI_RINGBUF
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_multi_output_ringbuf(audio_element_handle_t el, ringbuf_handle_t rb, int index)
Set multi output ringbuffer Element.
- Parameters
el – [in] The audio element handle
rb – [in] The ringbuffer handle
index – [in] Index of multi ringbuffer, starts from
0
, should be less thanNUMBER_OF_MULTI_RINGBUF
- Returns
ESP_OK
ESP_ERR_INVALID_ARG
-
ringbuf_handle_t audio_element_get_multi_input_ringbuf(audio_element_handle_t el, int index)
Get handle of multi input ringbuffer Element by index.
- Parameters
el – [in] The audio element handle
index – [in] Index of multi ringbuffer, starts from
0
, should be less thanNUMBER_OF_MULTI_RINGBUF
- Returns
NULL Error
Others ringbuf_handle_t
-
ringbuf_handle_t audio_element_get_multi_output_ringbuf(audio_element_handle_t el, int index)
Get handle of multi output ringbuffer Element by index.
- Parameters
el – [in] The audio element handle
index – [in] Index of multi ringbuffer, starts from
0
, should be less thanNUMBER_OF_MULTI_RINGBUF
- Returns
NULL Error
Others ringbuf_handle_t
-
esp_err_t audio_element_process_init(audio_element_handle_t el)
Provides a way to call element’s
open
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_process_deinit(audio_element_handle_t el)
Provides a way to call element’s
close
- Parameters
el – [in] The audio element handle
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_seek(audio_element_handle_t el, void *in_data, int in_size, void *out_data, int *out_size)
Call element’s
seek
- Parameters
el – [in] The audio element handle
in_data – [in] A pointer to in data
in_size – [in] The size of the
in_data
out_data – [out] A pointer to the out data
out_size – [out] The size of the
out_data
- Returns
ESP_OK
ESP_FAIL
ESP_ERR_NOT_SUPPORTED
-
bool audio_element_is_stopping(audio_element_handle_t el)
Get Element stopping flag.
- Parameters
el – [in] The audio element handle
- Returns
element’s stopping flag
-
esp_err_t audio_element_update_byte_pos(audio_element_handle_t el, int pos)
Update the byte position of element information.
- Parameters
el – [in] The audio element handle
pos – [in] The byte_pos accumulated by this value
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_byte_pos(audio_element_handle_t el, int pos)
Set the byte position of element information.
- Parameters
el – [in] The audio element handle
pos – [in] This value is assigned to byte_pos
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_update_total_bytes(audio_element_handle_t el, int total_bytes)
Update the total bytes of element information.
- Parameters
el – [in] The audio element handle
total_bytes – [in] The total_bytes accumulated by this value
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_total_bytes(audio_element_handle_t el, int total_bytes)
Set the total bytes of element information.
- Parameters
el – [in] The audio element handle
total_bytes – [in] This value is assigned to total_bytes
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_bps(audio_element_handle_t el, int bit_rate)
Set the bps of element information.
- Parameters
el – [in] The audio element handle
bit_rate – [in] This value is assigned to bps
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_codec_fmt(audio_element_handle_t el, int format)
Set the codec format of element information.
- Parameters
el – [in] The audio element handle
format – [in] This value is assigned to codec_fmt
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_music_info(audio_element_handle_t el, int sample_rates, int channels, int bits)
Set the sample_rate, channels, bits of element information.
- Parameters
el – [in] The audio element handle
sample_rates – [in] Sample_rates of music information
channels – [in] Channels of music information
bits – [in] Bits of music information
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_duration(audio_element_handle_t el, int duration)
Set the duration of element information.
- Parameters
el – [in] The audio element handle
duration – [in] This value is assigned to duration
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_reserve_user0(audio_element_handle_t el, int user_data0)
Set the user_data_0 of element information.
- Parameters
el – [in] The audio element handle
user_data0 – [in] This value is assigned to user_data_0
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_reserve_user1(audio_element_handle_t el, int user_data1)
Set the user_data_1 of element information.
- Parameters
el – [in] The audio element handle
user_data1 – [in] This value is assigned to user_data_1
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_reserve_user2(audio_element_handle_t el, int user_data2)
Set the user_data_2 of element information.
- Parameters
el – [in] The audio element handle
user_data2 – [in] This value is assigned to user_data_2
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_reserve_user3(audio_element_handle_t el, int user_data3)
Set the user_data_3 of element information.
- Parameters
el – [in] The audio element handle
user_data3 – [in] This value is assigned to user_data_3
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t audio_element_set_reserve_user4(audio_element_handle_t el, int user_data4)
Set the user_data_4 of element information.
- Parameters
el – [in] The audio element handle
user_data4 – [in] This value is assigned to user_data_4
- Returns
ESP_OK
ESP_FAIL
Structures
-
struct audio_element_reserve_data_t
Audio Element user reserved data.
-
struct audio_element_info_t
Audio Element informations.
Public Members
-
int sample_rates
Sample rates in Hz
-
int channels
Number of audio channel, mono is 1, stereo is 2
-
int bits
Bit wide (8, 16, 24, 32 bits)
-
int bps
Bit per second
-
int64_t byte_pos
The current position (in bytes) being processed for an element
-
int64_t total_bytes
The total bytes for an element
-
int duration
The duration for an element (optional)
-
char *uri
URI (optional)
-
esp_codec_type_t codec_fmt
Music format (optional)
-
audio_element_reserve_data_t reserve_data
This value is reserved for user use (optional)
-
int sample_rates
-
struct audio_element_cfg_t
Audio Element configurations. Each Element at startup will be a self-running task. These tasks will execute the callback open -> [loop: read -> process -> write] -> close. These callback functions are provided by the user corresponding to this configuration.
Public Members
-
el_io_func open
Open callback function
-
process_func process
Process callback function
-
el_io_func close
Close callback function
-
el_io_func destroy
Destroy callback function
-
stream_func read
Read callback function
-
stream_func write
Write callback function
-
int buffer_len
Buffer length use for an Element
-
int task_stack
Element task stack
-
int task_prio
Element task priority (based on freeRTOS priority)
-
int task_core
Element task running in core (0 or 1)
-
int out_rb_size
Output ringbuffer size
-
void *data
User context
-
const char *tag
Element tag
-
bool stack_in_ext
Try to allocate stack in external memory
-
int multi_in_rb_num
The number of multiple input ringbuffer
-
int multi_out_rb_num
The number of multiple output ringbuffer
-
el_io_func open
Macros
-
AUDIO_ELEMENT_INFO_DEFAULT()
-
DEFAULT_ELEMENT_RINGBUF_SIZE
-
DEFAULT_ELEMENT_BUFFER_LENGTH
-
DEFAULT_ELEMENT_STACK_SIZE
-
DEFAULT_ELEMENT_TASK_PRIO
-
DEFAULT_ELEMENT_TASK_CORE
-
DEFAULT_AUDIO_ELEMENT_CONFIG()
Type Definitions
-
typedef struct audio_element *audio_element_handle_t
-
typedef esp_err_t (*el_io_func)(audio_element_handle_t self)
-
typedef audio_element_err_t (*process_func)(audio_element_handle_t self, char *el_buffer, int el_buf_len)
-
typedef int (*stream_func)(audio_element_handle_t self, char *buffer, int len, TickType_t ticks_to_wait, void *context)
-
typedef esp_err_t (*event_cb_func)(audio_element_handle_t el, audio_event_iface_msg_t *event, void *ctx)
-
typedef esp_err_t (*ctrl_func)(audio_element_handle_t self, void *in_data, int in_size, void *out_data, int *out_size)
Enumerations
-
enum audio_element_err_t
Values:
-
enumerator AEL_IO_OK
-
enumerator AEL_IO_FAIL
-
enumerator AEL_IO_DONE
-
enumerator AEL_IO_ABORT
-
enumerator AEL_IO_TIMEOUT
-
enumerator AEL_PROCESS_FAIL
-
enumerator AEL_IO_OK
-
enum audio_element_state_t
Audio element state.
Values:
-
enumerator AEL_STATE_NONE
-
enumerator AEL_STATE_INIT
-
enumerator AEL_STATE_INITIALIZING
-
enumerator AEL_STATE_RUNNING
-
enumerator AEL_STATE_PAUSED
-
enumerator AEL_STATE_STOPPED
-
enumerator AEL_STATE_FINISHED
-
enumerator AEL_STATE_ERROR
-
enumerator AEL_STATE_NONE
-
enum audio_element_msg_cmd_t
Audio element action command, process on dispatcher
Values:
-
enumerator AEL_MSG_CMD_NONE
-
enumerator AEL_MSG_CMD_FINISH
-
enumerator AEL_MSG_CMD_STOP
-
enumerator AEL_MSG_CMD_PAUSE
-
enumerator AEL_MSG_CMD_RESUME
-
enumerator AEL_MSG_CMD_DESTROY
-
enumerator AEL_MSG_CMD_REPORT_STATUS
-
enumerator AEL_MSG_CMD_REPORT_MUSIC_INFO
-
enumerator AEL_MSG_CMD_REPORT_CODEC_FMT
-
enumerator AEL_MSG_CMD_REPORT_POSITION
-
enumerator AEL_MSG_CMD_NONE
-
enum audio_element_status_t
Audio element status report
Values:
-
enumerator AEL_STATUS_NONE
-
enumerator AEL_STATUS_ERROR_OPEN
-
enumerator AEL_STATUS_ERROR_INPUT
-
enumerator AEL_STATUS_ERROR_PROCESS
-
enumerator AEL_STATUS_ERROR_OUTPUT
-
enumerator AEL_STATUS_ERROR_CLOSE
-
enumerator AEL_STATUS_ERROR_TIMEOUT
-
enumerator AEL_STATUS_ERROR_UNKNOWN
-
enumerator AEL_STATUS_INPUT_DONE
-
enumerator AEL_STATUS_INPUT_BUFFERING
-
enumerator AEL_STATUS_OUTPUT_DONE
-
enumerator AEL_STATUS_OUTPUT_BUFFERING
-
enumerator AEL_STATUS_STATE_RUNNING
-
enumerator AEL_STATUS_STATE_PAUSED
-
enumerator AEL_STATUS_STATE_STOPPED
-
enumerator AEL_STATUS_STATE_FINISHED
-
enumerator AEL_STATUS_MOUNTED
-
enumerator AEL_STATUS_UNMOUNTED
-
enumerator AEL_STATUS_NONE