📄 parser.h
字号:
//**************************************************************************// Copyright (c) 2004, Cheertek Inc . All rights reserved.// D300, all right reserved.//// Product : CheerDVD Firmware// Date : 2004.12.12.// Author : Cheertek (D300 CSC)// Purpose : Parses different kind bit streams, MPEG & AVI, into elementary streams// , audio/video/subtitle, ..., etc.// It also handles the copy protection issue.// Sources : parser.h/ lparser.h/ parser.c/ parser_mpeg.h/ parser_mpeg.c/// parser_avi.h/ parser_avi.c/ parser_prescan.c///***************************************************************************// Modification use ://**************************************************************************// Update// Date : 2004.12.12// Name : Cheertek (D300 CSC)// Description : //// Item Source// ---------------------------------------- -------------------#ifndef __PARSER_H__#define __PARSER_H__#ifdef WIN32_TOOL#include "ctkav.h"#else // WIN32_TOOL// J500KWShih_216, Support CT909 Component AP and cross platform issue for Windows 909 Player//#include <cyg/kernel/kapi.h>//#include <cyg/hal/hal_intr.h>//#include <cyg/hal/hal_arch.h> // Architecture specific definitions//#include "winav.h"#include "ctkav.h"#include "srcfilter.h"#include "comdec.h"#include "disp.h"#include "initial.h"#endif // WIN32_TOOL#ifdef __cplusplusextern "C" {#endif //__cplusplus// K200 John, added thread delay to release CPU resource for CT216U//#define PARSER_SUPPORT_216U//#define PARSER_CODE_DEBUG // enable some debug code for check point//#define PARSER_DETAIL_DEBUG_INFO // enable detail debug information//#define PARSER_NORMAL_DEBUG_INFO // enable normal (necessary) debug information// J500KWShih_235, using stream rate to calculate video PTS#define PARSER_AVI_VIDEO_PTS_STREAM// J500KWShih_237, support MP4 (Nero Digital)// #define PARSER_SUPPORT_MP4//====================================// declare type/structure/definition//====================================// declare commands supported by PARSER module#define PARSER_DVB_FILTER_MAX (32) // support 16 sets filter#define PARSER_DVB_PID_MAX (16) // support maximum 16 PIDs#define PARSER_DVB_FILTER_ID_NO (3) // support how many DWORD ID#define PARSER_DVB_TIMEOUT_INFINITE (0)#define PARSER_INVALID_FILTER_ID (0xff)#define PARSER_DVB_DUMMY_PID (0x1ffe) // this PID almost won't be used, we use here as dummy PID for initialization#define RING_BUFFER_SIZE_1K (1024)#define RING_BUFFER_SIZE_4K (4096)#define RING_BUFFER_SIZE_8K (8192)#define DONT_CARE_TABLE_ID (0xff)#define DONT_CARE_SUB_TABLE_ID (0xffff)#define DONT_CARE_SECTION_NUM (0xff)// define filter flag's bit meaning#define PARSER_DVB_FILTER_NULL (0x00000000)#define PARSER_DVB_FILTER_PES_AUDIO (0x00000001)#define PARSER_DVB_FILTER_PES_VIDEO (0x00000002)#define PARSER_DVB_FILTER_PES_TELETEXT (0x00000004)#define PARSER_DVB_FILTER_PES_SUBTITLE (0x00000008)#define PARSER_DVB_FILTER_SECTION (0x00000010)#define PARSER_DVB_FILTER_EQUAL (0x00000020)#define PARSER_DVB_FILTER_NOT_EQUAL (0x00000040)// define section filter's status bit#define PARSER_DVB_SECTION_OK (0x00000001)#define PARSER_DVB_SECTION_OVERFLOW (0x00000002)#define PARSER_DVB_SECTION_DISCONTINUITY (0x00000004)#define PARSER_DVB_SECTION_DONE (0x00010000)#define PARSER_DVB_SECTION_SEARCH_START (0x00020000)#define PARSER_DVB_SECTION_RUNNING (0x00040000)#define PARSER_DVB_SECTION_ENABLE (0x00080000)typedef enum tagPARSER_FILTER_STATUS{ PARSER_FILTER_NO_ERROR, /**< no error */ PARSER_FILTER_SECTION_AVAILABLE, /**< there is a section available */ PARSER_FILTER_USER_ABORT, /**< user abort process */ PARSER_FILTER_TIMEOUT, /**< filter timeout */ PARSER_FILTER_CRC_ERROR, /**< section crc check error */ PARSER_FILTER_ERROR /**< some thing wrong */} PARSER_FILTER_STATUS, *PPARSER_FILTER_STATUS;typedef enum tagPARSER_DVBCMD{ PARSER_DVBCMD_ALLOC, PARSER_DVBCMD_ASSIGN, PARSER_DVBCMD_CHANGE_ID, PARSER_DVBCMD_FREE, PARSER_DVBCMD_SET, PARSER_DVBCMD_AVAILABLE, PARSER_DVBCMD_ALLAVAILABLE, PARSER_DVBCMD_ENABLE, PARSER_DVBCMD_DISABLE, PARSER_DVBCMD_INIT, PARSER_DVBCMD_INITALL, PARSER_DVBCMD_BUF_RESET, PARSER_DVBCMD_START, PARSER_DVBCMD_RESTART, PARSER_DVBCMD_STOP} PARSER_DVBCMD, *PPARSER_DVBCMD;typedef enum tagPARSER_DVBREPLAY_POS{ PARSER_DVBREPLAY_START, PARSER_DVBREPLAY_CUR} PARSER_DVBREPLAY_POS, *PPARSER_DVBREPLAY_POS;typedef void (*FPPARSER_SEC_CB)(BYTE bFID, PARSER_FILTER_STATUS FltStatus);typedef struct tagPARSER_DVB_SEC_HEAD{ union { DWORD dwSecHead[3]; BYTE bSecHead[12]; struct { BYTE bTable_id: 8; BYTE bSection_syntax_indicator: 1; BYTE bPrivate_indicator: 1; BYTE bReserved: 2; WORD wSection_length: 12; WORD wSubTableID: 16; BYTE bBitReserved2: 2; BYTE bVersionNumber: 5; BYTE bBitCurrenNext: 1; BYTE bSectionNumber: 8; BYTE bLastSectionNumber: 8; DWORD dwExtendIDs: 32; } PACK_FORMAT stSecHead; // Micky2.17c } Data;} PARSER_DVB_SEC_HEAD, *PPARSER_DVB_SEC_HEAD;typedef struct tagPARSER_DVB_FILTER_CFG{ WORD wPID; // indicate associate with which PID// WORD wPIDIdx; // indicate associate with which PID PARSER_DVB_SEC_HEAD SecHeadID; PARSER_DVB_SEC_HEAD SecHeadMask; DWORD dwFlag; DWORD dwUpperAddr; DWORD dwLowerAddr; FPPARSER_SEC_CB fpSecCB;} PARSER_DVB_FILTER_CFG, *PPARSER_DVB_FILTER_CFG;typedef struct tagPARSER_AVI_AUDIO_BUFFER{ DWORD AudioBuffer0; DWORD AudioBuffer1;} PARSER_AVI_AUDIO_BUFFER, *PPARSER_AVI_AUDIO_BUFFER;typedef enum tagPARSER_AVI_INFO{ PARSER_AVI_HEIGHT, PARSER_AVI_WIDTH, PARSER_AVI_PSUDO_RATE, PARSER_AVI_FRAMES, PARSER_AVI_CODEC_VERSION} PARSER_AVI_INFO, *PPARSER_AVI_INFO;typedef enum tagPARSER_COMMAND{ PARSER_CMD_STOP, PARSER_CMD_START, // J500KWShih, char-base 16M solution PARSER_CMD_PAUSE, PARSER_CMD_PRESCAN, PARSER_CMD_RESUME, PARSER_CMD_PUSH_VIDEO, PARSER_CMD_AVI_PTS, PARSER_CMD_DISC_KEY, PARSER_CMD_IGNORE_EDC, // J500CSC_110, enable EDC detection or not depneds on parameter's value PARSER_CMD_MAX} PARSER_COMMAND, *PPARSER_COMMAND;typedef enum tagPARSER_PLAY_PARM{ PARSER_PLAY_NORMAL = 0, PARSER_PLAY_REPLAY} PARSER_PLAY_PARM, *PPARSER_PLAY_PARM;typedef enum tagPARSER_PRESCAN{ // J500KWShih_120a, for container PARSER_PRESCAN_CONTAINER_INFO, PARSER_PRESCAN_CONTAINER_INDEX, PARSER_PRESCAN_SCR, PARSER_PRESCAN_1STSCR,// PARSER_PRESCAN_DISC_KEY, PARSER_PRESCAN_TITLE_KEY, PARSER_PRESCAN_DVB_PAT_PMT} PARSER_PRESCAN, *PPARSER_PRESCAN;typedef enum tagPARSER_CDDA_TYPE{ PARSER_CDDA_UNKNOWN = 0, PARSER_CDDA_PURE, PARSER_CDDA_HDCD, PARSER_CDDA_DTS, PARSER_CDDA_CDG} PARSER_CDDA_TYPE, *PPARSER_CDDA_TYPE;typedef enum tagPARSER_ESTYPE{ PARSER_ES_AUDIO = 0, PARSER_ES_VIDEO, PARSER_ES_SP1, PARSER_ES_TELETEXT = PARSER_ES_SP1, PARSER_ES_SP2, PARSER_ES_SUBTITLE = PARSER_ES_SP2, PARSER_ES_TS_PACKET = PARSER_ES_SP2, PARSER_ES_NV, PARSER_DVB_PID_AVAILABLE = PARSER_ES_NV, PARSER_DVB_FILTER_AVAILABLE = PARSER_DVB_PID_AVAILABLE, PARSER_ES_DATA, PARSER_ES_NULL, PARSER_ES_MAX = PARSER_ES_NULL} PARSER_ESTYPE, *PPARSER_ESTYPE;typedef enum tagPARSER_ESFMT{ PARSER_ESFMT_UNKNOWN = 0, // define audio ES format PARSER_ESFMT_MP12, PARSER_ESFMT_MP3, PARSER_ESFMT_AC3, PARSER_ESFMT_DTS, PARSER_ESFMT_PCM, PARSER_ESFMT_MLP, PARSER_ESFMT_OGG, PARSER_ESFMT_WMA_V1, PARSER_ESFMT_WMA_V2, PARSER_ESFMT_AAC, // LLY1.20 PARSER_ESFMT_MS_ADPCM, PARSER_ESFMT_DVI_ADPCM, PARSER_ESFMT_PCM_MULAW, PARSER_ESFMT_PCM_ALAW, // define SP ES format PARSER_ESFMT_DVD_SP = 100, // this is DVD SP format subtitle included in container (ex. AVI/ MP4/ ...) PARSER_ESFMT_TEXT_SP, // this is char base subtitle included in container (ex. AVI/ MP4/ ...) PARSER_ESFMT_UTF8_SP, // this is UTF-8 char base subtitle in container (ex. MP4) PARSER_ESFMT_TEXT_SP_EXT, // this is char base subtitle from external file // define video ES format PARSER_ESFMT_MPEG1 = 150, PARSER_ESFMT_MPEG2, PARSER_ESFMT_MJPG, PARSER_ESFMT_DIVX311 = 311, PARSER_ESFMT_DIVX4 = 412, PARSER_ESFMT_DIVX5 = 500, PARSER_ESFMT_MPEG4 = 801, PARSER_ESFMT_XVID = 802, PARSER_ESFMT_3IVX = 803, PARSER_ESFMT_MS_MPEG4 = 804,} PARSER_ESFMT, *PPARSER_ESFMT;#if 0typedef enum tagPARSER_MPEG4_NUM{ PARSER_MPEG4_COMMON = 0, PARSER_MPEG4_3IVX = 200, PARSER_MPEG4_DIVX311 = 311, PARSER_MPEG4_DIVX4 = 412, PARSER_MPEG4_DIVX5 = 500, PARSER_MPEG4_XVID = 100} PARSER_MPEG4_NUM, *PPARSER_MPEG4_NUM;#endif // 0typedef enum tagPARSER_STATE{ PARSER_STATE_STOP, PARSER_STATE_PAUSE, PARSER_STATE_FNP, PARSER_STATE_HEADER, PARSER_STATE_SUBHEADER, PARSER_STATE_DATA, PARSER_STATE_SKIP, PARSER_STATE_BYPASS, PARSER_STATE_DRM} PARSER_STATE, *PPARSER_STATE;typedef enum tagPARSER_STREAM_STATE{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -