/* * Copyright (C) 2017 Amlogic Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _AUDIO_CONTROLS_H_ #define _AUDIO_CONTROLS_H_ #include #include #include "audio_hw.h" #include "aml_ringbuffer.h" #include "aml_audio_log.h" #include "audio_controls_utils.h" //#include "aml_enc_api.h" #define DEVICE_NAME_LEN 16 #define ADEC_MAX_CAP 2 #define MAX_UEVENT_LEN 128 #define MIX_GAIN 0 #define MAX_GAIN 0xFFFFFF #define DEFAULT_ADC_HW_PORT 0xff //refer to alsa-ext-adc.h #define AC4_ADVOLUME_MIN (-32) #define AC4_ADVOLUME_MAX (32) typedef struct{ int rate; //sample rate int channel; //channel number //snd_pcm_uframes_t period_size; // the unit is frame unsigned int periods; // the ring buffer size = periods*period_size //snd_pcm_format_t format; // SND_PCM_FORMAT_S16_LE,SND_PCM_FORMAT_S32_LE... //snd_pcm_stream_t stream; //SND_PCM_STREAM_PLAYBACK,SND_PCM_STREAM_CAPTURE char device_name[DEVICE_NAME_LEN]; } device_params_t; typedef enum lge_param_index { OUTPUT_GAIN_SPK = 0, } lge_param_index_t; typedef enum lge_param_type { Integer, } lge_param_type_t; typedef enum Attribute_Num { MAX = 0, MIN = 1, STEP = 2, COUNT = 3, } Attribute_Num_t; enum Adec_info_type {ADEC_INFO_TYPE_INFO, ADEC_INFO_TYPE_TP_BUFFER, ADEC_INFO_TYPE_TP_PTS}; struct buffer_status { unsigned int max_size; unsigned int free_size; }; struct ad_status { int adec_idex; int ad_onoff; }; int audio_control_int_param_get(int param_index, int *value); int audio_control_param_info_get (int param_index, int *value); int audio_control_int_param_set(void *value); typedef int aml_snd_kcontrol_info_t(aml_ahal_ctl_elem_info_t * uinfo); typedef int aml_snd_kcontrol_get_t(aml_ahal_ctl_elem_value_t * ucontrol); typedef int aml_snd_kcontrol_put_t(aml_ahal_ctl_elem_value_t * ucontrol); typedef struct aml_kctl_fuc_new { const char *name; /* ASCII name of item */ aml_snd_kcontrol_info_t *info; aml_snd_kcontrol_get_t *get; aml_snd_kcontrol_put_t *put; } aml_kctl_func_new_t; int aml_kctl_func(int cmd, void *param, int size); #endif