📄 parser.h
字号:
PARSER_STREAM_START, PARSER_STREAM_PRESCAN} PARSER_STREAM_STATE, *PPARSER_STREAM_STATE;// define input data format#define PARSER_DATAFMT_DVD_2064 (0x00000001)#define PARSER_DATAFMT_DVD_2048 (0x00000002)#define PARSER_DATAFMT_CDDA (0x00000004)#define PARSER_DATAFMT_CDDA_SUBCODE (0x00000008)#define PARSER_DATAFMT_CDROM (0x00000010)#define PARSER_DATAFMT_CDROM_M1 (0x00000020)#define PARSER_DATAFMT_CDROM_M2 (0x00000040)#define PARSER_DATAFMT_CDROM_M2F1 (0x00000080)#define PARSER_DATAFMT_CDROM_M2F2 (0x00000100)#define PARSER_DATAFMT_LINEAR (0x00000200)//#define PARSER_DATAFMT_DVD_BLOCK (0x00000200)//#define PARSER_DATAFMT_CD_BLOCK (0x00000400)#define PARSER_DATAFMT_NOCHANGE (0x00000000)// define input bit stream format#define PARSER_BSFMT_MUXED (0x00000001) // *#define PARSER_BSFMT_AUDIO_ONLY (0x00000002) // *#define PARSER_BSFMT_VIDEO_ONLY (0x00000004) // *#define PARSER_BSFMT_SP1_ONLY (0x00000008) // *#define PARSER_BSFMT_SP2_ONLY (0x00000010) // *#define PARSER_BSFMT_DATA_ONLY (0x00000020) // *#define PARSER_BSFMT_CSS_DISC_KEY (0x00000040)#define PARSER_BSFMT_CSS_TITLE_KEY (0x00000080)#define PARSER_BSFMT_MKB_DATA (0x00000100)#define PARSER_BSFMT_CPPM_ALBUM_ID (0x00000200)#define PARSER_BSFMT_CPRM_MEDIA_KEY (0x00000400)#define PARSER_BSFMT_BYTE_SWAP (0x00000800)#define PARSER_BSFMT_AVI (0x00001000)#define PARSER_BSFMT_CDDA (0x00002000)#define PARSER_BSFMT_CDDA_SUBCODE (0x00004000)#define PARSER_BSFMT_MP4 (0x00008000)#define PARSER_BSFMT_DVD_VIDEO (0x00010000)#define PARSER_BSFMT_DVD_AUDIO (0x00020000)#define PARSER_BSFMT_SVCD (0x00040000)#define PARSER_BSFMT_CVD (0x00080000)#define PARSER_BSFMT_WAV (0x00100000)// J500KWShih_233, #define PARSER_BSFMT_WMA (0x00200000)#define PARSER_BSFMT_DVB (0x01000000)#define PARSER_BSFMT_DVB_TS (0x02000000)#define PARSER_BSFMT_NOCHANGE (0x00000000)// define output filter#define PARSER_ENABLE_AUDIO (0x01 << PARSER_ES_AUDIO)#define PARSER_ENABLE_VIDEO (0x01 << PARSER_ES_VIDEO)#define PARSER_ENABLE_SP1 (0x01 << PARSER_ES_SP1)#define PARSER_ENABLE_DVB_TELETEXT (0x01 << PARSER_ES_TELETEXT)#define PARSER_ENABLE_SP2 (0x01 << PARSER_ES_SP2)#define PARSER_ENABLE_DVB_SUBTITLE (0x01 << PARSER_ES_SUBTITLE)#define PARSER_ENABLE_NV (0x01 << PARSER_ES_NV)#define PARSER_ENABLE_DATA (0x01 << PARSER_ES_DATA)#define PARSER_ENABLE_END_PADDING (0x00010000)#define PARSER_ENABLE_NV_PAUSE (0x00020000)#define PARSER_ENABLE_COPY_PROTECTION (0x00040000)#define PARSER_ENABLE_ALL (0xffffffff)// define ES found#define PARSER_FOUND_AUDIO (PARSER_ENABLE_AUDIO)#define PARSER_FOUND_VIDEO (PARSER_ENABLE_VIDEO)#define PARSER_FOUND_SP1 (PARSER_ENABLE_SP1)#define PARSER_FOUND_DVB_TELETEXT (PARSER_ENABLE_DVB_TELETEXT)#define PARSER_FOUND_SP2 (PARSER_ENABLE_SP2)#define PARSER_FOUND_DVB_SUBTITLE (PARSER_ENABLE_DVB_SUBTITLE)#define PARSER_FOUND_NV (PARSER_ENABLE_NV)#define PARSER_FOUND_DATA (PARSER_ENABLE_DATA)#define PARSER_FOUND_NONE (0x0000000)// define event can be detected#define PARSER_EVENT_AUDIO_PTS (0x00000001)#define PARSER_EVENT_VIDEO_PTS (0x00000002)#define PARSER_EVENT_SP_PTS (0x00000004)#define PARSER_EVENT_NV_PACK (0x00000008)#define PARSER_EVENT_TRIGGER_FLAG (0x00000010)#define PARSER_EVENT_EOR_FLAG (0x00000020)#define PARSER_EVENT_EOF_FLAG (0x00000040)#define PARSER_EVENT_DSM_TRICK_INFO (0x00000080)#define PARSER_EVENT_MOTION_DETECTED (0x00000100)#define PARSER_EVENT_PACK_SCR (0x00000200)#define PARSER_EVENT_NEW_ES_FOUND (0x00000400)// J500KWShih_121, for different movie container//#define PARSER_EVENT_AVI_ERROR (0x10000000) // when AVI stream has some error, ID icorrect, sector crashed#define PARSER_EVENT_MOVIE_ERROR (0x10000000)#define PARSER_EVENT_ERROR (0x20000000)#define PARSER_EVENT_RUNNING (0x40000000)#define PARSER_EVENT_COMPLETED (0x80000000) // this special event can not be disabled#define ATAPI_EVENT_START (0x08000000) // this special event can not be disabled#define ATAPI_EVENT_COMPLETED (0x04000000) // this special event can not be disabled// J500KWShih_120a, for MP4 file support#define PARSER_EVENT_NOT_READY (0x02000000) // tell mm that should update source filter#define FLAG_SET_ALL (0xffffffff)#define PARSER_PADDING_BYTE (0xff)#define STREAM_INVALID_ID (0xffffffff)// J500KWShih_237, for support MP4 (Nero Digital)#ifdef PARSER_SUPPORT_MP4#define PARSER_ES_BUF_LEN (128)#else#define PARSER_ES_BUF_LEN (64)#endif // PARSER_SUPPORT_MP4#define PARSER_ES_BUF_MASK (PARSER_ES_BUF_LEN-1)// Modified by J500CSC_20060910, this value indicates a reserved space at ESBuf for inserting extra header information// and let AV decoder can handle data well. MUST MAKE SURE if we add or delete any information at DumpES function.// Here we set the value as more 8B tolerance than the largest reserved space needed.#define PARSER_EXTRA_HEAD_SIZE (32) //(12) // Extra information bytes needs to be added when each new // packet or chunk is found. // (1) LPCM for DVD-VIDEO: 0x55805580 + size(16-bit) // (2) (DVD or SVCD/CVD) Subtitle/OGT: PTS (4B) + ID (4B) // (3) AVI Video --> 12B or 16B // tag 0x000001ff (4B) + PTS (4B) + chunk offset (4B) // + DivX 311: 0x000001B6 (4B) // (4) WMA start header for AVI search function --> 24B // 0xfedcba9876543210 (8B) + 14B (audio header) + 2B extra header (B:4-5) // (5) (DivX) DVD Subtitle --> 16B // Start PTS (4B) + ID (4B) + tag DCSQ (4B) + End PTS (4B)#define PARSER_EXTRA_MANUAL_BYTES (24)#define PARSER_BS_BUF_LEN (128) // this value should be 2's power value#define PARSER_BS_BUF_MASK (PARSER_BS_BUF_LEN-1)#define PARSER_MAX_AVI_VIDEO_TRACK (1)#define PARSER_MAX_AVI_AUDIO_TRACK (8)#define PARSER_MAX_AVI_CHAPTER_TRACK (16)#define PARSER_MAX_AVI_SUBTITLE_TRACK (32)#define PARSER_MAX_DVD_VIDEO_TRACK (1)#define PARSER_MAX_DVD_AUDIO_TRACK (8)#define PARSER_MAX_DVD_SUBTITLE_TRACK (32)#define PARSER_MAX_MP4_VIDEO_TRACK (1)#define PARSER_MAX_MP4_AUDIO_TRACK (8)#define PARSER_MAX_MP4_SP_TRACK (32)// define error code for DivX DRM#define DRM_ERROR_NONE (0)#define DRM_ERROR_INVALID_MASTER_KEY (10)#define DRM_ERROR_DECRYPTION_FAILED (11)#define DRM_ERROR_READING_MEMORY (12)#define DRM_ERROR_WRITING_MEMORY (13)#define DRM_ERROR_UNRECOGNIZED_DRM_MODE (14)#define DRM_ERROR_NOT_AUTH_USER (15)#define DRM_ERROR_RENTAL_EXPIRED (16)#define DRM_ERROR_NEED_MORE_RANDOM_SAMPLE (17)#define DRM_ERROR_NOT_INITIALIZED (18)#define DRM_ERROR_NOT_LIMITED_RENTAL_TYPE (19) #define DRM_ERROR_NOT_COMMITTED (20)#define DRM_ERROR_NOT_RENTAL_QUERIED (21)#define DRM_ERROR_BAD_SLOT_NUMBER (22)#define DRM_ERROR_NULL_GUARD_SET_SIGNAL (23)#define DRM_ERROR_INVALID_ALIGNMENT (24)// define the EDC error code#define PARSER_EDC_NOERR (0x0000) // no error at all#define PARSER_EDC_ERROR (0x8000) // sector is dump-in with error can not recover#define PARSER_EDC_NULL (0x4000) // sector can not dump-in at all// J500KWShih_120a, for Nero Digital chapter#define PARSER_MP4_CHAP_NEXT (0x01)#define PARSER_MP4_CHAP_PREV (0x02)#define PARSER_MP4_CHAP_END (0xFFFFFFFF)// J500CSC_221, define the audio buffer gap for protecting overwrite issue at AC3#define PARSER_AUDIO_BUF_GAP (MCU_CHANNEL_DUMMY_LEN + MCU_CHANNEL_DUMMY_LEN + 2352 + 0x1000)#ifdef PARSER_CODE_DEBUGtypedef struct tagHW_ADDR{ volatile PDWORD pdwInStreamCurAddr; volatile PDWORD pdwInStreamType; volatile PDWORD pdwOutStreamCurAddr; volatile PDWORD pdwOutStreamType; volatile PDWORD pdwRemainderEnable; volatile PDWORD pdwVideoBufRemainder; volatile PDWORD pdwAudioBuf0Remainder; volatile PDWORD pdwAudioBuf1Remainder; volatile PDWORD pdwSP1BufRemainder; volatile PDWORD pdwSP2BufRemainder; volatile PDWORD pdwBIUCtrl; volatile PDWORD pdwBIUBypassCount; volatile PDWORD pdwBIURemainder;// volatile PDWORD pdw} HW_ADDR, *PHW_ADDR;#endif //PARSER_CODE_DEBUG// NOTE: The cache needs to be flushed if data is read by CPU directlytypedef struct tagPARSER_OUTPUT_STREAM_BUFFER{ DWORD dwBaseAddr; // At initialization stage, this address is the same as dwLowerAddr in general except some special usage DWORD dwUpperAddr; DWORD dwLowerAddr; DWORD dwTotalLen; // record the total length of output buffer in byte// DWORD dwReadCounter; // this only valid for CPU read directly from memory, unit is sector (PARSER_ES_DATA)// DWORD dwWriteCounter; // this only valid for CPU read directly from memory, unit is sector (PARSER_ES_DATA) BYTE bESBuf[PARSER_ES_BUF_LEN]; // a buffer stores the data can not transfer due to 64-bit alignment limintation DWORD dwESBufLen; // length of store buffer in bytes DWORD dwESBufIdx; // point to the first buffer store DWORD dwSPULen; // the lebgth for subpicture unit} PARSER_OUTPUT_STREAM_BUFFER, *PPARSER_OUTPUT_STREAM_BUFFER;// Added by J500CSC_20070111// define a struct to store the data for AVI's MS MPEG-4 header// We will overlap it with the NV's output stream buffer#define PARSER_MS_MPEG4_HEAD_BUF_LEN (32)typedef struct tagPARSER_MS_MPEG4_STREAM_HEADER{ BOOL fValid; BOOL fVideoRangeStart; DWORD dwBufLength; BYTE bBuffer[PARSER_MS_MPEG4_HEAD_BUF_LEN];} PARSER_MS_MPEG4_STREAM_HEADER, *PPARSER_MS_MPEG4_STREAM_HEADER;typedef struct tagPARSER_STATUS{ PARSER_STATE NextState; // specify next state when change occurred PARSER_STATE CurState; // specify the current status PARSER_STREAM_STATE CurStreamState; // specify current stream state PARSER_PRESCAN PrescanType; BOOL fFNPDone; // specify if the FNP state is done BOOL fBlockDone; // specify if block is processed ok BOOL fOutputBlocked; // specify if output is blocked BOOL fSkipDummyHead; // specify if this is dummy sector at head of a block for DVD-2064 or AVI header file DWORD dwCurID; // specify cirrent ID (it will need 32-bit for AVI format) DWORD dwESFound; // specify how many elementary stream detected PARSER_ESTYPE CurESType; // specify current ES type DWORD dwActionFilter; // specify the output filter for elementary stream DWORD dwByteScan; // specify how many bytes are scanned // J500KWShih_202, byte counter for by-pass/skip mode DWORD dwByteCount; // specify how many bytes are scanned DWORD dwBypassLen; // specify the length of bypass or skipping DWORD dwOverBypassLen; // specify the length of block overflow for bypass DWORD dwBSBufLen; DWORD dwBSBufIdx; BYTE bBSBuf[PARSER_BS_BUF_LEN]; // save the reset data which is not enough to complete the state action DWORD dwBSFormat; // specify the input data and bit stream format DWORD dwBIUCLIPLEN; // clipping information for this bit stream DWORD dwBIUSECTORLEN; // the sector length output from MCU DWORD dwBIUFRMLEN; // frmae length for this bit stream DWORD dwBIUInputEnable; // keep the settings for enabling BIU's input feature // If data comes from SERVO, we need to turn on scramble feature DWORD dwMCUBCR0A; DWORD dwMCUBCR0D; DWORD dwMCUBlockLen; // the length of whole block (MCU viewpoint) DWORD dwBIUBlockLen; DWORD dwSectorLen; // the length of sector (PARSER viewpoint) DWORD dwSectorsPerBlock; // the number of sectors per block DWORD dwSearchPatternLen; // list the search pattern length, ex. 3 for MPEG & 4 for AVI DWORD dwChunkSize; // indicate current Chunk size DWORD dwEDCFlag; // use one bit to indicate each sector has error or not // This value will be updated per block. // If current PARSER is handling sector n, the bit // sector (n-32) (n-31) (n-30) (n-4) (n-3) (n-2) (n-1) // bit 31 30 29 ... 03 02 01 00 // variables for DVB solution DWORD dwTSLen; DWORD dwCurPIDIdx; DWORD dwNStripeReadAddr; // J500KWShih_216, decoder read ES buffer address BOOL fNStripe; // J500KWShih_216, enable N-Stripe // TRUE : enable // FALSE: disable BOOL fDataFmtDetect; // indicate if the data format has been detected already BOOL fHeadDetected; // indicate a chunk or mpeg head was found BOOL fEDCDetect; // J500CSC_110, indicate to detect EDC flag or not BOOL fRangeStartDetect; // J500CSC_121 BOOL fRunAtDSRMode; // J500CSC for DVB, indicate if run at DVB mode or not? BOOL fCharSubpicture; // J500KWShih, indicate parser is wait for char subtitle parsing FLAG_T flagParserEvent; // report events when PARSER is parsing DWORD dwIPStartBiuBlk; // indicate the start block for Instant-Replay DWORD dwIPEndBiuBlk; // indicate the end block for Instant-Replay DWORD dwIPFreeBlk; // indicate how many blocks are not filled for Instant-Replay DWORD dwIPTotalBlk; // indicate the total number of blocks can be used for Instant-Replay BOOL fIPStartPlaying; // indicate the instant replay is enabling BOOL fDVBScramble; // indicate if the DVB stream is scramble or not DWORD dwDVBPktCounter; // a DVB 188 packet counter, increase one when one 188 packet is found PPARSER_MS_MPEG4_STREAM_HEADER pMSMpeg4Header; // store the MS MPEG-4 header and need to write to video buffer at each // stream start (include GoToTime) DWORD dwReserved[9]; // reserved for future usage} PARSER_STATUS, * PPARSER_STATUS;typedef struct tagPARSER_BITS_CONTENT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -