/****************************************************************************** *_Copyright (c) 2009 Digital Stream Technology Inc. All Rights Reserved. * * Module: dstdddtv.c * * Description * Platform/Vendor specific device driver for DTV Audio/Video. * * @author * @version $Revision: 1.1 $ * ******************************************************************************/ #include #include #include #include #include #include #include #include #include "dsthalcommon.h" #include "dstoslayer.h" #include "dstdddtv.h" #include "dstddaud.h" #include "dstddsys.h" #include "dstdddmx.h" #include "dstdddisp.h" #include "dstddcap.h" #include "dstddgpio.h" #include "pd_dmx.h" #ifdef DMALLOC #include #endif #include #include "mpeg2.h" /****************************************************************************** * Global variable declaration ******************************************************************************/ int gddAvDbgLvl = 2; int g_PcrStarted = 0; int g_PcrPid = -1; int g_PreSPDIFDelay = 800; // SPDIF AC3-PCM º¯°æÇϱâ ÀüÀÇ Delay int g_AftSPDIFDelay = 200; // SPDIF AC3-PCM º¯°æÇÑ ÈÄÀÇ Delay DS_U16 g_PESFilter = 0; int g_PESFilterStarted = 0; /****************************************************************************** * Imported variable declaration ******************************************************************************/ extern DHL_CAP_CONFIG g_dhlcap; extern DHL_DTV_CONFIG g_dhldtv; static P_DHL_PRG_INFO pPrgInfo = &g_dhldtv.PrgInfo; extern void PreInitSplashScreen(DS_U32 *arg); extern DS_BOOL g_DTVCCEnable; /****************************************************************************** * Imported function declaration ******************************************************************************/ /****************************************************************************** * Local definitions ******************************************************************************/ #define VIDEO_ALIVE_CHECK_INTERVAL 1200 // 12000 mSec #define AUDIO_ALIVE_CHECK_INTERVAL 150 // 1500 mSec #define USE_CC_Q 1 #define MAX_CC_MESSAGES 120 #define NULL_PID 0x1FFE /****************************************************************************** * Local typedefs ******************************************************************************/ #define DEBUG_PES_FILTER 0 // PES_filter debug dump »ç¿ë ¿©ºÎ. // /****************************************************************************** * Local variables declaration ******************************************************************************/ static DS_BOOL g_VideoStarted = _FALSE_; static DS_BOOL g_AudioStarted = _FALSE_; static int s_AVInit = 0; /****************************************************************************** * Local function prototypes ******************************************************************************/ static DHL_RESULT DD_DTV_IsAVAlive(DS_BOOL *bVideo, DS_BOOL *bAudio); static DHL_RESULT CCMonitorInit(void); static DHL_RESULT CCMonitorStart(void); static DHL_RESULT CCMonitorStop(void); void _CCUserDataCallback(unsigned char *data, unsigned long size, void *pInfo); ////////////////////////////////////////////////////////////////////////////// // Global Variables ////////////////////////////////////////////////////////////////////////////// int fsCod, Lfeon, acmod; DS_U32 lastAudioTime = 0; // ¸¶Áö¸· AC3 Info ¿Ã¶ó¿Â ½ÃÁ¡. ////////////////////////////////////////////////////////////////////////////// // Global Functions ////////////////////////////////////////////////////////////////////////////// DS_BOOL DD_DTV_IsVideoStarted(void); DS_BOOL DD_DTV_IsAudioStarted(void); DS_BOOL DD_DTV_IsAVStarted(void); #if 0 ___Common_Functions___() #endif DHL_RESULT DD_DTV_Init(void) { DHL_RESULT dhlResult = DHL_OK; extern int init_mpeg2dec(int width, int height); dhlResult = CCMonitorInit(); SysASSERT( dhlResult == DHL_OK ); dhlResult = CCMonitorStart(); SysASSERT( dhlResult == DHL_OK ); DD_CAP_SetSyncLock(1); init_mpeg2dec(0, 0); s_AVInit = 1; return dhlResult; } DHL_RESULT DD_DTV_Connect(void) { DHL_RESULT dhlResult = DHL_OK; return dhlResult; } DHL_RESULT DD_DTV_Close(void) { DHL_RESULT dhlResult = DHL_OK; dhlResult = CCMonitorStop(); SysASSERT( dhlResult == DHL_OK ); return dhlResult; } DHL_RESULT DD_DTV_Pause(void) { DHL_RESULT dhlResult = DHL_OK; return dhlResult; } DHL_RESULT DD_DTV_Resume(void) { DHL_RESULT dhlResult = DHL_OK; return dhlResult; } #if 0 ___DTVCC_Functions___() #endif #define PECC_TASK_PRIORITY 90 #define PECC_TASK_STACKSIZE 16384 static OS_MESSAGEQUEUE_ID PeCCQ; static OS_TASK_ID PECCMonitorSlaveId; static int tPECCMonitorStarted = 0; // PE CC Monitor Thread°¡ ½ÃÀ۵Ǿú´ÂÁö? static int tCCMonitorSlave(DS_U32 *dmstartup); static DHL_RESULT CCMonitorInit(void) { DHL_RESULT dhlResult = DHL_OK; mpeg_set_userdata_callback( _CCUserDataCallback ); PeCCQ = OS_CreateMessageQueue("q_PeCC", 0, MAX_CC_MESSAGES, sizeof(DS_U32)); if ( PeCCQ == (OS_MESSAGEQUEUE_ID)NULL ) { dhlResult = DHL_FAIL_OUT_OF_RESOURCE; goto done; } PECCMonitorSlaveId = OS_SpawnTask((void (*) (DS_U32))tCCMonitorSlave, "tPECCMonitorSlave", PECC_TASK_PRIORITY, PECC_TASK_STACKSIZE, 0); if ( PECCMonitorSlaveId == (OS_TASK_ID)NULL ) { dhlResult = DHL_FAIL_OUT_OF_RESOURCE; goto done; } done: return dhlResult; } static DHL_RESULT CCMonitorStart(void) { DHL_RESULT dhlResult = DHL_OK; if ( tPECCMonitorStarted == 1 ) { return dhlResult; } tPECCMonitorStarted = 1; return dhlResult; } static DHL_RESULT CCMonitorStop(void) { DHL_RESULT dhlResult = DHL_OK; return dhlResult; } void _CCUserDataCallback(unsigned char *data, unsigned long size, void *pInfo) { DS_U32 *ccBuf; DS_U8 *msgToSlave; DS_U32 flag = (DS_U32)pInfo; //pCCCallbackInfo_t pCallbackInfo = (pCCCallbackInfo_t)pInfo; if ( g_DTVCCEnable == DS_FALSE ) return; if((data == NULL) || (size <= 0) || (pInfo == NULL)) { printf("ERROR: invalid CC userdata 0x%lx %d 0x%lx\n", (DS_U32)data, (int)size, (DS_U32)pInfo); return; } //fprintf(stderr, "CC userdata 0x%lx %d 0x%lx\n", (DS_U32)data, (int)size, (DS_U32)pInfo); ccBuf = malloc(size+2*sizeof(DS_U32)); if ( !ccBuf ) { printf("%s| ERROR, Out of resource.\n", __FUNCTION__); return; } ((DS_U32 *)ccBuf)[0] = 0; ((DS_U32 *)ccBuf)[0] |= (flag & PIC_FLAG_PROGRESSIVE_FRAME) ? (1<>16)&0x03)< 2 ) { for (i=0; i<70; i++) { if ( !(i%16) ) printf("\n"); printf("%02X ", Buffer[i] ); } } if ( cc_test_flag > 1 ) { picStruct = (((DS_U32 *)Buffer)[0] >> DHL_CC_PIC_SHIFT) & DHL_CC_PIC_MASK; curField = (((DS_U32 *)Buffer)[0] >> DHL_CC_TOPFL_SHIFT) & DHL_CC_TOPFL_MASK; repeat1st = (((DS_U32 *)Buffer)[0] >> DHL_CC_RPTFL_SHIFT) & DHL_CC_RPTFL_MASK; printf("picStruct = %2d, curField = %d, repeatFirstField = %d\n", picStruct, curField, repeat1st ); } // // ATSC Identifier // if ( !(buffer[0] == 0x47 && buffer[1] == 0x41 && buffer[2] == 0x39 && buffer[3] == 0x34) ) return; // // user_data_type_code // if ( buffer[4] != 0x03 ) return; // // cc_count // cc_count = buffer[5] & 0x1F; ptr = (unsigned char *)&buffer[7]; for (i=0; i>6) & 0x3; if ( cc_test_flag > 1 ) printf("[CC] SeqNo=0x%02X\n", cur_offset ); if ( old_offset >= 0 ) { if ( cur_offset != ((old_offset+1)&3) ) { //#if DEBUG_CC printf(" lost packet! %d => %d\n", old_offset, cur_offset ); //#endif cc_error_count++; } } old_offset = cur_offset; cc_total_count++; } } } static int tCCMonitorSlave(DS_U32 *arg) { DS_U32 msgLen; static DS_U32 msg; DS_U32 ret; DHL_RESULT dhlResult = DHL_OK; DHL_DbgPrintf(0,DDDBG_AV,"entry.\n"); while(1) { msg = 0; ret = OS_ReceiveMessage(PeCCQ, &msg, sizeof(msg), &msgLen); if ( ret != 0 ) { DHL_DbgPrintf(0,DDDBG_AV,"ERROR, LINE=%d\n", __LINE__); continue; } if ( msgLen ) { dhlResult = DHL_DTV_DoCallback( DHL_CB_VDC_CCUDP, (void *)msg ); SysASSERT( dhlResult == DHL_OK ); } test_cc_function( (DS_U8 *)msg ); free( (void *)msg ); } DHL_DbgPrintf(gddAvDbgLvl,DDDBG_AV,"exit.\n"); } #if 0 ___Video_Functions___() #endif ////////////////////////////////////////////////////////////////////// // // DD_DTV_VideoStart(), DD_DTV_VideoStop() // DD_DTV_AudioStart(), DD_DTV_AudioStop() // ///////////////////////////////////////////////////////////////////// DHL_RESULT DD_DTV_VideoStart(DS_U16 uVidPID, DS_U16 uPcrPID) { DHL_RESULT dhlResult = DHL_OK; dhlResult = DD_DTV_Connect(); SysASSERT( dhlResult == DHL_OK ); SysASSERT( DD_DTV_IsVideoStarted() == _FALSE_ ); if ( g_PcrStarted == 0 || g_PcrPid != uPcrPID ) { // // Here call the vendor-supplied PCR start API. // //SysCHECK( PD_DMX_CreatePIDFilter( uVidPID, MPEG2_VIDEO_STREAM, DS_FALSE ) == PD_DMX_SUCCESS ); g_PcrStarted = 1; g_PcrPid = uPcrPID; } // // Here call the vendor-supplied Video start API. // g_VideoStarted = 1; return dhlResult; } DHL_RESULT DD_DTV_VideoStartEx2(DS_U16 uVidPID, DS_U16 uPcrPID, DS_U8 Stream_Type) { return DD_DTV_VideoStart( uVidPID, uPcrPID); } DHL_RESULT DD_DTV_VideoStop(void) { DHL_RESULT dhlResult = DHL_OK; // // Here call the vendor-supplied VIDEO-STOP API. // //SysCHECK( PD_DMX_DeletePIDFilter(pPrgInfo->VidPID) == PD_DMX_SUCCESS ); g_VideoStarted = 0; //close_mpeg2dec(); // // If audio is also stopped, then stop PCR also. // if ( !DD_DTV_IsAudioStarted() ) { // // Call the PCR STOP API here. // g_PcrStarted = 0; g_PcrPid = -1; } return dhlResult; } DS_BOOL DD_DTV_IsVideoStarted(void) { return g_VideoStarted; } DS_BOOL DD_DTV_IsAVStarted(void) { return (DD_DTV_IsVideoStarted() || DD_DTV_IsAudioStarted()); } DHL_RESULT DD_DTV_IsVideoAlive(DS_BOOL *bVideo, DS_U32 uWatingTicks) { DHL_RESULT dhlResult = DHL_OK; DS_BOOL audio, video; static DS_U32 lastTickCount = 0; static DS_BOOL lastIsAlive = 0; if ( uWatingTicks == 0 ) uWatingTicks = VIDEO_ALIVE_CHECK_INTERVAL; // // Video°¡ ½ÃÀÛµÇÁö ¾Ê¾ÒÀ¸¸é, ¹«Á¶°Ç Video Alive = 0. // if ( DD_DTV_IsVideoStarted() == 0 ) { *bVideo = 0; return dhlResult; } dhlResult = DD_DTV_IsAVAlive( &video, &audio ); if ( video == 0 ) { if ( (OS_GetTickCount() - lastTickCount) < uWatingTicks ) { *bVideo = lastIsAlive; return dhlResult; } else { *bVideo = video; lastIsAlive = video; lastTickCount = OS_GetTickCount(); return dhlResult; } } else { lastTickCount = OS_GetTickCount(); lastIsAlive = video; *bVideo = video; } *bVideo = video; return dhlResult; } #if 0 ___Audio_Functions___() #endif DHL_RESULT DD_DTV_AudioStart(DS_U16 uAudPID, DS_U16 uPcrPID, DHL_AUD_STREAMTYPE AudStreamType, DS_BOOL bAudOnlyCh) { DHL_RESULT dhlResult = DHL_OK; int i_audio_stream_type = AC3_AUDIO_STREAM; SysASSERT( DD_DTV_IsAudioStarted() == DS_FALSE ); switch(AudStreamType) { case DHL_STREAM_AUDIO_AC3: i_audio_stream_type = AC3_AUDIO_STREAM; break; case DHL_STREAM_AUDIO_MPEG2: i_audio_stream_type = MPEG2_AUDIO_STREAM; break; default: printf("!!! Cannot support 0x%x or invalid format.\n", AudStreamType); return DHL_FAIL; break; } // // Call the AUDIO START API here. // //SysCHECK( PD_DMX_CreatePIDFilter( uAudPID, i_audio_stream_type, DS_FALSE ) == PD_DMX_SUCCESS ); // // Some plaform need to set SPDIF output mode just after AUDIO-START. // If so, then call the appropriate API here. // if ( DHL_AUD_IsSpdifMuted() == _FALSE_ ) { dhlResult = DD_AUD_ChangeAudOutFormat(DHL_AUD_GetAudOutFormat()); SysASSERT( dhlResult == DHL_OK ); } g_AudioStarted = 1; // // If PCR is not started or PCR is not same as before, in that case call the PCR start here again. // if ( g_PcrStarted == 0 || g_PcrPid != uPcrPID ) { // // Call the PCR START API here. // g_PcrStarted = 1; g_PcrPid = uPcrPID; } return dhlResult; } DHL_RESULT DD_DTV_AudioStop(void) { DHL_RESULT dhlResult = DHL_OK; // // Call the vendor-supplied AUDIO-STOP API here. // //SysCHECK( PD_DMX_DeletePIDFilter(pPrgInfo->AudPID) == PD_DMX_SUCCESS ); pPrgInfo->AudPID = pPrgInfo->AudPID; g_AudioStarted = 0; // // If video is not started, in that case we have to stop PCR also here. // if ( DD_DTV_IsVideoStarted() == 0 ) { // // Call the vendor-supplied PCR-STOP API here. // g_PcrStarted = 0; g_PcrPid = -1; } return dhlResult; } DHL_RESULT DD_DTV_SetAudioDynamicRange(DS_BOOL On) { return DHL_OK; } static DHL_RESULT DD_DTV_IsAVAlive(DS_BOOL *bVideo, DS_BOOL *bAudio) { DHL_RESULT dhlResult = DHL_OK; // // Here we have to check incoming video is valid or not. // For example, checks whether PTS/DTS is changing. // Just for test purpose, just we return video is started. // *bVideo = (DS_BOOL)DD_DTV_IsVideoStarted(); *bAudio = (DS_BOOL)0; return dhlResult; } DHL_RESULT DD_DTV_IsAudioAlive(DS_BOOL *bAudio, DS_U32 uWatingTicks) { DHL_RESULT dhlResult = DHL_OK; if ( DD_DTV_IsAudioStarted() == _FALSE_ ) { *bAudio = 0; return dhlResult; } // // Check Audio data availability here and get back until uWaitingTicks timeout. // return dhlResult; } DS_BOOL DD_DTV_IsAudioStarted(void) { return g_AudioStarted; } DHL_RESULT DD_DTV_GetAC3Info(P_DHL_DTV_AC3_STATUS pAC3Status) { DHL_RESULT dhlResult = DHL_OK; return dhlResult; } #if 0 ___CC_Functions___() #endif static DHL_DTV_PES_CALLBACK s_cbPESFilterFunc = (DHL_DTV_PES_CALLBACK)NULL; #if 0 void _arib_process_statement_body(DS_U8 *p_buffer, int size, PESInfo_t *p_info) { int i; // DS_U16 p_decoded_text[4096]; int decodedLength; #ifndef CONV_TO_ASCII #define CONV_TO_ASCII(x) ( ((x) >= ' ' && (x) <= '~') ? (x) : '.' ) #endif //decodedLength=DMW_Decode_AribCCString(size, p_buffer, 4096, p_decoded_text); printf("Decoded ARIB-CC: "); for (i=0; i= ' ' && (p_decoded_text[i]) <= '~') //printf("%c", CONV_TO_ASCII(p_decoded_text[i]&0xFF)); //else printf("{%02X}", p_buffer[i]); } printf("\n"); } void _arib_process_data_unit(int i_lang, DS_U8 *p_buffer, int size, PESInfo_t *p_info) { DS_U8 unit_seperator; DS_U8 data_unit_parameter; DS_U32 data_unit_size; // if ( i_lang_select == -1 ) // return; // if ( i_lang != -1 && i_lang_select != i_lang ) // return; //i_lang_select = i_lang_select; if ( size < 0 ) return; unit_seperator = p_buffer[0]; if ( unit_seperator != 0x1F ) { printf("invalid unit_seperator 0x%x\n", unit_seperator); return; } data_unit_parameter = p_buffer[1]; data_unit_size = (p_buffer[2] << 16) + (p_buffer[3]<<8) + (p_buffer[4]); if ( size < (data_unit_size+5)) { printf("!! %s:%d too short length %ld / %d\n", __func__, __LINE__, data_unit_size, size ); return; } switch( data_unit_parameter ) { case 0x20: _arib_process_statement_body( &p_buffer[5], data_unit_size, p_info ); break; default: printf("unsupported data_unit_parameter 0x%x\n", data_unit_parameter); break; } } void _arib_process_caption_statement(int i_lang, DS_U8 *p_buffer, int size, PESInfo_t *p_info) { DS_U8 TMD; DS_U32 STMHigh, STMLow; int off = 0; DS_U32 data_unit_size; printf("%s:%d\n", __func__, __LINE__); TMD = (p_buffer[0] >> 6) & 0x03; off += 1; if (TMD == 2 || TMD == 1) { STMHigh = (p_buffer[1]>>(36-32)) & 0x0F; STMLow = (p_buffer[1]<<(32-4)) & 0xF0000000; STMLow += (p_buffer[2]<<(32-12)) & 0x0FF00000; STMLow += (p_buffer[3]<<(32-20)) & 0x000FF000; STMLow += (p_buffer[4]<<(32-28)) & 0x00000FF0; STMLow += (p_buffer[5]<<(32-32)) & 0x0000000F; off+=5; } printf("%s:%d\n", __func__, __LINE__); data_unit_size = (p_buffer[off]<<16)+(p_buffer[off+1]<<8)+(p_buffer[off+2]<<0); if ( size < off+data_unit_size ) { printf("!! %s:%d too short length %ld / %d\n", __func__, __LINE__, data_unit_size, size ); return; } off += 3; printf("%s:%d data_unit_size: %ld\n", __func__, __LINE__, data_unit_size); _arib_process_data_unit( i_lang, &p_buffer[off], data_unit_size, p_info ); } void _arib_process_caption_management(DS_U8 *p_buffer, int size, PESInfo_t *p_info) { int TMD; DS_U32 OTMHigh, OTMLow; int off=0; int numLang; int i; DS_U8 language_tag; DS_U8 DMF; DS_U8 DC; DS_U32 langcode; DS_U8 Format; DS_U8 TCS; DS_U8 rollup_mode; int data_unit_loop_length; printf("%s:%d\n", __func__, __LINE__); // // TO DO: utilize caption management information. // TMD = (p_buffer[0] >> 6) & 0x03; if (TMD == 2) { OTMHigh = (p_buffer[1]>>(36-32)) & 0x0F; OTMLow = (p_buffer[1]<<(32-4)) & 0xF0000000; OTMLow += (p_buffer[2]<<(32-12)) & 0x0FF00000; OTMLow += (p_buffer[3]<<(32-20)) & 0x000FF000; OTMLow += (p_buffer[4]<<(32-28)) & 0x00000FF0; OTMLow += (p_buffer[5]<<(32-32)) & 0x0000000F; off+=5; } if (size < off) return; printf("%s:%d\n", __func__, __LINE__); numLang = p_buffer[1+off]; off += 2; for (i=0; i>5) & 0x07; DMF = (p_buffer[off] & 0x0F); if ( DMF == 0x0C || DMF == 0x0D || DMF == 0x0E ) { DC = p_buffer[off+1]; off += 1; } langcode = (p_buffer[off+2]<<16)+(p_buffer[off+3]<<8)+(p_buffer[off+4]); Format = (p_buffer[off+5]>>4) & 0x0F; TCS = (p_buffer[off+5]>>2) & 0x03; rollup_mode = p_buffer[off+5] & 0x03; off += 6; printf("Language %d: tag[%d] DMF %x, langcode %lx, format %d, TCS %d, rollup %d\n", i, language_tag, DMF, langcode, Format, TCS, rollup_mode ); } if (size < off) return; printf("%s:%d\n", __func__, __LINE__); data_unit_loop_length = (p_buffer[off]<<16)+(p_buffer[off+1]<<8)+p_buffer[off+2]; off += 3; if (size < (off+data_unit_loop_length)) return; if ( data_unit_loop_length ) _arib_process_data_unit(-1/*-1=caption_management*/, &p_buffer[off], data_unit_loop_length, p_info); } void _arib_process_data_group(DS_U8 *p_buffer, int size, PESInfo_t *p_info) { int data_group_id; int data_group_version; int data_group_size; int i_lang; data_group_id = (p_buffer[0]>>2) & 0x3F; data_group_version = p_buffer[0] & 0x03; data_group_size = (p_buffer[3]<<8)+p_buffer[4]; i_lang = data_group_id & 0x0F; if ( size < (data_group_size+5+2) ) { printf("!! invalid data_group size %d / %d\n", data_group_size, size); return; } if (data_group_id == 0x00 || data_group_id == 0x20) _arib_process_caption_management( &p_buffer[5], data_group_size, p_info ); else _arib_process_caption_statement( i_lang, &p_buffer[5], data_group_size, p_info ); } void _arib_process_PES_data(DS_U8 *p_buffer, int size, PESInfo_t *p_info) { int PES_packet_header_length; int PES_data_byte_length; printf("%s:%d, p_buffer 0x%lx, size 0x%x\n", __func__, __LINE__, (DS_U32)p_buffer, size); if ( p_buffer[0] != 0x80 || p_buffer[1] != 0xFF ) return; PES_packet_header_length = p_buffer[2] & 0x0F; PES_data_byte_length = size - PES_packet_header_length - 3; if ( PES_data_byte_length > 0 ) _arib_process_data_group( &p_buffer[PES_packet_header_length+3], PES_data_byte_length, p_info ); #if 1//DEBUG_PES_FILTER else printf("!! No valid data_group byte: %d\n", PES_data_byte_length); #endif } #endif #if 0 __ARIB_CC_Test_String_From_FUJI__() #endif const unsigned char ccCount0[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x32, 0x3F, 0x00, 0x00, 0x2E, 0x1F, 0x20, 0x00, 0x00, 0x29, 0x0C, 0x8A, 0x87, 0xA4, 0xE4, 0xA4, 0xC3, 0xA4, 0xD1, 0x89, 0xA1, 0xA1, 0x8A, 0xB9, 0xE1, 0xA4, 0xEA, 0xA4, 0xC8, 0xA4, 0xAB, 0x89, 0xA1, 0xA1, 0x8A, 0xA4, 0xB9, 0xA4, 0xB4, 0xA4, 0xAF, 0xCC, 0xEE, 0xC0, 0xB8, 0xC5, 0xAA, 0xA4, 0xC7, 0xFC, 0xA1, 0x75, 0x7B, 0xA0, 0x1F, 0xEE, 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount1[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 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, 0xA4, 0xCD, 0x89, 0xA1, 0xA3, 0x75, 0xF9, 0xA0, 0x1F, 0xEA, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount3[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x27, 0x3F, 0x00, 0x00, 0x23, 0x1F, 0x20, 0x00, 0x00, 0x15, 0x0C, 0x8A, 0x82, 0xB0, 0xFB, 0xA4, 0xDF, 0xA4, 0xE4, 0xA4, 0xB9, 0xA4, 0xA4, 0xA4, 0xF3, 0xA4, 0xCA, 0xA4, 0xE9, 0xA1, 0xC4, 0x1F, 0x20, 0x00, 0x00, 0x04, 0x9D, 0x20, 0x50, 0x0C, 0x7A, 0x54, 0xA1, 0x1F, 0xE4, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount4[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x00, 0x00, 0x1B, 0x1F, 0x20, 0x00, 0x00, 0x16, 0x0C, 0x8A, 0x82, 0xB7, 0xDA, 0xB0, 0xE6, 0xC2, 0xF4, 0xA4, 0xC8, 0xA4, 0xAB, 0xA4, 0xCB, 0xA4, 0xA2, 0xA4, 0xEB, 0x89, 0xA1, 0xA3, 0x2C, 0x76, 0xA0, 0x1F, 0xE9, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount5[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x35, 0x3F, 0x00, 0x00, 0x31, 0x1F, 0x20, 0x00, 0x00, 0x2C, 0x0C, 0x8A, 0x83, 0xA4, 0xC8, 0xA4, 0xAD, 0xA4, 0xBF, 0xA4, 0xDE, 0x89, 0xA1, 0xA1, 0x8A, 0xB8, 0xC0, 0xA4, 0xC3, 0xA4, 0xC6, 0xA4, 0xEB, 0xA4, 0xB3, 0xA4, 0xC8, 0xA4, 0xAC, 0xCA, 0xAC, 0xA4, 0xAB, 0xA4, 0xF3, 0xA4, 0xCA, 0xA4, 0xA4, 0xA4, 0xE8, 0x89, 0xA1, 0xA3, 0x9E, 0xCC, 0xA1, 0x1F, 0xEC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount6[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x30, 0x3F, 0x00, 0x00, 0x2C, 0x1F, 0x20, 0x00, 0x00, 0x27, 0x0C, 0x8A, 0x87, 0xB9, 0xE2, 0xB8, 0xB6, 0xA4, 0xC7, 0xA4, 0xB9, 0xA4, 0xAB, 0xA1, 0xA9, 0x0D, 0x83, 0xB7, 0xAF, 0xA4, 0xCE, 0xCF, 0xC3, 0xA4, 0xCF, 0xC4, 0xB9, 0xA4, 0xAF, 0xA4, 0xCA, 0xA4, 0xEB, 0xA4, 0xAB, 0xA4, 0xE9, 0xA1, 0xAA, 0x69, 0x91, 0xA0, 0x1F, 0xED, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount7[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x2F, 0x3F, 0x00, 0x00, 0x2B, 0x1F, 0x20, 0x00, 0x00, 0x1D, 0x0C, 0x89, 0x87, 0xA1, 0xCA, 0x8A, 0xB0, 0xF0, 0xB3, 0xC0, 0x89, 0xA1, 0xCB, 0x8A, 0xA4, 0xA4, 0xA4, 0xBF, 0xA4, 0xC0, 0xA4, 0xAD, 0xA4, 0xDE, 0xA4, 0xB9, 0x89, 0xA1, 0xA3, 0x1F, 0x20, 0x00, 0x00, 0x04, 0x9D, 0x20, 0x50, 0x0C, 0x1F, 0x9D, 0xA1, 0x1F, 0xF1, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount8[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x1B, 0x3F, 0x00, 0x00, 0x17, 0x1F, 0x20, 0x00, 0x00, 0x12, 0x0C, 0x8A, 0x83, 0xA3, 0xB2, 0xA4, 0xC4, 0xA4, 0xC8, 0xA4, 0xE2, 0xBB, 0xB3, 0xCD, 0xD3, 0x89, 0xA1, 0xA3, 0x88, 0x3B, 0xA1, 0x1F, 0xEA, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount9[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x54, 0x3F, 0x00, 0x00, 0x50, 0x1F, 0x20, 0x00, 0x00, 0x42, 0x0C, 0x8A, 0x87, 0xA4, 0xBD, 0xA4, 0xA6, 0xA4, 0xC7, 0xA4, 0xB9, 0xA4, 0xCD, 0x89, 0xA1, 0xA1, 0x8A, 0xA5, 0xBF, 0xA5, 0xA4, 0xA5, 0xD7, 0xA4, 0xAC, 0xB0, 0xE3, 0xA4, 0xA6, 0x89, 0xA1, 0xA1, 0x8A, 0xA4, 0xB3, 0xA4, 0xC3, 0xA4, 0xC1, 0xA4, 0xAC, 0x89, 0xA1, 0xA1, 0x8A, 0xA5, 0xA6, 0xA5, 0xA9, 0xA5, 0xC3, 0xA5, 0xB7, 0xA5, 0xE5, 0xA5, 0xBF, 0xA5, 0xA4, 0xA5, 0xD7, 0xA4, 0xC7, 0x89, 0xA1, 0xA3, 0x1F, 0x20, 0x00, 0x00, 0x04, 0x9D, 0x20, 0x61, 0x0C, 0x9D, 0x1C, 0xA1, 0x1F, 0xE6, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount10[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x4B, 0x3F, 0x00, 0x00, 0x47, 0x1F, 0x20, 0x00, 0x00, 0x42, 0x0C, 0x8A, 0x87, 0xC2, 0xE7, 0xBE, 0xE6, 0xC9, 0xD7, 0xA4, 0xC7, 0xA4, 0xB9, 0xA4, 0xCD, 0x89, 0xA1, 0xA1, 0x8A, 0xB5, 0xD5, 0xA4, 0xCB, 0xB9, 0xC5, 0xA4, 0xE1, 0xA4, 0xC0, 0xA4, 0xC8, 0x89, 0xA1, 0xA1, 0x8A, 0xBE, 0xAF, 0xA4, 0xB7, 0x89, 0xA1, 0xA1, 0x8A, 0xA5, 0xEC, 0xA5, 0xF3, 0xA5, 0xB8, 0xA4, 0xC7, 0xA5, 0xC1, 0xA5, 0xF3, 0xA4, 0xB7, 0xA4, 0xDE, 0xA4, 0xB9, 0xA4, 0xCD, 0x89, 0xA1, 0xA3, 0x42, 0x05, 0xA1, 0x1F, 0xEE, 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount11[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0x00, 0x00, 0x1A, 0x1F, 0x20, 0x00, 0x00, 0x15, 0x0C, 0x8A, 0x87, 0xA4, 0xAA, 0xC5, 0xB9, 0xA4, 0xC7, 0xC7, 0xE4, 0xA4, 0xC3, 0xA4, 0xC6, 0xA4, 0xC6, 0xA4, 0xE2, 0xFC, 0xA1, 0x93, 0xF3, 0xA1, 0x1F, 0xE4, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount12[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x3D, 0x3F, 0x00, 0x00, 0x39, 0x1F, 0x20, 0x00, 0x00, 0x34, 0x0C, 0x89, 0x87, 0xA1, 0xD6, 0x8A, 0xBF, 0xA8, 0xA4, 0xF3, 0xA4, 0xCA, 0xA4, 0xA4, 0xA4, 0xC7, 0xA4, 0xAF, 0xA4, 0xC0, 0xA4, 0xB5, 0xA4, 0xA4, 0x89, 0xA1, 0xD7, 0x8A, 0xA4, 0xC3, 0xA4, 0xC6, 0x89, 0xA1, 0xA1, 0x8A, 0xBD, 0xF1, 0xA4, 0xA4, 0xA4, 0xC6, 0xA4, 0xA2, 0xA4, 0xEB, 0xA4, 0xCE, 0xA4, 0xCB, 0xFC, 0xA1, 0x36, 0x18, 0xA1, 0x1F, 0xE8, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount13[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x32, 0x3F, 0x00, 0x00, 0x2E, 0x1F, 0x20, 0x00, 0x00, 0x20, 0x0C, 0x8A, 0x87, 0xB9, 0xC5, 0xA4, 0xB5, 0xA4, 0xF2, 0x89, 0xA1, 0xA1, 0x8A, 0xA5, 0xC1, 0xA5, 0xA7, 0xA5, 0xC3, 0xA5, 0xAF, 0xA4, 0xB7, 0xA4, 0xDE, 0xA4, 0xB9, 0xA4, 0xCD, 0x89, 0xA1, 0xA3, 0x1F, 0x20, 0x00, 0x00, 0x04, 0x9D, 0x20, 0x54, 0x0C, 0x0D, 0x00, 0xA1, 0x1F, 0xEA, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount14[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x40, 0x3F, 0x00, 0x00, 0x3C, 0x1F, 0x20, 0x00, 0x00, 0x37, 0x0C, 0x8A, 0x87, 0xA5, 0xD0, 0xA5, 0xEB, 0xA5, 0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xA3, 0x1F, 0x20, 0x00, 0x00, 0x04, 0x9D, 0x20, 0x54, 0x0C, 0x21, 0x82, 0xA0, 0x1F, 0xEE, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount19[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x31, 0x3F, 0x00, 0x00, 0x2D, 0x1F, 0x20, 0x00, 0x00, 0x28, 0x0C, 0x8A, 0x82, 0xA4, 0xB3, 0xA4, 0xCE, 0xC8, 0xD6, 0xC1, 0xC8, 0xA4, 0xCE, 0x89, 0xA1, 0xA1, 0x8A, 0xC0, 0xD0, 0xC5, 0xC4, 0xA5, 0xD7, 0xA5, 0xED, 0xA5, 0xC7, 0xA5, 0xE5, 0xA1, 0xBC, 0xA5, 0xB5, 0xA1, 0xBC, 0xA4, 0xCB, 0x89, 0xA1, 0xA3, 0xA3, 0xFC, 0xA1, 0x1F, 0xE4, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char ccCount20[] = { 0x80, 0xFF, 0xF0, 0x04, 0x00, 0x00, 0x00, 0x58, 0x3F, 0x00, 0x00, 0x54, 0x1F, 0x20, 0x00, 0x00, 0x4F, 0x0C, 0x8A, 0x87, 0xBD, 0xC5, 0xA4, 0xBF, 0xA4, 0xB5, 0xA4, 0xC8, 0xA4, 0xAB, 0x89, 0xA1, 0xA1, 0xA5, 0xD5, 0xA5, 0xEB, 0xA5, 0xDC, 0xA5, 0xC7, 0xA5, 0xA3, 0xA1, 0xBC, 0x8A, 0xA4, 0xDF, 0xA4, 0xBF, 0xA4, 0xA4, 0xA4, 0xCA, 0x89, 0xA1, 0xA1, 0x8A, 0xB8, 0xC0, 0xA4, 0xA4, 0xCA, 0xFD, 0xA4, 0xC0, 0xA4, 0xC8, 0x89, 0xA1, 0xA1, 0xA5, 0xDC, 0xA5, 0xEB, 0xA5, 0xC9, 0xA1, 0xBC, 0x8A, 0xA4, 0xCA, 0xA4, 0xF3, 0xA4, 0xC7, 0xA4, 0xB9, 0xA4, 0xB1, 0xA4, 0xEC, 0xA4, 0xC9, 0xFC, 0xA1, 0xF8, 0x47, 0xA1, 0x1F, 0x60, 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char *ccTestString[21] = { ccCount0, ccCount1, ccCount2, ccCount3, ccCount4, ccCount5, ccCount6, ccCount7, ccCount8, ccCount9, ccCount10, ccCount11, ccCount12, ccCount13, ccCount14, ccCount15, ccCount16, ccCount17, ccCount18, ccCount19, ccCount20, }; const int ccTestSize[21] = { sizeof(ccCount0), sizeof(ccCount1), sizeof(ccCount2), sizeof(ccCount3), sizeof(ccCount4), sizeof(ccCount5), sizeof(ccCount6), sizeof(ccCount7), sizeof(ccCount8), sizeof(ccCount9), sizeof(ccCount10), sizeof(ccCount11), sizeof(ccCount12), sizeof(ccCount13), sizeof(ccCount14), sizeof(ccCount15), sizeof(ccCount16), sizeof(ccCount17), sizeof(ccCount18), sizeof(ccCount19), sizeof(ccCount20) }; void feed_cc(void) { static int idx = 0; if (s_cbPESFilterFunc) { // s_cbPESFilterFunc(Pid, p_buffer, size, p_info); s_cbPESFilterFunc( 0x154, (unsigned char *)ccTestString[idx], ccTestSize[idx], (PESInfo_t *)NULL ); idx++; } } static void _cbPESFilter(int Pid, DS_U8 *p_buffer, int size, PESInfo_t *p_info) { #if (DEBUG_PES_FILTER>2) static int ccCount = 0; int i, j; #ifndef CONV_TO_ASCII #define CONV_TO_ASCII(x) ( ((x) >= ' ' && (x) <= '~') ? (x) : '.' ) #endif //printf("Pid=0x%04X, PTS/DTS: %llx-%llx, flags=0x%08lX\n", Pid, p_info->i_pts, p_info->i_dts, p_info->i_flags); printf("const char ccCount%d[] = {\n", ccCount++); for (i=0; i<((size/16)+1); i++) { for (j=0; j<16; j++) { if ((i*16+j)