Commit 57c6cd63 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Replace p_decoder->ap_sections[256] array with a linked list.

The member p_decoder->ap_sections[256] is replaced by p_decoder->p_sections.
This is a pointer to a linked list, which makes the dvbpsi_decoder_section_chain()
function obsolete.
parent d4b49067
......@@ -45,7 +45,6 @@
#include "dvbpsi_private.h"
#include "psi.h"
/*****************************************************************************
* dvbpsi_crc32_table
*****************************************************************************
......@@ -189,9 +188,7 @@ dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather,
p_decoder->b_current_valid = false;
p_decoder->i_last_section_number = 0;
for (unsigned int i = 0; i <= 255; i++)
p_decoder->ap_sections[i] = NULL;
p_decoder->p_sections = NULL;
p_decoder->b_complete_header = false;
return p_decoder;
......@@ -209,14 +206,8 @@ void dvbpsi_decoder_reset(dvbpsi_decoder_t* p_decoder, const bool b_force)
p_decoder->b_current_valid = false;
/* Clear the section array */
for (unsigned int i = 0; i <= 255; i++)
{
if (p_decoder->ap_sections[i] != NULL)
{
dvbpsi_DeletePSISections(p_decoder->ap_sections[i]);
p_decoder->ap_sections[i] = NULL;
}
}
dvbpsi_DeletePSISections(p_decoder->p_sections);
p_decoder->p_sections = NULL;
}
/*****************************************************************************
......@@ -229,50 +220,65 @@ bool dvbpsi_decoder_sections_completed(dvbpsi_decoder_t* p_decoder)
bool b_complete = false;
for (unsigned int i = 0; i <= p_decoder->i_last_section_number &&
i <= 255; i++)
dvbpsi_psi_section_t *p = p_decoder->p_sections;
while (p)
{
if (!p_decoder->ap_sections[i])
break;
if (i == p_decoder->i_last_section_number)
if (p_decoder->i_last_section_number == p->i_number)
b_complete = true;
p = p->p_next;
}
return b_complete;
}
/*****************************************************************************
* dvbpsi_decoder_sections_chain
* dvbpsi_decoder_psi_section_add
*****************************************************************************/
void dvbpsi_decoder_sections_chain(dvbpsi_decoder_t *p_decoder)
bool dvbpsi_decoder_psi_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section)
{
assert(p_decoder);
assert(p_decoder->i_last_section_number <= 255);
assert(p_section);
if (p_decoder->i_last_section_number)
if (!p_decoder->p_sections)
{
for (uint8_t i = 0; i <= p_decoder->i_last_section_number - 1 &&
i <= 255; i++)
p_decoder->ap_sections[i]->p_next = p_decoder->ap_sections[i + 1];
p_decoder->p_sections = p_section;
return false;
}
}
/*****************************************************************************
* dvbpsi_decoder_section_add
*****************************************************************************/
bool dvbpsi_decoder_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section)
{
assert(p_decoder);
assert(p_section);
/* Insert in right place */
dvbpsi_psi_section_t *p = p_decoder->p_sections;
dvbpsi_psi_section_t *p_prev = p;
bool b_overwrite = false;
if (p_decoder->ap_sections[p_section->i_number] != NULL)
while (p)
{
if (p->i_number == p_section->i_number)
{
/* Replace */
p_prev->p_next = p_section;
p_section->p_next = p->p_next;
p->p_next = NULL;
dvbpsi_DeletePSISections(p);
b_overwrite = true;
break;
}
else if (p->i_number > p_section->i_number)
{
/* Insert */
p_prev->p_next = p_section;
p_section->p_next = p;
break;
}
p_prev = p;
p = p->p_next;
}
/* Add to end of list */
if (p_prev->i_number < p_section->i_number)
{
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
b_overwrite = true;
p_prev->p_next = p_section;
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return b_overwrite;
}
......@@ -284,11 +290,10 @@ void dvbpsi_decoder_delete(dvbpsi_decoder_t *p_decoder)
{
assert(p_decoder);
for (unsigned int i = 0; i <= 255; i++)
if (p_decoder->p_sections)
{
if (p_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_decoder->ap_sections[i]);
p_decoder->ap_sections[i] = NULL;
dvbpsi_DeletePSISections(p_decoder->p_sections);
p_decoder->p_sections = NULL;
}
dvbpsi_DeletePSISections(p_decoder->p_current_section);
......
......@@ -204,7 +204,7 @@ typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi, /*!< pointer to d
dvbpsi_psi_section_t *p_current_section; /*!< Current section */ \
bool b_current_valid; /*!< Current valid indicator */ \
uint8_t i_last_section_number;/*!< Last received section number */ \
dvbpsi_psi_section_t *ap_sections[256]; /*!< Array of received PSI sections */ \
dvbpsi_psi_section_t *p_sections; /*!< List of received PSI sections */ \
int i_need; /*!< Bytes needed */ \
bool b_complete_header; /*!< Flag for header completion */
......@@ -273,27 +273,16 @@ void dvbpsi_decoder_reset(dvbpsi_decoder_t* p_decoder, const bool b_force);
bool dvbpsi_decoder_sections_completed(dvbpsi_decoder_t* p_decoder);
/*****************************************************************************
* dvbpsi_decoder_sections_chain
* dvbpsi_decoder_psi_section_add
*****************************************************************************/
/*!
* \fn void dvbpsi_decoder_sections_chain(dvbpsi_decoder_t *p_decoder);
* \brief Chain the sections if the last has been received.
* \fn bool dvbpsi_decoder_psi_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
* \brief Add a section to the dvbpsi_decoder_t::p_sections list.
* \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \return nothing
*/
void dvbpsi_decoder_sections_chain(dvbpsi_decoder_t *p_decoder);
/*****************************************************************************
* dvbpsi_decoder_section_add
*****************************************************************************/
/*!
* \fn bool dvbpsi_decoder_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
* \brief Add a section to the dvbpsi_decoder_t::ap_sections[] array.
* \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \param p_section PSI section to add to dvbpsi_decoder_t::ap_sections[] array
* \param p_section PSI section to add to dvbpsi_decoder_t::p_sections list
* \return true if it overwrites a earlier section, false otherwise
*/
bool dvbpsi_decoder_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
bool dvbpsi_decoder_psi_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
/*****************************************************************************
* dvbpsi_decoder_present
......
......@@ -359,7 +359,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t *
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC EIT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -465,14 +465,12 @@ static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi,
/* Save the current information */
p_eit_decoder->current_eit = *p_eit_decoder->p_building_eit;
p_eit_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_eit_decoder));
/* Decode the sections */
dvbpsi_atsc_DecodeEITSections(p_eit_decoder->p_building_eit,
p_eit_decoder->ap_sections[0]);
p_eit_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[0]);
p_eit_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_eit_decoder->p_sections);
p_eit_decoder->p_sections = NULL;
/* signal the new EIT */
p_eit_decoder->pf_eit_callback(p_eit_decoder->p_cb_data,
p_eit_decoder->p_building_eit);
......
......@@ -303,7 +303,7 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC ETT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -387,14 +387,12 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi,
/* Save the current information */
p_ett_decoder->current_ett = *p_ett_decoder->p_building_ett;
p_ett_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_ett_decoder));
/* Decode the sections */
dvbpsi_atsc_DecodeETTSections(p_ett_decoder->p_building_ett,
p_ett_decoder->ap_sections[0]);
p_ett_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_ett_decoder->ap_sections[0]);
p_ett_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_ett_decoder->p_sections);
p_ett_decoder->p_sections = NULL;
/* signal the new ETT */
p_ett_decoder->pf_ett_callback(p_ett_decoder->p_cb_data,
p_ett_decoder->p_building_ett);
......
......@@ -389,7 +389,7 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t *
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC MGT decoder", "overwrite section number %d",
p_section->i_number);
return true;
......@@ -494,14 +494,12 @@ static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi,
/* Save the current information */
p_mgt_decoder->current_mgt = *p_mgt_decoder->p_building_mgt;
p_mgt_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_mgt_decoder));
/* Decode the sections */
dvbpsi_atsc_DecodeMGTSections(p_mgt_decoder->p_building_mgt,
p_mgt_decoder->ap_sections[0]);
p_mgt_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_mgt_decoder->ap_sections[0]);
p_mgt_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_mgt_decoder->p_sections);
p_mgt_decoder->p_sections = NULL;
/* signal the new MGT */
p_mgt_decoder->pf_mgt_callback(p_mgt_decoder->p_cb_data,
p_mgt_decoder->p_building_mgt);
......
......@@ -288,7 +288,7 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t *
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC STT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -394,15 +394,12 @@ static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_stt_decoder->current_stt = *p_stt_decoder->p_building_stt;
p_stt_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_stt_decoder));
/* Decode the sections */
dvbpsi_atsc_DecodeSTTSections(p_stt_decoder->p_building_stt,
p_stt_decoder->ap_sections[0]);
p_stt_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_stt_decoder->ap_sections[0]);
p_stt_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_stt_decoder->p_sections);
p_stt_decoder->p_sections = NULL;
/* signal the new STT */
p_stt_decoder->pf_stt_callback(p_stt_decoder->p_cb_data,
p_stt_decoder->p_building_stt);
......
......@@ -427,7 +427,7 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_vct_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_vct_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC VCT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -531,15 +531,12 @@ static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_vct_decoder->current_vct = *p_vct_decoder->p_building_vct;
p_vct_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_vct_decoder));
/* Decode the sections */
dvbpsi_atsc_DecodeVCTSections(p_vct_decoder->p_building_vct,
p_vct_decoder->ap_sections[0]);
p_vct_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_vct_decoder->ap_sections[0]);
p_vct_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_vct_decoder->p_sections);
p_vct_decoder->p_sections = NULL;
/* signal the new VCT */
p_vct_decoder->pf_vct_callback(p_vct_decoder->p_cb_data,
p_vct_decoder->p_building_vct);
......
......@@ -346,7 +346,7 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_bat_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_bat_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "BAT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -441,14 +441,12 @@ void dvbpsi_bat_sections_gather(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_bat_decoder->current_bat = *p_bat_decoder->p_building_bat;
p_bat_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_bat_decoder));
/* Decode the sections */
dvbpsi_bat_sections_decode(p_bat_decoder->p_building_bat,
p_bat_decoder->ap_sections[0]);
p_bat_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[0]);
p_bat_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_bat_decoder->p_sections);
p_bat_decoder->p_sections = NULL;
/* signal the new BAT */
p_bat_decoder->pf_bat_callback(p_bat_decoder->p_cb_data,
p_bat_decoder->p_building_bat);
......
......@@ -244,7 +244,7 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "CAT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -320,14 +320,12 @@ void dvbpsi_cat_sections_gather(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_cat_decoder->current_cat = *p_cat_decoder->p_building_cat;
p_cat_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_cat_decoder));
/* Decode the sections */
dvbpsi_cat_sections_decode(p_cat_decoder->p_building_cat,
p_cat_decoder->ap_sections[0]);
p_cat_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_cat_decoder->ap_sections[0]);
p_cat_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_cat_decoder->p_sections);
p_cat_decoder->p_sections = NULL;
/* signal the new CAT */
p_cat_decoder->pf_cat_callback(p_cat_decoder->p_cb_data,
p_cat_decoder->p_building_cat);
......
......@@ -327,12 +327,10 @@ static bool dvbpsi_IsCompleteEIT(dvbpsi_eit_decoder_t* p_eit_decoder, dvbpsi_psi
(p_eit_decoder->i_first_received_section_number == 0 &&
p_section->i_number == p_eit_decoder->i_last_section_number))
{
for (unsigned int i = 0; i <= p_eit_decoder->i_last_section_number; i++)
dvbpsi_psi_section_t *p = p_eit_decoder->p_sections;
while (p)
{
if (!p_eit_decoder->ap_sections[i])
break;
if (i == p_eit_decoder->i_last_section_number)
if (p->i_number == p_eit_decoder->i_last_section_number)
{
b_complete = true;
break;
......@@ -345,14 +343,16 @@ static bool dvbpsi_IsCompleteEIT(dvbpsi_eit_decoder_t* p_eit_decoder, dvbpsi_psi
* 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])
if (p->i_number == p->p_payload_start[4])
{
while (!p_eit_decoder->ap_sections[i + 1] &&
(i + 1 < p_eit_decoder->i_last_section_number))
while (!p->p_next &&
(p->p_next->i_number < p_eit_decoder->i_last_section_number))
{
i++;
p = p->p_next;
}
}
p = p->p_next;
}
}
......@@ -388,7 +388,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_eit_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_eit_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "EIT decoder",
"overwrite section number %d", p_section->i_number);
......@@ -473,23 +473,19 @@ void dvbpsi_eit_sections_gather(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_
p_eit_decoder->current_eit = *p_eit_decoder->p_building_eit;
p_eit_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_eit_decoder));
/* Decode the sections */
dvbpsi_eit_sections_decode(p_eit_decoder->p_building_eit, p_eit_decoder->ap_sections[0]);
dvbpsi_eit_sections_decode(p_eit_decoder->p_building_eit,
p_eit_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[0]);
p_eit_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_eit_decoder->p_sections);
p_eit_decoder->p_sections = NULL;
/* signal the new EIT */
p_eit_decoder->pf_eit_callback(p_eit_decoder->p_cb_data, p_eit_decoder->p_building_eit);
/* Reinitialize the structures */
p_eit_decoder->p_building_eit = NULL;
for (unsigned int i = 0; i <= p_eit_decoder->i_last_section_number; i++)
p_eit_decoder->ap_sections[i] = NULL;
}
}
......
......@@ -339,7 +339,7 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_nit_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_nit_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "NIT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -428,15 +428,12 @@ void dvbpsi_nit_sections_gather(dvbpsi_t *p_dvbpsi,
p_nit_decoder->current_nit = *p_nit_decoder->p_building_nit;
p_nit_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_nit_decoder));
/* Decode the sections */
dvbpsi_nit_sections_decode(p_nit_decoder->p_building_nit,
p_nit_decoder->ap_sections[0]);
p_nit_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[0]);
p_nit_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_nit_decoder->p_sections);
p_nit_decoder->p_sections = NULL;
/* signal the new NIT */
p_nit_decoder->pf_nit_callback(p_nit_decoder->p_cb_data,
p_nit_decoder->p_building_nit);
......
......@@ -255,7 +255,7 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_pat_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_pat_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "PAT decoder", "overwrite section number %d",
p_section->i_number);
return true;
......@@ -330,16 +330,13 @@ void dvbpsi_pat_sections_gather(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sect
p_pat_decoder->current_pat = *p_pat_decoder->p_building_pat;
p_pat_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_pat_decoder));
/* Decode the sections */
dvbpsi_pat_sections_decode(p_pat_decoder->p_building_pat,
p_pat_decoder->ap_sections[0]);
p_pat_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_pat_decoder->ap_sections[0]);
p_pat_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_pat_decoder->p_sections);
p_pat_decoder->p_sections = NULL;
/* signal the new PAT */
p_pat_decoder->pf_pat_callback(p_pat_decoder->p_cb_data,
......
......@@ -307,7 +307,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_pmt_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_pmt_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "PMT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -390,14 +390,12 @@ void dvbpsi_pmt_sections_gather(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sect
/* Save the current information */
p_pmt_decoder->current_pmt = *p_pmt_decoder->p_building_pmt;
p_pmt_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_pmt_decoder));
/* Decode the sections */
dvbpsi_pmt_sections_decode(p_pmt_decoder->p_building_pmt,
p_pmt_decoder->ap_sections[0]);
p_pmt_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_pmt_decoder->ap_sections[0]);
p_pmt_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_pmt_decoder->p_sections);
p_pmt_decoder->p_sections = NULL;
/* signal the new PMT */
p_pmt_decoder->pf_pmt_callback(p_pmt_decoder->p_cb_data,
p_pmt_decoder->p_building_pmt);
......
......@@ -290,7 +290,7 @@ static bool dvbpsi_rst_section_add(dvbpsi_t *p_dvbpsi, dvbpsi_rst_decoder_t *p_d
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "RST decoder", "overwrite section number %d",
p_section->i_number);
......@@ -385,14 +385,12 @@ void dvbpsi_rst_sections_gather(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_rst_decoder->current_rst = *p_rst_decoder->p_building_rst;
p_rst_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_rst_decoder));
/* Decode the sections */
dvbpsi_rst_sections_decode(p_rst_decoder->p_building_rst,
p_rst_decoder->ap_sections[0]);
p_rst_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_rst_decoder->ap_sections[0]);
p_rst_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_rst_decoder->p_sections);
p_rst_decoder->p_sections = NULL;
/* signal the new CAT */
p_rst_decoder->pf_rst_callback(p_rst_decoder->p_cb_data,
p_rst_decoder->p_building_rst);
......
......@@ -329,7 +329,7 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_sdt_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_sdt_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -407,14 +407,12 @@ void dvbpsi_sdt_sections_gather(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_sdt_decoder->current_sdt = *p_sdt_decoder->p_building_sdt;
p_sdt_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_sdt_decoder));
/* Decode the sections */
dvbpsi_sdt_sections_decode(p_sdt_decoder->p_building_sdt,
p_sdt_decoder->ap_sections[0]);
p_sdt_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_sdt_decoder->ap_sections[0]);
p_sdt_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_sdt_decoder->p_sections);
p_sdt_decoder->p_sections = NULL;
/* signal the new SDT */
p_sdt_decoder->pf_sdt_callback(p_sdt_decoder->p_cb_data,
p_sdt_decoder->p_building_sdt);
......
......@@ -313,7 +313,7 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_sis_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_sis_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -399,14 +399,12 @@ void dvbpsi_sis_sections_gather(dvbpsi_t *p_dvbpsi,
/* Save the current information */
p_sis_decoder->current_sis = *p_sis_decoder->p_building_sis;
p_sis_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_sis_decoder));
/* Decode the sections */
dvbpsi_sis_sections_decode(p_dvbpsi, p_sis_decoder->p_building_sis,
p_sis_decoder->ap_sections[0]);
p_sis_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_sis_decoder->ap_sections[0]);
p_sis_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_sis_decoder->p_sections);
p_sis_decoder->p_sections = NULL;
/* signal the new SDT */
p_sis_decoder->pf_sis_callback(p_sis_decoder->p_cb_data,
p_sis_decoder->p_building_sis);
......
......@@ -291,7 +291,7 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot
}
/* Fill the section array */
if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_tot_decoder), p_section))
if (dvbpsi_decoder_psi_section_add(DVBPSI_DECODER(p_tot_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "TOT decoder", "overwrite section number %d",
p_section->i_number);
......@@ -377,14 +377,13 @@ void dvbpsi_tot_sections_gather(dvbpsi_t* p_dvbpsi,
/* Save the current information */
p_tot_decoder->current_tot = *p_tot_decoder->p_building_tot;
p_tot_decoder->b_current_valid = true;
/* Chain the sections */
dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_tot_decoder));
/* Decode the sections */
dvbpsi_tot_sections_decode(p_dvbpsi, p_tot_decoder->p_building_tot,
p_tot_decoder->ap_sections[0]);
p_tot_decoder->p_sections);
/* Delete the sections */
dvbpsi_DeletePSISections(p_tot_decoder->ap_sections[0]);
p_tot_decoder->ap_sections[0] = NULL;
dvbpsi_DeletePSISections(p_tot_decoder->p_sections);
p_tot_decoder->p_sections = NULL;
/* signal the new TOT */
p_tot_decoder->pf_tot_callback(p_tot_decoder->p_cb_data,
p_tot_decoder->p_building_tot);
......
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