Commit b44e4bc9 authored by Johann Hanne's avatar Johann Hanne Committed by Christophe Massiot

* src/tables/eit.c: EIT discontinuities

parent 80aa1be2
...@@ -405,6 +405,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -405,6 +405,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
p_section->p_payload_start[4], p_section->p_payload_start[4],
p_section->p_payload_start[5]); p_section->p_payload_start[5]);
p_eit_decoder->i_last_section_number = p_section->i_last_number; p_eit_decoder->i_last_section_number = p_section->i_last_number;
p_eit_decoder->i_first_received_section_number = p_section->i_number;
} }
/* Fill the section array */ /* Fill the section array */
...@@ -427,6 +428,41 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -427,6 +428,41 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
b_complete = 1; b_complete = 1;
} }
/* As there may be gaps in the section_number fields (see below), we
* have to wait until we have received a section_number twice - this
* is the only way to be sure that a complete table has been sent! */
if(!b_complete &&
p_section->i_number == p_eit_decoder->i_first_received_section_number)
{
for(i = 0; i <= p_eit_decoder->i_last_section_number; i++)
{
if(!p_eit_decoder->ap_sections[i])
break;
if(i == p_eit_decoder->i_last_section_number)
{
b_complete = 1;
break;
}
/* ETSI EN 300 468 V1.5.1 section 5.2.4 says that the EIT
* sections may be structured into a number of segments and
* that there may be a gap in the section_number between
* two segments (but not within a single segment); thus at
* the end of a segment (indicated by
* section_number == segment_last_section_number)
* we have to search for the beginning of the next segment) */
if(i == p_eit_decoder->ap_sections[i]->p_payload_start[4])
{
while(!p_eit_decoder->ap_sections[i + 1] &&
(i + 1 < p_eit_decoder->i_last_section_number))
{
i++;
}
}
}
}
if(b_complete) if(b_complete)
{ {
/* Save the current information */ /* Save the current information */
...@@ -435,9 +471,17 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -435,9 +471,17 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_eit_decoder->i_last_section_number) if(p_eit_decoder->i_last_section_number)
{ {
for(i = 0; i <= p_eit_decoder->i_last_section_number - 1; i++) dvbpsi_psi_section_t * p_prev_section;
p_eit_decoder->ap_sections[i]->p_next =
p_eit_decoder->ap_sections[i + 1]; p_prev_section = p_eit_decoder->ap_sections[0];
for(i = 1; i <= p_eit_decoder->i_last_section_number; i++)
{
if(p_eit_decoder->ap_sections[i] != NULL)
{
p_prev_section->p_next = p_eit_decoder->ap_sections[i];
p_prev_section = p_eit_decoder->ap_sections[i];
}
}
} }
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeEITSections(p_eit_decoder->p_building_eit, dvbpsi_DecodeEITSections(p_eit_decoder->p_building_eit,
......
...@@ -44,6 +44,7 @@ typedef struct dvbpsi_eit_decoder_s ...@@ -44,6 +44,7 @@ typedef struct dvbpsi_eit_decoder_s
int b_current_valid; int b_current_valid;
uint8_t i_last_section_number; uint8_t i_last_section_number;
uint8_t i_first_received_section_number;
dvbpsi_psi_section_t * ap_sections [256]; dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_eit_decoder_t; } dvbpsi_eit_decoder_t;
......
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