예제 #1
0
void CDecodeUtil::AddTSData(BYTE* data)
{
	{
		CTSPacketUtil tsPacket;
		if( tsPacket.Set188TS(data, 188) == TRUE ){
			if( tsPacket.PID == 0x1FFF ){
				return;
			}
			CTSBuffUtil* buffUtil = NULL;

			map<WORD, CTSBuffUtil>::iterator itr;
			itr = this->buffUtilMap.find( tsPacket.PID );
			if( itr == this->buffUtilMap.end() ){
				//まだPIDがないので新規
				buffUtil = &this->buffUtilMap.insert(std::make_pair(tsPacket.PID, CTSBuffUtil())).first->second;
			}else{
				buffUtil = &itr->second;
			}
			if( buffUtil->Add188TS(&tsPacket) == TRUE ){
				BYTE* section = NULL;
				DWORD sectionSize = 0;
				while( buffUtil->GetSectionBuff( &section, &sectionSize ) == TRUE ){
					if( buffUtil->IsPES() == TRUE ){
						continue;
					}
					CPSITable* table;
					BOOL ret;
					switch( CTableUtil::Decode(section, sectionSize, &table) ){
					case CTableUtil::TYPE_PAT:
						ret = CheckPAT(tsPacket.PID, static_cast<CPATTable*>(table));
						break;
					case CTableUtil::TYPE_NIT:
						ret = CheckNIT(tsPacket.PID, static_cast<CNITTable*>(table));
						break;
					case CTableUtil::TYPE_SDT:
						ret = CheckSDT(tsPacket.PID, static_cast<CSDTTable*>(table));
						break;
					case CTableUtil::TYPE_TOT:
						ret = CheckTOT(tsPacket.PID, static_cast<CTOTTable*>(table));
						break;
					case CTableUtil::TYPE_TDT:
						ret = CheckTDT(tsPacket.PID, static_cast<CTDTTable*>(table));
						break;
					case CTableUtil::TYPE_EIT:
						ret = CheckEIT(tsPacket.PID, static_cast<CEITTable*>(table));
						break;
					case CTableUtil::TYPE_BIT:
						ret = CheckBIT(tsPacket.PID, static_cast<CBITTable*>(table));
						break;
					case CTableUtil::TYPE_SIT:
						ret = CheckSIT(tsPacket.PID, static_cast<CSITTable*>(table));
						break;
					case CTableUtil::TYPE_NONE:
						if( section[0] == 0 ){
							_OutputDebugString(L"★pid 0x%04X\r\n", tsPacket.PID);
						}
						ret = TRUE;
						break;
					default:
						ret = FALSE;
						break;
					}
					if( ret == FALSE ){
						delete table;
					}
				}
			}
		}
	}
}
예제 #2
0
파일: DecodeUtil.cpp 프로젝트: PyYoshi/EDCB
void CDecodeUtil::AddTSData(BYTE* data)
{
	{
		CTSPacketUtil tsPacket;
		if( tsPacket.Set188TS(data, 188) == TRUE ){
			if( tsPacket.PID == 0x1FFF ){
				return;
			}
			CTSBuffUtil* buffUtil = NULL;

			map<WORD, CTSBuffUtil*>::iterator itr;
			itr = this->buffUtilMap.find( tsPacket.PID );
			if( itr == this->buffUtilMap.end() ){
				//まだPIDがないので新規
				buffUtil = new CTSBuffUtil;
				this->buffUtilMap.insert(pair<WORD, CTSBuffUtil*>(tsPacket.PID, buffUtil));
			}else{
				buffUtil = itr->second;
			}
			if( buffUtil->Add188TS(&tsPacket) == TRUE ){
				BYTE* section = NULL;
				DWORD sectionSize = 0;
				while( buffUtil->GetSectionBuff( &section, &sectionSize ) == TRUE ){
					if( buffUtil->IsPES() == TRUE ){
						continue;
					}
					CTableUtil tableUtil;

					vector<TABLE_DATA*> tableList;
					DWORD decodeReadSize = 0;
					if( tableUtil.Decode(section, sectionSize, &tableList, &decodeReadSize) == TRUE ){
						for( size_t j=0; j<tableList.size(); j++ ){
							if( tableList[j]->PATTable != NULL ){
								if( CheckPAT(tsPacket.PID, tableList[j]->PATTable) == TRUE ){
									tableList[j]->PATTable = NULL;
								}
							}else if( tableList[j]->CATTable != NULL ){
								if( CheckCAT(tsPacket.PID, tableList[j]->CATTable) == TRUE ){
									tableList[j]->CATTable = NULL;
								}
							}else if( tableList[j]->PMTTable != NULL ){
								if( CheckPMT(tsPacket.PID, tableList[j]->PMTTable) == TRUE ){
									tableList[j]->PMTTable = NULL;
								}
							}else if( tableList[j]->NITTable != NULL ){
								if( CheckNIT(tsPacket.PID, tableList[j]->NITTable) == TRUE ){
									tableList[j]->NITTable = NULL;
								}
							}else if( tableList[j]->SDTTable != NULL ){
								if( CheckSDT(tsPacket.PID, tableList[j]->SDTTable) == TRUE ){
									tableList[j]->SDTTable = NULL;
								}
							}else if( tableList[j]->TOTTable != NULL ){
								if( CheckTOT(tsPacket.PID, tableList[j]->TOTTable) == TRUE ){
									tableList[j]->TOTTable = NULL;
								}
							}else if( tableList[j]->TDTTable != NULL ){
								if( CheckTDT(tsPacket.PID, tableList[j]->TDTTable) == TRUE ){
									tableList[j]->TDTTable = NULL;
								}
							}else if( tableList[j]->EITTable != NULL ){
								if( CheckEIT(tsPacket.PID, tableList[j]->EITTable) == TRUE ){
									tableList[j]->EITTable = NULL;
								}
							}else if( tableList[j]->CDTTable != NULL ){
								if( CheckCDT(tsPacket.PID, tableList[j]->CDTTable) == TRUE ){
									tableList[j]->CDTTable = NULL;
								}
							}else if( tableList[j]->SDTTTable != NULL ){
								if( CheckSDTT(tsPacket.PID, tableList[j]->SDTTTable) == TRUE ){
									tableList[j]->SDTTTable = NULL;
								}
							}else if( tableList[j]->BITTable != NULL ){
								if( CheckBIT(tsPacket.PID, tableList[j]->BITTable) == TRUE ){
									tableList[j]->BITTable = NULL;
								}
							}else if( tableList[j]->SITTable != NULL ){
								if( CheckSIT(tsPacket.PID, tableList[j]->SITTable) == TRUE ){
									tableList[j]->SITTable = NULL;
								}
							}else if( tableList[j]->EITTable_SD != NULL ){
								if( CheckEIT_SD(tsPacket.PID, tableList[j]->EITTable_SD) == TRUE ){
									tableList[j]->EITTable_SD = NULL;
								}
							}else if( tableList[j]->EITTable_SD2 != NULL ){
								if( CheckEIT_SD2(tsPacket.PID, tableList[j]->EITTable_SD2) == TRUE ){
									tableList[j]->EITTable_SD2 = NULL;
								}
							}
							SAFE_DELETE(tableList[j]);
						}
					}else{
						if( section[0] == 0 ){
							_OutputDebugString(L"★pid 0x%04X\r\n", tsPacket.PID);
						}
					}
				}
			}
		}
	}
}