Commit abdd7cf4 authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/dvbpsi.c: TDT carries no CRC_32

TDT carries no CRC_32, thus exclude it from validating CRC_32.
parent d0ba55f6
...@@ -374,7 +374,8 @@ bool dvbpsi_PushPacket(dvbpsi_t *handle, uint8_t* p_data) ...@@ -374,7 +374,8 @@ bool dvbpsi_PushPacket(dvbpsi_t *handle, uint8_t* p_data)
if (p_section->b_syntax_indicator) if (p_section->b_syntax_indicator)
p_section->p_payload_end -= 4; p_section->p_payload_end -= 4;
if (p_section->p_data[0] != 0x72 && dvbpsi_ValidPSISection(p_section)) if ((p_section->p_data[0] == 0x70) /* TDT (has no CRC 32) */ ||
(p_section->p_data[0] != 0x72 && dvbpsi_ValidPSISection(p_section)))
{ {
/* PSI section is valid */ /* PSI section is valid */
p_section->i_table_id = p_section->p_data[0]; p_section->i_table_id = p_section->p_data[0];
......
...@@ -147,6 +147,7 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -147,6 +147,7 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint64_t i_utc_time) void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint64_t i_utc_time)
{ {
p_tot->i_crc = 0;
p_tot->i_utc_time = i_utc_time; p_tot->i_utc_time = i_utc_time;
p_tot->p_first_descriptor = NULL; p_tot->p_first_descriptor = NULL;
} }
...@@ -241,7 +242,7 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, ...@@ -241,7 +242,7 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
| ((uint64_t)p_section->p_payload_start[3] << 8) | ((uint64_t)p_section->p_payload_start[3] << 8)
| (uint64_t)p_section->p_payload_start[4]); | (uint64_t)p_section->p_payload_start[4]);
else else
dvbpsi_error(p_dvbpsi, "TOT decoder", "failed decoding section"); dvbpsi_error(p_dvbpsi, "TOT/TDT decoder", "failed decoding section");
/* Decode the section */ /* Decode the section */
dvbpsi_DecodeTOTSections(p_dvbpsi, p_building_tot, p_section); dvbpsi_DecodeTOTSections(p_dvbpsi, p_building_tot, p_section);
...@@ -258,9 +259,9 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, ...@@ -258,9 +259,9 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
*****************************************************************************/ *****************************************************************************/
static bool dvbpsi_ValidTOTSection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section) static bool dvbpsi_ValidTOTSection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
{ {
if (p_section->i_table_id != 0x73) if (p_section->i_table_id == 0x70)
{ {
/* A TDT always has a length of 5 bytes (which is only the UTC time) */ /* A TDT (table_id 0x70) always has a length of 5 bytes (which is only the UTC time) */
if (p_section->i_length != 5) if (p_section->i_length != 5)
{ {
dvbpsi_error(p_dvbpsi, "TDT/TOT decoder", dvbpsi_error(p_dvbpsi, "TDT/TOT decoder",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment