book.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:15k
源码类别:

DVD

开发平台:

C/C++

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *         Copyright (c) 2002 by Sunplus Technology Co., Ltd.             *
  4.  *                                                                        *
  5.  *  This software is copyrighted by and is the property of Sunplus        *
  6.  *  Technology Co., Ltd. All rights are reserved by Sunplus Technology    *
  7.  *  Co., Ltd. This software may only be used in accordance with the       *
  8.  *  corresponding license agreement. Any unauthorized use, duplication,   *
  9.  *  distribution, or disclosure of this software is expressly forbidden.  *
  10.  *                                                                        *
  11.  *  This Copyright notice MUST not be removed or modified without prior   *
  12.  *  written consent of Sunplus Technology Co., Ltd.                       *
  13.  *                                                                        *
  14.  *  Sunplus Technology Co., Ltd. reserves the right to modify this        *
  15.  *  software without notice.                                              *
  16.  *                                                                        *
  17.  *  Sunplus Technology Co., Ltd.                                          *
  18.  *  19, Innovation First Road, Science-Based Industrial Park,             *
  19.  *  Hsin-Chu, Taiwan, R.O.C.                                              *
  20.  **************************************************************************/
  21. /*--------------------------------------------------------------------------
  22. |  File Name   :  book.c
  23. |
  24. |  Description :  it's book mark function Interface,must define SUPPORT_BOOK,
  25. |                 it can be used;  
  26. |                  
  27. |
  28. |  Version    :  0.1  
  29. |  Rev Date         Author(s)      Status & Comments
  30. |---------------------------------------------------------------------------------
  31. |  0.1 2001/5/15s        Kenny        Creating
  32. |--------------------------------------------------------------------------------*/
  33. /*****************************************************
  34. Creater: Kenny
  35. Date   : 2001/5/15 02:39PM
  36. Description: Search menu using 
  37. *****************************************************/
  38. #include "user_init.h"
  39. #ifdef SUPPORT_BOOK
  40. #include "global.h"
  41. #include "osd.h"
  42. #include "func.h"
  43. #include "cfont.h"
  44. #include "util.h"
  45. #include "user_if.h"
  46. #include "stdlib.h"
  47. //#define   BOOK_DBG    1
  48. //#define BOOK_MODE 2
  49. //#define BOOK_Y_ITEM 2
  50. //#define BOOK_X_ITEM 3
  51. //#define NO_ANTI 0
  52. //#define ANTI 2
  53. //#define ST_REGION REGION2
  54. extern void DispUpdateMark(BYTE xStart, BYTE *pStr, BYTE bFocus);
  55. void mark_UpdateOSD();
  56. void mark_GetValidString(BYTE *strBook);
  57. BYTE    bookIndex;      //Jeff 20020518
  58. /**************************************************************************
  59.  *                                                                        *
  60.  *  Function Name: record_book                                            *
  61.  *                                                                        *
  62.  *  Purposes:                                                             *
  63.  *    record information                                                  *
  64.  *  Descriptions:                                                         *
  65.  *    record some useful information ,for example                         *
  66.       tiele and chapter for dvd                                           *
  67.  *  Arguments:    NONE                                                    *
  68.  *  Returns:   NONE                                                       *
  69.  *                                                                        *
  70.  *  See also:  NONE                                                       *
  71.  *                                                                        *
  72.  **************************************************************************/
  73. void record_book()
  74. {
  75.         BYTE i;
  76.         i = bookIndex;    
  77.   
  78.         if (i<BOOK_MAX_ITEM) {
  79.                 book_tm[i]=disp_time;        
  80.                 if (cd_type_loaded==CDDVD) {
  81.                         book[i][0]=get_tt_info(DISP_TT);//dvd_title
  82.                         book[i][1]=get_tt_info(DISP_CH);//dvd_chapter;                           
  83.                 } else if ( psd_state!=(PSD_SEL_LIST|PSD_PLAY_SEG)) {        
  84.                         book[i][0]=cd_trk_now;         
  85.                 }
  86.     
  87.                 RSM_save(0xff,i+1);
  88.         }
  89. }
  90. //Jeff 20020411
  91. void book_cancel(void)
  92. {
  93. }
  94. /*
  95. void book_func_up(void)
  96. {
  97.         //printf("book_func_upn");
  98. }
  99. void book_func_down(void)
  100. {
  101.         //printf("book_func_downn");
  102. }*/
  103. /**************************************************************************
  104.  *                                                                        *
  105.  *  Function Name: mark_func_right                                        *
  106.  *                                                                        *
  107.  *  Purposes:                                                             *
  108.  *    HL turn right                                                       *
  109.  *  Descriptions:                                                         *
  110.  *    HL turn right                                                       *
  111.  *  Arguments: NONE                                                       *
  112.  *  Returns:   NONE                                                       *
  113.  *                                                                        *
  114.  *  See also:  NONE                                                       *
  115.  *                                                                        *
  116.  **************************************************************************/
  117. void mark_func_right()
  118. {
  119.         if (bookIndex < (BOOK_MAX_ITEM-1) ) {
  120.                 bookIndex++;
  121.                 mark_UpdateOSD();
  122.         }
  123.         //printf("mark_func_right:bookIndex=%dn", bookIndex);
  124. }
  125. void mark_func_left()
  126. {
  127.         if (bookIndex > 0) {
  128.                 bookIndex--;
  129.                 mark_UpdateOSD();
  130.         }
  131.         //printf("mark_func_left:bookIndex=%dn", bookIndex);
  132. }
  133. extern void invalid_key(void); // in ircmd.c
  134. //Jeff 200204112
  135. /**************************************************************************
  136.  *                                                                        *
  137.  *  Function Name: book_func_select                                       *
  138.  *                                                                        *
  139.  *  Purposes:                                                             *
  140.  *    book function was select that use enter key                         * 
  141.  *  Descriptions:                                                         *
  142.  *     according to the different states ,the                             *
  143.  *     book function was select that use enter key                        * 
  144.  *  Arguments: VOID                                                       *
  145.  *  Returns:   NONE                                                       *
  146.  *                                                                        *
  147.  *  See also:  NONE                                                       *
  148.  *                                                                        *
  149.  **************************************************************************/
  150. void book_func_select(void)
  151. {
  152. //printf("book_func_select:bookIndex=%d, play_state=%xn", bookIndex, play_state);
  153. #ifdef PULIANG_DVD  //yaowh add 04-12-17
  154.     if(book[bookIndex][0]) 
  155.     {
  156.         if(play_state==VCD_STATE_PAUSE)
  157.             {ircmd_play();}
  158.         else
  159.         {
  160.             book_func_play();
  161.             book_func_clear();
  162. }
  163.         return;
  164.     }
  165. #endif
  166. //terry,2004/1/30 03:11PM
  167. if( (play_state == VCD_STATE_STOP)||is_menu()||((cd_type_loaded!=CDDVD)&&((cd_trk_now<cd_trk_lo_now)||(cd_trk_now>cd_trk_hi))) )
  168. {
  169. invalid_key();
  170. return;
  171. }
  172. record_book();
  173. mark_UpdateOSD();
  174. }
  175. #ifdef FUSS_DVD
  176. #if defined(FUSS_PANEL)||defined(FUSS2_PANEL)
  177. extern BYTE book_flag;
  178. #endif
  179. #endif
  180. //Jeff 200204112
  181. /**************************************************************************
  182.  *                                                                        *
  183.  *  Function Name: book_func_play                                         *
  184.  *                                                                        *
  185.  *  Purposes:                                                             *
  186.  *    use play key to play the book mark                                  *
  187.  *  Descriptions:                                                         *
  188.  *    use play key to play the book mark                                  *
  189.  *  Arguments: NONE                                                       *
  190.  *  Returns:   NONE                                                       *
  191.  *                                                                        *
  192.  *  See also:  NONE                                                       *
  193.  *                                                                        *
  194.  **************************************************************************/
  195. void book_func_play()
  196. {
  197.         UINT32 c;
  198.         //printf("book_func_playn");
  199.         if(book[bookIndex][0]) {
  200.             
  201.                 #ifdef CANCEL_PRG_WHEN_BOOKMARK     //linrc 2004-6-9 13:37
  202.                 if (prog_cnt)
  203.                 {
  204.                     prog_func_clear();
  205.                     prog_func_off();                  
  206.                     prog_cnt = 0; 
  207.                     ircmd_book();   //I call this function again in order to build the bookmark parameter again.
  208.                 }
  209.                 #endif 
  210.                 if(rep_ab_mode != REPEAT_IDLE) // 2004-5-10 15:34 linrc add for when bookmark play that REPEAT=IDLE
  211.                 {
  212.             rep_ab_mode = REPEAT_AB_IDLE;
  213.             show_repeatAB(1);
  214.             }
  215.                 
  216.                 NCMD_exec_RSM(bookIndex+1);       //Jeff 20020411
  217.                 if(cd_type_loaded==CDDVD) {
  218.                         c=CMD_FUNC | CMD_FUNC_BOOK;
  219.                 } else {
  220.                         if ( IsPBCOn() ) {
  221.                                 pbcoff_init();                
  222.                         }/* else { //Jeff 20020418
  223.                          psd_state=0;
  224.                         }*///2002-4-26
  225.                         resumeTRK=book[bookIndex][0];
  226.                         c=CMD_FUNC | CMD_FUNC_RESUME;            
  227.                         goto_active = 1;//nono 2003-10-27 13:48 avoid ntsc->pal pic size error.            
  228.                 #ifdef FUSS_DVD        
  229.             #if defined(FUSS_PANEL)||defined(FUSS2_PANEL)
  230.                 book_flag=bookIndex+1; //2002-6-24 for fuss          
  231.                     #endif
  232.                 #endif
  233.                 }
  234.                 ircmd_post_func(c);
  235.                 if (user_mute) {    //restore MUTE OSD, Jeff 20020522
  236.                     PrintOsdMsg(STR_OS_MUTE,REGION1,0,0);
  237.                 }
  238.         }
  239. }
  240. /**************************************************************************
  241.  *                                                                        *
  242.  *  Function Name: book_func_clear                                        *
  243.  *                                                                        *
  244.  *  Purposes:                                                             *
  245.  *    clear the book mark information and refresh  the osd display        *
  246.  *  Descriptions:                                                         *
  247.  *    clear the book mark information and refresh  the osd display        *
  248.  *  Arguments: void                                                       *
  249.  *  Returns:   NONE                                                       *
  250.  *                                                                        *
  251.  *  See also:  NONE                                                       *
  252.  *                                                                        *
  253.  **************************************************************************/
  254. void book_func_clear(void)
  255. {
  256.         //printf("book_func_clearn");
  257.         book[bookIndex][0]=0;   
  258.         mark_UpdateOSD();
  259. }
  260. /**************************************************************************
  261.  *                                                                        *
  262.  *  Function Name: mark_UpdateOSD                                         *
  263.  *                                                                        *
  264.  *  Purposes:                                                             *
  265.  *    display book function bar on screen                                 *
  266.  *  Descriptions:                                                         *
  267.  *    display book function bar on screen                                 *
  268.  *  Arguments:    NONE                                                    *
  269.  *  Returns:   NONE                                                       *
  270.  *                                                                        *
  271.  *  See also:  NONE                                                       *
  272.  *                                                                        *
  273.  **************************************************************************/
  274. void mark_UpdateOSD()
  275. {
  276.         BYTE    strBook[20];
  277.         BYTE    strTemp[20];
  278.         mark_GetValidString(strBook);
  279.         if (bookIndex > 0) {
  280.                 strcpy(strTemp, strBook);
  281.                 strTemp[bookIndex]=0;
  282.                 DispUpdateMark(0, strTemp, 0);
  283.         }
  284.         strTemp[0] = strBook[bookIndex];
  285.         strTemp[1] = 0;
  286.         DispUpdateMark(bookIndex, strTemp, 1);
  287.         if (bookIndex < (BOOK_MAX_ITEM-1) ) {
  288.                 strcpy(strTemp, strBook+bookIndex+1);
  289.                 DispUpdateMark(bookIndex+1, strTemp, 0);
  290.         }
  291. }
  292. /**************************************************************************
  293.  *                                                                        *
  294.  *  Function Name: mark_GetValidString                                    *
  295.  *                                                                        *
  296.  *  Purposes:                                                             *
  297.  *    draw the "_" on the book bar                                        *
  298.  *  Descriptions:                                                         *
  299.  *    draw the "_" on the book bar                                        *
  300.  *  Arguments:    array address strBook                                   *
  301.  *  Returns:   NONE                                                       *
  302.  *                                                                        *
  303.  *  See also:  NONE                                                       *
  304.  *                                                                        *
  305.  **************************************************************************/
  306. void mark_GetValidString(BYTE *strBook)
  307. {
  308.         int     i;
  309.         for (i=0; i<BOOK_MAX_ITEM; i++) {
  310.                 if (book[i][0]) {
  311.                         strBook[i] = i+'1';
  312.                 } else {
  313.                         strBook[i] = '-';
  314.                 }
  315.         }
  316.         strBook[i] = 0;
  317. }
  318. //#ifdef support_book
  319. #else
  320. //void mark_GetValidString(BYTE *strBook) {}
  321. void mark_UpdateOSD() {}
  322. void book_func_clear() {}
  323. void book_func_play() {}
  324. void mark_func_right() {}
  325. void mark_func_left() {}
  326. void book_func_select() {}
  327. #endif