blob: 93e9e9e846987bf4f8d3e3bda5f6fbf697b645e3
1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | #include <string.h> |
4 | #include <android/log.h> |
5 | #include <cutils/properties.h> |
6 | |
7 | #include "../tvsetting/CTvSetting.h" |
8 | #include "../tvconfig/tvconfig.h" |
9 | #include "audio_cfg.h" |
10 | |
11 | #define LOG_TAG "audio_cfg" |
12 | #include "CTvLog.h" |
13 | |
14 | #define CS_AUDIO_AMP_MASTER_NOLINE_SWITCH_CFG_NAME "audio.amp.master.noline.switch" |
15 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_CNT_CFG_NAME "audio.amp.master.noline.point.cnt" |
16 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_IND_BUF_CFG_NAME "audio.amp.master.noline.point.ind.buf" |
17 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_DEF_BUF_CFG_NAME "audio.amp.master.noline.point.data.defbuf" |
18 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_IND_DEF_BUF_CFG_NAME "audio.amp.master.noline.point.ind.defbuf" |
19 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_TV_BUF_CFG_NAME "audio.amp.master.noline.point.data.tv" |
20 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_AV_BUF_CFG_NAME "audio.amp.master.noline.point.data.av" |
21 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_COMP_BUF_CFG_NAME "audio.amp.master.noline.point.data.comp" |
22 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_HDMI_BUF_CFG_NAME "audio.amp.master.noline.point.data.hdmi" |
23 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_VGA_BUF_CFG_NAME "audio.amp.master.noline.point.data.vga" |
24 | #define CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_MPEG_BUF_CFG_NAME "audio.amp.master.noline.point.data.mpeg" |
25 | |
26 | #define CS_AUDIO_AMP_SUPPERBASS_NOLINE_SWITCH_CFG_NAME "audio.amp.supperbass.noline.switch" |
27 | #define CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_CNT_CFG_NAME "audio.amp.supperbass.noline.point.cnt" |
28 | #define CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_IND_BUF_CFG_NAME "audio.amp.supperbass.noline.point.ind.buf" |
29 | #define CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_DATA_DEF_BUF_CFG_NAME "audio.amp.supperbass.noline.point.data.defbuf" |
30 | #define CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_IND_DEF_BUF_CFG_NAME "audio.amp.supperbass.noline.point.ind.defbuf" |
31 | |
32 | #define CS_AUDIO_AMP_BALANCE_EXCHG_CFG_NAME "audio.amp.balance.exchg" |
33 | |
34 | #define CS_EQ_MOUDLE_DISABLE_CFG_NAME "audio.eq.module.disable" |
35 | #define CS_EQ_USING_ANDROID_CFG_NAME "audio.eq.using.android" |
36 | #define CS_EQ_PRESETBUF_CFG_NAME "audio.eq.presetbuf" |
37 | #define CS_EQ_GAIN_RANGE_CFG_NAME "audio.eq.gain.range" |
38 | #define CS_EQ_UI_GAIN_RANGE_CFG_NAME "audio.eq.uigain.range" |
39 | #define CS_EQ_AMP_MASTER_GAIN_CFG_NAME "audio.eq.ampmaster.gain" |
40 | #define CS_EQ_AMP_SUPPERBASS_GAIN_CFG_NAME "audio.eq.ampsupperbass.gain" |
41 | |
42 | #define CS_AUDIO_AMP_MAINVOL_TV_LUTBUF_CFG_NAME "audio.amp.mainvol.tv.lutbuf" |
43 | #define CS_AUDIO_AMP_MAINVOL_AV_LUTBUF_CFG_NAME "audio.amp.mainvol.av.lutbuf" |
44 | #define CS_AUDIO_AMP_MAINVOL_COMP_LUTBUF_CFG_NAME "audio.amp.mainvol.comp.lutbuf" |
45 | #define CS_AUDIO_AMP_MAINVOL_HDMI_LUTBUF_CFG_NAME "audio.amp.mainvol.hdmi.lutbuf" |
46 | #define CS_AUDIO_AMP_MAINVOL_VGA_LUTBUF_CFG_NAME "audio.amp.mainvol.vga.lutbuf" |
47 | #define CS_AUDIO_AMP_MAINVOL_MPEG_LUTBUF_CFG_NAME "audio.amp.mainvol.mpeg.lutbuf" |
48 | |
49 | #define CS_AUDIO_AMP_SUPPERBASSVOL_TV_LUTBUF_CFG_NAME "audio.amp.supbassvol.tv.lutbuf" |
50 | #define CS_AUDIO_AMP_SUPPERBASSVOL_AV_LUTBUF_CFG_NAME "audio.amp.supbassvol.av.lutbuf" |
51 | #define CS_AUDIO_AMP_SUPPERBASSVOL_COMP_LUTBUF_CFG_NAME "audio.amp.supbassvol.comp.lutbuf" |
52 | #define CS_AUDIO_AMP_SUPPERBASSVOL_HDMI_LUTBUF_CFG_NAME "audio.amp.supbassvol.hdmi.lutbuf" |
53 | #define CS_AUDIO_AMP_SUPPERBASSVOL_VGA_LUTBUF_CFG_NAME "audio.amp.supbassvol.vga.lutbuf" |
54 | #define CS_AUDIO_AMP_SUPPERBASSVOL_MPEG_LUTBUF_CFG_NAME "audio.amp.supbassvol.mpeg.lutbuf" |
55 | |
56 | #define CS_SRS_MOUDLE_DISABLE_CFG_NAME "audio.srs.module.disable" |
57 | #define CS_SRS_SOURROUND_DISABLE_CFG_NAME "audio.srs.sourround.disable" |
58 | #define CS_SRS_TRUBASS_DISABLE_CFG_NAME "audio.srs.trubass.disable" |
59 | #define CS_SRS_DIALOGCLARITY_DISABLE_CFG_NAME "audio.srs.dialogclarity.disable" |
60 | #define CS_SRS_SOURROUND_GAIN_CFG_NAME "audio.srs.sourround.gain" |
61 | #define CS_SRS_SOURROUND_AMP_MASTER_GAIN_CFG_NAME "audio.srs.sourround.ampmaster.gain" |
62 | #define CS_SRS_SOURROUND_AMP_SUPPERBASS_GAIN_CFG_NAME "audio.srs.sourround.ampsupperbass.gain" |
63 | #define CS_SRS_TRUBASS_ONLY_GAIN_CFG_NAME "audio.srs.trubass.only.gain" |
64 | #define CS_SRS_TRUBASS_ONLY_AMP_MASTER_GAIN_CFG_NAME "audio.srs.trubass.only.ampmaster.gain" |
65 | #define CS_SRS_TRUBASS_ONLY_AMP_SUPPERBASS_GAIN_CFG_NAME "audio.srs.trubass.only.ampsupperbass.gain" |
66 | #define CS_SRS_DIALOGCLARITY_ONLY_GAIN_CFG_NAME "audio.srs.dialogclarity.only.gain" |
67 | #define CS_SRS_DIALOGCLARITY_ONLY_AMP_MASTER_GAIN_CFG_NAME "audio.srs.dialogclarity.only.ampmaster.gain" |
68 | #define CS_SRS_DIALOGCLARITY_ONLY_AMP_SUPPERBASS_GAIN_CFG_NAME "audio.srs.dialogclarity.only.ampsupperbass.gain" |
69 | #define CS_SRS_DIALOGCLARITY_ONLY_DEFINITION_GAIN_CFG_NAME "audio.srs.dialogclarity.only.definition.gain" |
70 | #define CS_SRS_TRUBASS_DIALOGCLARITY_TRUBASS_GAIN_CFG_NAME "audio.srs.turbass.dialogclarity.trubass.gain" |
71 | #define CS_SRS_TRUBASS_DIALOGCLARITY_DIALOGCLARITY_GAIN_CFG_NAME "audio.srs.turbass.dialogclarity.dialogclarity.gain" |
72 | #define CS_SRS_TRUBASS_DIALOGCLARITY_DEFINITION_GAIN_CFG_NAME "audio.srs.turbass.dialogclarity.definition.gain" |
73 | #define CS_SRS_TRUBASS_DIALOGCLARITY_AMP_MASTER_GAIN_CFG_NAME "audio.srs.turbass.dialogclarity.ampmaster.gain" |
74 | #define CS_SRS_TRUBASS_DIALOGCLARITY_AMP_SUPPERBASS_GAIN_CFG_NAME "audio.srs.turbass.dialogclarity.ampsupperbass.gain" |
75 | #define CS_SRS_SUPPERBASS_ON_TRUBASS_SPEAKER_SIZE_CFG_NAME "audio.srs.supperbasson.turbass.speakersize" |
76 | #define CS_SRS_SUPPERBASS_OFF_TRUBASS_SPEAKER_SIZE_CFG_NAME "audio.srs.supperbassoff.turbass.speakersize" |
77 | |
78 | #define CS_AUDIO_DUMP_DATA_ENABLE_CFG_NAME "audio.dump.data.en" |
79 | #define CS_KEY_MUTE_CFG_NAME "audio.mute.keymute" |
80 | #define CS_AVOUT_INIT_MUTE_CFG_NAME "audio.avout.init.mute" |
81 | #define CS_SUPPERBASS_MODULE_DISABLE_CFG_NAME "audio.supperbass.module.disable" |
82 | #define CS_SUPPERBASS_SWITCH_DISABLE_CFG_NAME "audio.supperbass.switch.disable" |
83 | #define CS_DVI_SUPPORT_ENABLE_CFG_NAME "audio.dvi.support.enable" |
84 | #define CS_SRC_INPUT_TV_LINEIN_VOL_CFG_NAME "audio.srcinput.linein.tv.vol" |
85 | #define CS_SRC_INPUT_AV_LINEIN_VOL_CFG_NAME "audio.srcinput.linein.av.vol" |
86 | #define CS_SRC_INPUT_COMP_LINEIN_VOL_CFG_NAME "audio.srcinput.linein.comp.vol" |
87 | #define CS_SRC_INPUT_HDMI_LINEIN_VOL_CFG_NAME "audio.srcinput.linein.hdmi.vol" |
88 | #define CS_SRC_INPUT_VGA_LINEIN_VOL_CFG_NAME "audio.srcinput.linein.vga.vol" |
89 | #define CS_SRC_INPUT_MPEG_LINEIN_VOL_CFG_NAME "audio.srcinput.linein.mpeg.vol" |
90 | #define CS_SRC_INPUT_TV_LINEOUT_VOL_CFG_NAME "audio.srcinput.lineout.tv.vol" |
91 | #define CS_SRC_INPUT_AV_LINEOUT_VOL_CFG_NAME "audio.srcinput.lineout.av.vol" |
92 | #define CS_SRC_INPUT_COMP_LINEOUT_VOL_CFG_NAME "audio.srcinput.lineout.comp.vol" |
93 | #define CS_SRC_INPUT_HDMI_LINEOUT_VOL_CFG_NAME "audio.srcinput.lineout.hdmi.vol" |
94 | #define CS_SRC_INPUT_VGA_LINEOUT_VOL_CFG_NAME "audio.srcinput.lineout.vga.vol" |
95 | #define CS_SRC_INPUT_MPEG_LINEOUT_VOL_CFG_NAME "audio.srcinput.lineout.mpeg.vol" |
96 | #define CS_SRC_INPUT_MPEG_LINEOUT_VOL_CFG_NAME_OLD "audio.srcinput.lineout.vol" |
97 | |
98 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_TV_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.tv" |
99 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_AV_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.av" |
100 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_COMP_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.comp" |
101 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_HDMI_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.hdmi" |
102 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_VGA_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.vga" |
103 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_MPEG_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.mpeg" |
104 | #define CS_AMP_MAINVOL_LUTBUF_COMPENSATION_DTV_CFG_NAME "audio.amp.mainvol.lutbuf.compensation.dtv" |
105 | |
106 | #define CS_AUDIO_NOISE_GATE_ENABLE_CFG_NAME "audio.noise.gate.enable" |
107 | #define CS_AUDIO_NOISE_GATE_THRESHOLD_CFG_NAME "audio.noise.gate.threshold" |
108 | #define CS_AUDIO_NOISE_GATE_UPPER_BOUND_CFG_NAME "audio.noise.gate.upper.bound" |
109 | |
110 | #define CS_DISABLE_RESET_SYSTEM_FRAMESIZE_CFG_NAME "audio.reset.system.framesize.disable" |
111 | #define CS_AUDIO_SYSTEM_FRAMESIZE_CFG_NAME "audio.reset.system.framesize" |
112 | |
113 | #define CS_AUDIO_ARCHITECTURE_TYPE_CFG_NAME "audio.architecture.type" |
114 | #define CS_AUDIO_RESAMPLE_TYPE_CFG_NAME "audio.resample.type" |
115 | |
116 | |
117 | #define CC_MAX_SUP_LUT_CFG_INDEX (32) |
118 | |
119 | static int gMasterNoLinePointsIndexBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
120 | static int gMasterNoLinePointsDefDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
121 | static int gMasterNoLinePointsDefIndexBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
122 | |
123 | static int gSupperBassNoLinePointsIndexBuffer[CC_NO_LINE_POINTS_MAX_CNT] = |
124 | { -1 }; |
125 | static int gSupperBassNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
126 | static int gSupperBassNoLinePointsDefDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { |
127 | -1 |
128 | }; |
129 | static int gSupperBassNoLinePointsDefIndexBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { |
130 | -1 |
131 | }; |
132 | |
133 | static int gTVMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
134 | static int gAVMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
135 | static int gCOMPMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
136 | static int gHDMIMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
137 | static int gVGAMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
138 | static int gMPEGMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { -1 }; |
139 | static int gHDMI4K2KMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { |
140 | -1 |
141 | }; |
142 | static int gUSB4K2KMasterNoLinePointsDataBuffer[CC_NO_LINE_POINTS_MAX_CNT] = { |
143 | -1 |
144 | }; |
145 | |
146 | static int mTVMainVolumeDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
147 | static int mAVMainVolumeDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
148 | static int mCOMPMainVolumeDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
149 | static int mHDMIMainVolumeDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
150 | static int mVGAMainVolumeDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
151 | static int mMPEGMainVolumeDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
152 | |
153 | static int mTVSupperBassDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
154 | static int mAVSupperBassDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
155 | static int mCOMPSupperBassDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
156 | static int mHDMISupperBassDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
157 | static int mVGASupperBassDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
158 | static int mMPEGSupperBassDigitLutBuf_XX[CC_LUT_BUF_SIZE]; |
159 | |
160 | static int mEQPresetValueBuf_XX[CC_EQ_PRESET_BUF_SIZE]; |
161 | static int mEQPresetDefBuf[CC_EQ_PRESET_BUF_SIZE] = { |
162 | // |
163 | 50, 50, 50, 50, 50, 50, // SM_STD |
164 | 70, 60, 50, 60, 70, 50, // SM_MUSIC |
165 | 25, 50, 70, 66, 25, 50, // SM_NEWS |
166 | 75, 65, 50, 65, 75, 50, // SM_THEATER |
167 | }; |
168 | |
169 | static int GetAudioCfgData(const char *key_str, int *buf_item_count, int radix, |
170 | int data_buf[]) |
171 | { |
172 | int cfg_item_count = 0; |
173 | char *token = NULL; |
174 | const char *strDelimit = ","; |
175 | const char *config_value; |
176 | char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 }; |
177 | |
178 | config_value = config_get_str("TV", key_str, "null"); |
179 | if (strcasecmp(config_value, "null") == 0) { |
180 | //LOGE("%s, can't get config \"%s\"!!!\n", "TV", key_str); |
181 | return -1; |
182 | } |
183 | |
184 | cfg_item_count = 0; |
185 | |
186 | memset((void *)data_str, 0, sizeof(data_str)); |
187 | strncpy(data_str, config_value, sizeof(data_str) - 1); |
188 | token = strtok(data_str, strDelimit); |
189 | while (token != NULL) { |
190 | if (cfg_item_count < *buf_item_count) { |
191 | data_buf[cfg_item_count] = strtol(token, NULL, radix); |
192 | |
193 | token = strtok(NULL, strDelimit); |
194 | cfg_item_count += 1; |
195 | } else { |
196 | LOGE("%s, we get data count more than desire count (%d)!!!\n", |
197 | __FUNCTION__ , *buf_item_count); |
198 | return -1; |
199 | } |
200 | } |
201 | |
202 | *buf_item_count = cfg_item_count; |
203 | |
204 | return 0; |
205 | } |
206 | |
207 | static int GetAudioCfgBufferData(const char *key_str, int *bufs_count, |
208 | int *buf_item_count, int radix, int data_buf[]) |
209 | { |
210 | int cfg_item_count = 0, tmpTotalItemCount = 0; |
211 | char *token = NULL; |
212 | const char *strDelimit = ","; |
213 | const char *config_value; |
214 | char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 }; |
215 | |
216 | config_value = config_get_str("TV", key_str, "null"); |
217 | if (strcasecmp(config_value, "null") == 0) { |
218 | // LOGE("%s, can't get config \"%s\"!!!\n", "TV", key_str); |
219 | *bufs_count = 0; |
220 | *buf_item_count = 0; |
221 | return -1; |
222 | } |
223 | |
224 | tmpTotalItemCount = 0; |
225 | |
226 | memset((void *)data_str, 0, sizeof(data_str)); |
227 | strncpy(data_str, config_value, sizeof(data_str) - 1); |
228 | token = strtok(data_str, strDelimit); |
229 | while (token != NULL) { |
230 | if (cfg_item_count == 0) { |
231 | *bufs_count = strtol(token, NULL, radix); |
232 | } else if (cfg_item_count == 1) { |
233 | *buf_item_count = strtol(token, NULL, radix); |
234 | } else if (cfg_item_count >= 2) { |
235 | data_buf[tmpTotalItemCount] = strtol(token, NULL, radix); |
236 | tmpTotalItemCount += 1; |
237 | } |
238 | |
239 | token = strtok(NULL, strDelimit); |
240 | cfg_item_count += 1; |
241 | } |
242 | |
243 | if ((*bufs_count) * (*buf_item_count) != tmpTotalItemCount) { |
244 | LOGE("%s, get item count error!!! should be %d, real is %d.\n", |
245 | __FUNCTION__, (*bufs_count) * (*buf_item_count), |
246 | tmpTotalItemCount); |
247 | *bufs_count = 0; |
248 | *buf_item_count = 0; |
249 | return -1; |
250 | } |
251 | |
252 | return 0; |
253 | } |
254 | |
255 | static int GetAudioCfgSingleIntData(const char *key_str, int def_val) |
256 | { |
257 | const char *config_value; |
258 | |
259 | config_value = config_get_str("TV", key_str, "null"); |
260 | |
261 | if (strcmp(config_value, "null") == 0) { |
262 | return def_val; |
263 | } |
264 | |
265 | return strtol(config_value, NULL, 10); |
266 | } |
267 | |
268 | template<typename T> |
269 | static int CheckNoLinePoints(int point_cnt, T points_buf[]) |
270 | { |
271 | int i = 0, same_cnt = 0, tmp_direct = -1, error_flag = 0; |
272 | |
273 | if (point_cnt <= 1) { |
274 | LOGD("%s, point is less than 2.\n", __FUNCTION__); |
275 | return 0; |
276 | } |
277 | |
278 | for (i = 0; i < point_cnt - 1; i++) { |
279 | if (points_buf[i] < points_buf[i + 1]) { |
280 | if (tmp_direct == -1) { |
281 | tmp_direct = 0; |
282 | } else if (tmp_direct == 1) { |
283 | LOGD("%s, check have direct error.\n", __FUNCTION__); |
284 | return -1; |
285 | } |
286 | } else if (points_buf[i] > points_buf[i + 1]) { |
287 | if (tmp_direct == -1) { |
288 | tmp_direct = 1; |
289 | } else if (tmp_direct == 0) { |
290 | LOGD("%s, check have direct error.\n", __FUNCTION__); |
291 | return -1; |
292 | } |
293 | } else { |
294 | same_cnt += 1; |
295 | } |
296 | } |
297 | |
298 | if (same_cnt == i) { |
299 | LOGD("%s, check have same error.\n", __FUNCTION__); |
300 | return -1; |
301 | } |
302 | |
303 | LOGD("%s, check no error.\n", __FUNCTION__); |
304 | return 0; |
305 | } |
306 | |
307 | int *GetAudioAmplifierNoLinePointsIndexBuffer(int lut_buf_type, int get_type) |
308 | { |
309 | if (lut_buf_type == CC_LUT_BUF_SUPPERBASS) { |
310 | return GetAudioAmplifierSupperBassNoLinePointsIndexBuffer(get_type); |
311 | } |
312 | |
313 | return NULL; |
314 | } |
315 | |
316 | int *GetAudioAmplifierNoLinePointsDataBuffer(int lut_buf_type, int get_type) |
317 | { |
318 | if (lut_buf_type == CC_LUT_BUF_SUPPERBASS) { |
319 | return GetAudioAmplifierSupperBassNoLinePointsDataBuffer(get_type); |
320 | } |
321 | |
322 | return NULL; |
323 | } |
324 | |
325 | int GetAudioAmplifierMasterNoLineSwitchFlag() |
326 | { |
327 | const char *config_value; |
328 | config_value = config_get_str("TV", |
329 | CS_AUDIO_AMP_MASTER_NOLINE_SWITCH_CFG_NAME, "null"); |
330 | |
331 | if (strcmp(config_value, "null") == 0) { |
332 | return 0; |
333 | } |
334 | |
335 | return strtol(config_value, NULL, 10); |
336 | } |
337 | |
338 | int GetAudioAmplifierSupperBassNoLineSwitchFlag() |
339 | { |
340 | const char *config_value; |
341 | config_value = config_get_str("TV", |
342 | CS_AUDIO_AMP_SUPPERBASS_NOLINE_SWITCH_CFG_NAME, "null"); |
343 | |
344 | if (strcmp(config_value, "null") == 0) { |
345 | return 0; |
346 | } |
347 | |
348 | return strtol(config_value, NULL, 10); |
349 | } |
350 | |
351 | int GetAudioAmplifierMasterNoLinePointsCount() |
352 | { |
353 | const char *config_value; |
354 | config_value = config_get_str("TV", |
355 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_CNT_CFG_NAME, "null"); |
356 | |
357 | if (strcmp(config_value, "null") == 0) { |
358 | return 11; |
359 | } |
360 | |
361 | return strtol(config_value, NULL, 10); |
362 | } |
363 | |
364 | int GetAudioAmplifierSupperBassNoLinePointsCount() |
365 | { |
366 | const char *config_value; |
367 | config_value = config_get_str("TV", |
368 | CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_CNT_CFG_NAME, "null"); |
369 | |
370 | if (strcmp(config_value, "null") == 0) { |
371 | return 5; |
372 | } |
373 | |
374 | return strtol(config_value, NULL, 10); |
375 | } |
376 | |
377 | static int GetAudioAmplifierNoLinePointsBuffer(const char *key_str, |
378 | int buf_item_count, int data_buf[]) |
379 | { |
380 | int i = 0, tmp_item_count = 0; |
381 | int tmp_buf[CC_NO_LINE_POINTS_MAX_CNT] = { 0 }; |
382 | |
383 | // if (data_buf[0] >= 0 && data_buf[0] <= 100) { |
384 | // LOGD("%s, we have get the index buffer.\n", "TV"); |
385 | // return 0; |
386 | // } |
387 | |
388 | tmp_item_count = buf_item_count; |
389 | if (GetAudioCfgData(key_str, &tmp_item_count, 10, tmp_buf) < 0) { |
390 | LOGE("%s, get index buffer data error, set default.\n", __FUNCTION__); |
391 | return -1; |
392 | } |
393 | |
394 | if (tmp_item_count != buf_item_count) { |
395 | LOGE( |
396 | "%s, get index buffer data error(buf item count error), set default.\n", |
397 | __FUNCTION__); |
398 | return -1; |
399 | } |
400 | |
401 | for (i = 0; i < buf_item_count; i++) { |
402 | data_buf[i] = tmp_buf[i]; |
403 | } |
404 | |
405 | return 0; |
406 | } |
407 | |
408 | int *GetAudioAmplifierSupperBassNoLinePointsIndexBuffer(int get_type) |
409 | { |
410 | int buf_item_count = 0; |
411 | |
412 | buf_item_count = GetAudioAmplifierSupperBassNoLinePointsCount(); |
413 | if (GetAudioAmplifierNoLinePointsBuffer( |
414 | CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_IND_BUF_CFG_NAME, |
415 | buf_item_count, gSupperBassNoLinePointsIndexBuffer) < 0) { |
416 | return GetAudioAmplifierSupperBassNoLinePointsDefIndexBuffer(); |
417 | } |
418 | |
419 | if (CheckNoLinePoints(buf_item_count, gSupperBassNoLinePointsIndexBuffer) |
420 | < 0) { |
421 | return GetAudioAmplifierSupperBassNoLinePointsDefIndexBuffer(); |
422 | } |
423 | |
424 | return gSupperBassNoLinePointsIndexBuffer; |
425 | } |
426 | |
427 | int *GetAudioAmplifierMasterNoLinePointsDataBuffer(int get_type) |
428 | { |
429 | int i = 0, buf_item_count = 0, tmp_offset = 0; |
430 | int *tmpPtr = NULL; |
431 | unsigned char tmp_buf[CC_NO_LINE_POINTS_MAX_CNT] = { 0 }; |
432 | |
433 | buf_item_count = GetAudioAmplifierMasterNoLinePointsCount(); |
434 | |
435 | if (get_type == CC_GET_LUT_TV) { |
436 | tmpPtr = gTVMasterNoLinePointsDataBuffer; |
437 | tmp_offset = get_type * buf_item_count; |
438 | } else if (get_type == CC_GET_LUT_AV) { |
439 | tmpPtr = gAVMasterNoLinePointsDataBuffer; |
440 | tmp_offset = get_type * buf_item_count; |
441 | } else if (get_type == CC_GET_LUT_COMP) { |
442 | tmpPtr = gCOMPMasterNoLinePointsDataBuffer; |
443 | tmp_offset = get_type * buf_item_count; |
444 | } else if (get_type == CC_GET_LUT_HDMI) { |
445 | tmpPtr = gHDMIMasterNoLinePointsDataBuffer; |
446 | tmp_offset = get_type * buf_item_count; |
447 | } else if (get_type == CC_GET_LUT_VGA) { |
448 | tmpPtr = gVGAMasterNoLinePointsDataBuffer; |
449 | tmp_offset = get_type * buf_item_count; |
450 | } else if (get_type == CC_GET_LUT_MPEG) { |
451 | tmpPtr = gMPEGMasterNoLinePointsDataBuffer; |
452 | tmp_offset = get_type * buf_item_count; |
453 | } |
454 | |
455 | if (tmpPtr != NULL && tmpPtr[0] != -1) { |
456 | return tmpPtr; |
457 | } |
458 | |
459 | if (SSMReadAudioNoLinePoints(tmp_offset, buf_item_count, tmp_buf) < 0) { |
460 | return GetAudioAmplifierMasterNoLinePointsDefDataBuffer(get_type); |
461 | } |
462 | |
463 | if (CheckNoLinePoints(buf_item_count, tmp_buf) < 0) { |
464 | return GetAudioAmplifierMasterNoLinePointsDefDataBuffer(get_type); |
465 | } |
466 | |
467 | for (i = 0; i < buf_item_count; i++) { |
468 | tmpPtr[i] = tmp_buf[i]; |
469 | } |
470 | |
471 | return tmpPtr; |
472 | } |
473 | |
474 | int *GetAudioAmplifierSupperBassNoLinePointsDataBuffer(int get_type) |
475 | { |
476 | int i = 0, buf_item_count = 0, tmp_offset = 0; |
477 | int *tmpPtr = NULL; |
478 | unsigned char tmp_buf[CC_NO_LINE_POINTS_MAX_CNT] = { 0 }; |
479 | |
480 | buf_item_count = GetAudioAmplifierSupperBassNoLinePointsCount(); |
481 | |
482 | tmpPtr = gSupperBassNoLinePointsDataBuffer; |
483 | if (tmpPtr != NULL && tmpPtr[0] != -1) { |
484 | return tmpPtr; |
485 | } |
486 | |
487 | tmp_offset = CC_GET_TYPE_CNT * GetAudioAmplifierMasterNoLinePointsCount(); |
488 | |
489 | if (SSMReadAudioNoLinePoints(tmp_offset, buf_item_count, tmp_buf) < 0) { |
490 | return GetAudioAmplifierSupperBassNoLinePointsDefDataBuffer(); |
491 | } |
492 | |
493 | if (CheckNoLinePoints(buf_item_count, tmp_buf) < 0) { |
494 | return GetAudioAmplifierSupperBassNoLinePointsDefDataBuffer(); |
495 | } |
496 | |
497 | for (i = 0; i < buf_item_count; i++) { |
498 | tmpPtr[i] = tmp_buf[i]; |
499 | } |
500 | |
501 | return tmpPtr; |
502 | } |
503 | |
504 | int *GetAudioAmplifierMasterNoLinePointsDefIndexBuffer() |
505 | { |
506 | int i = 0, buf_item_count = 0; |
507 | |
508 | buf_item_count = GetAudioAmplifierMasterNoLinePointsCount(); |
509 | if (GetAudioAmplifierNoLinePointsBuffer( |
510 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_IND_DEF_BUF_CFG_NAME, |
511 | buf_item_count, gMasterNoLinePointsDefIndexBuffer) < 0) { |
512 | gMasterNoLinePointsDefIndexBuffer[0] = 1; |
513 | |
514 | for (i = 1; i <= 10; i++) { |
515 | gMasterNoLinePointsDefIndexBuffer[i] = i * 10; |
516 | } |
517 | } |
518 | |
519 | if (CheckNoLinePoints(buf_item_count, gMasterNoLinePointsDefIndexBuffer) |
520 | < 0) { |
521 | gMasterNoLinePointsDefIndexBuffer[0] = 1; |
522 | |
523 | for (i = 1; i <= 10; i++) { |
524 | gMasterNoLinePointsDefIndexBuffer[i] = i * 10; |
525 | } |
526 | } |
527 | |
528 | return gMasterNoLinePointsDefIndexBuffer; |
529 | } |
530 | |
531 | int *GetAudioAmplifierSupperBassNoLinePointsDefIndexBuffer() |
532 | { |
533 | int i = 0, buf_item_count = 0; |
534 | |
535 | buf_item_count = GetAudioAmplifierSupperBassNoLinePointsCount(); |
536 | if (GetAudioAmplifierNoLinePointsBuffer( |
537 | CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_IND_DEF_BUF_CFG_NAME, |
538 | buf_item_count, gSupperBassNoLinePointsDefIndexBuffer) < 0) { |
539 | gSupperBassNoLinePointsDefIndexBuffer[0] = 1; |
540 | |
541 | for (i = 1; i <= 4; i++) { |
542 | gSupperBassNoLinePointsDefIndexBuffer[i] = i * 25; |
543 | } |
544 | } |
545 | |
546 | if (CheckNoLinePoints(buf_item_count, gSupperBassNoLinePointsDefIndexBuffer) |
547 | < 0) { |
548 | gSupperBassNoLinePointsDefIndexBuffer[0] = 1; |
549 | |
550 | for (i = 1; i <= 4; i++) { |
551 | gSupperBassNoLinePointsDefIndexBuffer[i] = i * 25; |
552 | } |
553 | } |
554 | |
555 | return gSupperBassNoLinePointsDefIndexBuffer; |
556 | } |
557 | |
558 | int *GetAudioAmplifierMasterNoLinePointsDefDataBuffer(int buf_type) |
559 | { |
560 | int i = 0, buf_item_count = 0, point_buffer_flag = 0; |
561 | |
562 | buf_item_count = GetAudioAmplifierMasterNoLinePointsCount(); |
563 | |
564 | switch (buf_type) { |
565 | case CC_GET_LUT_TV: |
566 | point_buffer_flag = GetAudioAmplifierNoLinePointsBuffer( |
567 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_TV_BUF_CFG_NAME, |
568 | buf_item_count, gMasterNoLinePointsDefDataBuffer); |
569 | break; |
570 | case CC_GET_LUT_AV: |
571 | point_buffer_flag = GetAudioAmplifierNoLinePointsBuffer( |
572 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_AV_BUF_CFG_NAME, |
573 | buf_item_count, gMasterNoLinePointsDefDataBuffer); |
574 | break; |
575 | case CC_GET_LUT_COMP: |
576 | point_buffer_flag = GetAudioAmplifierNoLinePointsBuffer( |
577 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_COMP_BUF_CFG_NAME, |
578 | buf_item_count, gMasterNoLinePointsDefDataBuffer); |
579 | break; |
580 | case CC_GET_LUT_HDMI: |
581 | point_buffer_flag = GetAudioAmplifierNoLinePointsBuffer( |
582 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_HDMI_BUF_CFG_NAME, |
583 | buf_item_count, gMasterNoLinePointsDefDataBuffer); |
584 | break; |
585 | case CC_GET_LUT_VGA: |
586 | point_buffer_flag = GetAudioAmplifierNoLinePointsBuffer( |
587 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_VGA_BUF_CFG_NAME, |
588 | buf_item_count, gMasterNoLinePointsDefDataBuffer); |
589 | break; |
590 | case CC_GET_LUT_MPEG: |
591 | point_buffer_flag = GetAudioAmplifierNoLinePointsBuffer( |
592 | CS_AUDIO_AMP_MASTER_NOLINE_POINT_DATA_MPEG_BUF_CFG_NAME, |
593 | buf_item_count, gMasterNoLinePointsDefDataBuffer); |
594 | break; |
595 | default: |
596 | point_buffer_flag = -1; |
597 | // LOGE("buffer type is wrong ,please check input Parameter !"); |
598 | break; |
599 | } |
600 | |
601 | if (point_buffer_flag < 0) { |
602 | for (i = 0; i < buf_item_count; i++) { |
603 | gMasterNoLinePointsDefDataBuffer[i] = 100 + i; |
604 | } |
605 | |
606 | return gMasterNoLinePointsDefDataBuffer; |
607 | } |
608 | |
609 | if (CheckNoLinePoints(buf_item_count, gMasterNoLinePointsDefDataBuffer) |
610 | < 0) { |
611 | for (i = 0; i < buf_item_count; i++) { |
612 | gMasterNoLinePointsDefDataBuffer[i] = 100 + i; |
613 | } |
614 | } |
615 | |
616 | return gMasterNoLinePointsDefDataBuffer; |
617 | } |
618 | |
619 | int *GetAudioAmplifierSupperBassNoLinePointsDefDataBuffer() |
620 | { |
621 | int i = 0, buf_item_count = 0; |
622 | |
623 | buf_item_count = GetAudioAmplifierSupperBassNoLinePointsCount(); |
624 | if (GetAudioAmplifierNoLinePointsBuffer( |
625 | CS_AUDIO_AMP_SUPPERBASS_NOLINE_POINT_DATA_DEF_BUF_CFG_NAME, |
626 | buf_item_count, gSupperBassNoLinePointsDefDataBuffer) < 0) { |
627 | for (i = 0; i < buf_item_count; i++) { |
628 | gSupperBassNoLinePointsDefDataBuffer[i] = 100 + i; |
629 | } |
630 | } |
631 | |
632 | if (CheckNoLinePoints(buf_item_count, gSupperBassNoLinePointsDefDataBuffer) |
633 | < 0) { |
634 | for (i = 0; i < buf_item_count; i++) { |
635 | gSupperBassNoLinePointsDefDataBuffer[i] = 100 + i; |
636 | } |
637 | } |
638 | |
639 | return gSupperBassNoLinePointsDefDataBuffer; |
640 | } |
641 | |
642 | int GetAudioAmplifierBalanceExchangeCFG() |
643 | { |
644 | const char *config_value; |
645 | config_value = config_get_str("TV", CS_AUDIO_AMP_BALANCE_EXCHG_CFG_NAME, |
646 | "null"); |
647 | if (strcmp(config_value, "null") == 0) { |
648 | return 0; //return 0 to disable balance exchange |
649 | } |
650 | |
651 | return strtol(config_value, NULL, 10); |
652 | } |
653 | |
654 | int GetAudioMainVolLutBufCFGIndexModifyEnable() |
655 | { |
656 | const char *config_value; |
657 | |
658 | config_value = config_get_str("TV", "audio.amp.master.cfgindex.mod.en", |
659 | "null"); |
660 | |
661 | if (strcmp(config_value, "null") == 0) { |
662 | return 0; |
663 | } |
664 | |
665 | return strtoul(config_value, NULL, 10); |
666 | } |
667 | |
668 | int GetAudioMainVolLutBufNameModifyUbootenvCFG() |
669 | { |
670 | char config_value[PROPERTY_VALUE_MAX]; |
671 | |
672 | memset(config_value, '\0', 32); |
673 | |
674 | property_get("ubootenv.var.ampindex", config_value, "null"); |
675 | if (strcasecmp(config_value, "null") == 0) { |
676 | return 0; |
677 | } |
678 | |
679 | return strtoul(config_value, NULL, 10); |
680 | } |
681 | |
682 | int GetAudioMainVolLutBufNameModifyFromUbootenv() |
683 | { |
684 | const char *config_value; |
685 | |
686 | config_value = config_get_str("TV", |
687 | "audio.amp.mainvol.lutbufname.mod.ubootenv", "null"); |
688 | |
689 | if (strcmp(config_value, "null") == 0) { |
690 | return 0; |
691 | } |
692 | |
693 | return strtoul(config_value, NULL, 10); |
694 | } |
695 | |
696 | int GetAudioMainVolLutBufNameModifyEnableCFG() |
697 | { |
698 | const char *config_value; |
699 | |
700 | config_value = config_get_str("TV", "audio.amp.mainvol.lutbufname.mod.en", |
701 | "null"); |
702 | |
703 | if (strcmp(config_value, "null") == 0) { |
704 | return 0; |
705 | } |
706 | |
707 | return strtoul(config_value, NULL, 10); |
708 | } |
709 | |
710 | int GetAudioMainVolLutBufNameCFG(int get_type, char name_buf[]) |
711 | { |
712 | if (get_type == CC_GET_LUT_TV) { |
713 | strcpy(name_buf, "audio.amp.mainvol.tv.lb.name"); |
714 | } else if (get_type == CC_GET_LUT_AV) { |
715 | strcpy(name_buf, "audio.amp.mainvol.av.lb.name"); |
716 | } else if (get_type == CC_GET_LUT_COMP) { |
717 | strcpy(name_buf, "audio.amp.mainvol.comp.lb.name"); |
718 | } else if (get_type == CC_GET_LUT_HDMI) { |
719 | strcpy(name_buf, "audio.amp.mainvol.hdmi.lb.name"); |
720 | } else if (get_type == CC_GET_LUT_VGA) { |
721 | strcpy(name_buf, "audio.amp.mainvol.vga.lb.name"); |
722 | } else if (get_type == CC_GET_LUT_MPEG) { |
723 | strcpy(name_buf, "audio.amp.mainvol.mpeg.lb.name"); |
724 | } else if (get_type == CC_GET_LUT_HDMI_4K2K) { |
725 | strcpy(name_buf, "audio.amp.mainvol.hdmi4k2k.lb.name"); |
726 | } else if (get_type == CC_GET_LUT_USB_4K2K) { |
727 | strcpy(name_buf, "audio.amp.mainvol.usb4k2k.lb.name"); |
728 | } else { |
729 | return -1; |
730 | } |
731 | |
732 | return 0; |
733 | } |
734 | |
735 | static int GetAudioMainVolLutBufDataByModifyName(int get_type, |
736 | int *VolumeDigitLutBuf_XX) |
737 | { |
738 | int i = 0, buf_count = 0, buf_item_count = 0; |
739 | char key_buf[128]; |
740 | const char *value_buf; |
741 | |
742 | memset(key_buf, '\0', 128); |
743 | |
744 | GetAudioMainVolLutBufNameCFG(get_type, key_buf); |
745 | |
746 | value_buf = config_get_str("TV", key_buf, (char *) ""); |
747 | |
748 | if (strcmp(value_buf, "") != 0) { |
749 | if (GetAudioCfgBufferData(value_buf, &buf_count, &buf_item_count, 10, |
750 | VolumeDigitLutBuf_XX) == 0) { |
751 | return 0; |
752 | } |
753 | } |
754 | |
755 | return -1; |
756 | } |
757 | |
758 | int *GetAudioAmplifierMasterVolumeLUTBufferPtr(int get_type, int audio_std) |
759 | { |
760 | int buf_count = 0, buf_item_count = 0; |
761 | int name_en = GetAudioMainVolLutBufNameModifyEnableCFG(); |
762 | |
763 | if (name_en == 1) { |
764 | if (get_type == CC_GET_LUT_TV) { |
765 | if (GetAudioMainVolLutBufDataByModifyName(get_type, |
766 | mTVMainVolumeDigitLutBuf_XX) == 0) { |
767 | return mTVMainVolumeDigitLutBuf_XX; |
768 | } |
769 | } else if (get_type == CC_GET_LUT_AV) { |
770 | if (GetAudioMainVolLutBufDataByModifyName(get_type, |
771 | mAVMainVolumeDigitLutBuf_XX) == 0) { |
772 | return mAVMainVolumeDigitLutBuf_XX; |
773 | } |
774 | } else if (get_type == CC_GET_LUT_COMP) { |
775 | if (GetAudioMainVolLutBufDataByModifyName(get_type, |
776 | mCOMPMainVolumeDigitLutBuf_XX) == 0) { |
777 | return mCOMPMainVolumeDigitLutBuf_XX; |
778 | } |
779 | } else if (get_type == CC_GET_LUT_HDMI) { |
780 | if (GetAudioMainVolLutBufDataByModifyName(get_type, |
781 | mHDMIMainVolumeDigitLutBuf_XX) == 0) { |
782 | return mHDMIMainVolumeDigitLutBuf_XX; |
783 | } |
784 | } else if (get_type == CC_GET_LUT_VGA) { |
785 | if (GetAudioMainVolLutBufDataByModifyName(get_type, |
786 | mVGAMainVolumeDigitLutBuf_XX) == 0) { |
787 | return mVGAMainVolumeDigitLutBuf_XX; |
788 | } |
789 | } else if (get_type == CC_GET_LUT_MPEG) { |
790 | if (GetAudioMainVolLutBufDataByModifyName(get_type, |
791 | mMPEGMainVolumeDigitLutBuf_XX) == 0) { |
792 | return mMPEGMainVolumeDigitLutBuf_XX; |
793 | } |
794 | } |
795 | } else { |
796 | if (get_type == CC_GET_LUT_TV) { |
797 | if (GetAudioCfgBufferData(CS_AUDIO_AMP_MAINVOL_TV_LUTBUF_CFG_NAME, |
798 | &buf_count, &buf_item_count, 10, |
799 | mTVMainVolumeDigitLutBuf_XX) == 0) { |
800 | return mTVMainVolumeDigitLutBuf_XX; |
801 | } |
802 | } else if (get_type == CC_GET_LUT_AV) { |
803 | if (GetAudioCfgBufferData(CS_AUDIO_AMP_MAINVOL_AV_LUTBUF_CFG_NAME, |
804 | &buf_count, &buf_item_count, 10, |
805 | mAVMainVolumeDigitLutBuf_XX) == 0) { |
806 | return mAVMainVolumeDigitLutBuf_XX; |
807 | } |
808 | } else if (get_type == CC_GET_LUT_COMP) { |
809 | if (GetAudioCfgBufferData(CS_AUDIO_AMP_MAINVOL_COMP_LUTBUF_CFG_NAME, |
810 | &buf_count, &buf_item_count, 10, |
811 | mCOMPMainVolumeDigitLutBuf_XX) == 0) { |
812 | return mCOMPMainVolumeDigitLutBuf_XX; |
813 | } |
814 | } else if (get_type == CC_GET_LUT_HDMI) { |
815 | if (GetAudioCfgBufferData(CS_AUDIO_AMP_MAINVOL_HDMI_LUTBUF_CFG_NAME, |
816 | &buf_count, &buf_item_count, 10, |
817 | mHDMIMainVolumeDigitLutBuf_XX) == 0) { |
818 | return mHDMIMainVolumeDigitLutBuf_XX; |
819 | } |
820 | } else if (get_type == CC_GET_LUT_VGA) { |
821 | if (GetAudioCfgBufferData(CS_AUDIO_AMP_MAINVOL_VGA_LUTBUF_CFG_NAME, |
822 | &buf_count, &buf_item_count, 10, |
823 | mVGAMainVolumeDigitLutBuf_XX) == 0) { |
824 | return mVGAMainVolumeDigitLutBuf_XX; |
825 | } |
826 | } else if (get_type == CC_GET_LUT_MPEG) { |
827 | if (GetAudioCfgBufferData(CS_AUDIO_AMP_MAINVOL_MPEG_LUTBUF_CFG_NAME, |
828 | &buf_count, &buf_item_count, 10, |
829 | mMPEGMainVolumeDigitLutBuf_XX) == 0) { |
830 | return mMPEGMainVolumeDigitLutBuf_XX; |
831 | } |
832 | } |
833 | } |
834 | return NULL; |
835 | } |
836 | |
837 | int GetAudioSupperBassVolLutBufCFGIndexModifyEnable() |
838 | { |
839 | const char *config_value; |
840 | config_value = config_get_str("TV", "audio.amp.supperbass.cfgindex.mod.en", |
841 | "null"); |
842 | //LOGD("%s, get audio.amp.supperbass.cfgindex.mod.en is %s \n", "TV", |
843 | // config_value); |
844 | |
845 | if (strcmp(config_value, "null") == 0) { |
846 | // LOGD( |
847 | // "%s, get config modify value \"%s\", return audio.amp.supperbass.cfgindex.mod.en.\n", |
848 | // "TV", config_value); |
849 | return 0; |
850 | } |
851 | |
852 | return strtoul(config_value, NULL, 10); |
853 | } |
854 | |
855 | int GetAudioSupperBassVolLutBufNameModifyEnableCFG() |
856 | { |
857 | const char *config_value; |
858 | |
859 | config_value = config_get_str("TV", |
860 | "audio.amp.supbassvol.lutbufname.mod.en", "null"); |
861 | //LOGD("%s, audio.amp.supbassvol.lutbufname.mod.en is %s \n", "TV", |
862 | // config_value); |
863 | |
864 | if (strcmp(config_value, "null") == 0) { |
865 | // LOGD( |
866 | // "%s, get config enable value \"%s\", return 0 to not enable moidfy lut buffer name.\n", |
867 | // "TV", config_value); |
868 | return 0; |
869 | } |
870 | |
871 | return strtoul(config_value, NULL, 10); |
872 | } |
873 | |
874 | int GetAudioSupperBassVolLutBufNameCFG(int get_type, char name_buf[]) |
875 | { |
876 | if (get_type == CC_GET_LUT_TV) { |
877 | strcpy(name_buf, "audio.amp.supbassvol.tv.lb.name"); |
878 | } else if (get_type == CC_GET_LUT_AV) { |
879 | strcpy(name_buf, "audio.amp.supbassvol.av.lb.name"); |
880 | } else if (get_type == CC_GET_LUT_COMP) { |
881 | strcpy(name_buf, "audio.amp.supbassvol.comp.lb.name"); |
882 | } else if (get_type == CC_GET_LUT_HDMI) { |
883 | strcpy(name_buf, "audio.amp.supbassvol.hdmi.lb.name"); |
884 | } else if (get_type == CC_GET_LUT_VGA) { |
885 | strcpy(name_buf, "audio.amp.supbassvol.vga.lb.name"); |
886 | } else if (get_type == CC_GET_LUT_MPEG) { |
887 | strcpy(name_buf, "audio.amp.supbassvol.mpeg.lb.name"); |
888 | } else if (get_type == CC_GET_LUT_HDMI_4K2K) { |
889 | strcpy(name_buf, "audio.amp.supbassvol.hdmi4k2k.lb.name"); |
890 | } else if (get_type == CC_GET_LUT_USB_4K2K) { |
891 | strcpy(name_buf, "audio.amp.supbassvol.usb4k2k.lb.name"); |
892 | } else { |
893 | return -1; |
894 | } |
895 | |
896 | return 0; |
897 | } |
898 | |
899 | static int GetAudioSupperBassByModifyName(int get_type, |
900 | int *VolumeDigitLutBuf_XX) |
901 | { |
902 | int i = 0, buf_count = 0, buf_item_count = 0; |
903 | char key_buf[128]; |
904 | const char *value_buf; |
905 | |
906 | memset(key_buf, '\0', 128); |
907 | |
908 | GetAudioSupperBassVolLutBufNameCFG(get_type, key_buf); |
909 | |
910 | value_buf = config_get_str("TV", key_buf, (char *) ""); |
911 | //LOGD("%s, get_type = %d, key_buf = %s, value_buf = %s \n", "TV", |
912 | // get_type, key_buf, value_buf); |
913 | |
914 | if (strcmp(value_buf, "") != 0) { |
915 | if (GetAudioCfgBufferData(value_buf, &buf_count, &buf_item_count, 10, |
916 | VolumeDigitLutBuf_XX) == 0) { |
917 | return 0; |
918 | } |
919 | } |
920 | |
921 | return -1; |
922 | } |
923 | |
924 | int *GetAudioAmplifierSupperBassVolumeLUTBufferPtr(int get_type, |
925 | int audio_std) |
926 | { |
927 | int buf_count = 0, buf_item_count = 0; |
928 | |
929 | int name_en = GetAudioSupperBassVolLutBufNameModifyEnableCFG(); |
930 | |
931 | if (name_en == 1) { |
932 | if (get_type == CC_GET_LUT_TV) { |
933 | if (GetAudioSupperBassByModifyName(get_type, |
934 | mTVSupperBassDigitLutBuf_XX) == 0) { |
935 | return mTVSupperBassDigitLutBuf_XX; |
936 | } |
937 | } else if (get_type == CC_GET_LUT_AV) { |
938 | if (GetAudioSupperBassByModifyName(get_type, |
939 | mAVSupperBassDigitLutBuf_XX) == 0) { |
940 | return mAVSupperBassDigitLutBuf_XX; |
941 | } |
942 | } else if (get_type == CC_GET_LUT_COMP) { |
943 | if (GetAudioSupperBassByModifyName(get_type, |
944 | mCOMPSupperBassDigitLutBuf_XX) == 0) { |
945 | return mCOMPSupperBassDigitLutBuf_XX; |
946 | } |
947 | } else if (get_type == CC_GET_LUT_HDMI) { |
948 | if (GetAudioSupperBassByModifyName(get_type, |
949 | mHDMISupperBassDigitLutBuf_XX) == 0) { |
950 | return mHDMISupperBassDigitLutBuf_XX; |
951 | } |
952 | } else if (get_type == CC_GET_LUT_VGA) { |
953 | if (GetAudioSupperBassByModifyName(get_type, |
954 | mVGASupperBassDigitLutBuf_XX) == 0) { |
955 | return mVGASupperBassDigitLutBuf_XX; |
956 | } |
957 | } else if (get_type == CC_GET_LUT_MPEG) { |
958 | if (GetAudioSupperBassByModifyName(get_type, |
959 | mMPEGSupperBassDigitLutBuf_XX) == 0) { |
960 | return mMPEGSupperBassDigitLutBuf_XX; |
961 | } |
962 | } |
963 | } else { |
964 | if (get_type == CC_GET_LUT_TV) { |
965 | if (GetAudioCfgBufferData( |
966 | CS_AUDIO_AMP_SUPPERBASSVOL_TV_LUTBUF_CFG_NAME, &buf_count, |
967 | &buf_item_count, 10, mTVSupperBassDigitLutBuf_XX) == 0) { |
968 | return mTVSupperBassDigitLutBuf_XX; |
969 | } |
970 | } else if (get_type == CC_GET_LUT_AV) { |
971 | if (GetAudioCfgBufferData( |
972 | CS_AUDIO_AMP_SUPPERBASSVOL_AV_LUTBUF_CFG_NAME, &buf_count, |
973 | &buf_item_count, 10, mAVSupperBassDigitLutBuf_XX) == 0) { |
974 | return mAVSupperBassDigitLutBuf_XX; |
975 | } |
976 | } else if (get_type == CC_GET_LUT_COMP) { |
977 | if (GetAudioCfgBufferData( |
978 | CS_AUDIO_AMP_SUPPERBASSVOL_COMP_LUTBUF_CFG_NAME, &buf_count, |
979 | &buf_item_count, 10, mCOMPSupperBassDigitLutBuf_XX) == 0) { |
980 | return mCOMPSupperBassDigitLutBuf_XX; |
981 | } |
982 | } else if (get_type == CC_GET_LUT_HDMI) { |
983 | if (GetAudioCfgBufferData( |
984 | CS_AUDIO_AMP_SUPPERBASSVOL_HDMI_LUTBUF_CFG_NAME, &buf_count, |
985 | &buf_item_count, 10, mHDMISupperBassDigitLutBuf_XX) == 0) { |
986 | return mHDMISupperBassDigitLutBuf_XX; |
987 | } |
988 | } else if (get_type == CC_GET_LUT_VGA) { |
989 | if (GetAudioCfgBufferData( |
990 | CS_AUDIO_AMP_SUPPERBASSVOL_VGA_LUTBUF_CFG_NAME, &buf_count, |
991 | &buf_item_count, 10, mVGASupperBassDigitLutBuf_XX) == 0) { |
992 | return mVGASupperBassDigitLutBuf_XX; |
993 | } |
994 | } else if (get_type == CC_GET_LUT_MPEG) { |
995 | if (GetAudioCfgBufferData( |
996 | CS_AUDIO_AMP_SUPPERBASSVOL_MPEG_LUTBUF_CFG_NAME, &buf_count, |
997 | &buf_item_count, 10, mMPEGSupperBassDigitLutBuf_XX) == 0) { |
998 | return mMPEGSupperBassDigitLutBuf_XX; |
999 | } |
1000 | } |
1001 | } |
1002 | |
1003 | return NULL; |
1004 | } |
1005 | |
1006 | int *GetAudioEQPresetBufferPtr() |
1007 | { |
1008 | int buf_count = 0, buf_item_count = 0; |
1009 | int *tmpDataBufPtr = NULL; |
1010 | |
1011 | tmpDataBufPtr = mEQPresetValueBuf_XX; |
1012 | |
1013 | memset((void *) tmpDataBufPtr, 0, sizeof(int) * CC_EQ_PRESET_BUF_SIZE); |
1014 | |
1015 | if (GetAudioCfgBufferData(CS_EQ_PRESETBUF_CFG_NAME, &buf_count, |
1016 | &buf_item_count, 10, tmpDataBufPtr) == 0) { |
1017 | return tmpDataBufPtr; |
1018 | } |
1019 | |
1020 | return mEQPresetDefBuf; |
1021 | } |
1022 | |
1023 | int GetAudioDVISupportEnable() |
1024 | { |
1025 | const char *config_value; |
1026 | |
1027 | config_value = config_get_str("TV", CS_DVI_SUPPORT_ENABLE_CFG_NAME, "null"); |
1028 | |
1029 | if (strcmp(config_value, "null") == 0) { |
1030 | return 0; |
1031 | } |
1032 | |
1033 | return strtoul(config_value, NULL, 10); |
1034 | } |
1035 | |
1036 | int GetTvAudioCardID(char tv_card_id_buf[]) |
1037 | { |
1038 | const char *value; |
1039 | value = config_get_str("TV", "audio.tv.card.id", "null"); |
1040 | //LOGD("%s, get card id is \"%s\".\n", "TV", tv_card_id_buf); |
1041 | |
1042 | strcpy(tv_card_id_buf, value); |
1043 | if (strcmp(value, "null") == 0) { |
1044 | strcpy(tv_card_id_buf, "0"); |
1045 | // LOGD("%s, card id not config, we set to default \"%s\".\n", |
1046 | // "TV", "0"); |
1047 | } |
1048 | |
1049 | return 0; |
1050 | } |
1051 | |
1052 | int GetTvAudioCardName(char tv_card_name_buf[]) |
1053 | { |
1054 | const char *value; |
1055 | value = config_get_str("TV", "audio.tv.card.name", "null"); |
1056 | //LOGD("%s, get card name is \"%s\".\n", "TV", tv_card_name_buf); |
1057 | |
1058 | strcpy(tv_card_name_buf, value); |
1059 | if (strcmp(value, "null") == 0) { |
1060 | strcpy(tv_card_name_buf, "AMLSYNO9629"); |
1061 | // LOGD("%s, card name not config, we set to default \"%s\".\n", |
1062 | // "TV", "AML-M2"); |
1063 | } |
1064 | |
1065 | return 0; |
1066 | } |
1067 | |
1068 | int GetTvAudioCardNeedSet() |
1069 | { |
1070 | const char *config_value; |
1071 | |
1072 | config_value = config_get_str("TV", "audio.tv.card.needset", "null"); |
1073 | //LOGD("%s, get \"%s\" is \"%s\".\n", "TV", "audio.tv.card.needset", |
1074 | // config_value); |
1075 | |
1076 | if (strcmp(config_value, "null") == 0) { |
1077 | return 0; |
1078 | } |
1079 | |
1080 | if (strtoul(config_value, NULL, 10) == 0) { |
1081 | return 0; |
1082 | } |
1083 | |
1084 | return 1; |
1085 | } |
1086 | |
1087 | static int GetAudioEffectAmplifierGainCfg(const char *cfg_name, |
1088 | int def_gain_val, int max_gain_val) |
1089 | { |
1090 | int tmp_val; |
1091 | const char *config_value; |
1092 | |
1093 | config_value = config_get_str("TV", cfg_name, "null"); |
1094 | //LOGD("%s, get %s is \"%s\".\n", "TV", cfg_name, config_value); |
1095 | |
1096 | if (strcmp(config_value, "null") == 0) { |
1097 | // LOGD( |
1098 | // "%s, get config \"%s\" is \"%s\", return default audio effect amplifier gain value(%d).\n", |
1099 | // "TV", cfg_name, config_value, def_gain_val); |
1100 | return def_gain_val; |
1101 | } |
1102 | |
1103 | tmp_val = strtoul(config_value, NULL, 10); |
1104 | if (tmp_val < 0 || tmp_val > max_gain_val) { |
1105 | // LOGD( |
1106 | // "%s, get config \"%s\" is error, it(%d) should between %d and %d, return default audio effect amplifier gain value(%d)\n", |
1107 | // "TV", cfg_name, tmp_val, 0, max_gain_val, def_gain_val); |
1108 | tmp_val = def_gain_val; |
1109 | } |
1110 | |
1111 | return tmp_val; |
1112 | } |
1113 | |
1114 | int GetAudioSRSModuleDisableCFG() |
1115 | { |
1116 | const char *config_value; |
1117 | |
1118 | config_value = config_get_str("TV", CS_SRS_MOUDLE_DISABLE_CFG_NAME, "null"); |
1119 | |
1120 | if (strcmp(config_value, "null") == 0) { |
1121 | return 0; |
1122 | } |
1123 | |
1124 | return strtoul(config_value, NULL, 10); |
1125 | } |
1126 | |
1127 | int GetAudioSRSSourroundDisableCFG() |
1128 | { |
1129 | const char *config_value; |
1130 | |
1131 | config_value = config_get_str("TV", CS_SRS_SOURROUND_DISABLE_CFG_NAME, |
1132 | "null"); |
1133 | |
1134 | if (strcmp(config_value, "null") == 0) { |
1135 | return 0; |
1136 | } |
1137 | |
1138 | return strtoul(config_value, NULL, 10); |
1139 | } |
1140 | |
1141 | int GetAudioSRSTrubassDisableCFG() |
1142 | { |
1143 | const char *config_value; |
1144 | |
1145 | config_value = config_get_str("TV", CS_SRS_TRUBASS_DISABLE_CFG_NAME, |
1146 | "null"); |
1147 | |
1148 | if (strcmp(config_value, "null") == 0) { |
1149 | return 0; |
1150 | } |
1151 | |
1152 | return strtoul(config_value, NULL, 10); |
1153 | } |
1154 | |
1155 | int GetAudioSRSDialogClarityDisableCFG() |
1156 | { |
1157 | const char *config_value; |
1158 | |
1159 | config_value = config_get_str("TV", CS_SRS_DIALOGCLARITY_DISABLE_CFG_NAME, |
1160 | "null"); |
1161 | |
1162 | if (strcmp(config_value, "null") == 0) { |
1163 | return 0; |
1164 | } |
1165 | |
1166 | return strtoul(config_value, NULL, 10); |
1167 | } |
1168 | |
1169 | static int GetAudioSRSGainCfg(const char *cfg_name, int def_gain_val) |
1170 | { |
1171 | int tmp_val; |
1172 | const char *config_value; |
1173 | |
1174 | config_value = config_get_str("TV", cfg_name, "null"); |
1175 | //LOGD("%s, get %s is \"%s\".\n", "TV", cfg_name, config_value); |
1176 | |
1177 | if (strcmp(config_value, "null") == 0) { |
1178 | // LOGD( |
1179 | // "%s, get config \"%s\" is \"%s\", return -1 to use default gain value.\n", |
1180 | // "TV", cfg_name, config_value); |
1181 | return -1; |
1182 | } |
1183 | |
1184 | tmp_val = strtoul(config_value, NULL, 10); |
1185 | if (tmp_val < 0 || tmp_val > 100) { |
1186 | tmp_val = def_gain_val; |
1187 | // LOGD("%s, get config \"%s\" is error, we set it to %d\n", "TV", |
1188 | // cfg_name, tmp_val); |
1189 | } |
1190 | |
1191 | return tmp_val; |
1192 | } |
1193 | |
1194 | static int GetAudioSRSAmplifierGainCfg(const char *cfg_name, int def_gain_val) |
1195 | { |
1196 | return GetAudioEffectAmplifierGainCfg(cfg_name, def_gain_val, 24); |
1197 | } |
1198 | |
1199 | static int GetAudioEQAmplifierGainCfg(const char *cfg_name, int def_gain_val) |
1200 | { |
1201 | return GetAudioEffectAmplifierGainCfg(cfg_name, def_gain_val, 24); |
1202 | } |
1203 | |
1204 | int GetAudioSRSSourroundGainCfg() |
1205 | { |
1206 | return GetAudioSRSGainCfg(CS_SRS_SOURROUND_GAIN_CFG_NAME, |
1207 | CC_SRS_SURROUND_GAIN_VAL); |
1208 | } |
1209 | |
1210 | int GetAudioSRSSourroundAmplifierMasterGainCfg() |
1211 | { |
1212 | return GetAudioSRSAmplifierGainCfg( |
1213 | CS_SRS_SOURROUND_AMP_MASTER_GAIN_CFG_NAME, |
1214 | CC_SRS_SURROUND_AMP_MASTER_GAIN_VAL); |
1215 | } |
1216 | |
1217 | int GetAudioSRSSourroundAmplifierSupperBassGainCfg() |
1218 | { |
1219 | return GetAudioSRSAmplifierGainCfg( |
1220 | CS_SRS_SOURROUND_AMP_SUPPERBASS_GAIN_CFG_NAME, |
1221 | CC_SRS_SURROUND_AMP_SUPPERBASS_GAIN_VAL); |
1222 | } |
1223 | |
1224 | int GetAudioSRSTrubassOnlyGainCfg() |
1225 | { |
1226 | return GetAudioSRSGainCfg(CS_SRS_TRUBASS_ONLY_GAIN_CFG_NAME, |
1227 | CC_SRS_TRUBASS_ONLY_GAIN_VAL); |
1228 | } |
1229 | |
1230 | int GetAudioSRSTrubassOnlyAmplifierMasterGainCfg() |
1231 | { |
1232 | return GetAudioSRSAmplifierGainCfg( |
1233 | CS_SRS_TRUBASS_ONLY_AMP_MASTER_GAIN_CFG_NAME, |
1234 | CC_SRS_TRUBASS_ONLY_AMP_MASTER_GAIN_VAL); |
1235 | } |
1236 | |
1237 | int GetAudioSRSTrubassOnlyAmplifierSupperBassGainCfg() |
1238 | { |
1239 | return GetAudioSRSAmplifierGainCfg( |
1240 | CS_SRS_TRUBASS_ONLY_AMP_SUPPERBASS_GAIN_CFG_NAME, |
1241 | CC_SRS_TRUBASS_ONLY_AMP_SUPPERBASS_GAIN_VAL); |
1242 | } |
1243 | |
1244 | int GetAudioSRSDialogClarityOnlyGainCfg() |
1245 | { |
1246 | return GetAudioSRSGainCfg(CS_SRS_DIALOGCLARITY_ONLY_GAIN_CFG_NAME, |
1247 | CC_SRS_DIALOGCLARITY_ONLY_GAIN_VAL); |
1248 | } |
1249 | |
1250 | int GetAudioSRSDialogClarityOnlyAmplifierMasterGainCfg() |
1251 | { |
1252 | return GetAudioSRSAmplifierGainCfg( |
1253 | CS_SRS_DIALOGCLARITY_ONLY_AMP_MASTER_GAIN_CFG_NAME, |
1254 | CC_SRS_DIALOGCLARITY_ONLY_AMP_MASTER_GAIN_VAL); |
1255 | } |
1256 | |
1257 | int GetAudioSRSDialogClarityOnlyAmplifierSupperBassGainCfg() |
1258 | { |
1259 | return GetAudioSRSAmplifierGainCfg( |
1260 | CS_SRS_DIALOGCLARITY_ONLY_AMP_SUPPERBASS_GAIN_CFG_NAME, |
1261 | CC_SRS_DIALOGCLARITY_ONLY_AMP_SUPPERBASS_GAIN_VAL); |
1262 | } |
1263 | |
1264 | int GetAudioSRSDialogClarityOnlyDefinitionGainCfg() |
1265 | { |
1266 | return GetAudioSRSGainCfg( |
1267 | CS_SRS_DIALOGCLARITY_ONLY_DEFINITION_GAIN_CFG_NAME, |
1268 | CC_SRS_DIALOGCLARITY_ONLY_DEFINITION_GAIN_VAL); |
1269 | } |
1270 | |
1271 | int GetAudioSRSTrubassAndDialogClarityTrubassGainCfg() |
1272 | { |
1273 | return GetAudioSRSGainCfg( |
1274 | CS_SRS_TRUBASS_DIALOGCLARITY_TRUBASS_GAIN_CFG_NAME, |
1275 | CC_SRS_TRUBASS_DIALOGCLARITY_TRUBASS_GAIN_VAL); |
1276 | } |
1277 | |
1278 | int GetAudioSRSTrubassAndDialogClarityDialogClarityGainCfg() |
1279 | { |
1280 | return GetAudioSRSGainCfg( |
1281 | CS_SRS_TRUBASS_DIALOGCLARITY_DIALOGCLARITY_GAIN_CFG_NAME, |
1282 | CC_SRS_TRUBASS_DIALOGCLARITY_DIALOGCLARITY_GAIN_VAL); |
1283 | } |
1284 | |
1285 | int GetAudioSRSTrubassAndDialogClarityDefinitionGainCfg() |
1286 | { |
1287 | return GetAudioSRSGainCfg( |
1288 | CS_SRS_TRUBASS_DIALOGCLARITY_DEFINITION_GAIN_CFG_NAME, |
1289 | CC_SRS_TRUBASS_DIALOGCLARITY_DEFINITION_GAIN_VAL); |
1290 | } |
1291 | |
1292 | int GetAudioSRSTrubassAndDialogClarityAmplifierMasterGainCfg() |
1293 | { |
1294 | return GetAudioSRSAmplifierGainCfg( |
1295 | CS_SRS_TRUBASS_DIALOGCLARITY_AMP_MASTER_GAIN_CFG_NAME, |
1296 | CC_SRS_TRUBASS_DIALOGCLARITY_AMP_MASTER_GAIN_VAL); |
1297 | } |
1298 | |
1299 | int GetAudioSRSTrubassAndDialogClarityAmplifierSupperBassGainCfg() |
1300 | { |
1301 | return GetAudioSRSAmplifierGainCfg( |
1302 | CS_SRS_TRUBASS_DIALOGCLARITY_AMP_SUPPERBASS_GAIN_CFG_NAME, |
1303 | CC_SRS_TRUBASS_DIALOGCLARITY_AMP_SUPPERBASS_GAIN_VAL); |
1304 | } |
1305 | |
1306 | int GetAudioSRSSupperBassTrubassSpeakerSizeCfg(int get_flag) |
1307 | { |
1308 | int tmp_val; |
1309 | char cfg_name[128] = { 0 }; |
1310 | const char *config_value; |
1311 | |
1312 | if (get_flag == 0) { |
1313 | strcpy(cfg_name, CS_SRS_SUPPERBASS_OFF_TRUBASS_SPEAKER_SIZE_CFG_NAME); |
1314 | } else { |
1315 | strcpy(cfg_name, CS_SRS_SUPPERBASS_ON_TRUBASS_SPEAKER_SIZE_CFG_NAME); |
1316 | } |
1317 | |
1318 | config_value = config_get_str("TV", cfg_name, "null"); |
1319 | |
1320 | if (strcmp(config_value, "null") == 0) { |
1321 | return -1; |
1322 | } |
1323 | |
1324 | tmp_val = strtoul(config_value, NULL, 10); |
1325 | if (tmp_val < 0 || tmp_val > 7) { |
1326 | tmp_val = -1; |
1327 | } |
1328 | |
1329 | return tmp_val; |
1330 | } |
1331 | |
1332 | int GetAudioEQAmplifierMasterAddGainCfg() |
1333 | { |
1334 | return GetAudioEQAmplifierGainCfg(CS_EQ_AMP_MASTER_GAIN_CFG_NAME, |
1335 | CC_EQ_AMP_MASTER_GAIN_VAL); |
1336 | } |
1337 | |
1338 | int GetAudioEQAmplifierSupperBassAddGainCfg() |
1339 | { |
1340 | return GetAudioEQAmplifierGainCfg(CS_EQ_AMP_SUPPERBASS_GAIN_CFG_NAME, |
1341 | CC_EQ_AMP_SUPPERBASS_GAIN_VAL); |
1342 | } |
1343 | |
1344 | int GetAudioEqModuleDisableCFG() |
1345 | { |
1346 | const char *config_value; |
1347 | |
1348 | config_value = config_get_str("TV", CS_EQ_MOUDLE_DISABLE_CFG_NAME, "null"); |
1349 | |
1350 | if (strcmp(config_value, "null") == 0) { |
1351 | return 0; |
1352 | } |
1353 | |
1354 | return strtoul(config_value, NULL, 10); |
1355 | } |
1356 | |
1357 | int GetAudioEqUsingAndroidCFG() |
1358 | { |
1359 | const char *config_value; |
1360 | |
1361 | config_value = config_get_str("TV", CS_EQ_USING_ANDROID_CFG_NAME, "null"); |
1362 | |
1363 | if (strcmp(config_value, "null") == 0) { |
1364 | return 0; |
1365 | } |
1366 | |
1367 | return strtoul(config_value, NULL, 10); |
1368 | } |
1369 | |
1370 | int GetAudioEQGainRangeCFG(int *min_val, int *max_val) |
1371 | { |
1372 | int i = 0, buf_item_count = 0, tmp_item_count = 0; |
1373 | int tmp_buf[16] = { 0 }; |
1374 | |
1375 | buf_item_count = 2; |
1376 | tmp_item_count = buf_item_count; |
1377 | if (GetAudioCfgData(CS_EQ_GAIN_RANGE_CFG_NAME, &tmp_item_count, 10, tmp_buf) |
1378 | < 0) { |
1379 | return -1; |
1380 | } |
1381 | |
1382 | if (tmp_item_count != buf_item_count) { |
1383 | return -1; |
1384 | } |
1385 | |
1386 | *min_val = tmp_buf[0]; |
1387 | *max_val = tmp_buf[1]; |
1388 | |
1389 | return 0; |
1390 | } |
1391 | |
1392 | int GetAudioEQUIGainRangeCFG(int *min_val, int *max_val) |
1393 | { |
1394 | int i = 0, buf_item_count = 0, tmp_item_count = 0; |
1395 | int tmp_buf[16] = { 0 }; |
1396 | |
1397 | buf_item_count = 2; |
1398 | tmp_item_count = buf_item_count; |
1399 | if (GetAudioCfgData(CS_EQ_UI_GAIN_RANGE_CFG_NAME, &tmp_item_count, 10, |
1400 | tmp_buf) < 0) { |
1401 | return -1; |
1402 | } |
1403 | |
1404 | if (tmp_item_count != buf_item_count) { |
1405 | return -1; |
1406 | } |
1407 | |
1408 | *min_val = tmp_buf[0]; |
1409 | *max_val = tmp_buf[1]; |
1410 | |
1411 | return 0; |
1412 | } |
1413 | |
1414 | int GetAudioDumpDataEnableFlagCfg() |
1415 | { |
1416 | const char *config_value; |
1417 | |
1418 | config_value = config_get_str("TV", CS_AUDIO_DUMP_DATA_ENABLE_CFG_NAME, |
1419 | "null"); |
1420 | |
1421 | if (strcmp(config_value, "null") == 0) { |
1422 | return 0; |
1423 | } |
1424 | |
1425 | return strtol(config_value, NULL, 10); |
1426 | } |
1427 | |
1428 | int GetAudioKeyMuteCfg() |
1429 | { |
1430 | const char *config_value; |
1431 | |
1432 | config_value = config_get_str("TV", CS_KEY_MUTE_CFG_NAME, "null"); |
1433 | |
1434 | if (strcmp(config_value, "null") == 0) { |
1435 | return 0; |
1436 | } |
1437 | |
1438 | return strtoul(config_value, NULL, 10); |
1439 | } |
1440 | |
1441 | int GetAudioAVOutInitMuteStatusCFG() |
1442 | { |
1443 | const char *config_value; |
1444 | int status = 0; |
1445 | |
1446 | config_value = config_get_str("TV", CS_AVOUT_INIT_MUTE_CFG_NAME, "null"); |
1447 | LOGD("%s, get %s is \"%s\".\n", __FUNCTION__, CS_AVOUT_INIT_MUTE_CFG_NAME, |
1448 | config_value); |
1449 | |
1450 | if (strcmp(config_value, "enable") == 0) { |
1451 | status = 1; |
1452 | } else { |
1453 | status = 0; |
1454 | } |
1455 | |
1456 | return status; |
1457 | } |
1458 | |
1459 | int GetAudioSupperBassModuleDisableCFG() |
1460 | { |
1461 | const char *config_value; |
1462 | |
1463 | config_value = config_get_str("TV", CS_SUPPERBASS_MODULE_DISABLE_CFG_NAME, |
1464 | "null"); |
1465 | |
1466 | if (strcmp(config_value, "null") == 0) { |
1467 | return 0; |
1468 | } |
1469 | |
1470 | return strtoul(config_value, NULL, 10); |
1471 | } |
1472 | |
1473 | int GetAudioSupperBassSwitchDisableCFG() |
1474 | { |
1475 | const char *config_value; |
1476 | |
1477 | config_value = config_get_str("TV", CS_SUPPERBASS_SWITCH_DISABLE_CFG_NAME, |
1478 | "null"); |
1479 | |
1480 | if (strcmp(config_value, "null") == 0) { |
1481 | return 0; |
1482 | } |
1483 | |
1484 | return strtoul(config_value, NULL, 10); |
1485 | } |
1486 | |
1487 | static int GetAudioSrcInputLineInVol(const char *cfg_str, int *l_vol, |
1488 | int *r_vol) |
1489 | { |
1490 | int buf_item_count = 2; |
1491 | int data_buf[2] = { -1, -1 }; |
1492 | |
1493 | if (GetAudioCfgData(cfg_str, &buf_item_count, 10, data_buf) < 0) { |
1494 | return -1; |
1495 | } |
1496 | |
1497 | if (buf_item_count < 2) { |
1498 | return -1; |
1499 | } |
1500 | |
1501 | *l_vol = data_buf[0]; |
1502 | *r_vol = data_buf[1]; |
1503 | |
1504 | return 0; |
1505 | } |
1506 | |
1507 | int GetAudioSrcInputTVLineInVol(int *l_vol, int *r_vol) |
1508 | { |
1509 | return GetAudioSrcInputLineInVol(CS_SRC_INPUT_TV_LINEIN_VOL_CFG_NAME, l_vol, |
1510 | r_vol); |
1511 | } |
1512 | |
1513 | int GetAudioSrcInputAVLineInVol(int *l_vol, int *r_vol) |
1514 | { |
1515 | return GetAudioSrcInputLineInVol(CS_SRC_INPUT_AV_LINEIN_VOL_CFG_NAME, l_vol, |
1516 | r_vol); |
1517 | } |
1518 | |
1519 | int GetAudioSrcInputCOMPLineInVol(int *l_vol, int *r_vol) |
1520 | { |
1521 | return GetAudioSrcInputLineInVol(CS_SRC_INPUT_COMP_LINEIN_VOL_CFG_NAME, |
1522 | l_vol, r_vol); |
1523 | } |
1524 | |
1525 | int GetAudioSrcInputHDMILineInVol(int *l_vol, int *r_vol) |
1526 | { |
1527 | return GetAudioSrcInputLineInVol(CS_SRC_INPUT_HDMI_LINEIN_VOL_CFG_NAME, |
1528 | l_vol, r_vol); |
1529 | } |
1530 | |
1531 | int GetAudioSrcInputVGALineInVol(int *l_vol, int *r_vol) |
1532 | { |
1533 | return GetAudioSrcInputLineInVol(CS_SRC_INPUT_VGA_LINEIN_VOL_CFG_NAME, |
1534 | l_vol, r_vol); |
1535 | } |
1536 | |
1537 | int GetAudioSrcInputMPEGLineInVol(int *l_vol, int *r_vol) |
1538 | { |
1539 | return GetAudioSrcInputLineInVol(CS_SRC_INPUT_MPEG_LINEIN_VOL_CFG_NAME, |
1540 | l_vol, r_vol); |
1541 | } |
1542 | |
1543 | static int GetAudioSrcInputLineOutVol(const char *cfg_str, int *l_vol, |
1544 | int *r_vol) |
1545 | { |
1546 | int buf_item_count = 2; |
1547 | int data_buf[2] = { -1, -1 }; |
1548 | |
1549 | if (GetAudioCfgData(cfg_str, &buf_item_count, 10, data_buf) < 0) { |
1550 | return -1; |
1551 | } |
1552 | |
1553 | if (buf_item_count < 2) { |
1554 | return -1; |
1555 | } |
1556 | |
1557 | *l_vol = data_buf[0]; |
1558 | *r_vol = data_buf[1]; |
1559 | |
1560 | return 0; |
1561 | } |
1562 | |
1563 | int GetAudioSrcInputTVLineOutVol(int *l_vol, int *r_vol) |
1564 | { |
1565 | return GetAudioSrcInputLineOutVol(CS_SRC_INPUT_TV_LINEOUT_VOL_CFG_NAME, |
1566 | l_vol, r_vol); |
1567 | } |
1568 | |
1569 | int GetAudioSrcInputAVLineOutVol(int *l_vol, int *r_vol) |
1570 | { |
1571 | return GetAudioSrcInputLineOutVol(CS_SRC_INPUT_AV_LINEOUT_VOL_CFG_NAME, |
1572 | l_vol, r_vol); |
1573 | } |
1574 | |
1575 | int GetAudioSrcInputCOMPLineOutVol(int *l_vol, int *r_vol) |
1576 | { |
1577 | return GetAudioSrcInputLineOutVol(CS_SRC_INPUT_COMP_LINEOUT_VOL_CFG_NAME, |
1578 | l_vol, r_vol); |
1579 | } |
1580 | |
1581 | int GetAudioSrcInputHDMILineOutVol(int *l_vol, int *r_vol) |
1582 | { |
1583 | return GetAudioSrcInputLineOutVol(CS_SRC_INPUT_HDMI_LINEOUT_VOL_CFG_NAME, |
1584 | l_vol, r_vol); |
1585 | } |
1586 | |
1587 | int GetAudioSrcInputVGALineOutVol(int *l_vol, int *r_vol) |
1588 | { |
1589 | return GetAudioSrcInputLineOutVol(CS_SRC_INPUT_VGA_LINEOUT_VOL_CFG_NAME, |
1590 | l_vol, r_vol); |
1591 | } |
1592 | |
1593 | int GetAudioSrcInputMPEGLineOutVol(int *l_vol, int *r_vol) |
1594 | { |
1595 | int tmp_val = 0; |
1596 | const char *config_value; |
1597 | |
1598 | config_value = config_get_str("TV", |
1599 | CS_SRC_INPUT_MPEG_LINEOUT_VOL_CFG_NAME_OLD, "null"); |
1600 | |
1601 | if (strcmp(config_value, "null") == 0) { |
1602 | return GetAudioSrcInputLineOutVol( |
1603 | CS_SRC_INPUT_MPEG_LINEOUT_VOL_CFG_NAME, l_vol, r_vol); |
1604 | } |
1605 | |
1606 | tmp_val = strtol(config_value, NULL, 10); |
1607 | |
1608 | *l_vol = tmp_val; |
1609 | *r_vol = tmp_val; |
1610 | |
1611 | return 0; |
1612 | } |
1613 | |
1614 | int GetAudioWallEffectTypeCfg() |
1615 | { |
1616 | return GetAudioCfgSingleIntData("audio.walleffect.type", 0); |
1617 | } |
1618 | |
1619 | static int GetAudioMainVolumeLutBufCompensation(const char *cfg_str, |
1620 | int *cfg_flag) |
1621 | { |
1622 | const char *config_value; |
1623 | |
1624 | config_value = config_get_str("TV", cfg_str, "null"); |
1625 | //LOGD("%s, get \"%s\" is \"%s\".\n", "TV", cfg_str, config_value); |
1626 | |
1627 | if (strcmp(config_value, "null") == 0) { |
1628 | if (cfg_flag != NULL) { |
1629 | *cfg_flag = 0; |
1630 | } |
1631 | |
1632 | //LOGD( |
1633 | // "%s, get config \"%s\" is \"%s\", return 0 to not compensation lut buffer.\n", |
1634 | // "TV", cfg_str, config_value); |
1635 | return 0; |
1636 | } |
1637 | |
1638 | if (cfg_flag != NULL) { |
1639 | *cfg_flag = 1; |
1640 | } |
1641 | |
1642 | return strtol(config_value, NULL, 10); |
1643 | } |
1644 | |
1645 | int GetAudioMainVolumeLutBufTVCompensation() |
1646 | { |
1647 | return GetAudioMainVolumeLutBufCompensation( |
1648 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_TV_CFG_NAME, NULL); |
1649 | } |
1650 | |
1651 | int GetAudioMainVolumeLutBufAVCompensation() |
1652 | { |
1653 | return GetAudioMainVolumeLutBufCompensation( |
1654 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_AV_CFG_NAME, NULL); |
1655 | } |
1656 | |
1657 | int GetAudioMainVolumeLutBufCOMPCompensation() |
1658 | { |
1659 | return GetAudioMainVolumeLutBufCompensation( |
1660 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_COMP_CFG_NAME, NULL); |
1661 | } |
1662 | |
1663 | int GetAudioMainVolumeLutBufHDMICompensation() |
1664 | { |
1665 | return GetAudioMainVolumeLutBufCompensation( |
1666 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_HDMI_CFG_NAME, NULL); |
1667 | } |
1668 | |
1669 | int GetAudioMainVolumeLutBufVGACompensation() |
1670 | { |
1671 | return GetAudioMainVolumeLutBufCompensation( |
1672 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_VGA_CFG_NAME, NULL); |
1673 | } |
1674 | |
1675 | int GetAudioMainVolumeLutBufMPEGCompensation() |
1676 | { |
1677 | int tmp_ret = 0, cfg_flag = 0; |
1678 | |
1679 | tmp_ret = GetAudioMainVolumeLutBufCompensation( |
1680 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_MPEG_CFG_NAME, &cfg_flag); |
1681 | |
1682 | if (cfg_flag == 0) { |
1683 | tmp_ret = GetAudioMainVolumeLutBufDTVCompensation(); |
1684 | } |
1685 | |
1686 | return tmp_ret; |
1687 | } |
1688 | |
1689 | int GetAudioMainVolumeLutBufDTVCompensation() |
1690 | { |
1691 | return GetAudioMainVolumeLutBufCompensation( |
1692 | CS_AMP_MAINVOL_LUTBUF_COMPENSATION_DTV_CFG_NAME, NULL); |
1693 | } |
1694 | |
1695 | int GetAudioNoiseGateEnableCFG() |
1696 | { |
1697 | const char *config_value; |
1698 | |
1699 | config_value = config_get_str("TV", CS_AUDIO_NOISE_GATE_ENABLE_CFG_NAME, |
1700 | "null"); |
1701 | |
1702 | if (strcmp(config_value, "null") == 0) { |
1703 | return 0; |
1704 | } |
1705 | |
1706 | return strtoul(config_value, NULL, 10); |
1707 | } |
1708 | |
1709 | int GetAudioNoiseGateUpperBoundCFG() |
1710 | { |
1711 | const char *config_value; |
1712 | |
1713 | config_value = config_get_str("TV", |
1714 | CS_AUDIO_NOISE_GATE_UPPER_BOUND_CFG_NAME, "254"); |
1715 | |
1716 | return strtol(config_value, NULL, 10); |
1717 | } |
1718 | |
1719 | int GetAudioNoiseGateThresholdCFG() |
1720 | { |
1721 | const char *config_value; |
1722 | |
1723 | config_value = config_get_str("TV", CS_AUDIO_NOISE_GATE_THRESHOLD_CFG_NAME, |
1724 | "-1"); |
1725 | |
1726 | return strtol(config_value, NULL, 10); |
1727 | } |
1728 | |
1729 | int GetDisableResetSystemFrameSize() |
1730 | { |
1731 | const char *config_value; |
1732 | config_value = config_get_str("TV", |
1733 | CS_DISABLE_RESET_SYSTEM_FRAMESIZE_CFG_NAME, "null"); |
1734 | |
1735 | if (strcmp(config_value, "null") == 0) { |
1736 | return 0; |
1737 | } |
1738 | |
1739 | return strtoul(config_value, NULL, 10); |
1740 | } |
1741 | |
1742 | static int gDisableResetSystemFrameSizeFlag = -1; |
1743 | int GetDisableReset_System_framesizeCFG(void) |
1744 | { |
1745 | if (gDisableResetSystemFrameSizeFlag == -1) { |
1746 | const char *config_value; |
1747 | |
1748 | config_value = config_get_str("TV", CS_AUDIO_SYSTEM_FRAMESIZE_CFG_NAME, |
1749 | "null"); |
1750 | LOGD("%s, get %s is \"%s\".\n", |
1751 | __FUNCTION__, CS_AUDIO_SYSTEM_FRAMESIZE_CFG_NAME, config_value); |
1752 | |
1753 | if (strcmp(config_value, "disable") == 0) { |
1754 | gDisableResetSystemFrameSizeFlag = 0x55; |
1755 | } else { |
1756 | gDisableResetSystemFrameSizeFlag = 0; |
1757 | } |
1758 | } |
1759 | |
1760 | return gDisableResetSystemFrameSizeFlag; |
1761 | } |
1762 | |
1763 | int GetAudioArchitectureTypeCFG() |
1764 | { |
1765 | static int architecture_type = -1; |
1766 | const char *config_value = NULL; |
1767 | |
1768 | if (architecture_type == -1) { |
1769 | config_value = config_get_str ( "TV", CS_AUDIO_ARCHITECTURE_TYPE_CFG_NAME, "null" ); |
1770 | if (strcasecmp(config_value, "null") == 0) { |
1771 | architecture_type = CC_DAC_T866_EXTERNAL_DAC_OFF_BOARD_FBC; |
1772 | } else if (strcasecmp(config_value, "t866_external_dac_offboard_fbc") == 0) { |
1773 | architecture_type = CC_DAC_T866_EXTERNAL_DAC_OFF_BOARD_FBC; |
1774 | } else if (strcasecmp(config_value, "t866_external_dac_offboard_customer_lib") == 0) { |
1775 | architecture_type = CC_DAC_T866_EXTERNAL_DAC_OFF_BOARD_CUSTOMER_LIB; |
1776 | } else if (strcasecmp(config_value, "t866_external_dac_offboard_digital") == 0) { |
1777 | architecture_type = CC_DAC_T866_EXTERNAL_DAC_OFF_BOARD_DIGITAL; |
1778 | } else if (strcasecmp(config_value, "t866_external_dac_onboard") == 0) { |
1779 | architecture_type = CC_DAC_T866_EXTERNAL_DAC_ON_BOARD; |
1780 | } else if (strcasecmp(config_value, "t866_iternal_dac") == 0) { |
1781 | architecture_type = CC_DAC_T866_INTERNAL_DAC; |
1782 | } else if (strcasecmp(config_value, "m6c") == 0) { |
1783 | architecture_type = CC_DAC_M6C_EXTERNAL_DAC_ON_BOARD; |
1784 | } else { |
1785 | architecture_type = CC_DAC_T866_EXTERNAL_DAC_OFF_BOARD_FBC; |
1786 | } |
1787 | } |
1788 | |
1789 | return architecture_type; |
1790 | } |
1791 | |
1792 | static int gAudioResampleType = -1; |
1793 | int GetAudioResampleTypeCFG() |
1794 | { |
1795 | char *token = NULL; |
1796 | const char *strDelimit = ","; |
1797 | const char *config_value = NULL; |
1798 | char cfg_buf[1024]; |
1799 | |
1800 | if (gAudioResampleType == -1) { |
1801 | gAudioResampleType = 0; |
1802 | |
1803 | config_value = config_get_str ( "TV", CS_AUDIO_RESAMPLE_TYPE_CFG_NAME, "null" ); |
1804 | strncpy(cfg_buf, config_value, sizeof(cfg_buf)); |
1805 | if (strcmp(cfg_buf, "") != 0) { |
1806 | token = strtok(cfg_buf, strDelimit); |
1807 | while (token != NULL) { |
1808 | if (strcasecmp(token, "hw") == 0) { |
1809 | gAudioResampleType |= CC_AUD_RESAMPLE_TYPE_HW; |
1810 | } else if (strcasecmp(token, "sw") == 0) { |
1811 | gAudioResampleType |= CC_AUD_RESAMPLE_TYPE_SW; |
1812 | } |
1813 | |
1814 | token = strtok(NULL, strDelimit); |
1815 | } |
1816 | } else { |
1817 | gAudioResampleType = CC_AUD_RESAMPLE_TYPE_SW; //if can't find config string, allow sw resample |
1818 | } |
1819 | } |
1820 | |
1821 | return gAudioResampleType; |
1822 | } |
1823 | |
1824 | int GetamAudioDisableFlagCFG() |
1825 | { |
1826 | static int am_audio_disable_flag = -1; |
1827 | const char *config_value = NULL; |
1828 | |
1829 | if (am_audio_disable_flag == -1) { |
1830 | config_value = config_get_str ( "TV", "audio.amaudio.disable", "null" ); |
1831 | if (strcasecmp(config_value, "null") == 0 || strcasecmp(config_value, "false") == 0) { |
1832 | am_audio_disable_flag = 0; |
1833 | } else if (strcasecmp(config_value, "true") == 0) { |
1834 | am_audio_disable_flag = 1; |
1835 | } else { |
1836 | am_audio_disable_flag = 0; |
1837 | } |
1838 | } |
1839 | |
1840 | return am_audio_disable_flag; |
1841 | } |
1842 | |
1843 | int GetAudioFirstInitSetTypeCFG() |
1844 | { |
1845 | const char *config_value; |
1846 | config_value = config_get_str ( "TV", "audio.firstinitset.type", "null" ); |
1847 | |
1848 | if (strcmp(config_value, "null") == 0) { |
1849 | return 0; |
1850 | } |
1851 | |
1852 | return strtoul(config_value, NULL, 10); |
1853 | } |
1854 |