prog_mp3dir.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:20k
- /*****************************************************
- Creater: Terry
- Date : 2001/5/14 05:30PM
- Description: Program menu using
- *****************************************************/
- //#define MONE_PROG
- extern UINT16 mp3_file_count(void);
- void FSGUI_cal_dir_file(UINT16 *dir,UINT16 *file,UINT16 iSelect);
- void FSGUI_cal_2_file(UINT16 *iSelect,UINT16 dir,UINT16 file);
- #ifdef DVD_PROG_AUTO_CURSOR_RIGHT //Maoyong 2004.02.10
- BYTE tt_input_num_count = 0;
- /*Function Purpose: Do checking for input TT in DVD Program.
- for a reasonal operation:
- (1)when TT>=10,
- a:input 2 should auto right shift HL cursor,
- b:input 02 or 10 should auto right shift HL cursor, too,
- c: input 1 should not
- (2)when TT<10,
- a number > 0, should auto right shift HL cursor, otherwise not
-
- Note: TT value = prog[y][0]
-
- RETURN: 1. do right shift
- 0. not do
- */
- BYTE check_cursor_shift_right(void)
- {
- UINT8 x, y;
-
- x=index_x%2;
- y=index_y+MAX_NM_Y*(index_x/2)-1;
-
- if( (pDSV->dTT_SRP_Ns <10) && (prog[y][0] > 0) )
- {
- tt_input_num_count = 0;
- return 1;
- }
- else //TT number > 10
- {
- tt_input_num_count++;
- if(tt_input_num_count == 1)
- {
- if( (prog[y][0] < 10)&& (prog[y][0] > (pDSV->dTT_SRP_Ns/10)) )//for (1)a
- {
- tt_input_num_count = 0;
- return 1;
- }
- else //for (1)c
- return 0;
- }
- else //for (1)b
- {
- tt_input_num_count = 0;
- if(prog[y][0] >0)
- return 1;
- else
- return 0;
- }
- }
- }
- void clear_tt_input_num_count(void)
- {
- tt_input_num_count = 0;
- }
- #endif
- #ifdef SUPPORT_OSDID3//suqiaoli add 2004-3-26
- extern void osd_init_OSDID3(void);
- extern void show_id3(void);
- #endif
- #ifdef SUPPORT_MP4_SUBTITLE // David 2004-5-12
- extern void osd_init_OSDSRT(void);
- #endif
- #ifdef SETUP_PROGRAM_IN_PLACE_UNDER_16M
- #ifdef NEW_STYLE_SETUP
- static inline void ProgOffForNewStyleSetup()
- { // 2004/11/26 yltseng
- #ifdef SDRAM_16Mb_Mode
-
- #include "memmap0.h"
- #include "navdata.h"
-
- regs0->osd_base_addr=regs0->osdya;
- osd_init();
- if( (prog_state == 2)||(prog_state == 6))
- {
- if ((cd_type_loaded == CDROM) && (pFsJpeg->gifsFuncBtn == 2))
- {
- prog_state=255;
- ircmd_post_func(CMD_FUNC | CMD_FUNC_PLAY);
- }
- else
- {
- if ((prog_state != 6)&& (prog_state != 3))
- ircmd_resume();
- prog_state=0;
- }
- OSD1000ISP_STATUS(OSDISP_PROG_CNL, OSDIR_PROGRAM);
- psprintf(RegionValStr[REGION1], "");
- PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
- }
-
- #else
-
- if( (old_play_state==VCD_STATE_NORMAL)&&(play_state==VCD_STATE_PAUSE) ) // add by shawn 20020218
- ircmd_play();
- #ifdef MP3_STOP_IN_GUI_START//zhaoyanhua add 03-10-14 11:39 keep inital state for MP3
- else if((Is_MP3_STATE()) && (old_play_state == VCD_STATE_MP3_FILELIST))
- {
- play_state = old_play_state;
- }
- #endif
-
- #endif
- }
- #else
- static inline void ProgOffForNormal()
- { // 2004/11/26 yltseng
- #ifdef SDRAM_16Mb_Mode
- osd_disable();
-
- extern UINT8 g_uiOSDStatus; // 2005/01/14 yltseng
- g_uiOSDStatus = OSD_FULL_SCREEN_STATUS_NONE;
- regs0->osd_base_addr=regs0->osdya;
-
- #ifdef JPEG_PAUSE_WHEN_SETUP // 2004/12/30 yltseng
- if( Is_JPEG_SlideMode() )
- {
- play_state = VCD_STATE_NORMAL;
- PrintOsdMsg( STR_OS_SEQUENCE, REGION1, 1, 0 );
- }
- #endif
- #endif
-
- if( (old_play_state==VCD_STATE_NORMAL)&&(play_state==VCD_STATE_PAUSE) ) // add by shawn 20020218
- ircmd_play();
- #ifdef MP3_STOP_IN_GUI_START//zhaoyanhua add 03-10-14 11:39 keep inital state for MP3
- else if((Is_MP3_STATE()) && (old_play_state == VCD_STATE_MP3_FILELIST))
- {
- play_state = old_play_state;
- }
- #endif
- }
- #endif
- void prog_func_off()
- {
- #ifdef DVD_PROG_AUTO_CURSOR_RIGHT //Maoyong 2004.02.24
- clear_tt_input_num_count();
- #endif
- if(prog_cnt==0) //uncomplete program no
- {
- ircmd_cancel(1);//terry 1011
- }
- #ifdef CD_PLAYER //liweihua add 2003-9-11
- if(cd_type_loaded == CDDA)
- osd_init_cdplayer();
- else
- osd_init();
- #else
- osd_init();
- #endif
- full_scrn = 0;
- // 2004/11/26 yltseng
- #ifdef NEW_STYLE_SETUP //zhaoyanhua add 2003-8-26 19:03
- ProgOffForNewStyleSetup();
- #else
- ProgOffForNormal();
- #endif
- #ifdef SUPPORT_OSDID3//liweihua add 2004-1-13
- if(Is_MP3_STATE()&& (play_state != VCD_STATE_STOP))
- {
- osd_init_OSDID3();
- show_id3();
- }
- #endif
- #ifdef SUPPORT_MP4_SUBTITLE // David 2004-5-12
- if (GetCurrentFileType() == CDROM_MP4)
- {
- osd_init_OSDSRT();
- }
- #endif
- }
- #else // SETUP_PROGRAM_IN_PLACE_UNDER_16M
- void prog_func_off()
- {
- #ifdef DVD_PROG_AUTO_CURSOR_RIGHT //Maoyong 2004.02.24
- clear_tt_input_num_count();
- #endif
- #ifdef CD_PLAYER //liweihua add 2003-9-11
- if(cd_type_loaded == CDDA)
- osd_init_cdplayer();
- else
- osd_init();
- #else
- osd_init();
- #endif
- if(prog_cnt==0) //uncomplete program no
- {
- ircmd_cancel(1);//terry 1011
- }
-
- full_scrn = 0;
- #ifdef SDRAM_16Mb_Mode
- {
- #include "memmap0.h"
- #include "navdata.h"
-
- regs0->osd_base_addr=regs0->osdya;
- osd_init();
-
- #ifdef NEW_STYLE_SETUP //zhaoyanhua add 2003-8-26 19:03
- if( (prog_state == 2)||(prog_state == 6))
- #else
- if (prog_state==2)
- #endif
- {
- if ((cd_type_loaded == CDROM) && (pFsJpeg->gifsFuncBtn == 2))
- {
- prog_state=255;
- ircmd_post_func(CMD_FUNC | CMD_FUNC_PLAY);
- } else {
- #ifdef NEW_STYLE_SETUP//zhaoyanhua add 2003-8-26 19:02
- if ((prog_state != 6)&& (prog_state != 3))
- ircmd_resume();
- prog_state=0;
- #else
- prog_state=0;
- ircmd_resume();
- #endif
- }
- psprintf(RegionValStr[REGION1], "");
- PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
- }
- }
- #else
- {
- if( (old_play_state==VCD_STATE_NORMAL)&&(play_state==VCD_STATE_PAUSE) ) // add by shawn 20020218
- ircmd_play();
- #ifdef MP3_STOP_IN_GUI_START//zhaoyanhua add 03-10-14 11:39 keep inital state for MP3
- else if((Is_MP3_STATE()) && (old_play_state == VCD_STATE_MP3_FILELIST))
- {
- play_state = old_play_state;
- }
- #endif
- }
- #endif
- #ifdef SUPPORT_OSDID3//liweihua add 2004-1-13
- if(Is_MP3_STATE()&& (play_state != VCD_STATE_STOP))
- {
- osd_init_OSDID3();
- show_id3();
- }
- #endif
- #ifdef SUPPORT_MP4_SUBTITLE // David 2004-5-12
- if (GetCurrentFileType() == CDROM_MP4)
- {
- osd_init_OSDSRT();
- }
- #endif
- }
- #endif // SETUP_PROGRAM_IN_PLACE_UNDER_16M
- void prog_func_clear(void)
- {
- UINT8 i;
- for(i=0;i<=SHOW_PROG_NO;i++)
- {
- prog[i][0]=0;
- prog[i][1]=0;
- }
- index_y=2;
- index_x=0;
-
- prog_cnt = 0;
- }
- int is_clear_pos(void)//2002-4-19 1:53
- {
- int ret=0;
- if(prog_item[page][index_y][0]==SET_FUNC)
- {
- #ifndef PROG_12_ITEMS //Jeff 20020925
- if(prog_item[page][index_y][index_x/2+1]==STR_OS_CLEAR)
- #else
- if(prog_item[page][index_y][index_x/2+2]==STR_OS_CLEAR)
- #endif
- {
- ret=1;
- }
- }
- return ret;
- }
- void prog_func_select(void)
- {
- #ifdef DVD_PROG_AUTO_CURSOR_RIGHT //Maoyong 2004.02.24
- clear_tt_input_num_count();
- #endif
-
- if(prog_item[page][index_y][0] == SET_FUNC)
- {
- #ifdef PROG_12_ITEMS
- if (prog_item[page][index_y][index_x / 2 + 2] == STR_OS_CLEAR)
- {
- prog_func_clear();
- ShowProgPage();
- }
- else if (prog_item[page][index_y][index_x / 2 + 2] == STR_OS_PLAY)
- ircmd_play();
- #else
- if (prog_item[page][index_y][index_x / 2 + 1] == STR_OS_CLEAR)
- {
- prog_func_clear();
- ShowProgPage();
- }
- else if (prog_item[page][index_y][index_x / 2 + 1] == STR_OS_PLAY)
- ircmd_play();
- #endif
- }
- }
- void prog_func_play(void)
- {
- UINT8 i;
- #ifdef MONE_PROG
- printf("prog_func_play, inn");
- #endif
-
- prog_cnt=0;
-
- for(i=0;i<=SHOW_PROG_NO;i++)
- {
- //if (offset == 3) { //Jeff 20010808
- if (cd_type_loaded == CDROM) { //Jeff 20010914
-
- if ((prog[i][0] >= 1) && (prog[i][0] <=mp3_file_count()))
- {
- #ifdef MONE_PROG
- printf("i:%d Page:%d Item:%d sucessn", i, prog[i][0], prog[i][1]);
- #endif
- prog_cnt++;
- FSGUI_cal_dir_file(&prog[prog_cnt][0],&prog[prog_cnt][1],prog[i][0]);
- printf("prog[prog_cnt][0]:%d prog[prog_cnt][1]:%dn",prog[prog_cnt][0],prog[prog_cnt][1]);
- //prog[prog_cnt][0]=prog[i][0];
- //prog[prog_cnt][1]=prog[i][1];
- }
- else
- {
- #ifdef MONE_PROG
- printf("i:%d Page:%d Item:%d failn", i, prog[i][0], prog[i][1]);
- #endif
- }
-
- if (i > prog_cnt)
- {
- prog[i][0]=0;
- prog[i][1]=0;
- }
- }
- else //if (cd_type_loaded == CDROM)
- if(offset==2)
- {
- //printf("i:%x prog[i][0]:%xn",i,prog[i][0]);
- // if( (prog[i][0]>=cd_trk_lo)&&(prog[i][0]<=show_trk_num(cd_trk_hi)) )
- if ((prog[i][0] >= 1) && (prog[i][0] <= show_trk_num(cd_trk_hi))) // robert 030512 for some case cd_trk_lo = 2
- {
- prog_cnt++;
- prog[prog_cnt][0]=prog[i][0];
- //printf("prog_cnt:%xn",prog_cnt);
- }
-
- if(i>prog_cnt)
- prog[i][0]=0;
- }
- else //if(offset==2)
- {//dvd ,reference ChkPTTRange
- UINT8 tt=prog[i][0];
- UINT16 ptt=prog[i][1];
-
- #ifdef DVD_AUDIO
- UINT8 (*ChkRange)(UINT8*, UINT16*);
- if (dAMG_LSN) // alan, 2002/11/8 11:40