How to understand audio_element_state, status, msg_cmd?
Posted: Thu Mar 21, 2024 3:53 am
Can anyone tell me what kind of message or state the dispatch will do with the audio element at each stage of action?
For example, when the mp3_decoder element finishes decoding, what type of state and message will it send out to the pipeline? AEL_STATE_FINISHED? AEL_MSG_CMD_FINISH? AEL_STATUS_STATE_FINISHED?
There are lumps of similar definition of state of elements in the header file, but I can't see how the function runs and what type of msg it will send out.
/**
* @brief Audio element state
*/
typedef enum {
AEL_STATE_NONE = 0,
AEL_STATE_INIT = 1,
AEL_STATE_INITIALIZING = 2,
AEL_STATE_RUNNING = 3,
AEL_STATE_PAUSED = 4,
AEL_STATE_STOPPED = 5,
AEL_STATE_FINISHED = 6,
AEL_STATE_ERROR = 7
} audio_element_state_t;
/**
* Audio element action command, process on dispatcher
*/
typedef enum {
AEL_MSG_CMD_NONE = 0,
// AEL_MSG_CMD_ERROR = 1,
AEL_MSG_CMD_FINISH = 2,
AEL_MSG_CMD_STOP = 3,
AEL_MSG_CMD_PAUSE = 4,
AEL_MSG_CMD_RESUME = 5,
AEL_MSG_CMD_DESTROY = 6,
// AEL_MSG_CMD_CHANGE_STATE = 7,
AEL_MSG_CMD_REPORT_STATUS = 8,
AEL_MSG_CMD_REPORT_MUSIC_INFO = 9,
AEL_MSG_CMD_REPORT_CODEC_FMT = 10,
AEL_MSG_CMD_REPORT_POSITION = 11,
} audio_element_msg_cmd_t;
/**
* Audio element status report
*/
typedef enum {
AEL_STATUS_NONE = 0,
AEL_STATUS_ERROR_OPEN = 1,
AEL_STATUS_ERROR_INPUT = 2,
AEL_STATUS_ERROR_PROCESS = 3,
AEL_STATUS_ERROR_OUTPUT = 4,
AEL_STATUS_ERROR_CLOSE = 5,
AEL_STATUS_ERROR_TIMEOUT = 6,
AEL_STATUS_ERROR_UNKNOWN = 7,
AEL_STATUS_INPUT_DONE = 8,
AEL_STATUS_INPUT_BUFFERING = 9,
AEL_STATUS_OUTPUT_DONE = 10,
AEL_STATUS_OUTPUT_BUFFERING = 11,
AEL_STATUS_STATE_RUNNING = 12,
AEL_STATUS_STATE_PAUSED = 13,
AEL_STATUS_STATE_STOPPED = 14,
AEL_STATUS_STATE_FINISHED = 15,
AEL_STATUS_MOUNTED = 16,
AEL_STATUS_UNMOUNTED = 17,
} audio_element_status_t;
For example, when the mp3_decoder element finishes decoding, what type of state and message will it send out to the pipeline? AEL_STATE_FINISHED? AEL_MSG_CMD_FINISH? AEL_STATUS_STATE_FINISHED?
There are lumps of similar definition of state of elements in the header file, but I can't see how the function runs and what type of msg it will send out.
/**
* @brief Audio element state
*/
typedef enum {
AEL_STATE_NONE = 0,
AEL_STATE_INIT = 1,
AEL_STATE_INITIALIZING = 2,
AEL_STATE_RUNNING = 3,
AEL_STATE_PAUSED = 4,
AEL_STATE_STOPPED = 5,
AEL_STATE_FINISHED = 6,
AEL_STATE_ERROR = 7
} audio_element_state_t;
/**
* Audio element action command, process on dispatcher
*/
typedef enum {
AEL_MSG_CMD_NONE = 0,
// AEL_MSG_CMD_ERROR = 1,
AEL_MSG_CMD_FINISH = 2,
AEL_MSG_CMD_STOP = 3,
AEL_MSG_CMD_PAUSE = 4,
AEL_MSG_CMD_RESUME = 5,
AEL_MSG_CMD_DESTROY = 6,
// AEL_MSG_CMD_CHANGE_STATE = 7,
AEL_MSG_CMD_REPORT_STATUS = 8,
AEL_MSG_CMD_REPORT_MUSIC_INFO = 9,
AEL_MSG_CMD_REPORT_CODEC_FMT = 10,
AEL_MSG_CMD_REPORT_POSITION = 11,
} audio_element_msg_cmd_t;
/**
* Audio element status report
*/
typedef enum {
AEL_STATUS_NONE = 0,
AEL_STATUS_ERROR_OPEN = 1,
AEL_STATUS_ERROR_INPUT = 2,
AEL_STATUS_ERROR_PROCESS = 3,
AEL_STATUS_ERROR_OUTPUT = 4,
AEL_STATUS_ERROR_CLOSE = 5,
AEL_STATUS_ERROR_TIMEOUT = 6,
AEL_STATUS_ERROR_UNKNOWN = 7,
AEL_STATUS_INPUT_DONE = 8,
AEL_STATUS_INPUT_BUFFERING = 9,
AEL_STATUS_OUTPUT_DONE = 10,
AEL_STATUS_OUTPUT_BUFFERING = 11,
AEL_STATUS_STATE_RUNNING = 12,
AEL_STATUS_STATE_PAUSED = 13,
AEL_STATUS_STATE_STOPPED = 14,
AEL_STATUS_STATE_FINISHED = 15,
AEL_STATUS_MOUNTED = 16,
AEL_STATUS_UNMOUNTED = 17,
} audio_element_status_t;