You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.8 KiB
144 lines
4.8 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
* Description: audio hal wrapper for SDK header file.
|
|
* Author: yinyingcai
|
|
* Create: 2020-05-11
|
|
* Notes: NA
|
|
* History: 2020-05-11 yinyingcai for CodingStyle
|
|
*/
|
|
#ifndef AIAO_WRAP_H
|
|
#define AIAO_WRAP_H
|
|
|
|
#include <system/audio.h>
|
|
#include <tinyalsa/asoundlib.h>
|
|
|
|
#include "audio_hw.h"
|
|
#include "hdo.h"
|
|
#include "hci.h"
|
|
|
|
typedef enum {
|
|
HAL_SYNC_REF_MODE_NONE = 0,
|
|
HAL_SYNC_REF_MODE_AUDIO,
|
|
HAL_SYNC_REF_MODE_VIDEO,
|
|
HAL_SYNC_REF_MODE_PCR,
|
|
HAL_SYNC_REF_MODE_SCR,
|
|
HAL_SYNC_REF_MODE_MAX
|
|
} hal_sync_ref_mode;
|
|
|
|
typedef enum {
|
|
HAL_SND_TRACK_TYPE_MASTER = 0,
|
|
HAL_SND_TRACK_TYPE_SLAVE,
|
|
HAL_SND_TRACK_TYPE_VIRTUAL,
|
|
HAL_SND_TRACK_TYPE_LOWLATENCY,
|
|
HAL_SND_TRACK_TYPE_OTTSOUND,
|
|
HAL_SND_TRACK_TYPE_SYSTEMAUDIO,
|
|
HAL_SND_TRACK_TYPE_APPAUDIO,
|
|
HAL_SND_TRACK_TYPE_MAX
|
|
} hal_snd_track_type;
|
|
|
|
typedef enum {
|
|
HAL_ACODEC_FORMAT_AC3 = 0,
|
|
HAL_ACODEC_FORMAT_EAC3,
|
|
HAL_ACODEC_FORMAT_OTHERS
|
|
} hal_acodec_format;
|
|
|
|
typedef enum {
|
|
HAL_SND_OUTPUTLATENCY_NORMAL = 0,
|
|
HAL_SND_OUTPUTLATENCY_LOW,
|
|
HAL_SND_OUTPUTLATENCY_MAX,
|
|
} hal_snd_output_latency;
|
|
|
|
typedef enum {
|
|
HAL_SND_OUT_PORT_DAC0 = 0x00,
|
|
HAL_SND_OUT_PORT_DAC1,
|
|
HAL_SND_OUT_PORT_DAC2,
|
|
HAL_SND_OUT_PORT_DAC3,
|
|
HAL_SND_OUT_PORT_I2S0,
|
|
HAL_SND_OUT_PORT_I2S1,
|
|
HAL_SND_OUT_PORT_I2S2,
|
|
HAL_SND_OUT_PORT_I2S3,
|
|
HAL_SND_OUT_PORT_I2S4,
|
|
HAL_SND_OUT_PORT_SPDIF0,
|
|
HAL_SND_OUT_PORT_HDMITX0,
|
|
HAL_SND_OUT_PORT_HDMITX1,
|
|
HAL_SND_OUT_PORT_ARC0,
|
|
HAL_SND_OUT_PORT_ARC1,
|
|
HAL_SND_OUT_PORT_ALL,
|
|
HAL_SND_OUT_PORT_MAX,
|
|
} hal_snd_out_port;
|
|
|
|
typedef struct {
|
|
hal_sync_ref_mode ref_mode;
|
|
int smooth_play_enable;
|
|
uint32_t pre_sync_timeout;
|
|
int start_vid_plus_time;
|
|
int start_vid_negative_time;
|
|
int quick_output_enable;
|
|
} hal_sync_attr;
|
|
|
|
typedef struct {
|
|
uint32_t buf_level_ms;
|
|
uint32_t start_threshold_ms;
|
|
} hal_audio_track_attr;
|
|
|
|
typedef struct {
|
|
uint32_t atmos;
|
|
hal_acodec_format format;
|
|
uint32_t channel_mode;
|
|
} hal_audio_stream_info;
|
|
|
|
typedef struct {
|
|
uint32_t add_mute;
|
|
uint32_t pcm_frame_max_num;
|
|
uint32_t pcm_samples;
|
|
} hal_snd_cast_attr;
|
|
|
|
/* function called through avplayservice */
|
|
int wraper_set_adec_buffer_size(uint32_t havplay, uint32_t adecMinBufSize, uint32_t adecOutFrameCnt);
|
|
int wraper_set_adec_attr(uint32_t havplay, const struct audio_attr* attr);
|
|
int wraper_set_sync_attr(uint32_t havplay, hal_sync_attr sync_attr);
|
|
int wraper_create_track(uint32_t *phtrack, hal_audio_track_attr track_attr, hal_snd_track_type track_type);
|
|
int wraper_register_acodec_lib(const char *fileName);
|
|
int wraper_get_buf(uint32_t hAvplay, uint32_t fragmentsize);
|
|
int wraper_put_buf(const uint8_t* pData, uint32_t hAvplay, uint32_t fragmentsize, uint32_t u32Pts);
|
|
int wraper_start_avplay(uint32_t havplay);
|
|
int wraper_create_avplay(uint32_t *sync_source);
|
|
int wraper_destroy_avplay(uint32_t sync_source);
|
|
int wraper_init_snd(void); /* init sound in avplayservice Process */
|
|
int wraper_deinit_snd(void);
|
|
int wraper_init_avplay(void);
|
|
int wraper_deinit_avplay(void);
|
|
int wraper_open_chan(uint32_t hAvplay);
|
|
int wraper_close_chan(uint32_t hAvplay);
|
|
int wraper_destroy_track(uint32_t hTrack);
|
|
int wraper_attach_snd(uint32_t hTrack, uint32_t hAvplay);
|
|
int wraper_detach_snd(uint32_t hTrack, uint32_t hAvplay);
|
|
int wraper_stop_avplay(uint32_t hAvplay);
|
|
int wraper_set_snd_default_latency(void);
|
|
int wraper_pause_avplay(uint32_t hAvplay);
|
|
int wraper_resume_avplay(uint32_t hAvplay);
|
|
int wraper_flush_avplay(uint32_t hAvplay);
|
|
int wraper_get_audio_playtime(uint32_t hAvplay, uint32_t *pu32PlayMS, uint32_t *pu32DelayMS);
|
|
int wraper_set_track_mute(uint32_t hTrack, bool mute);
|
|
int wraper_set_track_pre_scale(uint32_t hTrack, int s32IntegerGain, int s32DecimalGain);
|
|
int wraper_get_stream_info(int hw_sync_id, hal_audio_stream_info* stream_info);
|
|
|
|
/* function called by hci */
|
|
int wraper_destroy_cast(uint32_t hCast);
|
|
int wraper_set_snd_mute(hal_snd_out_port out_port, uint32_t mute);
|
|
int wraper_open_cast(hal_snd_cast_attr cast_attr, uint32_t *hCast);
|
|
int wraper_close_cast(uint32_t hCast);
|
|
int wraper_read_cast(uint32_t hCast, uint32_t *cacheBufSize, uint8_t *cacheBuf);
|
|
int wraper_set_snd_all_track_mute(uint32_t mute);
|
|
int wraper_set_sink_delay(uint32_t delay);
|
|
int wraper_get_sink_delay(uint32_t *delay);
|
|
int wraper_set_cast_volume(uint32_t hCast, int32_t integer_gain, int32_t decimal_gain);
|
|
int wraper_set_cast_mute(uint32_t hCast, bool mute);
|
|
|
|
int wraper_init_hal_sound(void);
|
|
void wraper_deinit_hal_sound(void);
|
|
int wraper_set_output_latency_mode(hal_snd_output_latency out_mode);
|
|
int wraper_amp_init(void);
|
|
int wraper_amp_deinit(void);
|
|
#endif
|