filter.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:6k
源码类别:

DVD

开发平台:

C/C++

  1. /*****************************************************************************
  2. File Name: filter.h
  3. Description: Private Section filter
  4. COPYRIGHT (C) 2004 STMicroelectronics
  5. *****************************************************************************/
  6. #ifndef __FILTER_H
  7. #define __FILTER_H
  8. /* Includes --------------------------------------------------------------- */
  9. #include "stddefs.h"    /* STAPI includes */
  10. #include "stpti.h"
  11. #include "stpti_hal.h"
  12. /* defines ----------------------------------------------------------------- */
  13. typedef enum
  14. {
  15.     SECTION,
  16.     NUM_FILTERS
  17. };
  18. #define KB_FILTER_TS_SIZE      188
  19. #define KB_FILTER_DSS_SIZE     127
  20. #define KB_FILTER_BUFFER_SIZE  (KB_FILTER_DSS_SIZE * KB_FILTER_TS_SIZE)
  21. #define KB_FILTER_SIZE  16
  22. /* PSI fields within section filter */
  23. #define KB_FILTER_TABLE_ID(_f_)          (_f_[0])
  24. #define KB_FILTER_PROGRAM_NUM_1(_f_)     (_f_[1])
  25. #define KB_FILTER_PROGRAM_NUM_2(_f_)     (_f_[2])
  26. #define KB_FILTER_VERSION_NUM(_f_)       (_f_[3])
  27. #define KB_FILTER_SECTION_NUM(_f_)       (_f_[4])
  28. /* Data extraction macros */
  29. #define KB_FILTER_EXTRACT_32(_X)     ((*(_X+0) << 24) | 
  30.                             (*(_X+1) << 16) | 
  31.                             (*(_X+2) <<  8) | 
  32.                             (*(_X+3) <<  0))
  33. #define KB_FILTER_EXTRACT_24(_X)     ((*(_X+0) << 16) | 
  34.                             (*(_X+1) <<  8) | 
  35.                             (*(_X+2) <<  0))
  36. #define KB_FILTER_EXTRACT_16(_X)     ((*(_X+0) <<  8) | 
  37.                             (*(_X+1) <<  0))
  38. #define KB_FILTER_EXTRACT_8(_X)      (*(_X))
  39. #define KB_FILTER_EXTRACT_4T(_X)     ((*(_X) >> 4) & 0xf)
  40. #define KB_FILTER_EXTRACT_4B(_X)     (*(_X) & 0xf)
  41. /* structures ------------------------------------------------------------ */
  42. typedef struct _KB_FILTER
  43. {
  44.     STPTI_Slot_t       SlotHandle;
  45.     STPTI_Buffer_t     BufferHandle;
  46.     STPTI_Signal_t     SignalHandle;
  47.     STPTI_Filter_t     Filter;
  48.     STPTI_FilterData_t FilterData;
  49.     U8                 FilterBytes[KB_FILTER_SIZE];
  50.     U8                 FilterMasks[KB_FILTER_SIZE];
  51.     U8                 Buffer[KB_FILTER_BUFFER_SIZE];
  52. } KB_FILTER;
  53. /* Valid Tables: */
  54. #define KB_FILTER_SI_VIDEO_STREAM              0x02
  55. #define KB_FILTER_SI_AUDIO_STREAM              0x03
  56. #define KB_FILTER_SI_HIERACHY                  0x04
  57. #define KB_FILTER_SI_REGISTRATION              0x05
  58. #define KB_FILTER_SI_DATA_STREAM_ALIGNMENT     0x06
  59. #define KB_FILTER_SI_TARGET_BACKGROUND_GRID    0x07
  60. #define KB_FILTER_SI_VIDEO_WINDOW              0x08
  61. #define KB_FILTER_SI_CA                        0x09
  62. #define KB_FILTER_SI_LANGUAGE                  0x0A /* PMT */
  63. #define KB_FILTER_SI_SYSTEM_CLOCK              0x0B
  64. #define KB_FILTER_SI_MULTIPLEX_BUFFER_USAGE    0x0C
  65. #define KB_FILTER_SI_COPYRIGHT                 0x0D /* PMT */
  66. #define KB_FILTER_SI_MAXIMUM_BITRATE           0x0E
  67. #define KB_FILTER_SI_PRIVATE_DATA_INDICATOR    0x0F
  68. #define KB_FILTER_SI_SMOOTHING_BUFFER          0x10
  69. #define KB_FILTER_SI_STD                       0x11
  70. #define KB_FILTER_SI_IBP                       0x12
  71. #define KB_FILTER_SI_NETWORK_NAME              0x40
  72. #define KB_FILTER_KB_FILTER_SI_SERVICE_LIST              0x41
  73. #define KB_FILTER_SI_STUFFING                  0x42 /* EIT, SDT */
  74. #define KB_FILTER_SI_SATELLITE_DELIVERY        0x43
  75. #define KB_FILTER_SI_CABLE_DELIVERY            0x44
  76. #define KB_FILTER_SI_BOUQUET_NAME              0x47 /* SDT */
  77. #define KB_FILTER_SI_SERVICE                   0x48 /* SDT */
  78. #define KB_FILTER_SI_COUNTRY_AVAILABILITY      0x49 /* SDT */
  79. #define KB_FILTER_SI_LINKAGE                   0x4A /* EIT, SDT */
  80. #define KB_FILTER_SI_NVOD_REFERENCE            0x4B /* SDT */
  81. #define KB_FILTER_SI_TIME_SHIFTED_SERVICE      0x4C /* SDT */
  82. #define KB_FILTER_SI_SHORT_EVENT               0x4D /* EIT */
  83. #define KB_FILTER_SI_EXTENDED_EVENT            0x4E /* EIT */
  84. #define KB_FILTER_SI_TIME_SHIFTED_EVENT        0x4F /* EIT */
  85. #define KB_FILTER_SI_COMPONENT                 0x50 /* EIT */
  86. #define KB_FILTER_SI_MOSAIC                    0x51 /* SDT, PMT */
  87. #define KB_FILTER_SI_STREAM_IDENTIFIER         0x52 /* PMT */
  88. #define KB_FILTER_SI_CA_IDENTIFIER             0x53 /* EIT, SDT */
  89. #define KB_FILTER_SI_CONTENT                   0x54 /* EIT */
  90. #define KB_FILTER_SI_PARENTAL_RATING           0x55 /* EIT */
  91. #define KB_FILTER_SI_TELETEXT                  0x56 /* PMT */
  92. #define KB_FILTER_SI_TELEPHONE                 0x57 /* EIT, SDT */
  93. #define KB_FILTER_SI_LOCAL_TIME_OFFSET         0x58 /* TOT */
  94. #define KB_FILTER_SI_SUBTITLING                0x59 /* PMT */
  95. #define KB_FILTER_SI_TERRESTRIAL_DELIVERY      0x5A
  96. #define KB_FILTER_SI_MULTILINGUAL_NETWORK_NAME 0x5B
  97. #define KB_FILTER_SI_MULTILINGUAL_BOUQUET_NAME 0x5C
  98. #define KB_FILTER_SI_MULTILINGUAL_SERVICE_NAME 0x5D /* SDT */
  99. #define KB_FILTER_SI_MULTILINGUAL_COMPONENT    0x5E /* EIT */
  100. #define KB_FILTER_SI_PRIVATE_DATA_SPECIFIER    0x5F /* EIT, SDT, PMT */
  101. #define KB_FILTER_SI_SERVICE_MOVE              0x60 /* PMT */
  102. #define KB_FILTER_SI_SHORT_SMOOTHING_BUFFER    0x61 /* EIT */
  103. #define KB_FILTER_SI_FREQUENCY_LIST            0x62
  104. #define KB_FILTER_SI_PARTIAL_TRANSPORT_STREAM  0x63
  105. #define KB_FILTER_SI_DATA_BROADCAST            0x64 /* EIT, SDT */
  106. #define KB_FILTER_SI_CA_SYSTEM                 0x65 /* PMT */
  107. #define KB_FILTER_SI_DATA_BROADCAST_ID         0x66 /* PMT */
  108. typedef struct  _KB_FILTERPATData
  109. {
  110.     U16     PgmPid;
  111.     U16     PmtPid;
  112. }KB_FILTERPATData;
  113. typedef struct _KB_FILTERSDTData
  114. {
  115.     U16  serID;
  116.     char ServiceName_p[50]; /* not null terminated */
  117. }KB_FILTERSDTData;
  118. /* Global ----------------------------------------------------------------- */
  119. extern KB_FILTER Filter[NUM_FILTERS];
  120. /* Prototypes ------------------------------------------------------------- */
  121. extern ST_ErrorCode_t KB_FilterSetup( KB_FILTER *Filter_p );
  122. extern ST_ErrorCode_t KB_FilterStart( KB_FILTER *Filter_p, STPTI_Pid_t Pid, U8 TableId );
  123. extern void KB_FilterCreate(KB_FILTER *Filter_p, U32 TableId, U32 Program, U32 Version, U32 Section);
  124. extern void KB_FilterPMTDump( U16 PmtPid, U16 ProgNo,U16 *pVidPid,U16 *pAudPid,U16 *pPCRPid );
  125. extern void KB_FilterPATDump(UINT16 serID,UINT16 *pmtPID);
  126. extern  BOOL KB_FilterSDTDump(STTST_Parse_t *pars_p, char *Result );
  127. extern KB_FILTERPATData g_KB_PATData[100];
  128. extern KB_FILTERSDTData g_KB_SDTData[100];
  129. extern int g_KB_SDTLen ;
  130. BOOL KB_FILTERInitCommand(void);
  131. #endif /* __FILTER_H */
  132. /* EOF --------------------------------------------------------------------- */