bool BUFEcmCASTB_PrivateDataGot( CDCA_U8 byReqID, CDCA_BOOL bTimeout, CDCA_U16 wPid, const CDCA_U8* pbyData,CDCA_U16 wLen) { // AutoLockT lock(g_hResourceMutex); // 重复的filter 数据,不用往buffer 中存放 if(MyMemCmp(&gSaveEcmRecvData, (char *)pbyData,wLen)) { dxreport("BUFEcmCASSTB_PrivateDataGot recv same data,discard!\n"); return false; } { gSaveEcmRecvData.len = wLen; memcpy(gSaveEcmRecvData.data,pbyData,wLen); } //#define _NO_ECM_BUFFER #ifdef _NO_ECM_BUFFER CDCASTB_PrivateDataGot(byReqID, bTimeout, wPid, pbyData, wLen); return true; #endif //#define _ONLY_ONE_ECM #ifdef _ONLY_ONE_ECN gStbCa.pEcmSendCaMsgRing_->ClearRing(); #endif again: SendToCAMsg *pMsg = gStbCa.pEcmSendCaMsgRing_->BeginPush(); if(pMsg) { pMsg->type = CAMT_PRIVATEDATA_GOT; pMsg->PrivateDataGot_.ReqID = byReqID; pMsg->PrivateDataGot_.pid = wPid; pMsg->PrivateDataGot_.bTimeOut = bTimeout; memcpy(pMsg->PrivateDataGot_.RecvData, pbyData, wLen); pMsg->PrivateDataGot_.RecvDataLen = wLen; gStbCa.pEcmSendCaMsgRing_->EndPush(); } else { dxreport("Warning! Ecm Buffer Ring Overflow!!!,reqID:%d, pid:0x%x\n",byReqID, wPid); // gStbCa.pEcmSendCaMsgRing_->PrintPos("Ecm Ring Overflow"); gStbCa.pEcmSendCaMsgRing_->ClearRing(); goto again; } return true; }
static void conti_rcv_sec_cb(struct get_section_param * param) { UINT8 i; /*call cas callback function*/ struct cas_channel *tmp_channle = (struct cas_channel *)param; if(param->sec_hit_num >= MAX_MV_NUM) return; if(((1<<param->sec_hit_num) & param->mask_value->tb_flt_msk)==0) return; CAS_DMX_PRINTF("data got! req_id:%d, pid: 0x%04x\n", tmp_channle->req_id[param->sec_hit_num], param->pid); CDCASTB_PrivateDataGot(tmp_channle->req_id[param->sec_hit_num], CDCA_TRUE, param->pid, param->buff, param->sec_tbl_len); if (CAS_DMX_ECM_REQUESTID == tmp_channle->req_id[0])//if ECM, release channel { for(i=0; i<MAX_SEC_MASK_LEN; i++) { tmp_channle->mask_value.value[param->sec_hit_num][i] = 0; tmp_channle->mask_value.multi_mask[param->sec_hit_num][i] = 0; } tmp_channle->mask_value.tb_flt_msk &= ~(1<<param->sec_hit_num); } return; }
void STB_SendDataToCaLib() { SendToCAMsg *pMsg = gStbCa.pEcmSendCaMsgRing_->BeginPop(); if(pMsg) { switch(pMsg->type) { case CAMT_PRIVATEDATA_GOT: { CAPrivateDataGot &ref = pMsg->PrivateDataGot_; // if(gStbCa.bSCardStatus_==true ) { // 若发现pid 不符合,请找demux 协助解决,demux 要保证delete filter 后不再有数据上来 // 换台时会清理过滤器 // 这里不能reject, 否则不能更新过滤器 // 换台后,ECM pid 不相同不能进,因为可能是旧的ecm . 频繁换台时出现 if(IsCorrectEcmPid(ref.pid)) { dxreport("ecm SendTo Calib, reqid:%d, pid:0x%x,timeout:%d\n",ref.ReqID,ref.pid,ref.bTimeOut); CDCASTB_PrivateDataGot(ref.ReqID, ref.bTimeOut, ref.pid, ref.RecvData, ref.RecvDataLen); gStbCa.enableEmm_ = true; } else if(ref.pid == 0x10) // 放过nit id { dxreport("SendTo Calib, reqid:%d, pid:0x%x,timeout:%d,v5\n",ref.ReqID,ref.pid,ref.bTimeOut); CDCASTB_PrivateDataGot(ref.ReqID, ref.bTimeOut, ref.pid, ref.RecvData, ref.RecvDataLen); } else { dxreport("pid invalid, discard!"); } } } break; default: ; } gStbCa.pEcmSendCaMsgRing_->EndPop(); return; // 当有ecm 时,就不再处理emm 了,以此提高ecm 优先权(100 ms) } pMsg = gStbCa.pEmmSendCaMsgRing_->BeginPop(); if(pMsg) { switch(pMsg->type) { case CAMT_PRIVATEDATA_GOT: { CAPrivateDataGot &ref = pMsg->PrivateDataGot_; dxreport("emm SendTo Calib, reqid:%d, pid:%d,timeout:%d\n",ref.ReqID,ref.pid,ref.bTimeOut); CDCASTB_PrivateDataGot(ref.ReqID, ref.bTimeOut, ref.pid, ref.RecvData, ref.RecvDataLen); } break; default: ; } gStbCa.pEmmSendCaMsgRing_->EndPop(); // gStbCa.pEmmSendCaMsgRing_->PrintPos("Emm Buffer->Calib"); } }