Commit 7a09ba19 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add utility function dvbpsi_AddSectionDecoder()

Add a PSI section to dvbpsi_decoder_t::ap_sections[] array. The function returns
true when it overwrites an earlier entry and false otherwise.
parent 2e8db83c
...@@ -256,6 +256,26 @@ void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder) ...@@ -256,6 +256,26 @@ void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder)
} }
} }
/*****************************************************************************
* dvbpsi_AddSectionDecoder
*****************************************************************************/
bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section)
{
assert(p_decoder);
assert(p_section);
bool b_overwrite = false;
if (p_decoder->ap_sections[p_section->i_number] != NULL)
{
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
b_overwrite = true;
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return b_overwrite;
}
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteDecoder * dvbpsi_DeleteDecoder
*****************************************************************************/ *****************************************************************************/
......
...@@ -281,6 +281,18 @@ bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder); ...@@ -281,6 +281,18 @@ bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder);
*/ */
void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder); void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder);
/*****************************************************************************
* dvbpsi_AddSectionDecoder
*****************************************************************************/
/*!
* \fn bool dvbpsi_AddSectionDecoder(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
* \return true if it overwrites a earlier section, false otherwise
*/
bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_HasDecoder * dvbpsi_HasDecoder
*****************************************************************************/ *****************************************************************************/
......
...@@ -364,13 +364,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t * ...@@ -364,13 +364,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (p_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "ATSC EIT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC EIT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -302,13 +302,9 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t * ...@@ -302,13 +302,9 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (p_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "ATSC ETT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC ETT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -394,14 +394,9 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t * ...@@ -394,14 +394,9 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (p_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "ATSC MGT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC MGT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -293,13 +293,9 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t * ...@@ -293,13 +293,9 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (p_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "ATSC STT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC STT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -432,13 +432,9 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t * ...@@ -432,13 +432,9 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (p_vct_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_vct_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "ATSC VCT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC VCT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_vct_decoder->ap_sections[p_section->i_number]);
}
p_vct_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -350,13 +350,9 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat ...@@ -350,13 +350,9 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat
} }
/* Fill the section array */ /* Fill the section array */
if (p_bat_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_bat_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "BAT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "BAT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[p_section->i_number]);
}
p_bat_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -247,13 +247,9 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec ...@@ -247,13 +247,9 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec
} }
/* Fill the section array */ /* Fill the section array */
if (p_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "CAT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "CAT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_decoder->ap_sections[p_section->i_number]);
}
p_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -390,13 +390,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit ...@@ -390,13 +390,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
} }
/* Fill the section array */ /* Fill the section array */
if (p_eit_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_eit_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "EIT decoder", dvbpsi_debug(p_dvbpsi, "EIT decoder",
"overwrite section number %d", p_section->i_number); "overwrite section number %d", p_section->i_number);
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[p_section->i_number]);
}
p_eit_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -341,13 +341,9 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit ...@@ -341,13 +341,9 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
} }
/* Fill the section array */ /* Fill the section array */
if (p_nit_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_nit_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "NIT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "NIT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[p_section->i_number]);
}
p_nit_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -255,14 +255,9 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat ...@@ -255,14 +255,9 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat
} }
/* Fill the section array */ /* Fill the section array */
if (p_pat_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_pat_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "PAT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "PAT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_pat_decoder->ap_sections[p_section->i_number]);
}
p_pat_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -310,13 +310,9 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt ...@@ -310,13 +310,9 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt
} }
/* Fill the section array */ /* Fill the section array */
if (p_pmt_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_pmt_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "PMT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "PMT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_pmt_decoder->ap_sections[p_section->i_number]);
}
p_pmt_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -331,13 +331,9 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt ...@@ -331,13 +331,9 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt
} }
/* Fill the section array */ /* Fill the section array */
if (p_sdt_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_sdt_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_sdt_decoder->ap_sections[p_section->i_number]);
}
p_sdt_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -315,13 +315,9 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis ...@@ -315,13 +315,9 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis
} }
/* Fill the section array */ /* Fill the section array */
if (p_sis_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_sis_decoder), p_section))
{
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_sis_decoder->ap_sections[p_section->i_number]);
}
p_sis_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
...@@ -294,13 +294,9 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot ...@@ -294,13 +294,9 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot
} }
/* Fill the section array */ /* Fill the section array */
if (p_tot_decoder->ap_sections[p_section->i_number] != NULL) if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_tot_decoder), p_section))
{ dvbpsi_debug(p_dvbpsi, "TOT decoder", "overwrite section number %d",
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
dvbpsi_DeletePSISections(p_tot_decoder->ap_sections[p_section->i_number]);
}
p_tot_decoder->ap_sections[p_section->i_number] = p_section;
return true; return true;
} }
......
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