UiVideoFileList.c
上传用户:hjhsjcl
上传日期:2020-09-25
资源大小:11378k
文件大小:18k
源码类别:

压缩解压

开发平台:

C++ Builder

  1. /*==========================================================================
  2. Copyright (c) 2004 ALi Corporation. All Rights Reserved
  3. File: UiVideo.c
  4. content: user interface for play module
  5. History: Created by Walace 2005/11/16
  6. ==========================================================================*/
  7. #define _UI_VIDEO_FILE_H_ //Walace060926#1 VideoResume
  8. #include <DP8051XP.H>
  9. #include "TypeDef.h"
  10. #include "Const.h"
  11. #include "Reg5661.h"
  12. #include "Common.h"
  13. #include "Key.h"
  14. #include "SaveSetting.h"
  15. #include "NandFlash.h"
  16. #include "Idma.h"
  17. #include "FileSystem.h"
  18. #include "UiCommon.h"
  19. #include "OLED.h"
  20. #include "IconDefine.h"
  21. #include "SysStrDef.h"
  22. #include "UiSysStr.h"
  23. #include "OledString.h"
  24. #include "UiPlayCommon.h"
  25. #include "UiVideoCommon.h"
  26. #include "UiVideoFileList.h"
  27. #include "Video.h" //Walace060926#1 VideoResume
  28. #if(UI_USE_CLASS_LIST)
  29. #include "ClassDataBase.h"
  30. #endif
  31. #include "VideoDsp.h" //Walace070329#1
  32. #define gxbUiVideoMainState gxbUiMenuMainStates
  33. #define gxbUiVideoSubState gxbUiMenuSubStates
  34. #define UI_VIDEO_DEL_MENU UI_DEL_YES_NO_MENU //Walace060806#2
  35. #define UI_VIDEO_FILE_LIST UI_FILE_LIST_MENU
  36. void UiVideoFileListInit(void);
  37. void UiVideoFileBrowseCtrl(BYTE bKey);
  38. BOOL UiSelectFileOrFolder(void);
  39. //void UiDispDelYesNoMenu(void) large;
  40. void UiDelMenuCtrl(BYTE bKey) large;
  41. //Walace060926#1 VideoResume start
  42. BOOL VideoFileInit(void);
  43. void VideoCheckResumeRequire(void);
  44. void VideoGotoResumeFile(void);
  45. void VideoReadSettingValue(void);
  46. void SwicthToSaveSetting(void) large;
  47. void VideoSaveLastPlayInfo(void);
  48. //Walace060926#1 VideoResume end
  49. main(void)
  50. {
  51. BYTE bKey;
  52. #if(ICE_REAL_MODE) //vicky061001#2 Debug Play
  53. EnableTimer0();
  54. IE=0x83;
  55. #endif
  56. UiVideoFileListInit();
  57. bKey = KEY_INVALID;
  58. while(TRUE)
  59. {
  60. UiNormalCheck();  
  61. KeyGet(bKey);
  62. UiCheckBackLight(bKey);
  63. UiVideoNormalCheck();
  64. switch(gxbUiVideoMainState)
  65. {
  66. case UI_VIDEO_FILE_LIST:
  67. UiVideoFileBrowseCtrl(bKey);
  68. break;
  69. case UI_VIDEO_DEL_MENU:
  70. UiDelMenuCtrl(bKey);
  71. break; 
  72. }
  73. //Nick061120 start //NandRestore start //Walace061218#1
  74. #if(NAND_ECC_DEBUG) //vicky070105#3
  75. if((gxwTimeToScanPM > SCAN_PM_DURATION)&&gfMLCMode)
  76. #else
  77. if(gxbRestoreBlkNum || (gxwTimeToScanPM > SCAN_PM_DURATION)&&gfMLCMode)
  78. #endif
  79. {
  80. gxbModuleState=MODULE_VIDEO_FLIST;
  81. //Nick061204 start
  82. if(gxwTimeToScanPM > SCAN_PM_DURATION)
  83. gxbRestoreCMD |= PM_SCAN;
  84. else
  85. gxbRestoreCMD = FullStep;
  86. //Nick061204 end
  87. LoadProgram(PM_PLAY_DATA_RTN_RESTORE, BASIC_CODE_ONLY);
  88. }
  89. //Nick061120 end //NandRestore end  //Walace061218#1
  90.  }
  91.  
  92. } // main(1)
  93. #if(1) //Walace060926#1 VideoResume start
  94. void UiVideoFileListInit(void) 
  95. {
  96. #if(SETTING_FOR_ICE_START)
  97. UiVideoICEInit();
  98. #endif
  99.        VideoCommonInitial();
  100.         //NandRestore start //Walace061218#1
  101. if((gxbModuleState&MODULE_SUB)==MODULE_NAND_RTN_RESOTRE) //Nick061120
  102. {
  103. gxbModuleState=MODULE_OTHERS;
  104. return;
  105.         }
  106. //NandRestore end  //Walace061218#1  
  107. switch(gxbModuleState)
  108. {
  109. case MODULE_FILE_DEL:
  110. gfDelFile = TRUE; 
  111. gxbModuleState=MODULE_OTHERS;
  112. SET_VD_MODULE_FLOW(VIDEO_TO_FLIST_INIT);
  113. break;
  114. case MODULE_INITIAL:
  115. gfDspCtrlCdc=FALSE;
  116. gfCdcAlreadyInit=FALSE;  
  117. gxbModuleState=MODULE_OTHERS;
  118. SET_VD_MODULE_FLOW(VIDEO_TO_FLIST_INIT);
  119. break;
  120. }
  121. switch(GET_VD_MODULE_FROM())
  122. {
  123. case VIDEO_FROM_PLAY:
  124. VideoSaveLastPlayInfo();
  125. break;
  126. case VIDEO_FROM_MENU:
  127. case VIDEO_FROM_FLIST:
  128. case VIDEO_FROM_FLIST_INIT:
  129. case VIDEO_FROM_SAVE:
  130. default:
  131. break;
  132. }
  133. switch(GET_VD_MODULE_TO())
  134. {
  135. case VIDEO_TO_FLIST_INIT:
  136. //vicky070103#3
  137. #if(USE_ERR_MSG_DISPLAY)
  138. if(!gbFsUnableUse) 
  139. #endif
  140. {
  141. UiShowWaitMsg(UI_SHOW_WAIT_START);
  142. }
  143. VideoReadSettingValue();
  144. if(!VideoFileInit())
  145. {
  146.  //vicky070103#3
  147.  if(gbFsUnableUse)
  148. {
  149. gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_SEL_MODE;
  150. gxbSettingBuffer[SETTING_DISPLAY_SWAPING]=TRUE;
  151. gxbLastErrCode=ERR_NO_ERROR;
  152.   }
  153.  //End
  154. SwicthToSaveSetting(); 
  155. }
  156.               UiRndPlayInit();
  157. UiShowWaitMsg(UI_SHOW_WAIT_TIME_OUT); 
  158. break;
  159. case VIDEO_TO_MENU:
  160. UiVideoSwitchModule(VIDEO_TO_MENU);
  161. break;
  162. case VIDEO_TO_SAVE:
  163. SwicthToSaveSetting();
  164. break;
  165. }
  166. // WHH #8 301_061226(start)
  167. UiShowLargeBackground(5,IM_BROWSER_BG_S1); //tne 2007/01/10 #2
  168. // WHH #8 301_061226(end)
  169. UiGoFileList();
  170. gxbUiVideoMainState = UI_VIDEO_FILE_LIST;
  171. }
  172. #else
  173. void UiVideoFileListInit(void) 
  174. {
  175. #if(SETTING_FOR_ICE_START)
  176. UiVideoICEInit();
  177. #endif
  178.        VideoCommonInitial();
  179. switch(gxbModuleState)
  180. {
  181. case MODULE_FROM_PLAYBACK:
  182. break;
  183. case MODULE_FROM_PLAYDEL:
  184. VideoFileInit();
  185. gfDelFile = TRUE;  //It would be better that gfDelFile was be maintained by PlayDel target
  186. break;
  187. case MODULE_FROM_PLAY_MENU:
  188. break;
  189. }
  190. UiGoFileList();
  191. gxbUiVideoMainState = UI_VIDEO_FILE_LIST;
  192. }
  193. #endif
  194. //Walace060926#1 VideoResume end
  195. //Walace060926#1 VideoResume start
  196. //#define RESUME_TIME_COL SEG7
  197. //#define RESUME_TIME_ROW PAGE3
  198. #define RESUME_TIME_COL 70
  199. #define RESUME_TIME_ROW 98
  200. void UiConfirmResumeMenu(void)
  201. {
  202. BYTE bKey;
  203. WORD wTemp;
  204. // WHH 070109
  205. /*OLED_CLEAR_ALL();
  206. OledShowIcon(ICON_SEARCH_TO,SEG1,PAGE1);
  207. OledShowIcon(ICON_COLON,RESUME_TIME_COL+16,RESUME_TIME_ROW+4) ; //Icon Slash        */
  208. OledShowIconNew(2,IM_BG_CLEAR_TO_BLACK,0,0);
  209. //OledShowIcon(ICON_SEARCH_TO,SEG1,PAGE1);
  210. OledShowIconNew(1,IM_MOVIE_ICON_PLAYBACK,RESUME_TIME_COL,RESUME_TIME_ROW);
  211. //OledShowIcon(ICON_COLON,RESUME_TIME_COL+8,RESUME_TIME_ROW+24) ;
  212. OledShowIconNew(1,IM_MOVIE_RESUME_COLON,RESUME_TIME_COL+16,RESUME_TIME_ROW+36);
  213. bKey = KEY_RIGHT_BREAK;
  214. gfFirstResume=FALSE;
  215. while(TRUE)
  216. {
  217. switch(bKey)
  218. {
  219. case KEY_RIGHT_BREAK:
  220. case KEY_LEFT_BREAK:
  221. gfFirstResume=!gfFirstResume;
  222. if(gfFirstResume)
  223. wTemp=gxwVideoLastPlayTime;
  224. else
  225. wTemp=0;
  226. OledShowBigNumber(wTemp/60,RESUME_TIME_COL,RESUME_TIME_ROW+36,2);
  227. OledShowBigNumber(wTemp%60,RESUME_TIME_COL+24,RESUME_TIME_ROW+36,2);
  228. //OledShowIcon(ICON_COLON,RESUME_TIME_COL+16,RESUME_TIME_ROW+4) ; //Icon Slash        
  229. break;
  230. case KEY_UP_BREAK:
  231. //WHH 070109
  232. //OLED_CLEAR_ALL();
  233. OledShowIconNew(2,IM_BG_CLEAR_TO_BLACK,0,0);
  234. return;
  235. }
  236. bKey = KEY_INVALID;
  237. UiNormalCheck();  
  238. KeyGet(bKey);
  239. UiCheckBackLight(bKey);
  240. UiVideoNormalCheck();
  241.  }
  242. }
  243. #undef RESUME_TIME_COL 
  244. #undef RESUME_TIME_ROW 
  245. //Walace060926#1 VideoResume end
  246. void UiVideoFileBrowseCtrl(BYTE bKey)
  247. {
  248. if(gfScrollFlag) //Walace060213#3
  249. {
  250. if( (gxbLcdCounter>=UI_SCROLL_DELAY_TIME)&&(gxwFileNumInFileList!=0) )
  251. {
  252. //WHH #8 301_061226
  253. //LcdScrollFileList(&stUiFileListData,gxbUiMenuSubStates<<1,TRUE);
  254. LcdScrollFileList(&stUiFileListData,gxbUiMenuSubStates,TRUE);
  255. gxbLcdCounter=0;
  256. }
  257. }
  258. switch(bKey)
  259. {
  260. case KEY_LEFT_BREAK:
  261. case KEY_LEFT_LONG:   // Jeff070125#5
  262. UiShowFileList(UI_FILE_LIST_UP);
  263. break;
  264. case KEY_RIGHT_BREAK:
  265. case KEY_RIGHT_LONG:  // Jeff070125#5
  266. UiShowFileList(UI_FILE_LIST_DOWN);
  267. break;
  268. case KEY_UP_BREAK:
  269. if(UiSelectFileOrFolder())
  270. {
  271. //Walace060926#1 VideoResume start
  272. VideoCheckResumeRequire();
  273. if(gfFirstResume)
  274. {
  275. UiConfirmResumeMenu();
  276. }
  277. UiVideoSwitchModule(VIDEO_TO_PLAY);
  278. //Walace060926#1 VideoResume end
  279. }
  280. break;
  281. #if(UI_VIDEO_USE_MENU)
  282. //case KEY_FUNC_BREAK:
  283. case KEY_FUNC_LONG_BREAK:  //Walace060803#5
  284.  UiVideoSwitchModule(VIDEO_TO_MENU);  //Walace060926#1 VideoResume
  285. break;
  286. #endif
  287. case KEY_FUNC_BREAK: //Walace060803#5 start
  288. if(stUiFileListData.bPathDepth==0)
  289. {
  290. gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_SEL_MODE;
  291. UiVideoSwitchModule(VIDEO_TO_SAVE);
  292. }//Walace060926#1 VideoResume
  293. else
  294. {
  295. //gxbPhotoProcState = PHO_ENG_STOP;
  296. gxwFileNumInFileList=0;
  297. UiSelectFileOrFolder();
  298. }
  299. break;  //Walace060803#5 end
  300. //tne 2005/12/17
  301. #if(!FIVEKEY)
  302. case KEY_REC_BREAK:
  303. #else
  304. case KEY_VOL_BREAK:
  305. #endif
  306. if(gxwFileNumInFileList>0)
  307. {
  308.   UiDrawSubMenu(SYS_STR_TOOLS_DEL);
  309. gxbUiVideoMainState=UI_VIDEO_DEL_MENU;
  310. gxbUiMenuSubStates=FALSE;
  311. UiDispYesNoMenu();
  312. }
  313. break;
  314. //case KEY_MODE_BREAK:
  315. case KEY_FUNC_LONG: // WHH 070110 NEW UI KEY
  316. gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_SEL_MODE;
  317. UiVideoSwitchModule(VIDEO_TO_SAVE);  //Walace060926#1 VideoResume start
  318. break;
  319.              default:
  320. break;
  321. }
  322. }
  323. #if(UI_USE_ALARM_DISPLAY)
  324. //tne 2007/01/15 #1 move to UiCommon.c
  325. //void UiShowWakeUp() large
  326. #endif
  327. BOOL UiSelectFileOrFolder(void)
  328. {
  329. if(gxwFileNumInFileList<=gxwTotalDirInDir)
  330. {    
  331. gpstFileIndex=&stUiFileListData;
  332. if(gxwFileNumInFileList==0)
  333. {
  334. //tne 2005/12/29 #4
  335. if(stUiFileListData.bPathDepth>0)
  336. {
  337. FsChangeDir(RESTORE_DIR);
  338. gxwFileNumInFileList=UiGetBackDirNum();
  339. }
  340. }
  341. else
  342. {
  343. FsChangeDir(ENTER_DIR);
  344. gxwFileNumInFileList=0;
  345. }
  346. UiGetFileListNum();
  347. UiGoFileList();
  348. return FALSE;
  349. }
  350. else
  351. {
  352. gxbFileNumSearchMode=FNUM_SEARCH_RESET_MODE;
  353. UiCountCurtFileNum(&stPhoFileInf,&stUiFileListData);
  354. return TRUE;
  355. }
  356. }
  357. //tne 2005/12/17
  358. /* tne 2007/01/14 #1
  359. void UiDispDelYesNoMenu(void) large
  360. {
  361. UiShowSubMenuNum(gxbUiMenuSubStates+1,2);
  362. UI_CLEAR_MENU_TAG_AREA();
  363. StrShowSysString(cwStringSysYesNoList[gxbUiMenuSubStates],LCD_AUTO_CENTER_COL,OLED_TAG_ROW);
  364. }
  365. */
  366. //tne 2005/12/17
  367. void UiDelMenuCtrl(BYTE bKey) large
  368. {
  369. switch(bKey)
  370. {
  371. case KEY_LEFT_BREAK:
  372. case KEY_RIGHT_BREAK:
  373. gxbUiMenuSubStates ^= 0x01;
  374. UiDispYesNoMenu();
  375. break;
  376. case KEY_UP_BREAK:
  377. if(gxbUiMenuSubStates==TRUE) //del file
  378. {
  379. //OLED_CLEAR_ALL(); //Walace060806#2
  380. //StrShowSysString(SYS_STR_HOST_WORKING_DEL,LCD_AUTO_CENTER_COL,PAGE3);
  381.  
  382. SetSysSpeed(0x02);
  383. gxbModuleState=MODULE_VIDEO_FLIST; //Walace060926#1 VideoResume
  384. if(gxwFileNumInFileList>gxwTotalDirInDir) //select a file //tne dir del
  385. {
  386. LoadProgram(PM_PLAY_DEL,NORMAL_CODE);
  387. //gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_FILE_DEL; //Tne05122#Video
  388. }
  389. else
  390. {
  391. LoadProgram(PM_DIR_DEL,NORMAL_CODE);
  392. //gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_DIR_DEL;//Tne05122#Video
  393. }
  394. /*
  395. gxbSettingBuffer[SETTING_DISPLAY_SWAPING]=FALSE;
  396. gxbLastErrCode=ERR_NO_ERROR;
  397. SaveSetting();
  398. */
  399. }
  400. case KEY_FUNC_BREAK:
  401.      UiGoFileList();
  402.      gxbUiMenuMainStates = UI_FILE_LIST_MENU;
  403. break;
  404. }
  405. }
  406. //Walace060926#1 VideoResume start
  407. void FsStructInit(struct FILE_INF_DATA xdata* pFsStruct )
  408. {
  409. pFsStruct->pbFileName=gxbFileName;
  410. pFsStruct->pbLongFileName=gxbLongFileName;
  411. pFsStruct->bPathDepth=0;
  412. pFsStruct->dwDirStartSec=gxdwRoot;
  413. pFsStruct->dwDirSec[0]=gxdwRoot;
  414. pFsStruct->wDirOffset[0]=0;
  415. }
  416. void VideoCheckResumeRequire(void)
  417. {
  418. BYTE bI;
  419. gfFirstResume=FALSE;
  420. if(gxwVideoLastPlayTime==0)
  421. return;
  422. stPhoFileInf=stUiFileListData;
  423. gpstFileIndex = &stUiFileListData;
  424. if(gpstFileIndex->bPathDepth!=gxbLastFileDepth)
  425. goto COMPARE_END;
  426. for(bI=0;bI<11;bI++)
  427. {
  428. if(gxbLastFileName[bI]!=gpstFileIndex->pbFileName[bI])
  429. goto COMPARE_END;
  430. }
  431. while(gpstFileIndex->bPathDepth>0)
  432. {
  433. FsChangeDir(RESTORE_DIR);
  434. FsOpenFile(RELOAD_DIR_NAME); //stUiFileListData
  435. for(bI=0;bI<11;bI++)
  436. {
  437. if(gxbLastFilePath[(gpstFileIndex->bPathDepth)*11+bI]!=gpstFileIndex->pbFileName[bI])
  438. {
  439. goto COMPARE_END;
  440. }
  441. }
  442. }
  443. gfFirstResume=TRUE;
  444. COMPARE_END:
  445. stUiFileListData=stPhoFileInf;
  446. FsOpenFile(RELOAD_FILE_NAME);
  447. return;
  448. }
  449. void VideoGotoResumeFile(void)
  450. {
  451. BYTE bI,bDepth;
  452. gpstFileIndex=&stUiFileListData;
  453. for(bDepth=1;bDepth<=gxbLastFileDepth;bDepth++)
  454. {
  455. if(UiSearchFile(ALL_DIR_IN_DIR,(PBYTE)(gxbLastFilePath+(bDepth-1)*11)))
  456. {
  457. FsChangeDir(ENTER_DIR);
  458. }
  459. else
  460. {
  461. goto FIRST_VIDEO_FILE;
  462. }
  463. }
  464. //search last play file
  465. gpstFileIndex=&stPhoFileInf;
  466. FsOpenFile(FIRST_PLAYBACK);
  467. gxwCurtFileInAll=1;
  468. gxwCurtFileInDir=0;
  469. while(1)
  470. {
  471. //check the same dir
  472. if(stPhoFileInf.dwDirStartSec==stUiFileListData.dwDirStartSec)
  473. {
  474. gxwCurtFileInDir++;
  475. for(bI=0;bI<11;bI++)
  476. {
  477. if(gxbLastFileName[bI]!=gxbFileName[bI])
  478. break;
  479. }
  480. if(bI==11) //find the same file
  481. //gfFirstResume=TRUE; //tne 2005/08/19
  482. break;
  483. }
  484. }
  485. if(gxwCurtFileInAll>=gxwTotalFileInAll) //not found the same file
  486. {
  487. stPhoFileInf=stUiFileListData;
  488. goto FIRST_VIDEO_FILE;
  489. }
  490. FsOpenFile(NEXT_PLAYBACK);
  491. gxwCurtFileInAll++;
  492. }
  493. return;
  494. FIRST_VIDEO_FILE:
  495. gpstFileIndex=&stPhoFileInf;
  496. FsOpenFile(FIRST_PLAYBACK);
  497. gxwCurtFileInAll=1;
  498. gxwCurtFileInDir=1;
  499. return;
  500. }
  501. BOOL VideoFileInit(void)
  502. {
  503. if(gbFsUnableUse)
  504. {
  505. OLED_CLEAR_ALL();
  506. gxbLastErrCode=ERR_INIT_FS_ERR;
  507. #if(USE_ERR_MSG_DISPLAY)
  508. UiCheckIniErr();
  509. #endif
  510. return FALSE;
  511. }
  512. FsStructInit(&stUiFileListData); 
  513. FsStructInit(&stPhoFileInf);  
  514. gxbFileMode = VIDEO_FILE;
  515. gxbLongFileName[0]=STRING_TYPE_UNICODE;
  516. gfDelFile = FALSE;
  517. gdwFileSector=0;
  518. gfFirstResume=FALSE;
  519. #if(DRM_MODE_EN)
  520. UiSearchMtpPropFile();
  521. #else
  522. gxbExceptFileAttrib=(FILE_ATTR_LABEL|FILE_ATTR_SYSTEM|FILE_ATTR_HIDDEN);
  523. #endif
  524. //4  ==== Get "gxwTotalFileInAll" ====
  525. gxwTotalFileInAll=UiCountFileInDir(COUNT_ALL_PLAYBACK);
  526. FsStructInit(&stUiFileListData); 
  527. //4  ==== Get "gxwCurtFileInAll , gxwCurtFileInDir , gxwTotalDirInDir, gxwTotalFileInDir " ===
  528. if(gxwTotalFileInAll==0) 
  529. {
  530. gxwCurtFileInAll=0;
  531. gxwCurtFileInDir=0;
  532. gxwTotalDirInDir=UiCountFileInDir(COUNT_DIR_IN_DIR);
  533. gxwTotalFileInDir=0;
  534. }
  535. else
  536. {
  537. VideoGotoResumeFile();
  538. stUiFileListData=stPhoFileInf; //all point to playback file
  539. UiGetFileListNum(); 
  540. FsOpenFile(RELOAD_FILE_NAME);
  541. }
  542. //4 ==== Get "gxwNumTotalFiles" , "gxwCurrentFileNum","gxwFileNumInFileList" ====
  543. if(gfPlayAutoSearchFile)
  544. {
  545. gxwNumTotalFiles=gxwTotalFileInAll;
  546. gxwCurrentFileNum=gxwCurtFileInAll;
  547. }
  548. else
  549. {
  550. gxwNumTotalFiles=gxwTotalFileInDir;
  551. gxwCurrentFileNum=gxwCurtFileInDir;
  552. }
  553. gxwFileNumInFileList=gxwCurtFileInDir+gxwTotalDirInDir;
  554. return TRUE;
  555. }
  556. //Walace051218
  557. void VideoReadSettingValue(void)
  558. {
  559. BYTE bI;
  560. PBYTE pbFsData;
  561. NandPrivateEn();
  562. ReadSettingData(FS_DATA_0_0);
  563. pbFsData = (gxbFsData+gxwOffsetDataSec);
  564. gxbRepeatMode=*(pbFsData+SRAM_VIDEO_REPEAT_MODE);
  565. gfPlayAutoSearchFile = ((gxbRepeatMode & REPEAT_SETTING_DIR_FLAG_J)>>7);
  566. gxbRepeatMode&=REPEAT_SETTING_MODE;
  567. gxbVolume=*(pbFsData+SRAM_VOLUME);
  568. gxbLastFileDepth=*(pbFsData+SRAM_VIDEO_PATH_DEPTH);
  569. for(bI=0;bI<(gxbLastFileDepth*11);bI++)
  570. gxbLastFilePath[bI]=*(pbFsData+SRAM_VIDEO_PATH_START+bI);
  571. for(;bI<(MAX_PATH_DEPTH-1)*11;bI++)
  572. gxbLastFilePath[bI]=0;
  573. for(bI=0;bI<11;bI++)
  574. gxbLastFileName[bI]=*(pbFsData+SRAM_LAST_VIDEO_FILE+bI);
  575. gxdwLastPlayFileSector=*((PDWORD)(pbFsData+SRAM_VIDEO_LAST_FILESECTOR));
  576.     gxwVideoLastPlayTime=*((PWORD)(pbFsData+SRAM_VIDEO_LAST_PLAY_TIME));
  577. NandPrivateDis();
  578. }
  579. void SwicthToSaveSetting(void) large
  580. {
  581. MCU_ACCESS_CODEC_I2S_EN();   //Renshuo050216#A
  582. obALGPAREG |= 0x04; //power down PDY
  583. obALGPAREG |= 0x01; //power down PD
  584. obALGPAREG |= 0x02; //power down PDX
  585. MCU_ACCESS_CODEC_I2S_DIS();  //Renshuo050216#A
  586. gfCdcAlreadyInit = FALSE;
  587.    
  588. gxbTargetVolume = FADEOUT_VOL;
  589. gxbLastVolume = FADEOUT_VOL;
  590. //gxbSettingBuffer[SETTING_DISPLAY_SWAPING]=TRUE;
  591. //gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_SEL_MODE;
  592. gxbLastErrCode=ERR_NO_ERROR;
  593. SaveSetting();
  594. }
  595. /*
  596. #define AVI_H_SUPPORT_VERSION 0x01 //Walace060912#1
  597. #define AVI_H_SUPPORT_SYNC 0xFF //0xFF for old sync word, 0xEE for new sync word  //Walace060912#1 
  598. #define AVI_H_SYC_WORD 0x00           //LEN 6 bytes //Sync. word ALiAVI 0x414c49415649
  599. #define AVI_H_PACKET_SEQ  0x06   //LEN 2 bytes //Packet sequcence
  600. #define AVI_H_PACKET_COUNT 0x0A    //LEN 2 bytes  // Packet count    //Horry060313#1 start
  601. #define AVI_H_PACKET_SIZE 0x0E       //LEN 2 bytes  // Packet size (include Header size)
  602. #define AVI_H_FRAME_RATE 0x10       //LEN 1 bytes  // Video frame rate //1,5,10,20  //Horry060313#1 start
  603. #define AVI_H_SAMPLE_RATE 0x11     //LEN 1 bytes // Audio sample rate //Horry060313#1
  604. #define AVI_H_IMAGE_INFO 0x13       //Walace060912#1 start
  605. #define AVI_H_IMAGE_FRAME_COUNT_MASK 0xF0   
  606. #define AVI_H_IMAGE_SIZE_MASK 0x0F   //Walace060912#1 end
  607. #define AVI_H_VIDEO_VERSION 0x14  //Walace060912#1
  608. */
  609. void VideoSaveLastPlayInfo(void)
  610. {
  611. BYTE bI;
  612. if(gxwCurrentPlayTime==gxwTotalPlayTime)
  613. {
  614. gxwCurrentPlayTime=0;
  615. gdwFileSector=0;
  616. }
  617. stUiFileListData=stPhoFileInf;
  618. gpstFileIndex=&stUiFileListData;
  619. for(bI=0;bI<11;bI++)
  620. gxbLastFileName[bI]=gxbFileName[bI];
  621. gxbLastFileDepth=gpstFileIndex->bPathDepth;
  622. while(gpstFileIndex->bPathDepth>0)
  623. {
  624. FsChangeDir(RESTORE_DIR);
  625. FsOpenFile(RELOAD_DIR_NAME);
  626. for(bI=0;bI<11;bI++)
  627. gxbLastFilePath[(gpstFileIndex->bPathDepth)*11+bI]=gxbFileName[bI];
  628. }
  629. stUiFileListData=stPhoFileInf;
  630. gxdwLastPlayFileSector = gdwFileSector;
  631. gxwVideoLastPlayTime= gxwCurrentPlayTime;
  632. if(gxbVideoFormat==VIDEO_TYPE_MP3_V1) //Walace070329#1
  633. {
  634. gxwVideoLastPlayTime=0;
  635. gxdwLastPlayFileSector=0;
  636. }
  637. }
  638. //Walace060926#1 VideoResume end