/** * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved. * * @file * * @brief Definitions for DVB EPG. * * @note This file is from ETSI EN 300 468 and ISO 13818. * * @note D Book/E Book/Z Book/Nordig and freeview are defined here. * * This file is the EPG data which forms a part of DVB bitstreams. * * @htmlonly * The diagram below shows the DVB delivery model. * @endhtmlonly * * @image html dvb_delivery_model.PNG "DVB Delivery Model" * * @htmlonly * The diagram below shows the service information relationship. * @endhtmlonly * * @image html organization_service_information.PNG * "Service Information Relationship" */ #ifndef SUNMEDIA_MID_EPG_INCLUDED #define SUNMEDIA_MID_EPG_INCLUDED #include "types.h" #include "umf_debug.h" #ifdef CONFIG_EPG_USE_RESERVE_MM extern void *EPG_MM_Malloc(size_t size); extern void EPG_MM_Free(void *address); #define EPG_MALLOC(size) EPG_MM_Malloc(size) #define EPG_FREE(ptr) EPG_MM_Free(ptr) #else #define EPG_MALLOC(size) malloc(size) #define EPG_FREE(ptr) free(ptr) #endif #define MAGIC_NO (0x5678) /** Match any service id */ #define RESERVED_SERVICE_ID (0xFFFF) /** Match any transport stream id */ #define RESERVED_TRANSPORT_ID (0xFFFF) /** Match any original network id */ #define RESERVED_ORIGINAL_NET_ID (0xFFFF) #define MAX_ISO_LANG_CODE (4) #if 0//defined(CONFIG_DRAMSIZE) && CONFIG_DRAMSIZE == 64 #define MAX_DATA_SIZE (255) #define EPG_EXTEND_EVENT_DESC_NUM (16) #else #define MAX_DATA_SIZE (512)//(255)/* modify by qinhe on 2014/04/27 for new font show UTF8 length is 298 for si02_21c_2k_64qam_cr23_gi32_7.30.ts SIT888 & #2426_Russia_578000_DVBT.ts mantis 23917 */ #define EPG_EXTEND_EVENT_DESC_NUM (19) //(16) , increase to 19 for 16 is not enough for some event. mantis 0038265: [T1][RDA8528]DTV,DVB-C,播放ZDF_20110925_130918.TS,節目ZDF,進到EPG,在ZDF.umwelt按info key,最後面的內容有少. #endif #define MAX_CONTENT_NUM_IN_CONTENT_DESCRIPTOR (127) /** Remove lator */ #define MID_EPG_DBG_FLAG (0) #define MID_EPG_ERROR_FLAG (1) /**< Debug and error print defines */ #if MID_EPG_DBG_FLAG #define EPG_PRINT(fmt, arg...) \ do { \ UMFDBG(0,"[Debug]%s: %d Line\n", __FUNCTION__, __LINE__); \ UMFDBG(0,fmt, ##arg); \ } while(0) #else #define EPG_PRINT(fmt, arg...); #endif #if MID_EPG_ERROR_FLAG #define EPG_ERROR(fmt, arg...) \ do { \ UMFDBG(0,"[ERR]%s: %d Line\n", __FUNCTION__, __LINE__); \ UMFDBG(0,fmt, ##arg); \ } while(0) #else #define EPG_ERROR(fmt, arg...); #endif #ifdef __cplusplus extern "C" { #endif /** * @brief The epg events types. */ typedef enum { EVENT_TYPE_NOW = 0, EVENT_TYPE_NEXT, EVENT_TYPE_SCHEDULE, EVENT_TYPE_OTHER, } MID_EPG_EventType; /** * @brief ST Date */ typedef struct _ST_DATE { UINT16 usYear; /**< year */ UINT8 ucMonth; /**< month */ UINT8 ucDay; /**< day */ } ST_DATE; /** * @brief ST time */ typedef struct _ST_TIME { UINT8 ucHour; /**< hour */ UINT8 ucMin; /**< minute */ UINT8 ucSec; /**< second */ } ST_TIME; /** * @brief ST event date and time */ typedef struct _ST_EVENT_TIME { ST_DATE stStartDate; /**< start date */ ST_TIME stStartTime; /**< start time */ ST_DATE stEndDate; /**< end date */ ST_TIME stEndTime; /**< end time */ } ST_EVENT_TIME; /** * @brief return types */ typedef enum { MID_EPG_SUCCESS, MID_EPG_FAILED, MID_EPG_INVALID_PARAM, MID_EPG_STATE_ERROR, } MID_EPG_Return_t; /** * @brief Identifies a specific EPG Handle. * * It is an opaque type specific to the target implement. It is used to * identify the EPG. * * @note 0 is invalid handle. */ typedef INT32 MID_EPG_Handle_t; /** * @brief Identifies a specific EPG event Handle. * * It is an opaque type specific to the target implement. It is used to * identify the EPG event. * * @note 0 is invalid handle. */ typedef UINT32 MID_EPG_EventHandle_t; /** * The epg events that are passed to the application through callback */ typedef enum MID_EPGEvent_t { EPG_EVENT_NOW_ADDED, /**< Now event added */ EPG_EVENT_NOW_MODIFIED, /**< Now event modified */ EPG_EVENT_NOW_DELETE, /**< Now event deleted */ /** EPG Schedule Event */ EPG_EVENT_ADDED, /**< Entry added */ EPG_EVENT_MODIFIED, /**< Entry modified(Reserved) */ EPG_EVENT_DELETED, /**< Entry deleted */ EPG_ALLEVENTS_DELETED, /**< All Events deleted */ EPG_GET_SYSTEMTIME, /**< get current system time */ EPG_CHECK_SRVEXIST, /**< check the service is exist in database */ } MID_EPGEvent_t; /** * The epg mode, for example normal and time shift */ typedef enum MID_EPGMode_t { EPG_MODE_NORMAL, EPG_MODE_TIMESHIFT, } MID_EPGMode_t; /** * @brief The prototype of the callback to be registed with epg. * * @param enEvent EPG event, see #MID_EPGEvent_t. * * @param pParam A pointer to the EPG event that has changed, see #MID_EPGEventCallback_t. */ typedef void (*fMidEpgCallback)(MID_EPGEvent_t enEvent, void* pParam); /** * struct MID_ServLocator_t * @brief dvb service locator. * * This structure defines the dvb service locator. */ typedef struct MID_ServLocator_t { /** Service information */ UINT16 original_network_id; /**< Original network ID */ UINT16 tranport_id; /**< transport id */ UINT16 service_id; /**< service id */ } MID_ServLocator_t; /** * struct MID_EPGEventParam_t * @brief epg callback parameter. * * This structure defines the parameter of epg callback. */ typedef struct MID_EPGEventCallback_t { MID_EPG_EventHandle_t epg_handle; UINT16 event_id; /**< event id */ UINT16 event_type; /**