Skip to content

Commit 1e0b8c2

Browse files
committed
1.增大usb声卡的buf
2.修改文件名太长,会挂掉的问题 3.增加同轴播放时关模拟部分电源 4.修改一些客户要求的UI
1 parent 8281d7f commit 1e0b8c2

File tree

10 files changed

+120
-55
lines changed

10 files changed

+120
-55
lines changed

apps/player/SettingsView.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ namespace mango
5656
log_i("------------>set usb adb");
5757
system("openadb");
5858
}else{
59-
log_i("------------>set usb chager");
59+
log_i("------------>set usb chager");
6060
system("setprop persist.usb.debug 1");
61+
system("setprop persist.sys.usb.config mass_storage");
6162
}
6263
}
6364
}
@@ -188,9 +189,9 @@ namespace mango
188189
setMainState(0x1400);
189190
}
190191
void SettingsView::initMainList(){
191-
int img[]={IDP_SETTING_EQ,IDP_SETTING_PLAYORDER,IDP_SETTING_GAPLESS,IDP_SETTING_MUSICINFO,IDB_DUSBOTG_ICON,IDP_SETTING_ADVANCED,IDP_SETTING_ADVANCED};
192-
int imgsec[]={IDP_SETTING_EQ_S,IDP_SETTING_PLAYORDER_S,IDP_SETTING_GAPLESS_S,IDP_SETTING_MUSICINFO_S,IDB_DUSBOTG_ICON_S,IDP_SETTING_ADVANCED_S,IDP_SETTING_ADVANCED_S};
193-
int text[]={STR_SETTING_EQ,STR_SETTING_PLAYOODER,STR_SETTING_GAPLESS,STR_SETTING_MUSICINFO,STR_USB_CONECT_SETTING,STR_SETTING_ADVANCED,STR_SETTING_DIGITAL_FILTER};
192+
int img[]={IDP_SETTING_EQ,IDP_SETTING_PLAYORDER,IDP_SETTING_GAPLESS,IDP_SETTING_MUSICINFO,IDB_DUSBOTG_ICON,IDP_SETTING_DF,IDP_SETTING_ADVANCED};
193+
int imgsec[]={IDP_SETTING_EQ_S,IDP_SETTING_PLAYORDER_S,IDP_SETTING_GAPLESS_S,IDP_SETTING_MUSICINFO_S,IDB_DUSBOTG_ICON_S,IDP_SETTING_DF_S,IDP_SETTING_ADVANCED_S};
194+
int text[]={STR_SETTING_EQ,STR_SETTING_PLAYOODER,STR_SETTING_GAPLESS,STR_SETTING_MUSICINFO,STR_USB_CONECT_SETTING,STR_SETTING_DIGITAL_FILTER,STR_SETTING_ADVANCED};
194195
int i,count = sizeof(img)/sizeof(int);
195196

196197
mListView->deleteAllItems();
@@ -332,7 +333,7 @@ namespace mango
332333
}else
333334
mDigitalFilterListAdapter->refresh();
334335

335-
mTitle->setTextResoure(STR_POWER_SCREEN_OFF);
336+
mTitle->setTextResoure(STR_SETTING_DIGITAL_FILTER);
336337
mTitle->setTextLayoutType(TEXT_LAYOUT_CENTER);
337338
mTitle->invalidateRect();
338339
setMainState(0x1600);
@@ -426,9 +427,10 @@ namespace mango
426427
case 4:
427428
initUSBSettingList(); break;
428429
case 5:
429-
initAdvanceList(); break;
430+
initDigitalFilterList();break;
430431
case 6:
431-
initDigitalFilterList();break;
432+
initAdvanceList(); break;
433+
432434
}
433435
break;
434436
case 0x1200:

apps/player/audiousb.cpp

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,59 @@ typedef void* (*PTHREAD_START_ROUTINE)(void*);
1616
#else
1717
#define logi(...)
1818
#endif
19+
1920
void openOrCloseWm8740Mute(bool enable);
2021
void startCloseCodecMute();
21-
int gRun = 1;
22+
int gRun = 1;
23+
int mWakeLockCount = 0;
24+
void lockWake(bool lock)
25+
{
26+
FILE* class_fs = NULL;
27+
char buffer[2];
28+
29+
if (lock)
30+
{
31+
if (mWakeLockCount > 0)
32+
{
33+
mWakeLockCount++;
34+
return;
35+
}
36+
37+
mWakeLockCount++;
38+
}
39+
else
40+
{
41+
if (mWakeLockCount > 1)
42+
{
43+
mWakeLockCount--;
44+
return;
45+
}
46+
47+
if (mWakeLockCount <= 0)
48+
return;
49+
50+
mWakeLockCount--;
51+
}
52+
53+
do
54+
{
55+
class_fs = fopen("/sys/class/codec/wake", "wt");
56+
if (class_fs == NULL)
57+
{
58+
log_m("Can't open /sys/class/codec/wake");
59+
break;
60+
}
61+
62+
buffer[0] = lock? '1' : '0';
63+
buffer[1] = '\0';
64+
fwrite(buffer, 1, 2, class_fs);
65+
66+
}while(0);
67+
68+
if (class_fs)
69+
fclose(class_fs);
70+
}
71+
2272
//volatile
2373
typedef struct tagRingBufferContext
2474
{
@@ -624,7 +674,7 @@ void writePcm(unsigned char* buf,int size){
624674
hifi_pcm_close(mHiFiOut);
625675
continue;
626676
}
627-
677+
lockWake(true);
628678

629679
while(1)
630680
{
@@ -644,7 +694,7 @@ void writePcm(unsigned char* buf,int size){
644694
pcm_write(mHiFiOut, packet->data, packet->mSize - 4);
645695
}
646696
}
647-
697+
lockWake(false);
648698
hifi_pcm_close(mHiFiOut);
649699
mHiFiOut = NULL;
650700
}
@@ -682,7 +732,7 @@ int main (int argc, char* argv[])
682732
pthread_t readThreadId ;
683733
pthread_t sendThreadId ;
684734

685-
gHiFiRing.setBufferSize(1024 * 4 * 2 * 4 );
735+
gHiFiRing.setBufferSize(1024 * 4 * 2 * 4*2 );
686736
gHiFiRing.clear();
687737

688738
pthread_create(&readThreadId, NULL, (PTHREAD_START_ROUTINE)USBHiFiReading, (void*)(&n));
@@ -696,4 +746,4 @@ int main (int argc, char* argv[])
696746
LOGI("usbhifi init end-.");
697747

698748
return 0;
699-
}
749+
}

apps/player/mediaView.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ namespace mango
344344
TCHAR fileName[MAX_PATH];
345345
int fileAttribute;
346346
File file;
347-
char cName[255];
347+
char cName[MAX_PATH];
348348

349349
if (!file.findOpen(mCurrentPath)) {
350350
log_e ("findOpen") ;
@@ -1065,14 +1065,14 @@ namespace mango
10651065
else if(fromView == NULL && code == NM_DISPLAY){
10661066
log_i("NM_DISPLAY");
10671067
if(mNeedPlayPath != NULL){
1068-
char *ptr,parent[255];
1068+
char *ptr,parent[MAX_PATH];
10691069
char *where = NULL;
1070-
char sqlpath[300];
1070+
char sqlpath[MAX_PATH];
10711071
int count;
10721072
ArrayMediaInfo *pinfo;
10731073

10741074
pinfo = new ArrayMediaInfo();
1075-
ptr = where = new char[300];
1075+
ptr = where = new char[MAX_SQL];
10761076

10771077
mediaprovider::slqFormatOut(mNeedPlayPath,sqlpath);
10781078

@@ -1087,14 +1087,14 @@ namespace mango
10871087
if(count>0){
10881088
char* name;
10891089
ArrayMediaInfo arrayInfo;
1090-
char sqlParent[350];
1090+
char sqlParent[MAX_SQL];
10911091

10921092
if(mPlayinglist == NULL)
10931093
mPlayinglist = new Playinglist();
10941094
mPlayinglist->clearAll();
10951095

10961096
mediaprovider::slqFormatOut(parent,sqlParent);
1097-
ptr = where = new char[300];
1097+
ptr = where = new char[MAX_SQL];
10981098
ptr += sprintf(ptr," where path like '%s/%%' and not path like '%s/%%/%%' ",sqlParent,sqlParent);
10991099
count = gmediaprovider.queryMusicArray(where,&arrayInfo);
11001100
arrayInfo.sort();
@@ -1113,7 +1113,7 @@ namespace mango
11131113
else if(code == SDCARD_START_UNMOUNT){
11141114
char *ret = NULL;
11151115
char *ptr = NULL;
1116-
char utf8Path[300];
1116+
char utf8Path[MAX_SQL];
11171117

11181118
Charset::wideCharToMultiByte(CP_UTF8, mCurrentPath, String::lstrlen(mCurrentPath), utf8Path, MAX_PATH * 3);
11191119

@@ -1136,7 +1136,7 @@ namespace mango
11361136
}
11371137

11381138
int MediaView::getArrayInfoFromFile(char *path,ArrayMediaInfo& array,CString& cover){
1139-
char direct[255];
1139+
char direct[MAX_PATH];
11401140
int fileAttribute;
11411141
File file;
11421142
mediainfo info;

apps/player/mediaprovider.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ namespace mango
11521152
}
11531153
bool mediaprovider::cueCheckCursor(CursorItem& item,CString& pathStr){
11541154
CString dir;
1155-
char cuePath[300]={0};
1155+
char cuePath[MAX_PATH]={0};
11561156
bool ret = false;
11571157
CursorMediaInfo curMedia;
11581158

@@ -1167,7 +1167,7 @@ namespace mango
11671167
return ret;
11681168
}
11691169
bool mediaprovider::cueCheck(char *direct,mediainfo *info){
1170-
char cuePath[300];
1170+
char cuePath[MAX_PATH];
11711171
bool ret = false;
11721172

11731173
memset(cuePath,0,300);
@@ -1456,7 +1456,7 @@ namespace mango
14561456

14571457
int mediaprovider::insert(char *table,mediainfo *info)
14581458
{
1459-
char *ptr,sql[1024*5];
1459+
char *ptr,sql[MAX_SQL];
14601460

14611461
ptr = sql;
14621462
ptr += sprintf(ptr,"insert into %s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) ",
@@ -1475,7 +1475,7 @@ namespace mango
14751475
}
14761476
int mediaprovider::insertCursorItem(CursorItem& item){
14771477
int i;
1478-
char *ptr,sql[1024*5];
1478+
char *ptr,sql[MAX_SQL];
14791479

14801480
ptr = sql;
14811481
ptr += sprintf(ptr,"insert into music (");
@@ -1531,13 +1531,13 @@ namespace mango
15311531
return 0;
15321532
}
15331533
int mediaprovider::deleteMusicOnDir(const char *dir){
1534-
char sql[1024];
1534+
char sql[MAX_SQL];
15351535
sprintf(sql,"delete from music where path like '%s/%%'",dir);
15361536
return exec(sql,0,0);
15371537
}
15381538
int mediaprovider::querymusic(char *where, mediainfo **minfo)
15391539
{
1540-
char *ptr,sql[1024];
1540+
char *ptr,sql[MAX_SQL];
15411541
Musicdbinfo *info,*pt;
15421542
mediainfo *infolist;
15431543
int count = 0;
@@ -1589,7 +1589,7 @@ namespace mango
15891589

15901590
int mediaprovider::queryMusicArray(char *where, void *array)
15911591
{
1592-
char *ptr,sql[1024*5];
1592+
char *ptr,sql[MAX_SQL];
15931593
Musicdbinfo *info,*pt;
15941594
ArrayMediaInfo *arraylist;
15951595
int count = 0;
@@ -1630,7 +1630,7 @@ namespace mango
16301630
}
16311631
int mediaprovider::queryArrayMedia(char *where, void *array)
16321632
{
1633-
char *ptr,sql[1024];
1633+
char *ptr,sql[MAX_SQL];
16341634
Musicdbinfo *info,*pt;
16351635
ArrayMediaInfo *arraylist;
16361636
int count = 0;
@@ -1672,7 +1672,7 @@ namespace mango
16721672
return count;
16731673
}
16741674
int mediaprovider::queryCursor(char *where, Cursor* cur){
1675-
char *ptr,sql[1024];
1675+
char *ptr,sql[MAX_SQL];
16761676
int count = 0;
16771677

16781678
log_i("-------queryCursor");
@@ -1915,7 +1915,7 @@ namespace mango
19151915
void SdcardAudioData::insertCursor(CursorItem& item){
19161916
int i,ret;
19171917
char *pErrMsg = 0;
1918-
char *ptr,sql[1024*5];
1918+
char *ptr,sql[MAX_SQL];
19191919

19201920
if(db == NULL)
19211921
return;
@@ -2029,7 +2029,7 @@ namespace mango
20292029

20302030
item.getValue("img_path",str);
20312031

2032-
char sdcardPath[300]={"/mnt/external_sd/.audio_data/album_img/"};
2032+
char sdcardPath[MAX_PATH]={"/mnt/external_sd/.audio_data/album_img/"};
20332033

20342034
if( FileAttr::FileExist(str.string) ){
20352035

apps/player/player.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ namespace mango
8888
gAlarmManager->initialize();
8989
gAlarmManager->setAlarmWakeup(6);
9090
#endif
91+
spdifProbe();
9192
holdKeyProbe();
9293
log_i("end");
9394
//mUSBHiFi = new USBHiFi(TEXT("Playing"), NULL, NULL, 0, SW_NORMAL);
@@ -661,7 +662,9 @@ namespace mango
661662
bool isSpidfIn;
662663
isSpidfIn = isSpdifIn();
663664
if(isSpidfIn)
664-
openCodecPower(!isSpidfIn);
665+
system("echo '0'>/sys/class/codec/power");
666+
else
667+
system("echo '1'>/sys/class/codec/power");
665668
}
666669

667670
bool Player::isSpdifIn(){
@@ -832,7 +835,8 @@ namespace mango
832835
}
833836
}else if(keyCode == KEYCODE_LONG_POWER&&action == VM_KEYDOWN){
834837
//gPlayer.showShutDownView();
835-
gPlayer.showChosenView(ChosenView::CHOSEN_POWEROFF);
838+
//gPlayer.showChosenView(ChosenView::CHOSEN_POWEROFF);
839+
gMessageQueue.post(gPlayer.mPlayingView,VM_NOTIFY,NM_POWER_OFF,keyCode);
836840
}else if(action == VM_MEDIA){
837841
gMessageQueue.post(gPlayer.mPlayingView,VM_NOTIFY,keyCode,0);
838842
gMessageQueue.post(gPlayer.mMeidaView,VM_NOTIFY,keyCode,0);

apps/player/playingView.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,12 @@ namespace mango
619619
if(gPlayer.mCodecType == 0){
620620
isSpdifIn = gPlayer.isSpdifIn();
621621
mPlayinglist->setSpdifOut(isSpdifIn);
622+
}else if(gPlayer.mCodecType == 1){
623+
isSpdifIn = gPlayer.isSpdifIn();
624+
if(isSpdifIn)
625+
system("echo '0'>/sys/class/codec/power");
626+
else
627+
system("echo '1'>/sys/class/codec/power");
622628
}
623629
gPlayer.mSpdifSwitch->resetSwicth();
624630
}

apps/player/playinglist.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ void Playinglist::startSlient(){
687687

688688
void Playinglist::setSpdifOut(bool isSpdif){
689689
int playPostion;
690+
log_i("--->setSpdifOut:%d",isSpdif);
690691
if(mParticleplayer != NULL){
691692
if(mParticleplayer->isSpdifOut() != isSpdif){
692693
mParticleplayer->enableSpdifOut(isSpdif);

0 commit comments

Comments
 (0)