123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- /**
- * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
- *
- * @file
- * Common macros, declarations and definitions of Database.
- *
- * @author jun.luo
- *
- */
- #ifndef __DB_COMMON_H__
- #define __DB_COMMON_H__
- #include "types.h"
- #include "gl_task.h"
- #include "umf_debug.h"
- #ifdef __cplusplus
- extern "C"{
- #endif
- #define DB_DEBUG
- #ifndef DEBUG_LEVEL
- #define DEBUG_LEVEL DEBUG_LEVEL_ERRORS
- #endif
- #ifdef DB_DEBUG
- #undef DEBUG_PRINT
- #undef DEBUG_PRINTV
- #define DEBUG_PRINTV(fmt, arg...) UMFDBG(0,fmt, ##arg)
- #define DEBUG_PRINT(fmt, arg...) UMFDBG(0,fmt, ##arg)
- #define DB_ASSERT(condition, str) \
- if (!(condition)) { \
- do { \
- DEBUG_PRINTV( "%s %d >> DB_ASSERT (%s) : \"%s\"\n", \
- __FUNCTION__,__LINE__, #condition, str); \
- }while(1); \
- }
- #else
- #define DEBUG_PRINT(fmt, arg...)
- #define DEBUG_PRINTV(fmt, arg...)
- #define DB_ASSERT(condition, str)
- #endif
- #define DEBUG_LEVEL_NONE 0
- #define DEBUG_LEVEL_ERRORS 1
- #define DEBUG_LEVEL_WARNINGS 2
- #define DEBUG_LEVEL_MESSAGES 3
- #define DEBUG_LEVEL_ALL 4
- #if (DEBUG_LEVEL >= DEBUG_LEVEL_MESSAGES)
- #define DEBUG_MESSAGE(fmt, arg...) DEBUG_PRINT(fmt, ##arg)
- #else
- #define DEBUG_MESSAGE(fmt, arg...)
- #endif
- #if (DEBUG_LEVEL >= DEBUG_LEVEL_WARNINGS)
- #define DEBUG_WARNING(fmt, arg...) DEBUG_PRINT(fmt, ##arg)
- #else
- #define DEBUG_WARNING(fmt, arg...)
- #endif
- #if (DEBUG_LEVEL >= DEBUG_LEVEL_ERRORS)
- #define DEBUG_ERROR(fmt, arg...) DEBUG_PRINT(fmt, ##arg)
- #else
- #define DEBUG_ERROR(fmt, arg...)
- #endif
- /** Macro define to get offset of item in a data structure */
- #define DBITEM_OFFSET(type, field) ((UINT32)&(((type *)0)->field))
- /** Macro define to get the size of item in a given data structure */
- #define DBITEM_SIZE(type, field) (sizeof ((type *)0)->field)
- /** Macro define to get the maximum */
- #define DBMAX(a, b) ((a) > (b) ? (a) : (b))
- /** Exported constants */
- enum
- {
- DB_DVB_MAX_NETNAME_LEN = 80,
- DB_DVB_MAX_MULTIPNAME_LEN = 14,
- DB_DVB_MAX_MULTIP_FREQ_NUM = 20, /**< Refer to Riks requirement <frequency list descriptor>, Actually we are not sure what is the maximum ? */
- DB_DVB_MAX_CHNAME_LEN = 100, /**< Max DVB channel name length in bytes */
- DB_DVB_MAX_AUDIO_NUM = 3,
- DB_DVB_MAX_PRV_COMP_NUM = 8,
- DB_ATV_MAX_CHNAME_LEN = 8, /**< Max Analog channel name length in bytes */
- DB_DVB_INVALID_PID = 0x1fff,
- DB_DVB_INVALID_ID = 0x1fff,
- DB_DVB_MAX_SRV_TRD = 4, /**< Actually we are not sure what is the maximum ? */
- DB_DVB_MAX_SRV_MAX_CICAM_BRANDS = 2, /**< One service support MAX CI CAM BRANDS */
- TDB_MAX_TSNUM_WITHIN_NETWORK = 100, /**< Actually we are not sure what is the maximum ? */
- };
- /** Database Error type define */
- typedef enum
- {
- DB_FAILURE = -1,
- DB_SUCCESS =0,
- DB_INVALID_PARAM,
- DB_CRC_ERROR,
- DB_ALLOC_FAILURE,
- } EDBError_t;
- /** Service type define */
- typedef enum
- {
- SERVICE_DVB_TV = 1 << 0,
- SERVICE_DVB_RADIO = 1 << 1,
- SERVICE_DVB_DATA = 1 << 2,
- SERVICE_DVB_ALL = SERVICE_DVB_TV | SERVICE_DVB_RADIO | SERVICE_DVB_DATA, /**< Flexibilty for DB */
- SERVICE_ATV = 1 << 3,
- SERVICE_TYPE_INVALID /**< Invalid Service */
- } EServiceType_t;
- /** Tune type define */
- typedef enum
- {
- DB_MANUAL_SEARCH,
- DB_AUTO_SEARCH,
- } EDBTuneType_t;
- /**< DVB private spec type define */
- typedef enum
- {
- DB_DVB_PRISPEC_DBOOK = 0, /**< for UK, except ireland */
- DB_DVB_PRISPEC_ZBOOK, /**< Italy */
- DB_DVB_PRISPEC_AUS, /**< Australia */
- DB_DVB_PRISPEC_NORDIG, /**< Nordig */
- DB_DVB_PRISPEC_EBOOK, /**< pan Europe */
- DB_DVB_PRISPEC_SBTVD, /**< Brazil */
- DB_DVB_PRISPEC_OCA, /**< Reserved all service */
- } EDBPrivateSpec_t;
- /** DVB delivery type define */
- typedef enum
- {
- EDVB_DELIVER_TYPE_T,
- EDVB_DELIVER_TYPE_T2,
- EDVB_DELIVER_TYPE_C,
- EDVB_DELIVER_TYPE_C2,
- EDVB_DELIVER_TYPE_S,
- EDVB_DELIVER_TYPE_S2,
- EDVB_DELIVER_TYPE_ISDB_T,
- EDVB_DELIVER_TYPE_ATSC,
- } EDVBDeliveryType_t;
- /** Enumeration of sort types */
- typedef enum
- {
- DB_SORTBY_NONE, /**< No Sort */
- DB_SORTBY_NO, /**< Sort by Service Number */
- DB_SORTBY_TYPE_INNER_NO, /**< Sort by Service Number within a service type */
- DB_SORTBY_NAME, /**< Sort by Service Name */
- DB_SORTBY_ID,
- DB_SORTBY_FREQ_INNER_NAME, /**< Sort by Service Frequency */
- DB_SORTBY_FREQ, /**< Sort by Service Frequency(if rec is service, all services with equal freq will be list with its position in SDT) */
- DB_SORTBY_FREQ_OCA, /*< same with DB_SORTBY_FREQ, and process the duplicate service to the list tail */
- DB_SORTBY_SERVTYPE, /**< Sort by Service Type */
- DB_SORTBY_USER, /**< Sort by User */
- DB_TOTAL_SORTS
- } EDBSortType_t;
- /** The database events that are passed to the application through callback */
- typedef enum
- {
- DB_SERVICE_INFO = 1 << 0, /**< Change in channel info(contain DVB service and ATV service) */
- DB_MULTIPLEX_INFO = 1 << 1, /**< Change in Transponder info */
- DB_NETWORK_INFO = 1 << 2, /**< Change in Network info */
- DB_FULLDB_INFO = 1 << 3, /**< Change in full database */
- DB_ENTRY_ADDED = 1 << 4, /**< Entry added */
- DB_ENTRY_MODIFIED = 1 << 5, /**< Entry modified */
- DB_ENTRY_DELETED = 1 << 6, /**< Entry deleted, means this entry can be restore, distinguish entry remove */
- DB_ENTRY_REMOVED = 1 << 7, /**< Entry removed */
- DB_ENTRY_HASNOCHILD = 1 << 8, /**< This entry is a superfluous record, because it has no child now */
- DB_ENTRY_CHANGEPARENT = 1 << 9, /**< This entry has changed his parent */
- DB_FULLDB_RESTORED = 1 << 10, /**< Restore whole Database module, case CRC error when load Database Module or case system is boot at first time */
- DB_FULLDB_STORED = 1 << 11, /**< Sync whole Database module to none valitile memory */
- DB_FULLDB_ISFULL = 1 << 12, /**< DB full */
- } EDBEvent_t;
- /** the Record priority define if duplicate record exist */
- typedef enum
- {
- DB_DUPLIREC_RESERVE_FORMER, /**< The former has high priority, discard the later or delete the latter if it has added */
- DB_DUPLIREC_RESERVE_LATTER, /**< The latter has high priority, discard the former or delete the former if it has added */
- DB_DUPLIREC_RESERVE_ALL, /**< Reserved two services, this behavior is required by some spec(such as Z-Book) */
- } EDBDupliRecStrategy_t;
- /** Stream_type defined by MPEG2 Organization */
- typedef enum
- {
- DB_STREAM_TYPE_VIDEO_MPEG1 = 0x01,
- DB_STREAM_TYPE_VIDEO_MPEG2 = 0x02,
- DB_STREAM_TYPE_AUDIO_MPEG1 = 0x03,
- DB_STREAM_TYPE_AUDIO_MPEG2 = 0x04,
- DB_STREAM_TYPE_PRIVATE_SECTION = 0x05,
- DB_STREAM_TYPE_PRIVATE_DATA = 0x06,
- DB_STREAM_TYPE_13522_MPEG = 0x07,
- DB_STREAM_TYPE_H220_13818_6_DSMCC = 0x08,
- DB_STREAM_TYPE_H220_13818_1 = 0x09,
- DB_STREAM_TYPE_MULTIPROTOCOL_ENCAP = 0x0A,
- DB_STREAM_TYPE_OBJECT_DATA_CAROUSEL = 0x0B,
- DB_STREAM_TYPE_DSMCC_DESCRIPTOR = 0x0C,
- DB_STREAM_TYPE_ANY_DSMCC_DATA = 0x0D,
- DB_STREAM_TYPE_VIDEO_MPEG4 = 0x10,
- DB_STREAM_TYPE_AUDIO_AAC = 0x11,
- DB_STREAM_TYPE_VIDEO_AVC = 0x1B,
- DB_STREAM_TYPE_AUDIO_AC3 = 0x81,
- DB_STREAM_TYPE_AUDIO_EAC3 = 0x87,
- DB_STREAM_TYPE_VC_1 = 0xEA,
- } EStreamType_t;
- /** Service type define, refer to service descriptor in 300468 */
- typedef enum
- {
- DB_SERV_TYPE_RESERVED_FOR_FUTURE = 0x00, /**< service type of RESERVED_FOR_FUTURE*/
- DB_SERV_TYPE_DIGITAL_TELEVISION = 0x01, /**< service type of DIGITAL_TELEVISION */
- DB_SERV_TYPE_DIGITAL_RADIO = 0x02, /**< service type of DIGITAL_RADIO*/
- DB_SERV_TYPE_TELETEXT = 0x03, /**< service type of TELETEXT*/
- DB_SERV_TYPE_NVOD_REFERENCE = 0x04, /**< service type of NVOD_REFERENCE*/
- DB_SERV_TYPE_NVOD_TIMESHIFT = 0x05, /**< service type of NVOD_TIMESHIFT*/
- DB_SERV_TYPE_MOSAIC = 0x06, /**< service type of MOSAIC*/
- DB_SERV_TYPE_PAL_CODED_SIGNAL = 0x07, /**< service type of PAL_CODED_SIGNAL*/
- DB_SERV_TYPE_SECAM_CODED_SIGNAL = 0x08, /**< service type of SECAM_CODED_SIGNAL*/
- DB_SERV_TYPE_D_D2_MAC = 0x09, /**< service type of D_D2_MAC*/
- DB_SERV_TYPE_ADVANCED_DIGITAL_RADIO= 0x0A, /**< service type of ADVANCED_DIGITAL_RADIO*/
- DB_SERV_TYPE_NTSC_CODED_SIGNAL = 0x0B, /**< service type of NTSC_CODED_SIGNAL*/
- DB_SERV_TYPE_DATABROADCAST = 0x0C, /**< service type of DATABROADCAST*/
- DB_SERV_TYPE_COMMON_INTERFACE = 0x0D, /**< service type of COMMON_INTERFACE*/
- DB_SERV_TYPE_RCS_MAP = 0x0E, /**< service type of RCS_MAP*/
- DB_SERV_TYPE_RCS_FLS = 0x0F, /**< service type of RCS_FLS*/
- DB_SERV_TYPE_DVB_MHP = 0x10, /**< service type of DVB_MHP*/
- DB_SERV_TYPE_MPEG2_HD_DIGITAL_TELEVISION= 0x11, /**< service type of MPEG2_HD_DIGITAL_TELEVISION*/
- DB_SERV_TYPE_ADVANCED_SD_DIGITAL_TV= 0x16, /**< service type of ADVANCED_SD_DIGITAL_TV*/
- DB_SERV_TYPE_ADVANCED_HD_DIGITAL_TV= 0x19, /**< service type ofn ADVANCED_HD_DIGITAL_TV*/
- DB_SERV_TYPE_ADVANCED_HD_NVOD_TIMESHIFT= 0x1A, /**< service type of ADVANCED_HD_NVOD_TIMESHIFT*/
- DB_SERV_TYPE_ADVANCED_HD_NVOD_REFERENCE= 0x1B, /**< service type of ADVANCED_HD_NVOD_REFERENCE*/
- } EServSDTType_t;
- /** Service attribute define */
- typedef struct
- {
- UINT32 fav1 : 1; /**< fave 1 bit*/
- UINT32 fav2 : 1; /**< fave 2 bit*/
- UINT32 fav3 : 1; /**< fave 3 bit*/
- UINT32 fav4 : 1; /**< fave 4 bit*/
- UINT32 fav5 : 1; /**< fave 5 bit */
- UINT32 fav6 : 1; /**< fave 6 bit*/
- UINT32 fav7 : 1; /**< fave 7 bit*/
- UINT32 fav8 : 1; /**< fave 8 bit*/
- UINT32 move : 1; /**< move bit*/
- UINT32 skip : 1; /**< skip bit*/
- UINT32 delete : 1; /**< delete bit*/
- UINT32 unStable :1; /**<set program as unstable temporaryly when scan or servcie update */
- UINT32 parental_lock : 1; /**< parental lock bit*/
- UINT32 scramble : 1; /**< scramble bit*/
- UINT32 svrnotrun : 1; /**< */
- UINT32 svrtmp : 1; /**< temp service type */
- UINT32 mpeg4type : 1; /**< mpeg4 type */
- UINT32 videoavc : 1; /**< avc type */
- UINT32 notvisible : 1; /**< not visible */
- UINT32 notselectable : 1; /**< not selectable type */
- UINT32 freeca : 1; /**< free CA type */
- UINT32 nameModified :1; /**< program name modified by user */
- UINT32 NIDMatched :1; /**< network id matched */
- UINT32 ONIDMatched :1; /**< origine network matched */
- UINT32 ciplusused :1; /**< only ci plus direct tune and play used */
- UINT32 bInvalidService :1; /**< does this service exist in SDT,if yes it's valid (0).otherwise it's invalid (1). */
- UINT32 movestay : 1; /* need reserved move */
- UINT32 OCADupServLostFlag :1;/**< For Spain Channel Order */
- UINT32 SDServLostFlag :1; /**< For Germary Channel Order */
- UINT32 astraused :1; /**< only dvb-s astra used */
- UINT32 isProfileServ :1; /**< whether is profile service */
- UINT32 isVirtualChannel :1; /**< whether is virtual channel */
- } DBServAttrib_t;
- /** PES compnet define */
- typedef struct
- {
- UINT16 usDataPID; /**< pid value */
- UINT16 usStrmID; /**<stream id */
- UINT16/*EStreamType_t*/ usCodec; /**<stream codec */
- UINT16 usECMPID; /**< ecm pid*/
- UINT16 usCompTag; /**<mheg5 compnent tag */
- } DBPIDInfo_t;
- /** Prototype defined for store TRD Code */
- typedef struct
- {
- UINT8 u8DepthStatus; /**<0 means not found the TRD */
- UINT8 u8PrimaryCode;
- UINT8 u8SecondayCode;
- UINT16 u16TertiaryCode;
- } DBTRDCodeInfo_t;
- /**Define CAS system*/
- typedef enum{
- CAS_VIACCESS = 1,
- CAS_MEDIAGUA,
- CAS_IRDETO,
- CAS_NAGRA,
- CAS_NDS,
- CAS_CONAX,
- CAS_CRYPTOWO,
- CAS_ETC,//BISS
- CAS_MAX,
- }CASSystem_t;
- /** ci protection data struct */
- typedef struct
- {
- UINT8 u8hasShunningData;
- UINT8 u8freeCiModeFlag;
- UINT8 u8matchBrandFlag;
- UINT8 u8numberOfEntries;
- UINT16 u16entries[DB_DVB_MAX_SRV_MAX_CICAM_BRANDS];
- } DBCIProtection_t;
- #ifdef __cplusplus
- }
- #endif
- #endif
|