void CPatParser::OnTsPacket(byte* tsPacket) { m_packetsReceived++; if (m_packetsReceived > m_packetsToSkip) { for (int i=0; i < (int)m_pmtParsers.size(); ++i) { CPmtParser* parser = m_pmtParsers[i]; parser->OnTsPacket(tsPacket); } CSectionDecoder::OnTsPacket(tsPacket); } if (m_iState==Parsing && m_pCallback!=NULL) { for (int i=0; i < (int)m_pmtParsers.size(); ++i) { CPmtParser* parser = m_pmtParsers[i]; if (true == parser->IsReady()) { CChannelInfo info; if (GetChannel(i, info)) { m_iState=Idle; info.PatVersion = m_iPatTableVersion; m_pCallback->OnNewChannel(info); m_iState = Parsing; return; } } } } }
int CPatParser::Count() { int count = m_pmtParsers.size(); if (count == 0) return 0; for (int i=0; i < (int)m_pmtParsers.size(); ++i) { CPmtParser* parser = m_pmtParsers[i]; if (true == parser->IsReady()) { return count; } } return 0; }
bool CPatParser::GetChannel(int index, CChannelInfo& info) { static CChannelInfo unknownChannel; if (index < 0 || index > Count()) { return false; } CPmtParser* parser = m_pmtParsers[index]; if (false == parser->IsReady()) { return false; } info.PidTable = parser->GetPidInfo(); m_iState = Idle; return true; }