📄 parser.h
字号:
{ BOOL fValid; BOOL fCopyProtection;// BOOL fVideoIDConfirm; BOOL fUpdatePTSValid; DWORD dwVideoTrackCount; DWORD dwAudioTrackCount; DWORD dwSubtitleTrackCount; DWORD dwWidth; // width of the AVI file in pixels DWORD dwHeight; // height of the AVI file in pixels DWORD dwFrameRate; // video frame rate DWORD dwPsudoRate; // fram rate * 65536 DWORD dwTotalFrames; DWORD dwMicrosecPerFrame; // the number of microseconds between frames DWORD dwDropHeadSize; // indicate how many bytes need to be dropped at first in order to get the chunk ID position DWORD dwCurAudioByteCount; // record a byte counter from start play or audio switching for update audio PTS WORD wCurAudioIdx; WORD wCurVideoIdx; // J500KWShih, for MP4 DWORD dwChapterCount; DWORD dwStartPTS; union { struct { DWORD dwSample2Chunk; struct { PARSER_ESFMT ESFormat; BYTE bChannelNo; BYTE bBitsPerSample; // J500CSC_20070130, report the number of bits per sample for host reference DWORD dwID; DWORD dwSampleRate; DWORD dwSamples; // save the audio sample counter for AVI bit stream } AudioTrack[PARSER_MAX_AVI_AUDIO_TRACK]; struct { PARSER_ESFMT ESFormat; DWORD dwID; DWORD dwID_db; // J500KWShih_235, using stream rate to calculate video PTS#ifdef PARSER_AVI_VIDEO_PTS_STREAM DWORD dwFrameCount;#else ULONGLONG ullVideoMSCount; // save the frame's micro second for AVI bit stream#endif // PARSER_AVI_VIDEO_PTS_STREAM } VideoTrack[PARSER_MAX_AVI_VIDEO_TRACK]; struct { PARSER_ESFMT ESFormat; DWORD dwID; } SubtitleTrack[PARSER_MAX_AVI_SUBTITLE_TRACK]; } AVI; struct { struct { PARSER_ESFMT ESFormat; DWORD dwID; } AudioTrack[PARSER_MAX_DVD_AUDIO_TRACK]; DWORD dwVideoTrackID[PARSER_MAX_DVD_VIDEO_TRACK]; DWORD dwSubtitleTrackID[PARSER_MAX_DVD_SUBTITLE_TRACK]; } MPEG; } StreamID; DWORD dwReserved[16]; // reserved for future usage} PARSER_BITS_CONTENT, *PPARSER_BITS_CONTENT;// define ID structure for DVB system// Each ID contains 3x4 bytes and has bit mask operation, EQUAL or NOT EQUAL,typedef struct tagPARSER_DVB_FILTER{ WORD wPIDIdx; // indicate associate with which PID WORD wSecLen; // indicate how much data is not processed DWORD dwID[PARSER_DVB_FILTER_ID_NO]; DWORD dwIDMask[PARSER_DVB_FILTER_ID_NO]; DWORD dwFlag; // indicate the filter is valid or empty DWORD dwWriteAddr; // At initialization stage, this address is the same as dwLowerAddr in general except some special usage // It will be increase only when one complete field is output DWORD dwCurWriteAddr; // current writting address DWORD dwUpperAddr; DWORD dwLowerAddr;// DWORD dwTotalLen; // record the total length of output buffer in byte DWORD dwReadAddr; // this only valid for CPU read directly from memory DWORD dwStatusFlag; // indicate if any error occurred DWORD dwPESLen; // keep how many PES length are there FPPARSER_SEC_CB fpSecCB; DWORD dwTimeoutMilliS; // millisecond to time out DWORD dwTimerEnd; DWORD dwSecReadCounter; DWORD dwSecWriteCounter; DWORD dwDebug;} PARSER_DVB_FILTER, *PPARSER_DVB_FILTER;#define PARSER_DVB_PESLEN_INFINITE (0xffffffff) // means there is no specified how many bytes is a PES packet#define PARSER_DVB_END_SECTOR (0x00ffffff)#define PARSER_DVB_LOOPBACK_SECTOR (PARSER_DVB_END_SECTOR >> 4)typedef struct tagPARSER_DVB_PID_STATE{ WORD wPID; BYTE bTSContinuity; BOOL fAlloc; BOOL fTSDiscontinuity; BYTE bCount; WORD wBufRemLen; // save how many bytes remaining at buffer (< 4) DWORD dwSecRemLen; // indicate how many section length are remained ULONG_UNION ulunBuf; // save remaining bytes (in DWORD alignment)} PARSER_DVB_PID_STATE, *PPARSER_DVB_PID_STATE;typedef struct tagPARSER_GBL{ PARSER_STATUS Status[MAX_STREAM_COUNT]; PARSER_BITS_CONTENT BitsContent; DWORD dwCurInStreamIdx; // store current stream index working on //================================= Don't change above order !!!!!!!!!!!!!! PARSER_OUTPUT_STREAM_BUFFER ESBuffer[PARSER_ES_MAX]; // declare infortmation storage for each output stream#ifdef PARSER_CODE_DEBUG HW_ADDR HWAddr;#endif //PARSER_CODE_DEBUG#ifdef PARSER_SUPPORT_DVB PARSER_DVB_FILTER DVBFilter[PARSER_DVB_FILTER_MAX]; PARSER_DVB_PID_STATE DVBPIDState[PARSER_DVB_PID_MAX]; cyg_flag_t flagDVBFilterEvent; // report events when PARSER is parsing#endif // PARSER_SUPPORT_DVB} PARSER_GBL, *PPARSER_GBL;#define PARSER_VIDEO_PTS_GAP (0)#define PARSER_AUDIO_COUNT_NULL (0xFFFFFFFF)#define PARSER_FAIL_SECTOR (0xFFFFFFFF)typedef struct tagPARSER_AV_PTS{ DWORD dwVideoPTS; DWORD dwAudioPTS;} PARSER_AV_PTS, *PPARSER_AV_PTS;// J500KWShih_220, AVI audio timestamp formulatypedef enum tagPARSER_AVI_TIMESTAMP_FORMULA{ PARSER_AVI_TIMESTAMP_FORMULA_STREAM, // PC PARSER_AVI_TIMESTAMP_FORMULA_BYTE // MTK} PARSER_AVI_TIMESTAMP_FORMULA, *PPARSER_AVI_TIMESTAMP_FORMULA;//====================================// declare global variables//====================================extern PARSER_GBL __PARSER_gbl; // declare the export global data structure//====================================// declare global functions//====================================extern void PARSER_ThreadMain( DWORD index );extern void PARSER_ThreadExit( WORD data );extern void PARSER_ThreadInit( void );extern void PARSER_DRM_Config( DWORD dwEEPROMBaseAddr );extern BOOL PARSER_DRM_PowerOnInit( void );extern void PARSER_DRM_SetModelID( BYTE bLow, BYTE bTop );extern BOOL PARSER_DRM_GetRegistrationCodeString( PBYTE pbRegistrationCodeString );extern DWORD PARSER_DRM_Init( PBYTE pbUseLimit, PBYTE pbUseCount );extern void PARSER_DRM_EarlyInit( void );extern DWORD PARSER_DRM_CommitPlayback( void );extern DWORD PARSER_GetAVIInfo( PARSER_AVI_INFO AVIInfoType );extern BOOL PARSER_Command( DWORD dwStreamIdx, PARSER_COMMAND Command, void * pParamRet );extern BOOL PARSER_BufferReset( PARSER_ESTYPE ESType );extern BOOL PARSER_ActionFilter( DWORD dwStreamIdx, DWORD dwESFilter, BOOL fEnable );extern BOOL PARSER_ChangeID( DWORD dwStreamIdx, PARSER_ESTYPE ESType, DWORD dwID );extern BOOL PARSER_SetDataFmt( DWORD dwStreamIdx, DWORD dwDataFmt, DWORD dwBSFmt );extern DWORD PARSER_GetBufferRemainder( PARSER_ESTYPE ESType );extern BOOL PARSER_SetOutBufferAddress( PARSER_ESTYPE ESType, DWORD dwBufLowerAdr, DWORD dwBufUpperAdr );extern BOOL PARSER_SetBSBufferAddress( DWORD dwStreamIdx, DWORD dwBufLowerAdr, DWORD dwBufUpperAdr );extern DWORD PARSER_QueryEvent( DWORD dwStreamIdx, DWORD dwEvents, BOOL fClear );extern DWORD PARSER_GetCurSector( DWORD dwStreamIdx );extern void PARSER_WriteTitleKey( ULONGLONG_UNION ullunTitleKey );extern void PARSER_ReadTitleKey( PULONGLONG_UNION pullunTitleKey );extern DWORD PARSER_ReadCPRMAI( void );// J500KWShih_120a, for containerextern PPARSER_BITS_CONTENT PARSER_GetContainerContent( void );extern DWORD PARSER_GetContainerIndexPosition(DWORD dwFileStartSector);extern DWORD PARSER_GetContainerTimePosition( DWORD dwFileStartSector, DWORD dwTimeInSec, DWORD dwIndexInc, PPARSER_AV_PTS pAVPTS );extern DWORD PARSER_GetMovieEndPosition(DWORD dwFileStartSector);extern DWORD PARSER_GetContainerCurVideoTime( void );extern void PARSER_InitialContainerPrescan(DWORD dwIdxTblTempBuffer, DWORD dwIdxTblTempBufferLen, DWORD dwIdxTblBuffer, DWORD dwIdxTblBufferLen);// J500KWShih_214, get DVD CGMSextern DWORD PARSER_GetDVDCGMS(DWORD dwStreamIdx);// J500KWShih_216, enable N-Stripe//***************************************************************************// Function : PARSER_EnableNStripe// Abstract : enable N Stripe//// Arguments : dwStreamIdx// flag : TRUE , enable// FALSE, disable// dwReadAddr : decoder read ES buffer address// // Return : TRUE , success// FALSE, unreasonable read address// Side Effect :// Notes : If disable N-stripe (flag = FALSE), the value of dwReadAddr will// be ignored and will be set to 0.//***************************************************************************extern BOOL PARSER_EnableNStripe(DWORD dwStreamIdx, BOOL flag, DWORD dwReadAddr);// J500KWShih_216, we will not extern __PARSER_gbl for information hiding// UTL_Read_PreScan_Info in utl.c and _MM_MotionTrigger in mmanager.c// should used this function to get copy protection infomationextern BOOL PARSER_GetCopyProtection(void);extern BOOL PARSER_GetSCR( PDWORD pdwSCR );extern DWORD PARSER_GetEDCFlag( DWORD dwStreamIdx );extern BOOL PARSER_AddExtTextSP( DWORD dwStreamIdx ); // J500CSC_120extern PARSER_ESFMT PARSER_QueryContainerAudioType( DWORD dwStreamIdx, DWORD dwAudioIdx ); // J500CSC_121#ifdef PARSER_SUPPORT_MP4// J500KWShih_120a, for MP4 file supportextern DWORD PARSER_GetMP4MoovBoxPosition(void);extern WORD PARSER_GetMP4Chapter(DWORD dwTimeInSec);extern DWORD PARSER_GetMP4ChapterTime(BYTE bDirection);#endif PARSER_SUPPORT_MP4// J500KWShih_220, set AVI audio timestamp formulaextern void PARSER_setAVITimestampFormula(PARSER_AVI_TIMESTAMP_FORMULA timestamp);// J500KWShih_230, add index entry by decoder while AVI w/o index tableextern void PARSER_addAVIIndexEntry(DWORD dwPTS, DWORD dwOffset);// J500KWShih_230, query AVI index tableextern BOOL PARSER_QueryAVIIndexTable(void);// J500KWShih_230, get AVI video buffer ratioextern BYTE PARSER_getAVIVideoRatio(void);// J500KWShih_232, get AVI audio track indexextern BYTE PARSER_getAVIAudioMaxBitrateTrackIndex(void);// J500KWShih_232, get AVI audio buffer sizeextern DWORD PARSER_getAVIAudioBufferSize(BYTE index);// J500KWShih_233, get WMA time positionextern DWORD PARSER_getWMATimePosition(DWORD dwFileStartSector, DWORD dwHeaderSize, DWORD dwPacketSize, DWORD dwBitRate, DWORD dwTimeInSec);extern void PARSER_Debug( DWORD dwStreamIdx );#ifdef PARSER_TESTextern void ATAPI_Thread( DWORD index );extern BYTE ATAPI_ReadSectors( DWORD dwStartPos, DWORD dwEndPos );#endif // PARSER_TEST#ifdef PARSER_CHECK_FRAME_IDextern void PARSER_CheckFrame(BOOL fType);#endif // PARSER_CHECK_FRAME_IDextern BOOL PARSER_CheckESFound(DWORD ESType);extern DWORD PARSER_CtlDVBFilter( PARSER_DVBCMD PIDCmd, DWORD dwFilterIdx, DWORD dwParam );extern DWORD PARSER_DVB_FilterOpen( DWORD dwBufSize, WORD wPID );extern void PARSER_DVB_FilterClose( DWORD dwFilterIdx );extern PARSER_FILTER_STATUS PARSER_DVB_SectionMonitor( WORD wPID, BYTE bTableID, WORD wSubTableID, BYTE bSectionNum, FPPARSER_SEC_CB sec_cb, WORD wTimeoutMilliSec, PBYTE pbFilterIdx );extern PARSER_FILTER_STATUS PARSER_DVB_SectionGet( WORD wPID, BYTE bTableID, WORD wSubTableID, BYTE bSectionNum, PBYTE pbSection, WORD wMaxSecSize, WORD wTimeoutMilliSec );extern void PARSER_DVB_FilterPoll( void );extern BOOL PARSER_DVB_FilterCheckTimeOut( DWORD dwFilterIdx );extern BOOL PARSER_DVB_FilterSectionReady( DWORD dwFilterIdx );extern BOOL PARSER_DVB_FilterGetSection( DWORD dwFilterIdx, PBYTE pbSection, WORD wMaxLength, BOOL fTSPkt );extern DWORD PARSER_DVBCRC32( PBYTE pbSectionField );extern BOOL PARSER_DVBInitPath( DWORD dwStreamIdx, DWORD dwNimCfgFlag, BOOL f909SEval );extern void PARSER_DVBClosePath( DWORD dwStreamIdx );extern void PARSER_DVBResetPath( void );extern void PARSER_DVBRestartPath( DWORD dwStreamIdx, DWORD dwNimCfgFlag );extern void PARSER_DVB_ForceStop( void );extern BOOL PARSER_DVBReplayReset( DWORD dwStreamIdx, PARSER_DVBREPLAY_POS ReplayPos );extern DWORD PARSER_DVB_IstantReplayRatio( DWORD dwStreamIdx );extern DWORD PARSER_DVB_IstantReplayFillRatio( DWORD dwStreamIdx );extern DWORD PARSER_DVB_TSFilterOpen( DWORD dwBufAddr, DWORD dwBufSize, WORD wPID );extern void PARSER_DVB_TSFilterClose( DWORD dwFilterIdx );extern DWORD PARSER_DVB_GetPktCounter( DWORD dwStreamIdx );extern BOOL PARSER_DVB_BSScramble( DWORD dwStreamIdx );extern void Upper4Chars( PULONG_UNION pulunData );extern DWORD ATOI(PCHAR pstr);extern BOOL PARSER_QueryNoneInputBufferReady( DWORD dwStreamIdx );extern BOOL PARSER_QueryESBufferReady( DWORD dwStreamIdx, DWORD dwSize );// J500CSC_20070514, Support host to get current MPEG SCRextern BOOL PARSER_MPEG_GetCurrentSCR( PULONGLONG_UNION pullunSCR );#ifdef __cplusplus}#endif //__cplusplus#endif // __PARSER_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -