svcd.c
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:20k
源码类别:

DVD

开发平台:

C/C++

  1. /*
  2. ** FILE
  3. ** svcd.c
  4. **
  5. ** DESCRIPTION
  6. ** check and return current CD infomation.
  7. ** manage low-level navigation structure.
  8. **
  9. */
  10. #include "config.h"
  11. #include "global.h"
  12. #include "memmap0.h"
  13. #include "func.h"
  14. #include "dma.h"
  15. #include "cdxa.h"
  16. #include "util.h"
  17. #include "stdlib.h"
  18. #include "cdfs.h"
  19. #include "epp.h"
  20. #include "cfont.h"
  21. #include "cd.h"
  22. #include "svcd.h"
  23. #include "osd.h"
  24. #include "user_init.h"
  25. #include "image.h"
  26. #include "navdata.h"
  27. #include "fs96602.h"
  28. #include "fsNav.h"
  29. #include "atapi_if.h"
  30. #ifdef SP1000_NO_DVD
  31. #include "svcd_null.c"
  32. #else
  33. //======================================================
  34. // debug option
  35. //======================================================
  36. #ifndef DVDRELEASE
  37. //#define SVCD_DBG        1
  38. #endif
  39. #ifndef SVCD_DBG
  40. #undef printf
  41. #undef print_block
  42. #define printf(f, a...) do {} while (0)
  43. #define print_block(x,y) do {} while (0)
  44. #endif
  45. //UINT32 dVts_iso9600_addr;
  46. /*
  47. **
  48. ** iso9660_str Tag (at PVD) for CDROM disc
  49. **
  50. ** vcd_str Tag (at INFO) for VCD
  51. ** cvd_str Tag (at INFO) for CVD
  52. ** svcd_str Tag (at INFO) for SVCD
  53. */
  54. static const char iso9660_str[5] = {'C','D','0','0','1'};
  55. static const char vcd_str[8] = {'V','I','D','E','O','_','C','D'};
  56. static const char cdi_str[4] = {'C','D','-','I'};
  57. static const char cvd_str[8] = {'H','Q','-','V','C','D',' ',' '};
  58. static const char svcd_str[8] = {'S','U','P','E','R','V','C','D'};
  59. static  const   char    oko_str[6] = {'P','A','-','V','C','D'};
  60. static const char mpeg_str[4] = {'M','P','E','G'};
  61. static const char vcd30_str[7] = {'S','_','V','C','D','3','0'};
  62. void Check9660Init();
  63. UINT32 Check9660Dir(UINT32);
  64. void Check9660Files(UINT32);
  65. UINT32 CheckFileInDir(char* pStr, UINT32 nDirLoc);      //wanghaoying 2003-8-12 17:13 added 
  66. extern void save_cmp_disc_info(UINT32 info1);           //wanghaoying 2003-8-12 17:15
  67. extern BYTE DiscType;
  68. UINT32 nVideoTsLoc;
  69. //terry,2003/12/25 02:15PM
  70. #ifdef BBK_DVD
  71. #define CORRECT_VCD_TYPE
  72. #endif
  73. #ifdef  CORRECT_VCD_TYPE            
  74. void correct_vcd_type(void)
  75. {
  76.    if (cd_trk_hi > 1)
  77.    {
  78.        if( M2I(gettrkmsf(cd_trk_lo))<180 )
  79.           cd_trk_lo++;
  80.    }
  81. }
  82. #else
  83. #define correct_vcd_type();
  84. #endif
  85. /*
  86. ** FUNCTION
  87. ** check_cdtype
  88. ** 
  89. ** DESCRIPTION
  90. ** this is the routine to check cd-type
  91. */
  92. int check_cdtype()
  93. {
  94. int Res;
  95. t_primary_volume_descriptor *v ;
  96. /*
  97. ** check track 1 coding type
  98. */
  99. printf("check typen");
  100. cd_type_loaded = CDVCD10;
  101. if ((gettrkcna(1) & CNA_MASK_TYPE) != CNA_DATA)
  102. {
  103. cd_type_loaded = CDDA;
  104. return cd_type_loaded;
  105. }
  106. //#ifndef SUPPORT_MIX_MP3_CDDA   //linrc change "SUPPORT_MIX_MP3_CDDA" to "SUPPORT_MIX_DATA_CDDA_DISC"
  107. #ifndef SUPPORT_MIX_DATA_CDDA_DISC //because we not only support this type mix mode disc 2004-12-15 15:53
  108. // cyue for cd xtra 2000/11/13 11:06AM
  109. if((cd_trk_hi > 1) && ((gettrkcna(2) & CNA_MASK_TYPE) != CNA_DATA))
  110. {
  111. cd_type_loaded = CDDA;
  112. cd_trk_lo = 2;
  113. return cd_type_loaded;
  114. }
  115. #endif
  116. wb_init(msf2l(MSF_INFO));
  117. if(is_user_opened())
  118. return -1;
  119. if(system_state == SYSTEM_POWER)
  120. return -3;
  121. {
  122. t_sect_info *p = (t_sect_info *)pwb;
  123. //printf("tag:%s, ver:%xn",p->file_id,p->version);
  124.         printf("tag:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x, ver:%xn", 
  125.             p->file_id[0],p->file_id[1],p->file_id[2],p->file_id[3],p->file_id[4],p->file_id[5],
  126.             p->file_id[6],p->file_id[7],p->file_id[8],p->file_id[9],p->file_id[10],p->file_id[11],
  127.             p->version);
  128. print_block(p->album_id,10);
  129.         /*
  130. ** compare TAG
  131. */    
  132. if(strncmp(p->file_id, vcd_str, 8) == 0)
  133. {
  134. /* VCD */
  135. int ver = getUINT16_bi(&p->version);
  136. //terry,2002/9/6 12:01PM
  137. //纒