123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- #include <stdlib.h>
- #include <stdio.h>
- #include <stdbool.h>
- #include "drv_dtv_external.h"
- #include "time.h"
- #ifndef TRUE
- #define TRUE 1
- #endif
- #ifndef FALSE
- #define FALSE 0
- #endif
- #ifndef BOOL
- #define BOOL unsigned char
- #endif
- #ifndef UINT64
- #define UINT64 unsigned long long
- #endif
- #ifndef UINT32
- #define UINT32 unsigned int
- #endif
- #ifndef UINT16
- #define UINT16 unsigned short
- #endif
- #ifndef UINT8
- #define UINT8 unsigned char
- #endif
- #define MAX_PATH_NAME_LEN 768
- #define FILE_NAME_LEN 512
- #define SHORT_FILE_NAME_LEN 256
- #define EXT_FILE_NAME_LEN 8
- #ifndef REC_MAX_MAP_PIDS_NUM
- #define REC_MAX_MAP_PIDS_NUM 16
- #endif
- #ifndef PVR_FILE_EXT_STR
- #define PVR_FILE_EXT_STR ".ts"
- #endif
- #define RECORD_FILE_MAX_SIZE 0xFF000000 // 4080MB
- #define SUPPORT_REWIND_BY_USER_SETTING 1
- #define SUPPORT_PRE_OPEN_FILE 0
- #define SUPPORT_MONITOR_MEM 0
- typedef struct _tagRecTimeInfo
- {
- UINT16 m_nYear;
- UINT8 m_nMonth;
- UINT8 m_nDay;
- UINT8 m_nHour;
- UINT8 m_nMinute;
- UINT8 m_nSecond;
- UINT8 m_nMode;
- }REC_TIME_INFO,*PREC_TIME_INFO;
- typedef struct _tagRecTime
- {
- union
- {
- UINT32 m_dwRecTime;
- REC_TIME_INFO m_sRecTimeInfo;
- };
- }REC_TIME,*PREC_TIME;
- #ifdef CONFIG_CIPLUS_SUPPORT_PVR
- typedef struct _tagRecCIInfo
- {
- UINT8 mIsRCD;
- UINT8 mIndex;
- UINT32 mFileSize;
- }__attribute__ ((packed))REC_CI_File_Info,*PREC_CI_File_Info;
- typedef struct RecCITSPLHeader
- {
- UINT8 ModuleName[6]; //6
- UINT32 Cidata_length;
- UINT16 FileCnt;
- REC_TIME_INFO rec_time; //8
- UINT32 HeaderPkt[26];
- UINT32 HeaderSize;
- }__attribute__ ((packed))CITSPLREC_UNIT,RecCITSPLHeader; //remove padding & alignment
- #endif
- typedef struct _FACTORY_RECORD_CONFIG
- {
- char szFileName[MAX_PATH_NAME_LEN]; /*!< recorded filename*/
- char szFileExtName[EXT_FILE_NAME_LEN]; /*!< recorded file ext name, mpg, mp3, ac3,...*/
- }FACTORY_RECORD_CONFIG;
- typedef struct _RECORD_CONFIG
- {
- // autocut config
- UINT32 dwAutocutSize; /*!< autocut size, set 0 to disable autocut for infinite timeshifting or NTFS HDD.*/
- // pids mapping config
- UINT16 usVideoPid; /*!< video mapping pid, 0x1fff means no video pid packets*/
- UINT16 usAudioPid; /*!< audio mapping pid, 0x1fff means no audio pid packets*/
- UINT16 usVidStrmType; /*!< video stream type */
- UINT16 usAudStrmType; /*!< audio stream type */
- UINT16 usProgNum; /*!< program number */
- UINT16 usPcrPid; /*!< pcr mapping pid, 0xffff means no pcr pid packets*/
- UINT16 usPatPid; /*!< PAT mapping pid, 0xffff means no pat pid packets*/
- UINT16 usPmtPid; /*!< PMT mapping pid, 0xffff means no pmt pid packets*/
- UINT16 usOtherPesPids[REC_MAX_MAP_PIDS_NUM]; /*!< other mapping pid, 0xffff entry means end of other PES pids array*/
- UINT16 usOtherPsiPids[REC_MAX_MAP_PIDS_NUM]; /*!< other mapping pid, 0xffff entry means end of other PSI pids array*/
- // user pack
- UINT8 ucUserPack; /*!< Add user pack at the first of file, only used for TV/Audio service type*/
- // record service type config
- UINT8 ucServiceType; /*!< MID_REC_SERVICE_TV, MID_REC_SERVICE_RADIO, MID_REC_SERVICE_TS(transport stream packets)*/
- // autocut num
- UINT8 ucAutocutExtNum; /*!< autocut start number for file ext name */
- // pcr discontinunity config
- UINT8 ucPcrDiscLimit; /*!< source PCR discontinunity ignore limit times, set 0 for not ignoring.*/
- UINT32 dwPcrDiscTolerance; /*!< tolerance difference between 2 consecutive PCR values, set 0 for using 9000(100ms) defined by spec.*/
- UINT64 *pllStartSCR; /*!< SCR start time of the first PS pack. NULL pointer indicates no defined.*/
- // ring buffer
- UINT32 u32RingBuffer; /*!< Ring buffer size in minutes for TSPB*/
- // file name
- char szFileName[MAX_PATH_NAME_LEN]; /*!< recorded filename*/
- char szFileExtName[EXT_FILE_NAME_LEN]; /*!< recorded file ext name, mpg, mp3, ac3,...*/
- // new services user added //Mika_101109: mantis 109499 //Mika_101223: mantis 118634
- UINT8 bNewService; /*!< dvb-s new services added*/
- UINT8 AudioIndex; //switch audio track
- UINT16 CurSubtitlePid; /*!< from PES pids, switch to current subtitle PID*/
- UINT16 CurADPid; /*switch to current AD PID*/
- UINT8 parental_rating; //parental rating
- char ci_pin[5]; //ci cam pin, 4 digits with null terminated
- UINT8 CAServiceType;
- #ifdef CONFIG_SUPPORT_PVR_DATA_ENCRYPTION
- UINT8 bHAS_HDCPKSV;
- UINT8 HDCPKSV[5];
- #endif
- }RECORD_CONFIG;
- typedef enum _RECTYPE
- {
- MID_REC_MODE_MANUAL = 0, //pvr
- MID_REC_MODE_AUTO, //timeshoft
- MID_REC_MODE_TIMESHIFT_AFTER_REC, //timeshift
- MID_REC_MODE_UNATTENDED, //unattended record mode
- MID_REC_MODE_TIMESHIFT_AUTOREWIND,
- MID_REC_MODE_PVR_AUTOPLAY, //file exist mode
- MID_REC_MODE_MAX,
- } RECTYPE,MID_REC_MODE;
- typedef enum _CAServiceType
- {
- FTA, //free to air
- CI_SCRAMBLED,
- BISS_SCRAMBLED,
- }SERVICETYPE,MID_CA_SERVICE_TYPE;
- typedef enum
- {
- TS_TSHIFT_SIGNAL_HAS_DATA = 0,
- TS_TSHIFT_SIGNAL_HAS_NO_DATA,
- }TSHIFT_CALLBK_TYPE;
- typedef void ( * TSHIFT_CALLBACK_FUNC )( UINT16 wParam , UINT32 dwParam);
- void TS_SetTShiftCallBackFunc(void( * pCallBackFunc )( UINT16 wParam , UINT32 dwParam) );
- typedef void ( * REC_CALLBACK_FUNC )( UINT16 wParam , UINT32 dwParam);
- void TS_SetCallBackFunc(void( * pCallBackFunc )( UINT16 wParam , UINT32 dwParam) );
- UINT32 TS_Get_USB_WriteSize(void);
- BOOL TSPidRemap(RECORD_CONFIG *gRecConfig);
- BOOL TSSetConfig(RECORD_CONFIG *gRecConfig);
- BOOL TSStart(char *szUSBFlashRootDir, int AvailSizeInMB);
- BOOL TSStop();
- void TSPause();
- BOOL TS_IsRecording();
- BOOL TS_IsPause();
- void TSResume();
- BOOL TSGetParserRecordingTime(long *recDurTime);
- BOOL TSGetRecordingDuration(long *recDurTime);
- void TSSwitchCurMode(int RecMode);
- int GetRecordFolder(char *folder);
- UINT32 TSGetByteRate();
- UINT32 TSGetRecordFileSize();
- void TSGetCurIndexAndSize(UINT32 *Index , UINT64 *singleSize);
- UINT32 TSGetFrameRate();
- int TSGetRecordFileIndex();
- BOOL TSIsRewind(long *buffertime);
- BOOL TSPlaybackAttachPE();
- BOOL TSPlaybackDetachDTV();
- BOOL AttachDTV();
- int GetRecordName(char *recordName);
- BOOL TSGetCurRWPos(UINT32 *Wptr , int64_t *Rptr);
- BOOL TSSetFactoryConfig(FACTORY_RECORD_CONFIG *gRecConfig);
- BOOL TSRecordModeChange(int mode);
- UINT32 TSGetByteRate();
- UINT32 TSGetAvaiableTime();
- #if SUPPORT_PRE_OPEN_FILE
- BOOL TSScheOpenFile(char *szUSBFlashRootDir ,char * filename , char * filename_ext);
- BOOL TSScheDeletFile();
- #endif
- void TSSetRecRewindMode(char mode);
- UINT16 TSGetParserProgId();
- BOOL TSRecordContiProgram();
|