/** * \brief release audio dec * \param handle pointer to player private data * \return 0 on success otherwise -1 if an error occurred */ int audio_decode_release(void **handle) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *) * handle; if (!handle) { adec_print("audio handle is NULL !\n"); return -1; } cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_RELEASE; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } ret = pthread_join(audec->thread_pid, NULL); free(*handle); *handle = NULL; return ret; }
/** * \brief set audio volume * \param handle pointer to player private data * \param vol volume value * \return 0 on success otherwise -1 if an error occurred */ int audio_decode_set_lrvolume(void *handle, float lvol,float rvol) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; if (!handle) { adec_print("audio handle is NULL !\n"); return -1; } cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_SET_LRVOL; cmd->value.volume = lvol; audec->volume = lvol; cmd->has_arg = 1; cmd->value_ext.volume = rvol; audec->volume_ext = rvol; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief pause audio dec * \param handle pointer to player private data * \return 0 on success otherwise -1 if an error occurred */ int audio_decode_pause(void *handle) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_PAUSE; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief output right channel * \param handle pointer to player private data * \return 0 on success otherwise -1 if an error occurred */ int audio_channel_right_mono(void *handle) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_RIGHT_MONO; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief swap audio left and right channels * \param handle pointer to player private data * \return 0 on success otherwise -1 if an error occurred */ int audio_channels_swap(void *handle) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_CHANL_SWAP; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief set audio volume * \param handle pointer to player private data * \param vol volume value * \return 0 on success otherwise -1 if an error occurred */ int audio_decode_set_volume(void *handle, float vol) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_SET_VOL; cmd->value.volume = vol; cmd->has_arg = 1; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief mute audio output * \param handle pointer to player private data * \param en 1 = mute output, 0 = unmute output * \return 0 on success otherwise -1 if an error occurred */ int audio_decode_set_mute(void *handle, int en) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_MUTE; cmd->value.en = en; cmd->has_arg = 1; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief start audio dec * \param handle pointer to player private data * \return 0 on success otherwise -1 if an error occurred */ int audio_decode_start(void *handle) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; if (!handle) { adec_print("audio handle is NULL !\n"); return -1; } cmd = adec_message_alloc(); if (cmd) { cmd->ctrl_cmd = CMD_START; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }
/** * \brief output left and right channels * \param handle pointer to player private data * \return 0 on success otherwise -1 if an error occurred */ int audio_channel_stereo(void *handle) { int ret; adec_cmd_t *cmd; aml_audio_dec_t *audec = (aml_audio_dec_t *)handle; if (!handle) { adec_print("audio handle is NULL !\n"); return -1; } cmd = adec_message_alloc(); if (cmd) { audec->soundtrack = HW_STEREO_MODE; cmd->ctrl_cmd = CMD_STEREO; ret = adec_send_message(audec, cmd); } else { adec_print("message alloc failed, no memory!"); ret = -1; } return ret; }