static void sdt_pid_parse(uint8_t *psi, void *arg) { uint8_t *section; int section_len; struct epgdump_s *epgd = arg; if (!sdt_validate(psi)) return; if (!psi_get_current(psi)) return; if (psi_get_tableid(psi) != SDT_TABLE_ID_ACTUAL) return; section_len = psi_get_length(psi) + PSI_HEADER_SIZE; section = malloc(section_len); if (!section) critical_error("Memory allocation failed\n"); memcpy(section, psi, section_len); if (!psi_table_section(epgd->sdt.sdt_current, section)) return; epgd->sdt.complete = 1; epgd->sdt.original_network_id = sdt_get_onid(epgd->sdt.sdt_current[0]); epgd->sdt.current_ts_id = sdt_get_tsid(epgd->sdt.sdt_current[0]); demux_del_psi_pid(&epgd->demux, SDT_PID); }
static void handle_sdt_section(uint16_t i_pid, uint8_t *p_section) { if (i_pid != SDT_PID || !sdt_validate(p_section)) { printf("<ERROR type=\"invalid_sdt_section\" pid=\"%hu\"/>\n", i_pid); free(p_section); return; } if (!psi_table_section(pp_next_sdt_sections, p_section)) return; handle_sdt(); }