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