Commit 72c8e6fa authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/tables/*: replace DVBPSI_ERROR with dvbpsi_error

Follow up of commit id: 1f223e37

Use a message callback of dvbpsi_h instead of printf. The decoder
table functions all use a decoder_t. In dvbpsi.h a decoder_t * is
typedefed as dvbpsi_h.
Table encoder (or generators) do not use a dvbpsi_h handle. The
DVBPSI_{ERROR,DEBUG} have been disabled in these functions for now.

The descriptors will be done in another commit.
parent 1f223e37
......@@ -55,6 +55,7 @@
int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, void* p_cb_data)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_bat_decoder_t* p_bat_decoder;
......@@ -113,6 +114,7 @@ int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_demux->p_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_bat_decoder_t* p_bat_decoder;
......@@ -287,6 +289,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_bat_decoder_t * p_bat_decoder
= (dvbpsi_bat_decoder_t*)p_private_decoder;
int b_append = 1;
......@@ -638,10 +641,11 @@ dvbpsi_psi_section_t* dvbpsi_GenBATSections(dvbpsi_bat_t* p_bat)
i_transport_stream_loop_length = (p_current->p_payload_end - p_transport_stream_loop_length) - 2;
p_transport_stream_loop_length[0] = (i_transport_stream_loop_length >> 8) | 0xf0;
p_transport_stream_loop_length[1] = i_transport_stream_loop_length;
#if 0 /* FIXME: */
/* will put more descriptors in an empty section */
dvbpsi_debug(h_dvbpsi, "BAT generator",
"create a new section to carry more TS descriptors");
#endif
p_prev = p_current;
p_current = dvbpsi_NewPSISection(1024);
p_prev->p_next = p_current;
......@@ -698,10 +702,10 @@ dvbpsi_psi_section_t* dvbpsi_GenBATSections(dvbpsi_bat_t* p_bat)
p_descriptor = p_descriptor->p_next;
}
#if 0 /* FIXME: */
if(p_descriptor != NULL)
dvbpsi_error(h_dvbpsi, "BAT generator", "unable to carry all the TS descriptors");
#endif
/* transport_descriptors_length */
i_transport_descriptors_length = p_current->p_payload_end - p_ts_start - 5;
p_ts_start[4] = (i_transport_descriptors_length >> 8) | 0xf0;
......
......@@ -182,6 +182,7 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat,
void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_decoder;
dvbpsi_cat_decoder_t* p_cat_decoder
= (dvbpsi_cat_decoder_t*)p_decoder->p_private_decoder;
int b_append = 1;
......
......@@ -56,6 +56,7 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_eit_callback pf_callback,
void* p_cb_data)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_eit_decoder_t* p_eit_decoder;
......@@ -115,6 +116,7 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_demux->p_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_eit_decoder_t* p_eit_decoder;
......@@ -273,6 +275,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_eit_decoder_t* p_eit_decoder
= (dvbpsi_eit_decoder_t*)p_private_decoder;
int b_append = 1;
......
......@@ -57,6 +57,7 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_nit_decoder_t* p_nit_decoder;
......@@ -117,6 +118,7 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_demux->p_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_nit_decoder_t* p_nit_decoder;
......@@ -298,6 +300,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_decoder;
dvbpsi_nit_decoder_t* p_nit_decoder
= (dvbpsi_nit_decoder_t*)p_private_decoder;
int b_append = 1;
......@@ -648,10 +651,11 @@ dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit,
i_transport_stream_loop_length = (p_current->p_payload_end - p_transport_stream_loop_length) - 2;
p_transport_stream_loop_length[0] = (i_transport_stream_loop_length >> 8) | 0xf0;
p_transport_stream_loop_length[1] = i_transport_stream_loop_length;
#if 0 /* FIXME: */
/* will put more descriptors in an empty section */
dvbpsi_debug(h_dvbpsi, "NIT generator",
"create a new section to carry more TS descriptors");
#endif
p_prev = p_current;
p_current = dvbpsi_NewPSISection(1024);
p_prev->p_next = p_current;
......@@ -708,10 +712,10 @@ dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit,
p_descriptor = p_descriptor->p_next;
}
#if 0 /* FIXME: */
if(p_descriptor != NULL)
dvbpsi_error(h_dvbpsi, "NIT generator", "unable to carry all the TS descriptors");
#endif
/* TS_info_length */
i_ts_length = p_current->p_payload_end - p_ts_start - 5;
p_ts_start[4] = (i_ts_length >> 8) | 0xf0;
......
......@@ -599,8 +599,10 @@ dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt)
&& (i_es_length <= 1008))
{
/* will put more descriptors in an empty section */
#if 0
dvbpsi_debug(h_dvbpsi, "PMT generator",
"create a new section to carry more ES descriptors");
#endif
p_prev = p_current;
p_current = dvbpsi_NewPSISection(1024);
p_prev->p_next = p_current;
......@@ -656,10 +658,10 @@ dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt)
p_descriptor = p_descriptor->p_next;
}
#if 0
if(p_descriptor != NULL)
dvbpsi_error(h_dvbpsi, "PMT generator", "unable to carry all the ES descriptors");
#endif
/* ES_info_length */
i_es_length = p_current->p_payload_end - p_es_start - 5;
p_es_start[3] = (i_es_length >> 8) | 0xf0;
......
......@@ -55,6 +55,7 @@ int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sdt_callback pf_callback,
void* p_cb_data)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_sdt_decoder_t* p_sdt_decoder;
......@@ -114,6 +115,7 @@ int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_demux->p_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_sdt_decoder_t* p_sdt_decoder;
......@@ -270,6 +272,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_sdt_decoder_t * p_sdt_decoder
= (dvbpsi_sdt_decoder_t*)p_private_decoder;
int b_append = 1;
......@@ -532,7 +535,9 @@ dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_sdt_t* p_sdt)
if ( (p_descriptor != NULL) && (p_service_start - p_current->p_data != 11) && (i_service_length <= 1009) )
{
/* will put more descriptors in an empty section */
#if 0
dvbpsi_debug(h_dvbpsi, "SDT generator","create a new section to carry more Service descriptors");
#endif
p_prev = p_current;
p_current = dvbpsi_NewPSISection(1024);
p_prev->p_next = p_current;
......@@ -580,8 +585,10 @@ dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_sdt_t* p_sdt)
p_descriptor = p_descriptor->p_next;
}
#if 0
if(p_descriptor != NULL)
dvbpsi_error(h_dvbpsi, "SDT generator", "unable to carry all the descriptors");
#endif
/* ES_info_length */
i_service_length = p_current->p_payload_end - p_service_start - 5;
......
......@@ -56,6 +56,7 @@ int dvbpsi_AttachSIS(dvbpsi_decoder_t *p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sis_callback pf_callback,
void* p_cb_data)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_sis_decoder_t* p_sis_decoder;
......@@ -110,6 +111,7 @@ int dvbpsi_AttachSIS(dvbpsi_decoder_t *p_psi_decoder, uint8_t i_table_id,
void dvbpsi_DetachSIS(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_demux->p_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_sis_decoder_t* p_sis_decoder;
......@@ -224,6 +226,7 @@ void dvbpsi_GatherSISSections(dvbpsi_decoder_t * p_psi_decoder,
void * p_private_decoder,
dvbpsi_psi_section_t * p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_sis_decoder_t * p_sis_decoder
= (dvbpsi_sis_decoder_t*)p_private_decoder;
int b_append = 1;
......
......@@ -57,6 +57,7 @@ int dvbpsi_AttachTOT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension,
dvbpsi_tot_callback pf_callback, void* p_cb_data)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_psi_decoder;
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_tot_decoder_t* p_tot_decoder;
......@@ -110,6 +111,7 @@ int dvbpsi_AttachTOT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
void dvbpsi_DetachTOT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_demux->p_decoder;
dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec;
......@@ -200,6 +202,7 @@ void dvbpsi_GatherTOTSections(dvbpsi_decoder_t* p_decoder,
void * p_private_decoder,
dvbpsi_psi_section_t* p_section)
{
dvbpsi_handle h_dvbpsi = (dvbpsi_handle) p_decoder;
dvbpsi_tot_decoder_t* p_tot_decoder
= (dvbpsi_tot_decoder_t*)p_private_decoder;
int b_append = 1;
......@@ -282,8 +285,10 @@ int dvbpsi_ValidTOTSection(dvbpsi_psi_section_t* p_section)
}
else
{
#if 0 /* FIXME */
dvbpsi_error(h_dvbpsi, "TDT/TOT decoder",
"Bad CRC_32 (0x%08x) !!!", i_crc);
#endif
return 0;
}
}
......@@ -291,9 +296,11 @@ int dvbpsi_ValidTOTSection(dvbpsi_psi_section_t* p_section)
{
/* A TDT always has a length of 5 bytes (which is only the UTC time) */
if(p_section->i_length != 5) {
#if 0 /* FIXME */
dvbpsi_error(h_dvbpsi, "TDT/TOT decoder",
"TDT has an invalid payload size (%d bytes) !!!",
p_section->i_length);
#endif
return 0;
}
}
......@@ -395,8 +402,10 @@ dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_tot_t* p_tot)
if( (p_result->p_payload_end - p_result->p_data)
+ p_descriptor->i_length > 4090)
{
#if 0 /* FIXME: */
dvbpsi_error(h_dvbpsi, "TDT/TOT generator",
"TOT does not fit into one section as it ought to be !!!");
#endif
break;
}
......
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