static void handle_ts(Mpegts *ts, uint8_t *pkt) { uint16_t pid = ((pkt[1] & 0x1F) << 8) | pkt[2]; fprintf(stderr, "%02x,%02x,%02x pid %d (pmt = %d)\r\n", pkt[0], pkt[1], pkt[2], pid, ts->pmt); if(pid == 0) handle_pat(ts, pkt); if(pid == ts->pmt) handle_pmt(ts, pkt); }
/***************************************************************************** * handle_section *****************************************************************************/ static void handle_section(uint16_t i_pid, uint8_t *p_section) { uint8_t i_table_id = psi_get_tableid(p_section); if (!psi_validate(p_section)) { printf("<ERROR type=\"invalid_section\" pid=\"%hu\"/>\n", i_pid); free(p_section); return; } switch (i_table_id) { case PAT_TABLE_ID: handle_pat_section(i_pid, p_section); break; case TSDT_TABLE_ID: handle_tsdt_section(i_pid, p_section); break; case PMT_TABLE_ID: handle_pmt(i_pid, p_section); break; case NIT_TABLE_ID_ACTUAL: handle_nit_section(i_pid, p_section); break; case SDT_TABLE_ID_ACTUAL: handle_sdt_section(i_pid, p_section); break; default: free( p_section ); break; } }