summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvsetting/audio_cfg.cpp (plain)
blob: 1eee1ce68e676ad761d8fda9e815b4d60bf25598
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
14static const char AudioAmpMainVolLutBaseNameTable[CC_GET_TYPE_CNT][128] = {"audio.amp.mainvol.tv.lutbuf",//0
15 "audio.amp.mainvol.av.lutbuf",//1
16 "audio.amp.mainvol.comp.lutbuf",//2
17 "audio.amp.mainvol.hdmi.lutbuf",//3
18 "audio.amp.mainvol.vga.lutbuf",//4
19 "audio.amp.mainvol.mpeg.lutbuf",//5
20 "audio.amp.mainvol.hdmi4k2k.lutbuf",//6
21 "audio.amp.mainvol.usb4k2k.lutbuf"//7
22 };
23
24static const int Default_EQGain_Table[24] = {
25 //
26 50, 50, 50, 50, 50, 50, // SM_STD
27 70, 60, 50, 60, 70, 50, // SM_MUSIC
28 25, 50, 70, 66, 25, 50, // SM_NEWS
29 75, 65, 50, 65, 75, 50, // SM_THEATER
30};
31
32static const int Default_AVoutGain_Table[9] = {
33 //PGA_IN ADC_Capture DAC_Playback
34 11, 92, 255, // CC_AUDIO_IN_SOURCE_LINEIN
35 11, 92, 255, //CC_AUDIO_IN_SOURCE_HDMI
36 11, 92, 255, //CC_AUDIO_IN_SOURCE_ATV
37};
38
39int GetAudioAmpMasterNolinePointData(int get_type, const char *value_buf, int data_buf[])
40{
41 const char *config_value;
42 if (value_buf != NULL) {
43 config_value = config_get_str(CFG_SECTION_TV, value_buf, "null");
44 } else {
45 switch (get_type) {
46 case CC_GET_LUT_TV: {
47 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.tv", "null");
48 }
49 break;
50 case CC_GET_LUT_AV: {
51 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.av", "null");
52 }
53 break;
54 case CC_GET_LUT_COMP: {
55 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.comp", "null");
56 }
57 break;
58 case CC_GET_LUT_HDMI: {
59 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.hdmi", "null");
60 }
61 break;
62 case CC_GET_LUT_VGA: {
63 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.vga", "null");
64 }
65 break;
66 case CC_GET_LUT_MPEG: {
67 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.mpeg", "null");
68 }
69 break;
70 case CC_GET_LUT_HDMI_4K2K: {
71 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.hdmi4k2k", "null");
72 }
73 break;
74 case CC_GET_LUT_USB_4K2K: {
75 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.data.usb4k2k", "null");
76 }
77 break;
78 default: {
79 config_value = "null";
80 }
81 break;
82 }
83 }
84 if (strcasecmp(config_value, "null") == 0) {
85 //LOGE("%s, can't get config \"%s\"!!!\n", CFG_SECTION_TV, key_str);
86 return -1;
87 }
88
89 char *pSave;
90 char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 };
91
92 memset((void *)data_str, 0, sizeof(data_str));
93 strncpy(data_str, config_value, sizeof(data_str) - 1);
94 char *token = strtok_r(data_str, ",", &pSave);
95 int bufferDataIndex = 0;
96 while (token != NULL) {
97 data_buf[bufferDataIndex] = strtol(token, NULL, 10);
98 bufferDataIndex ++;
99 token = strtok_r(NULL, ",", &pSave);
100 }
101
102 return 0;
103}
104
105int GetDefault_EQGain_Table(int *EqTable)
106{
107 memcpy(EqTable, Default_EQGain_Table, sizeof(Default_EQGain_Table));
108
109 return 0;
110}
111
112int GetAudioEQPresetBufferPtr(int *EqTable)
113{
114 int bufs_count = 0, buf_item_count = 0;
115 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.eq.presetbuf", "null");
116 if (strcasecmp(config_value, "null") == 0) {
117 return -1;
118 }
119
120 char *pSave;
121 char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 };
122
123 memset((void *)data_str, 0, sizeof(data_str));
124 strncpy(data_str, config_value, sizeof(data_str) - 1);
125 char *token = strtok_r(data_str, ",", &pSave);
126 int allIndex = 0, bufferDataIndex = 0;
127 while (token != NULL) {
128 if (allIndex == 0) {
129 bufs_count = strtol(token, NULL, 10);
130 } else if (allIndex == 1) {
131 buf_item_count = strtol(token, NULL, 10);
132 } else if (allIndex >= 2) {
133 EqTable[bufferDataIndex] = strtol(token, NULL, 10);
134 bufferDataIndex ++;
135 }
136
137 token = strtok_r(NULL, ",", &pSave);
138 allIndex ++;
139 }
140
141 return 0;
142}
143
144/**
145 * @param:get_type
146 * @return:data_buf
147 */
148const char *GetAudioAmpMainvolTableBaseName(int get_type)
149{
150 return AudioAmpMainVolLutBaseNameTable[get_type];
151}
152
153int GetAudioAmpMainvolBuf(const char *TableKeyName, int data_buf[])
154{
155 int bufs_count = 0, buf_item_count = 0;
156 const char *config_value;
157
158 config_value = config_get_str(CFG_SECTION_TV, TableKeyName, "null");
159 if (strcasecmp(config_value, "null") == 0) {
160 return -1;
161 }
162 char *pSave;
163 char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 };
164 memset((void *)data_str, 0, sizeof(data_str));
165 strncpy(data_str, config_value, sizeof(data_str) - 1);
166 char *token = strtok_r(data_str, ",", &pSave);
167 int allIndex = 0, bufferDataIndex = 0;
168 while (token != NULL) {
169 if (allIndex == 0) {
170 bufs_count = strtol(token, NULL, 10);
171 } else if (allIndex == 1) {
172 buf_item_count = strtol(token, NULL, 10);
173 } else if (allIndex >= 2) {
174 data_buf[bufferDataIndex] = strtol(token, NULL, 10);
175 bufferDataIndex ++;
176 }
177 token = strtok_r(NULL, ",", &pSave);
178 allIndex ++;
179 }
180
181 return 0;
182}
183
184/**
185 * @param:get_type
186 * @return:data_buf
187 */
188int GetAudioAmpSupbassvolBuf(int get_type, int data_buf[])
189{
190 int bufs_count = 0, buf_item_count = 0;
191 const char *config_value;
192
193 switch (get_type) {
194 case CC_GET_LUT_TV: {
195 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.tv.lutbuf", "null");
196 }
197
198 break;
199 case CC_GET_LUT_AV: {
200 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.av.lutbuf", "null");
201 }
202 break;
203 case CC_GET_LUT_COMP: {
204 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.comp.lutbuf", "null");
205 }
206 break;
207 case CC_GET_LUT_HDMI: {
208 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.hdmi.lutbuf", "null");
209 }
210 break;
211 case CC_GET_LUT_VGA: {
212 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.vga.lutbuf", "null");
213 }
214
215 break;
216 case CC_GET_LUT_MPEG: {
217 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.mpeg.lutbuf", "null");
218 }
219
220 break;
221 case CC_GET_LUT_HDMI_4K2K: {
222 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.hdmi4k2k.lb.name", "null");
223 }
224
225 break;
226 case CC_GET_LUT_USB_4K2K: {
227 config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.usb4k2k.lb.name", "null");
228 }
229
230 break;
231 default: {
232 config_value = "null";
233 }
234 break;
235 }
236
237 if (strcasecmp(config_value, "null") == 0) {
238 return -1;
239 }
240 char *pSave;
241 char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 };
242 memset((void *)data_str, 0, sizeof(data_str));
243 strncpy(data_str, config_value, sizeof(data_str) - 1);
244 char *token = strtok_r(data_str, ",", &pSave);
245 int allIndex = 0, bufferDataIndex = 0;
246 while (token != NULL) {
247 if (allIndex == 0) {
248 bufs_count = strtol(token, NULL, 10);
249 } else if (allIndex == 1) {
250 buf_item_count = strtol(token, NULL, 10);
251 } else if (allIndex >= 2) {
252 data_buf[bufferDataIndex] = strtol(token, NULL, 10);
253 bufferDataIndex ++;
254 }
255 token = strtok_r(NULL, ",", &pSave);
256 allIndex ++;
257 }
258
259 return 0;
260}
261
262int GetAudioAmplifierMasterNoLineSwitchFlag()
263{
264 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.switch", "null");
265
266 if (strcmp(config_value, "null") == 0) {
267 return 0;
268 }
269
270 return strtol(config_value, NULL, 10);
271}
272
273int GetAudioAmplifierSupperBassNoLineSwitchFlag()
274{
275 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supperbass.noline.switch", "null");
276
277 if (strcmp(config_value, "null") == 0) {
278 return 0;
279 }
280
281 return strtol(config_value, NULL, 10);
282}
283
284int GetAudioAmplifierMasterNoLinePointsCount()
285{
286 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.noline.point.cnt", "null");
287
288 if (strcmp(config_value, "null") == 0) {
289 return 11;
290 }
291
292 return strtol(config_value, NULL, 10);
293}
294
295int GetAudioAmplifierSupperBassNoLinePointsCount()
296{
297 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supperbass.noline.point.cnt", "null");
298
299 if (strcmp(config_value, "null") == 0) {
300 return 5;
301 }
302
303 return strtol(config_value, NULL, 10);
304}
305
306int GetAudioAmplifierBalanceExchangeCFG()
307{
308 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.balance.exchg", "null");
309
310 // if (data_buf[0] >= 0 && data_buf[0] <= 100) {
311 // LOGD("%s, we have get the index buffer.\n", CFG_SECTION_TV);
312 // return 0;
313 // }
314
315 if (strcmp(config_value, "null") == 0) {
316 return 0; //return 0 to disable balance exchange
317 }
318
319 return strtol(config_value, NULL, 10);
320}
321
322int GetAudioMainVolLutBufCFGIndexModifyEnable()
323{
324 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.master.cfgindex.mod.en", "null");
325
326 if (strcmp(config_value, "null") == 0) {
327 return 0;
328 }
329
330 return strtoul(config_value, NULL, 10);
331}
332
333int GetAudioMainVolLutBufNameModifyUbootenvCFG()
334{
335 char config_value[PROPERTY_VALUE_MAX];
336
337 memset(config_value, '\0', 32);
338 property_get("ubootenv.var.ampindex", config_value, "null");
339
340 if (strcasecmp(config_value, "null") == 0) {
341 return 0;
342 }
343
344 return strtoul(config_value, NULL, 10);
345}
346
347
348int GetAudioMainVolLutBufNameModifyEnableCFG()
349{
350 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.mainvol.lutbufname.mod.en", "null");
351
352 if (strcmp(config_value, "null") == 0) {
353 return 0;
354 }
355
356 return strtoul(config_value, NULL, 10);
357}
358
359
360int GetAudioSupperBassVolLutBufCFGIndexModifyEnable()
361{
362 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supperbass.cfgindex.mod.en", "null");
363
364 if (strcmp(config_value, "null") == 0) {
365 return 0;
366 }
367
368 return strtoul(config_value, NULL, 10);
369}
370
371int GetAudioSupperBassVolLutBufNameModifyEnableCFG()
372{
373 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.amp.supbassvol.lutbufname.mod.en", "null");
374
375 if (strcmp(config_value, "null") == 0) {
376 return 0;
377 }
378
379 return strtoul(config_value, NULL, 10);
380}
381
382
383int GetAudioDVISupportEnable()
384{
385 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.dvi.support.enable", "null");
386
387 if (strcmp(config_value, "null") == 0) {
388 return 0;
389 }
390
391 return strtoul(config_value, NULL, 10);
392}
393
394
395int GetTvAudioCardName(char tv_card_name_buf[])
396{
397 const char *value = config_get_str(CFG_SECTION_TV, "audio.tv.card.name", "null");
398
399 strcpy(tv_card_name_buf, value);
400 if (strcmp(value, "null") == 0) {
401 strcpy(tv_card_name_buf, "AMLSYNO9629");
402 }
403
404 return 0;
405}
406
407int GetTvAudioCardNeedSet()
408{
409 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.tv.card.needset", "null");
410 if (strcmp(config_value, "null") == 0) {
411 return 0;
412 }
413
414 if (strtoul(config_value, NULL, 10) == 0) {
415 return 0;
416 }
417
418 return 1;
419}
420
421int GetAudioEffectAmplifierGainCfg(const char *cfg_name, int def_gain_val, int max_gain_val)
422{
423 int tmp_val;
424 const char *config_value = config_get_str(CFG_SECTION_TV, cfg_name, "null");
425 if (strcmp(config_value, "null") == 0) {
426 tmp_val = def_gain_val;
427 } else {
428 tmp_val = strtoul(config_value, NULL, 10);
429 if (tmp_val < 0 || tmp_val > max_gain_val) {
430 tmp_val = def_gain_val;
431 }
432 }
433 LOGD("%s = %d\n", cfg_name, tmp_val);
434 return tmp_val;
435}
436
437
438int GetAudioSRSSourroundEnableCFG()
439{
440 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.srs.sourround.enable", "null");
441
442 if (strcmp(config_value, "null") == 0) {
443 return 0;
444 }
445
446 return strtoul(config_value, NULL, 10);
447}
448
449int GetAudioSRSGainCfg(const char *cfg_name, int def_gain_val)
450{
451 int tmp_val = 0;
452 const char *config_value = config_get_str(CFG_SECTION_TV, cfg_name, "null");
453
454 if (strcmp(config_value, "null") == 0) {
455 tmp_val = def_gain_val;
456 } else {
457 if (tmp_val < 0 || tmp_val > 100) {
458 tmp_val = def_gain_val;
459 LOGE("Error setting: %s = %d (0~100)\n", cfg_name, tmp_val);
460 }
461 tmp_val = strtoul(config_value, NULL, 10);
462 }
463 //LOGD(" %s = %d\n", cfg_name, tmp_val);
464 return tmp_val;
465}
466
467int GetAudioSRSSupperBassTrubassSpeakerSizeCfg()
468{
469 char cfg_name[128] = { 0 };
470
471 strcpy(cfg_name, "audio.srs.turbass.speakersize");
472
473 const char *config_value = config_get_str(CFG_SECTION_TV, cfg_name, "null");
474
475 if (strcmp(config_value, "null") == 0) {
476 return -1;
477 }
478
479 int tmp_val = strtoul(config_value, NULL, 10);
480 if (tmp_val < 0 || tmp_val > 7) {
481 tmp_val = -1;
482 }
483
484 return tmp_val;
485}
486
487int GetAudioDumpDataEnableFlagCfg()
488{
489 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.dump.data.en", "null");
490
491 if (strcmp(config_value, "null") == 0) {
492 return 0;
493 }
494
495 return strtol(config_value, NULL, 10);
496}
497
498int GetAudioSupperBassSwitchDisableCFG()
499{
500 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.supperbass.switch.disable", "null");
501
502 if (strcmp(config_value, "null") == 0) {
503 return 0;
504 }
505
506 return strtoul(config_value, NULL, 10);
507}
508
509int GetAudioWallEffectTypeCfg()
510{
511 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.walleffect.type", "null");
512
513 if (strcmp(config_value, "null") == 0) {
514 return 0;
515 }
516
517 return strtol(config_value, NULL, 10);
518}
519
520int Get2d4gHeadsetEnable()
521{
522 const char *config_value = config_get_str ( CFG_SECTION_TV, "tvin.2d4G.headset.en", "null" );
523 if (strcmp(config_value, "enable") == 1) {
524 return 1;
525 }
526
527
528 return 0;
529}
530
531const char *GetAudExtDacLibPath()
532{
533 return config_get_str(CFG_SECTION_TV, "audio.external.dac.libpath", "/system/lib/libdac.so");
534}
535
536int GetKaraokAvEnable()
537{
538 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.switch.karaok.av.enable", "null");
539 if (strtoul(config_value, NULL, 10) == 1)
540 return 1;
541
542 return 0;
543}
544
545int GetDefaultAvOutGainBuf(int *nAvoutTable)
546{
547 memcpy(nAvoutTable, Default_AVoutGain_Table, sizeof(Default_AVoutGain_Table));
548
549 return 0;
550}
551
552int GetAvOutGainBuf_Cfg(int *nAvoutTable)
553{
554 int bufs_count = 0, buf_item_count = 0;
555 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.avoutgain.presetbuf", "null");
556 if (strcasecmp(config_value, "null") == 0) {
557 // LOGE("%s, can't get config \"%s\"!!!\n", CFG_SECTION_TV, key_str);
558 return -1;
559 }
560
561 char *pSave;
562 char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 };
563
564 memset((void *)data_str, 0, sizeof(data_str));
565 strncpy(data_str, config_value, sizeof(data_str) - 1);
566 char *token = strtok_r(data_str, ",", &pSave);
567 int allIndex = 0, bufferDataIndex = 0;
568 while (token != NULL) {
569 if (allIndex == 0) {
570 bufs_count = strtol(token, NULL, 10);
571 } else if (allIndex == 1) {
572 buf_item_count = strtol(token, NULL, 10);
573 } else if (allIndex >= 2) {
574 nAvoutTable[bufferDataIndex] = strtol(token, NULL, 10);
575 bufferDataIndex ++;
576 }
577
578 token = strtok_r(NULL, ",", &pSave);
579 allIndex ++;
580 }
581
582 return 0;
583}
584
585int GetADCDigitalCaptureVol_Cfg(void)
586{
587 int capture_vol = 0;
588 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.adc.digital.capture.vol", "null");
589
590 if (strcmp(config_value, "null") == 0) {
591 return -1;
592 }
593
594 return strtoul(config_value, NULL, 10);
595}
596
597int GetAudioInternalDacPGAInGain_Cfg(void)
598{
599 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.internal.dac.pga_in.gain", "null");
600
601 if (strcmp(config_value, "null") == 0) {
602 return 16;
603 }
604
605 return strtol(config_value, NULL, 10);
606}
607
608int GetAudioInternalDACDigitalPlayBackVolume_Cfg(int audio_src_in_type)
609{
610 const char *config_value = NULL;
611
612 if (audio_src_in_type == 2) { // CC_AUDIO_IN_SOURCE_HDMI
613 config_value = config_get_str(CFG_SECTION_TV, "audio.internal.dac.playback.volume_hdmi", "null");
614 } else if (audio_src_in_type == 0) { // CC_AUDIO_IN_SOURCE_LINEIN
615 config_value = config_get_str(CFG_SECTION_TV, "audio.internal.dac.playback.volume_linein", "null");
616 } else if (audio_src_in_type == 1) { // CC_AUDIO_IN_SOURCE_ATV
617 config_value = config_get_str(CFG_SECTION_TV, "audio.internal.dac.playback.volume_atv", "null");
618 }
619
620 if (strcmp(config_value, "null") == 0) {
621 return 255;
622 }
623
624 return strtol(config_value, NULL, 10);
625}
626
627int GetAudioOutputSwapStatus(tv_source_input_t source_input)
628{
629 int sw_status = 0;
630 const char *config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.enable", "null");
631 if ( strcmp ( config_value, "enable" ) == 0 ) {
632 switch (source_input) {
633 case SOURCE_AV1:
634 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.av1", "null");
635 break;
636 case SOURCE_AV2:
637 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.av2", "null");
638 break;
639 case SOURCE_HDMI1:
640 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.hdmi1", "null");
641 break;
642 case SOURCE_HDMI2:
643 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.hdmi2", "null");
644 break;
645 case SOURCE_HDMI3:
646 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.hdmi3", "null");
647 break;
648 case SOURCE_TV:
649 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.tv", "null");
650 break;
651 case SOURCE_DTV:
652 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.dtv", "null");
653 break;
654 case SOURCE_MPEG:
655 config_value = config_get_str(CFG_SECTION_TV, "audio.output.swap.mpeg", "null");
656 break;
657 default:
658 break;
659 }
660
661 }
662
663 sw_status = atoi ( config_value );
664 return sw_status;
665}
666
667int GetAudioArchitectureTypeCFG()
668{
669 static int architecture_type = -1;
670 const char *config_value = NULL;
671
672 config_value = config_get_str ( CFG_SECTION_TV, "audio.architecture.type", "null" );
673 if (strcasecmp(config_value, "null") == 0) {
674 architecture_type = CC_DAC_G9TV_EXTERNAL_DAC_OFF_BOARD_FBC;
675 } else if ((strcasecmp(config_value, "t866_external_dac_offboard_fbc") == 0) || (strcasecmp(config_value, "g9tv_external_dac_offboard_fbc") == 0)) {
676 architecture_type = CC_DAC_G9TV_EXTERNAL_DAC_OFF_BOARD_FBC;
677 } else if ((strcasecmp(config_value, "t866_external_dac_offboard_customer_lib") == 0) || (strcasecmp(config_value, "g9tv_external_dac_customer_lib") == 0)) {
678 architecture_type = CC_DAC_G9TV_EXTERNAL_DAC_CUSTOMER_LIB;
679 } else if ((strcasecmp(config_value, "t866_external_dac_offboard_digital") == 0) || (strcasecmp(config_value, "g9tv_external_dac_digital") == 0)) {
680 architecture_type = CC_DAC_G9TV_EXTERNAL_DAC_DIGITAL;
681 } else if ((strcasecmp(config_value, "t866_external_dac_onboard") == 0) || (strcasecmp(config_value, "g9tv_external_dac_onboard") == 0)) {
682 architecture_type = CC_DAC_G9TV_EXTERNAL_DAC_ON_BOARD;
683 } else if ((strcasecmp(config_value, "t866_iternal_dac") == 0) || (strcasecmp(config_value, "g9tv_iternal_dac") == 0)) {
684 architecture_type = CC_DAC_G9TV_INTERNAL_DAC;
685 }
686
687 return architecture_type;
688}
689
690static int gAudioResampleType = -1;
691int GetAudioResampleTypeCFG()
692{
693 char *token = NULL;
694 const char *strDelimit = ",";
695 const char *config_value = NULL;
696 char cfg_buf[1024];
697
698 if (gAudioResampleType == -1) {
699 gAudioResampleType = 0;
700
701 char *pSave;
702 config_value = config_get_str ( CFG_SECTION_TV, "audio.resample.type", "null" );
703 strncpy(cfg_buf, config_value, sizeof(cfg_buf));
704 if (strcmp(cfg_buf, "") != 0) {
705 token = strtok_r(cfg_buf, strDelimit, &pSave);
706 while (token != NULL) {
707 if (strcasecmp(token, "hw") == 0) {
708 gAudioResampleType |= CC_AUD_RESAMPLE_TYPE_HW;
709 } else if (strcasecmp(token, "sw") == 0) {
710 gAudioResampleType |= CC_AUD_RESAMPLE_TYPE_SW;
711 }
712
713 token = strtok_r(NULL, strDelimit, &pSave);
714 }
715 } else {
716 gAudioResampleType = CC_AUD_RESAMPLE_TYPE_SW; //if can't find config string, allow sw resample
717 }
718 }
719
720 return gAudioResampleType;
721}
722
723