Commit 826a8881 authored by Jean-Paul Saman's avatar Jean-Paul Saman

demux: rename dvbpsi_demux_subdec_t::p_cb_data to p_decoder

The functions dvbpsi_GatherXSections() and dvbpsi_NewDemuxSubDecoder() take a
private decoder as argument. Change this argument from 'void *' to 'dvbpsi_decoder_t *'.
This makes its use more clear.
parent 2d3fb64a
......@@ -120,7 +120,7 @@ void dvbpsi_Demux(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section)
}
if (p_subdec)
p_subdec->pf_gather(p_dvbpsi, p_subdec->p_cb_data, p_section);
p_subdec->pf_gather(p_dvbpsi, p_subdec->p_decoder, p_section);
else
dvbpsi_DeletePSISections(p_section);
}
......@@ -162,7 +162,7 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
const uint16_t i_extension,
dvbpsi_demux_detach_cb_t pf_detach,
dvbpsi_demux_gather_cb_t pf_gather,
void *cb_data)
dvbpsi_decoder_t *p_decoder)
{
assert(pf_gather);
assert(pf_detach);
......@@ -175,7 +175,7 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
/* subtable decoder configuration */
p_subdec->i_id = i_id;
p_subdec->p_cb_data = cb_data;
p_subdec->p_decoder = p_decoder;
p_subdec->pf_gather = pf_gather;
p_subdec->pf_detach = pf_detach;
......@@ -193,8 +193,8 @@ void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec)
if (!p_subdec)
return;
free(p_subdec->p_cb_data);
/* FIXME: find a saner way to release private decoder resources */
free(p_subdec->p_decoder);
free(p_subdec);
p_subdec = NULL;
}
......
......@@ -60,7 +60,7 @@ typedef void (*dvbpsi_demux_new_cb_t) (dvbpsi_t *p_dvbpsi, /*!< pointer to dvbp
* \brief Callback used for gathering psi sections on behalf of subtable decoders.
*/
typedef void (*dvbpsi_demux_gather_cb_t) (dvbpsi_t *p_dvbpsi, /*!< pointer to dvbpsi handle */
void *p_cb_data, /*!< pointer to callback data */
dvbpsi_decoder_t *p_decoder, /*!< pointer to decoder */
dvbpsi_psi_section_t *p_section); /*!< pointer to psi section */
/*!
......@@ -92,7 +92,7 @@ typedef struct dvbpsi_demux_subdec_s
uint32_t i_id; /*!< subtable id */
dvbpsi_demux_gather_cb_t pf_gather; /*!< gather subdec callback */
void * p_cb_data; /*!< subdec callback data */
dvbpsi_decoder_t *p_decoder; /*!< private decoder for this subdec */
dvbpsi_demux_detach_cb_t pf_detach; /*!< detach subdec callback */
......@@ -196,14 +196,14 @@ void dvbpsi_Demux(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section);
* \param i_extension table extension to create subtable decoder for
* \param pf_detach pointer to detach function for subtable decoder.
* \param pf_gather pointer to gather function for subtable decoder.
* \param p_cb_data pointer to private decoder.
* \param p_decoder pointer to private decoder.
* \return pointer to demux subtable decoder.
*/
dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
const uint16_t i_extension,
dvbpsi_demux_detach_cb_t pf_detach,
dvbpsi_demux_gather_cb_t pf_gather,
void *cb_data);
dvbpsi_decoder_t *p_decoder);
/*****************************************************************************
* dvbpsi_DeleteDemuxSubDecoder
......
......@@ -166,6 +166,8 @@ typedef struct dvbpsi_psi_section_s dvbpsi_psi_section_t;
*/
typedef struct dvbpsi_decoder_s dvbpsi_decoder_t;
#define DVBPSI_DECODER(x) ((dvbpsi_decoder_t *)(x))
/*****************************************************************************
* dvbpsi_callback
*****************************************************************************/
......
......@@ -75,7 +75,7 @@ static dvbpsi_descriptor_t *dvbpsi_atsc_EITChannelAddDescriptor(
uint8_t *p_data);
static void dvbpsi_atsc_GatherEITSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder, dvbpsi_psi_section_t* p_section);
dvbpsi_decoder_t* p_decoder, dvbpsi_psi_section_t* p_section);
static void dvbpsi_atsc_DecodeEITSections(dvbpsi_atsc_eit_t* p_eit,
dvbpsi_psi_section_t* p_section);
......@@ -108,7 +108,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_atsc_DetachEIT,
dvbpsi_atsc_GatherEITSections, p_eit_decoder);
dvbpsi_atsc_GatherEITSections, DVBPSI_DECODER(p_eit_decoder));
if (p_subdec == NULL)
{
free(p_eit_decoder);
......@@ -153,7 +153,7 @@ void dvbpsi_atsc_DetachEIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
}
dvbpsi_atsc_eit_decoder_t* p_eit_decoder;
p_eit_decoder = (dvbpsi_atsc_eit_decoder_t*)p_subdec->p_cb_data;
p_eit_decoder = (dvbpsi_atsc_eit_decoder_t*)p_subdec->p_decoder;
if (!p_eit_decoder)
return;
......@@ -166,8 +166,8 @@ void dvbpsi_atsc_DetachEIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[i]);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -308,15 +308,15 @@ static dvbpsi_descriptor_t *dvbpsi_atsc_EITChannelAddDescriptor(
*****************************************************************************
* Callback for the subtable demultiplexor.
*****************************************************************************/
static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi, void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi,
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section)
{
assert(p_dvbpsi);
assert(p_dvbpsi->p_private);
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
dvbpsi_atsc_eit_decoder_t * p_eit_decoder
= (dvbpsi_atsc_eit_decoder_t*)p_private_decoder;
dvbpsi_atsc_eit_decoder_t * p_eit_decoder = (dvbpsi_atsc_eit_decoder_t*)p_decoder;
if (!p_eit_decoder)
{
dvbpsi_error(p_dvbpsi, "ATSC EIT decoder", "No decoder specified");
......
......@@ -76,8 +76,8 @@ typedef struct dvbpsi_atsc_ett_decoder_s
* Callback for the PSI decoder.
*****************************************************************************/
static void dvbpsi_atsc_GatherETTSections(dvbpsi_t * p_dvbpsi,
void * p_private_decoder,
dvbpsi_psi_section_t* p_section);
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* dvbpsi_atsc_DecodeETTSection
......@@ -85,7 +85,7 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t * p_dvbpsi,
* TDT decoder.
*****************************************************************************/
static void dvbpsi_atsc_DecodeETTSection(dvbpsi_atsc_ett_t* p_ett,
dvbpsi_psi_section_t* p_section);
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* dvbpsi_atsc_AttachETT
......@@ -116,7 +116,7 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
/* PSI decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_atsc_DetachETT,
dvbpsi_atsc_GatherETTSections, p_ett_decoder);
dvbpsi_atsc_GatherETTSections, DVBPSI_DECODER(p_ett_decoder));
if (p_subdec == NULL)
{
free(p_ett_decoder);
......@@ -157,7 +157,7 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
}
dvbpsi_atsc_ett_decoder_t* p_ett_decoder;
p_ett_decoder = (dvbpsi_atsc_ett_decoder_t*)p_subdec->p_cb_data;
p_ett_decoder = (dvbpsi_atsc_ett_decoder_t*)p_subdec->p_decoder;
if (!p_ett_decoder)
return;
......@@ -168,8 +168,8 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
free(p_etm_version);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -236,16 +236,15 @@ void dvbpsi_atsc_DeleteETT(dvbpsi_atsc_ett_t *p_ett)
* Callback for the PSI decoder.
*****************************************************************************/
static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi,
void * p_private_decoder,
dvbpsi_psi_section_t* p_section)
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t* p_section)
{
assert(p_dvbpsi);
assert(p_dvbpsi->p_private);
// FIXME: Gather*Sections needs updating
// dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
dvbpsi_atsc_ett_decoder_t* p_ett_decoder
= (dvbpsi_atsc_ett_decoder_t*)p_private_decoder;
dvbpsi_atsc_ett_decoder_t* p_ett_decoder = (dvbpsi_atsc_ett_decoder_t*)p_decoder;
if (!p_ett_decoder)
{
dvbpsi_error(p_dvbpsi, "ATSC ETT decoder", "No decoder specified");
......
......@@ -78,8 +78,8 @@ static dvbpsi_descriptor_t *dvbpsi_atsc_MGTTableAddDescriptor(
uint8_t *p_data);
static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section);
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section);
static void dvbpsi_atsc_DecodeMGTSections(dvbpsi_atsc_mgt_t* p_mgt,
dvbpsi_psi_section_t* p_section);
......@@ -112,7 +112,7 @@ bool dvbpsi_atsc_AttachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_atsc_DetachMGT,
dvbpsi_atsc_GatherMGTSections, p_mgt_decoder);
dvbpsi_atsc_GatherMGTSections, DVBPSI_DECODER(p_mgt_decoder));
if (p_subdec == NULL)
{
free(p_mgt_decoder);
......@@ -158,7 +158,7 @@ void dvbpsi_atsc_DetachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
}
dvbpsi_atsc_mgt_decoder_t* p_mgt_decoder;
p_mgt_decoder = (dvbpsi_atsc_mgt_decoder_t*)p_subdec->p_cb_data;
p_mgt_decoder = (dvbpsi_atsc_mgt_decoder_t*)p_subdec->p_decoder;
if (!p_mgt_decoder)
return;
......@@ -171,8 +171,8 @@ void dvbpsi_atsc_DetachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_DeletePSISections(p_mgt_decoder->ap_sections[i]);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -341,13 +341,12 @@ static dvbpsi_descriptor_t *dvbpsi_atsc_MGTTableAddDescriptor(
* Callback for the subtable demultiplexor.
*****************************************************************************/
static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
dvbpsi_atsc_mgt_decoder_t * p_mgt_decoder
= (dvbpsi_atsc_mgt_decoder_t*)p_private_decoder;
dvbpsi_atsc_mgt_decoder_t * p_mgt_decoder = (dvbpsi_atsc_mgt_decoder_t*)p_decoder;
if (!p_mgt_decoder)
{
dvbpsi_error(p_dvbpsi, "ATSC MGT decoder", "No decoder specified");
......
......@@ -58,7 +58,7 @@ dvbpsi_descriptor_t *dvbpsi_atsc_STTAddDescriptor(
uint8_t *p_data);
static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder, dvbpsi_psi_section_t* p_section);
dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t* p_section);
static void dvbpsi_atsc_DecodeSTTSections(dvbpsi_atsc_stt_t* p_stt,
dvbpsi_psi_section_t* p_section);
......@@ -69,7 +69,7 @@ static void dvbpsi_atsc_DecodeSTTSections(dvbpsi_atsc_stt_t* p_stt,
* Initialize a STT subtable decoder.
*****************************************************************************/
bool dvbpsi_atsc_AttachSTT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_atsc_stt_callback pf_stt_callback, void* p_cb_data)
dvbpsi_atsc_stt_callback pf_stt_callback, void* p_cb_data)
{
assert(p_dvbpsi);
assert(p_dvbpsi->p_private);
......@@ -92,7 +92,7 @@ bool dvbpsi_atsc_AttachSTT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_atsc_DetachSTT,
dvbpsi_atsc_GatherSTTSections, p_stt_decoder);
dvbpsi_atsc_GatherSTTSections, DVBPSI_DECODER(p_stt_decoder));
if (p_subdec == NULL)
{
free(p_stt_decoder);
......@@ -134,12 +134,12 @@ void dvbpsi_atsc_DetachSTT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
}
dvbpsi_atsc_stt_decoder_t* p_stt_decoder;
p_stt_decoder = (dvbpsi_atsc_stt_decoder_t*)p_subdec->p_cb_data;
p_stt_decoder = (dvbpsi_atsc_stt_decoder_t*)p_subdec->p_decoder;
if(!p_stt_decoder)
return;
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -230,14 +230,14 @@ dvbpsi_descriptor_t *dvbpsi_atsc_STTAddDescriptor( dvbpsi_atsc_stt_t *p_stt,
*****************************************************************************
* Callback for the subtable demultiplexor.
*****************************************************************************/
static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi, void *p_private_decoder,
dvbpsi_psi_section_t * p_section)
static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section)
{
assert(p_dvbpsi);
assert(p_dvbpsi->p_private);
dvbpsi_atsc_stt_decoder_t *p_stt_decoder =
(dvbpsi_atsc_stt_decoder_t*)p_private_decoder;
dvbpsi_atsc_stt_decoder_t *p_stt_decoder = (dvbpsi_atsc_stt_decoder_t*)p_decoder;
if (!p_stt_decoder)
{
dvbpsi_error(p_dvbpsi, "EIT decoder", "No decoder specified");
......
......@@ -87,7 +87,7 @@ static dvbpsi_descriptor_t *dvbpsi_atsc_VCTChannelAddDescriptor(
uint8_t *p_data);
static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t * p_dvbpsi,
void * p_private_decoder, dvbpsi_psi_section_t * p_section);
dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t * p_section);
static void dvbpsi_atsc_DecodeVCTSections(dvbpsi_atsc_vct_t* p_vct,
dvbpsi_psi_section_t* p_section);
......@@ -122,7 +122,7 @@ bool dvbpsi_atsc_AttachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_atsc_DetachVCT,
dvbpsi_atsc_GatherVCTSections, p_vct_decoder);
dvbpsi_atsc_GatherVCTSections, DVBPSI_DECODER(p_vct_decoder));
if (p_subdec == NULL)
{
free(p_vct_decoder);
......@@ -169,7 +169,7 @@ void dvbpsi_atsc_DetachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
}
dvbpsi_atsc_vct_decoder_t* p_vct_decoder;
p_vct_decoder = (dvbpsi_atsc_vct_decoder_t*)p_subdec->p_cb_data;
p_vct_decoder = (dvbpsi_atsc_vct_decoder_t*)p_subdec->p_decoder;
if (!p_vct_decoder)
return;
free(p_vct_decoder->p_building_vct);
......@@ -179,8 +179,8 @@ void dvbpsi_atsc_DetachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
if (p_vct_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_vct_decoder->ap_sections[i]);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -379,12 +379,11 @@ static dvbpsi_descriptor_t *dvbpsi_atsc_VCTChannelAddDescriptor(
* Callback for the subtable demultiplexor.
*****************************************************************************/
static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t *p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
dvbpsi_atsc_vct_decoder_t * p_vct_decoder
= (dvbpsi_atsc_vct_decoder_t*)p_private_decoder;
dvbpsi_atsc_vct_decoder_t * p_vct_decoder = (dvbpsi_atsc_vct_decoder_t*)p_decoder;
if (!p_section->b_syntax_indicator)
{
......
......@@ -80,7 +80,7 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachBAT,
dvbpsi_GatherBATSections, p_bat_decoder);
dvbpsi_GatherBATSections, DVBPSI_DECODER(p_bat_decoder));
if (p_subdec == NULL)
{
free(p_bat_decoder);
......@@ -127,7 +127,7 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
}
dvbpsi_bat_decoder_t* p_bat_decoder;
p_bat_decoder = (dvbpsi_bat_decoder_t*)p_subdec->p_cb_data;
p_bat_decoder = (dvbpsi_bat_decoder_t*)p_subdec->p_decoder;
free(p_bat_decoder->p_building_bat);
for (unsigned int i = 0; i < 256; i++)
......@@ -135,8 +135,8 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
if (p_bat_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[i]);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -298,12 +298,11 @@ dvbpsi_descriptor_t *dvbpsi_BATTSAddDescriptor(
* Callback for the subtable demultiplexor.
*****************************************************************************/
void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
dvbpsi_bat_decoder_t * p_bat_decoder
= (dvbpsi_bat_decoder_t*)p_private_decoder;
dvbpsi_bat_decoder_t * p_bat_decoder = (dvbpsi_bat_decoder_t *) p_decoder;
bool b_reinit = false;
......
......@@ -56,8 +56,8 @@ typedef struct dvbpsi_bat_decoder_s
*****************************************************************************
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherBATSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder, dvbpsi_psi_section_t* p_section);
void dvbpsi_GatherBATSections(dvbpsi_t* p_dvbpsi, dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* dvbpsi_DecodeBATSections
......
......@@ -79,7 +79,7 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachEIT,
dvbpsi_GatherEITSections, p_eit_decoder);
dvbpsi_GatherEITSections, DVBPSI_DECODER(p_eit_decoder));
if (p_subdec == NULL)
{
free(p_eit_decoder);
......@@ -126,7 +126,7 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
}
dvbpsi_eit_decoder_t* p_eit_decoder;
p_eit_decoder = (dvbpsi_eit_decoder_t*)p_subdec->p_cb_data;
p_eit_decoder = (dvbpsi_eit_decoder_t*)p_subdec->p_decoder;
free(p_eit_decoder->p_building_eit);
for (unsigned int i = 0; i <= 255; i++)
......@@ -134,8 +134,8 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
if (p_eit_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[i]);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
dvbpsi_DeleteDemuxSubDecoder(p_subdec);
......@@ -273,7 +273,7 @@ dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor( dvbpsi_eit_event_t* p_event,
*****************************************************************************
* Callback for the subtable demultiplexor.
*****************************************************************************/
void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, void *p_private_decoder,
void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section)
{
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
......
......@@ -56,9 +56,9 @@ typedef struct dvbpsi_eit_decoder_s
*****************************************************************************
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherEITSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder,
dvbpsi_psi_section_t* p_section);
void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section);
/*****************************************************************************
* dvbpsi_DecodeEITSection
......
......@@ -81,7 +81,7 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachNIT,
dvbpsi_GatherNITSections, p_nit_decoder);
dvbpsi_GatherNITSections, DVBPSI_DECODER(p_nit_decoder));
if (p_subdec == NULL)
{
free(p_nit_decoder);
......@@ -126,7 +126,7 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
}
dvbpsi_nit_decoder_t* p_nit_decoder;
p_nit_decoder = (dvbpsi_nit_decoder_t*)p_subdec->p_cb_data;
p_nit_decoder = (dvbpsi_nit_decoder_t*)p_subdec->p_decoder;
free(p_nit_decoder->p_building_nit);
for (unsigned int i = 0; i <= 255; i++)
......@@ -134,8 +134,8 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
if (p_nit_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[i]);
}
free(p_subdec->p_cb_data);
p_subdec->p_cb_data = NULL;
free(p_subdec->p_decoder);
p_subdec->p_decoder = NULL;
/* Free demux sub table decoder */
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
......@@ -293,8 +293,8 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts,
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section)
{
dvbpsi_nit_decoder_t* p_nit_decoder
= (dvbpsi_nit_decoder_t*)p_private_decoder;
......
......@@ -60,7 +60,7 @@ typedef struct dvbpsi_nit_decoder_s
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherNITSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder,
dvbpsi_decoder_t* p_private_decoder,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
......
......@@ -78,7 +78,7 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachSDT,
dvbpsi_GatherSDTSections, p_sdt_decoder);
dvbpsi_GatherSDTSections, DVBPSI_DECODER(p_sdt_decoder));
if (p_subdec == NULL)
{
free(p_sdt_decoder);
......@@ -124,10 +124,10 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
return;
}
assert(p_subdec->p_cb_data);
assert(p_subdec->p_decoder);
dvbpsi_sdt_decoder_t* p_sdt_decoder;
p_sdt_decoder = (dvbpsi_sdt_decoder_t*)p_subdec->p_cb_data;
p_sdt_decoder = (dvbpsi_sdt_decoder_t*)p_subdec->p_decoder;
free(p_sdt_decoder->p_building_sdt);
for (unsigned int i = 0; i <= 255; i++)
......@@ -277,7 +277,7 @@ dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor(
* Callback for the subtable demultiplexor.
*****************************************************************************/
void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t * p_section)
{
assert(p_dvbpsi);
......
......@@ -56,8 +56,8 @@ typedef struct dvbpsi_sdt_decoder_s
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
void* p_private_decoder,
dvbpsi_psi_section_t* p_section);
dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section);
/*****************************************************************************
* dvbpsi_DecodeSDTSection
......
......@@ -80,7 +80,7 @@ bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachSIS,
dvbpsi_GatherSISSections, p_sis_decoder);
dvbpsi_GatherSISSections, DVBPSI_DECODER(p_sis_decoder));
if (p_subdec == NULL)
{
free(p_sis_decoder);
......@@ -230,15 +230,14 @@ dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis,
* Callback for the subtable demultiplexor.
*****************************************************************************/
void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section)
{
assert(p_dvbpsi);
assert(p_dvbpsi->p_private);
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_private;
dvbpsi_sis_decoder_t * p_sis_decoder
= (dvbpsi_sis_decoder_t*)p_private_decoder;
dvbpsi_sis_decoder_t * p_sis_decoder = (dvbpsi_sis_decoder_t*)p_decoder;
dvbpsi_debug(p_dvbpsi, "SIS decoder",
"Table version %2d, " "i_table_id %2d, " "i_extension %5d, "
......
......@@ -53,7 +53,7 @@ typedef struct dvbpsi_sis_decoder_s
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherSISSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder,
dvbpsi_decoder_t * p_decoder,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
......
......@@ -69,11 +69,11 @@ bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
dvbpsi_error(p_dvbpsi, "TDT/TOT decoder",
"Already a decoder for (table_id == 0x%02x,"
"extension == 0x%02x)",
i_table_id, 0);
i_table_id, i_extension);
return false;
}
dvbpsi_tot_decoder_t* p_tot_decoder;
dvbpsi_tot_decoder_t *p_tot_decoder;
p_tot_decoder = (dvbpsi_tot_decoder_t*)calloc(1, sizeof(dvbpsi_tot_decoder_t));
if (p_tot_decoder == NULL)
return false;
......@@ -81,7 +81,7 @@ bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
/* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachTOT,
dvbpsi_GatherTOTSections, p_tot_decoder);
dvbpsi_GatherTOTSections, DVBPSI_DECODER(p_tot_decoder));
if (p_subdec == NULL)
{
free(p_tot_decoder);
......@@ -119,7 +119,7 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
dvbpsi_error(p_dvbpsi, "TDT/TOT Decoder",
"No such TDT/TOT decoder (table_id == 0x%02x,"
"extension == 0x%02x)",
i_table_id, 0);
i_table_id, i_extension);
return;
}
......@@ -207,14 +207,14 @@ dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot,
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section)
{
assert(p_dvbpsi);
assert(p_dvbpsi->p_private);
dvbpsi_tot_decoder_t* p_tot_decoder
= (dvbpsi_tot_decoder_t*)p_private_decoder;
= (dvbpsi_tot_decoder_t*)p_decoder;
dvbpsi_debug(p_dvbpsi, "TDT/TOT decoder", "got a section");
......
......@@ -51,7 +51,7 @@ typedef struct dvbpsi_tot_decoder_s
* Callback for the PSI decoder.
*****************************************************************************/
void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
void * p_private_decoder,
dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
......
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