Commit 551e2865 authored by Jean-Paul Saman's avatar Jean-Paul Saman

New utility function dvbpsi_ReInitDecoder().

Add a function to reinit a decoder as is needed by PSI decoders.
parent 61a0d7c4
...@@ -196,6 +196,28 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, ...@@ -196,6 +196,28 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
return p_decoder; return p_decoder;
} }
/*****************************************************************************
* dvbpsi_ReinitDecoder
*****************************************************************************/
void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force)
{
assert(p_decoder);
/* Force redecoding */
if (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_DeleteDecoder * dvbpsi_DeleteDecoder
*****************************************************************************/ *****************************************************************************/
......
...@@ -246,6 +246,19 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, ...@@ -246,6 +246,19 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
*/ */
void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder); void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder);
/*****************************************************************************
* dvbpsi_ReinitDecoder
*****************************************************************************/
/*!
* \fn void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force);
* \brief Reinit a decoder.
* \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \param b_force If 'b_force' is true then dvbpsi_decoder_t::b_current_valid
* is set to false, invalidating the current section.
* \return nothing
*/
void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force);
/***************************************************************************** /*****************************************************************************
* dvbpsi_HasDecoder * dvbpsi_HasDecoder
*****************************************************************************/ *****************************************************************************/
......
...@@ -295,26 +295,16 @@ static void dvbpsi_ReInitEIT(dvbpsi_atsc_eit_decoder_t *p_decoder, const bool b_ ...@@ -295,26 +295,16 @@ static void dvbpsi_ReInitEIT(dvbpsi_atsc_eit_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_eit) if (p_decoder->p_building_eit)
dvbpsi_atsc_DeleteEIT(p_decoder->p_building_eit); dvbpsi_atsc_DeleteEIT(p_decoder->p_building_eit);
} }
p_decoder->p_building_eit = NULL; p_decoder->p_building_eit = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t *p_decoder, static bool dvbpsi_CheckEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t *p_decoder,
......
...@@ -227,26 +227,16 @@ static void dvbpsi_ReInitETT(dvbpsi_atsc_ett_decoder_t *p_decoder, const bool b_ ...@@ -227,26 +227,16 @@ static void dvbpsi_ReInitETT(dvbpsi_atsc_ett_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_ett) if (p_decoder->p_building_ett)
dvbpsi_atsc_DeleteETT(p_decoder->p_building_ett); dvbpsi_atsc_DeleteETT(p_decoder->p_building_ett);
} }
p_decoder->p_building_ett = NULL; p_decoder->p_building_ett = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *p_decoder, static bool dvbpsi_CheckETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *p_decoder,
......
...@@ -325,26 +325,16 @@ static void dvbpsi_ReInitMGT(dvbpsi_atsc_mgt_decoder_t *p_decoder, const bool b_ ...@@ -325,26 +325,16 @@ static void dvbpsi_ReInitMGT(dvbpsi_atsc_mgt_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_mgt) if (p_decoder->p_building_mgt)
dvbpsi_atsc_DeleteMGT(p_decoder->p_building_mgt); dvbpsi_atsc_DeleteMGT(p_decoder->p_building_mgt);
} }
p_decoder->p_building_mgt = NULL; p_decoder->p_building_mgt = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t *p_decoder, static bool dvbpsi_CheckMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t *p_decoder,
......
...@@ -234,26 +234,16 @@ static void dvbpsi_ReInitSTT(dvbpsi_atsc_stt_decoder_t *p_decoder, const bool b_ ...@@ -234,26 +234,16 @@ static void dvbpsi_ReInitSTT(dvbpsi_atsc_stt_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_stt) if (p_decoder->p_building_stt)
dvbpsi_atsc_DeleteSTT(p_decoder->p_building_stt); dvbpsi_atsc_DeleteSTT(p_decoder->p_building_stt);
} }
p_decoder->p_building_stt = NULL; p_decoder->p_building_stt = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t *p_decoder, static bool dvbpsi_CheckSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t *p_decoder,
......
...@@ -364,26 +364,16 @@ static void dvbpsi_ReInitVCT(dvbpsi_atsc_vct_decoder_t *p_decoder, const bool b_ ...@@ -364,26 +364,16 @@ static void dvbpsi_ReInitVCT(dvbpsi_atsc_vct_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_vct) if (p_decoder->p_building_vct)
dvbpsi_atsc_DeleteVCT(p_decoder->p_building_vct); dvbpsi_atsc_DeleteVCT(p_decoder->p_building_vct);
} }
p_decoder->p_building_vct = NULL; p_decoder->p_building_vct = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *p_vct_decoder, static bool dvbpsi_CheckVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *p_vct_decoder,
......
...@@ -285,26 +285,16 @@ static void dvbpsi_ReInitBAT(dvbpsi_bat_decoder_t* p_decoder, const bool b_force ...@@ -285,26 +285,16 @@ static void dvbpsi_ReInitBAT(dvbpsi_bat_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_bat) if (p_decoder->p_building_bat)
dvbpsi_DeleteBAT(p_decoder->p_building_bat); dvbpsi_DeleteBAT(p_decoder->p_building_bat);
} }
p_decoder->p_building_bat = NULL; p_decoder->p_building_bat = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat_decoder, static bool dvbpsi_CheckBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat_decoder,
......
...@@ -172,30 +172,20 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, ...@@ -172,30 +172,20 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat,
} }
/* */ /* */
static void dvbpsi_ReInitCAT(dvbpsi_cat_decoder_t* p_cat_decoder, const bool b_force) static void dvbpsi_ReInitCAT(dvbpsi_cat_decoder_t* p_decoder, const bool b_force)
{ {
assert(p_cat_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_cat_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_cat_decoder->p_building_cat) if (p_decoder->p_building_cat)
dvbpsi_DeleteCAT(p_cat_decoder->p_building_cat); dvbpsi_DeleteCAT(p_decoder->p_building_cat);
}
p_cat_decoder->p_building_cat = NULL;
/* Clear the section array */
for (unsigned int i = 0; i <= 255; i++)
{
if (p_cat_decoder->ap_sections[i] != NULL)
{
dvbpsi_DeletePSISections(p_cat_decoder->ap_sections[i]);
p_cat_decoder->ap_sections[i] = NULL;
}
} }
p_decoder->p_building_cat = NULL;
} }
static bool dvbpsi_CheckCAT(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section) static bool dvbpsi_CheckCAT(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section)
......
...@@ -263,26 +263,15 @@ static void dvbpsi_ReInitEIT(dvbpsi_eit_decoder_t* p_decoder, const bool b_force ...@@ -263,26 +263,15 @@ static void dvbpsi_ReInitEIT(dvbpsi_eit_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
/* Force redecoding */ dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_eit) if (p_decoder->p_building_eit)
dvbpsi_DeleteEIT(p_decoder->p_building_eit); dvbpsi_DeleteEIT(p_decoder->p_building_eit);
} }
p_decoder->p_building_eit = NULL; p_decoder->p_building_eit = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit_decoder, static bool dvbpsi_CheckEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit_decoder,
......
...@@ -282,26 +282,16 @@ static void dvbpsi_ReInitNIT(dvbpsi_nit_decoder_t* p_decoder, const bool b_force ...@@ -282,26 +282,16 @@ static void dvbpsi_ReInitNIT(dvbpsi_nit_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_nit) if (p_decoder->p_building_nit)
dvbpsi_DeleteNIT(p_decoder->p_building_nit); dvbpsi_DeleteNIT(p_decoder->p_building_nit);
} }
p_decoder->p_building_nit = NULL; p_decoder->p_building_nit = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit_decoder, static bool dvbpsi_CheckNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit_decoder,
......
...@@ -183,30 +183,20 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, ...@@ -183,30 +183,20 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat,
} }
/* */ /* */
static void dvbpsi_ReInitPAT(dvbpsi_pat_decoder_t* p_pat_decoder, const bool b_force) static void dvbpsi_ReInitPAT(dvbpsi_pat_decoder_t* p_decoder, const bool b_force)
{ {
assert(p_pat_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_pat_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_pat_decoder->p_building_pat) if (p_decoder->p_building_pat)
dvbpsi_DeletePAT(p_pat_decoder->p_building_pat); dvbpsi_DeletePAT(p_decoder->p_building_pat);
}
p_pat_decoder->p_building_pat = NULL;
/* Clear the section array */
for (unsigned int i = 0; i <= 255; i++)
{
if (p_pat_decoder->ap_sections[i] != NULL)
{
dvbpsi_DeletePSISections(p_pat_decoder->ap_sections[i]);
p_pat_decoder->ap_sections[i] = NULL;
}
} }
p_decoder->p_building_pat = NULL;
} }
static bool dvbpsi_CheckPAT(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section) static bool dvbpsi_CheckPAT(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section)
......
...@@ -249,26 +249,16 @@ static void dvbpsi_ReInitPMT(dvbpsi_pmt_decoder_t* p_decoder, const bool b_force ...@@ -249,26 +249,16 @@ static void dvbpsi_ReInitPMT(dvbpsi_pmt_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_pmt) if (p_decoder->p_building_pmt)
dvbpsi_DeletePMT(p_decoder->p_building_pmt); dvbpsi_DeletePMT(p_decoder->p_building_pmt);
} }
p_decoder->p_building_pmt = NULL; p_decoder->p_building_pmt = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckPMT(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section) static bool dvbpsi_CheckPMT(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section)
......
...@@ -264,26 +264,16 @@ static void dvbpsi_ReInitSDT(dvbpsi_sdt_decoder_t* p_decoder, const bool b_force ...@@ -264,26 +264,16 @@ static void dvbpsi_ReInitSDT(dvbpsi_sdt_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_sdt) if (p_decoder->p_building_sdt)
dvbpsi_DeleteSDT(p_decoder->p_building_sdt); dvbpsi_DeleteSDT(p_decoder->p_building_sdt);
} }
p_decoder->p_building_sdt = NULL; p_decoder->p_building_sdt = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt_decoder, static bool dvbpsi_CheckSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt_decoder,
......
...@@ -244,26 +244,16 @@ static void dvbpsi_ReInitSIS(dvbpsi_sis_decoder_t* p_decoder, const bool b_force ...@@ -244,26 +244,16 @@ static void dvbpsi_ReInitSIS(dvbpsi_sis_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_sis) if (p_decoder->p_building_sis)
dvbpsi_DeleteSIS(p_decoder->p_building_sis); dvbpsi_DeleteSIS(p_decoder->p_building_sis);
} }
p_decoder->p_building_sis = NULL; p_decoder->p_building_sis = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t* p_sis_decoder, static bool dvbpsi_CheckSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t* p_sis_decoder,
......
...@@ -224,26 +224,16 @@ static void dvbpsi_ReInitTOT(dvbpsi_tot_decoder_t* p_decoder, const bool b_force ...@@ -224,26 +224,16 @@ static void dvbpsi_ReInitTOT(dvbpsi_tot_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
p_decoder->b_current_valid = false;
/* Free structures */ /* Free structures */
if (p_decoder->p_building_tot) if (p_decoder->p_building_tot)
dvbpsi_DeleteTOT(p_decoder->p_building_tot); dvbpsi_DeleteTOT(p_decoder->p_building_tot);
} }
p_decoder->p_building_tot = NULL; p_decoder->p_building_tot = NULL;
/* 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;
}
}
} }
static bool dvbpsi_CheckTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot_decoder, static bool dvbpsi_CheckTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_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