Commit 95403168 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add a few common PSI fields to the table structs.

Some tables like EIT and ATSC EIT need to know what the value of table_id and
i_extension fields are for this PSI section. Therefor add this information to
the tables decoded structs.
parent 3dfc7ed8
...@@ -175,7 +175,7 @@ static void DumpBAT(void* p_zero, dvbpsi_bat_t* p_bat) ...@@ -175,7 +175,7 @@ static void DumpBAT(void* p_zero, dvbpsi_bat_t* p_bat)
printf( "\n"); printf( "\n");
printf( "New active BAT(binary dumped)\n"); printf( "New active BAT(binary dumped)\n");
printf( " bouquet_id : %d\n", printf( " bouquet_id : %d\n",
p_bat->i_bouquet_id); p_bat->i_extension);
printf( " version_number : %d\n", printf( " version_number : %d\n",
p_bat->i_version); p_bat->i_version);
printf( " | ts_id \n"); printf( " | ts_id \n");
......
...@@ -1330,7 +1330,7 @@ static void handle_EIT(void* p_data, dvbpsi_eit_t* p_eit) ...@@ -1330,7 +1330,7 @@ static void handle_EIT(void* p_data, dvbpsi_eit_t* p_eit)
printf("\n"); printf("\n");
printf(" EIT: Event Information Table\n"); printf(" EIT: Event Information Table\n");
printf("\tVersion number : %d\n", p_eit->i_version); printf("\tVersion number : %d\n", p_eit->i_version);
printf("\tService id : %d\n", p_eit->i_service_id); printf("\tService id : %d\n", p_eit->i_extension);
printf("\tCurrent next : %s\n", p_eit->b_current_next ? "yes" : "no"); printf("\tCurrent next : %s\n", p_eit->b_current_next ? "yes" : "no");
printf("\tTransport stream id : %d\n", p_eit->i_ts_id); printf("\tTransport stream id : %d\n", p_eit->i_ts_id);
printf("\tOriginal network id : %d\n", p_eit->i_network_id); printf("\tOriginal network id : %d\n", p_eit->i_network_id);
...@@ -1355,7 +1355,6 @@ static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot) ...@@ -1355,7 +1355,6 @@ static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot)
printf("\tVersion number : %d\n", p_tot->i_version); printf("\tVersion number : %d\n", p_tot->i_version);
printf("\tCurrent next : %s\n", p_tot->b_current_next ? "yes" : "no"); printf("\tCurrent next : %s\n", p_tot->b_current_next ? "yes" : "no");
printf("\tTransport stream id : %d\n", p_tot->i_ts_id);
printf("\tUTC time : %"PRId64"\n", p_tot->i_utc_time); printf("\tUTC time : %"PRId64"\n", p_tot->i_utc_time);
if (table_id == 0x73) /* TOT */ if (table_id == 0x73) /* TOT */
...@@ -1451,7 +1450,7 @@ static void handle_BAT(void* p_data, dvbpsi_bat_t* p_bat) ...@@ -1451,7 +1450,7 @@ static void handle_BAT(void* p_data, dvbpsi_bat_t* p_bat)
printf("\n"); printf("\n");
printf(" BAT: Bouquet Association Table\n"); printf(" BAT: Bouquet Association Table\n");
printf("\tVersion number : %d\n", p_bat->i_version); printf("\tVersion number : %d\n", p_bat->i_version);
printf("\tBouquet id : %d\n", p_bat->i_bouquet_id); printf("\tBouquet id : %d\n", p_bat->i_extension);
printf("\tCurrent next : %s\n", p_bat->b_current_next ? "yes" : "no"); printf("\tCurrent next : %s\n", p_bat->b_current_next ? "yes" : "no");
DumpDescriptors("\t | ]", p_bat->p_first_descriptor); DumpDescriptors("\t | ]", p_bat->p_first_descriptor);
DumpTSDescriptorsBAT(p_bat->p_first_ts); DumpTSDescriptorsBAT(p_bat->p_first_ts);
......
...@@ -162,11 +162,15 @@ void dvbpsi_atsc_DetachEIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -162,11 +162,15 @@ void dvbpsi_atsc_DetachEIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_atsc_eit_t structure. * Initialize a pre-allocated dvbpsi_atsc_eit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_protocol, void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, uint8_t i_protocol,
uint16_t i_source_id, bool b_current_next) uint16_t i_source_id, bool b_current_next)
{ {
assert(p_eit); assert(p_eit);
p_eit->i_table_id = i_table_id;
p_eit->i_extension = i_extension;
p_eit->i_version = i_version; p_eit->i_version = i_version;
p_eit->b_current_next = b_current_next; p_eit->b_current_next = b_current_next;
p_eit->i_protocol = i_protocol; p_eit->i_protocol = i_protocol;
...@@ -175,13 +179,15 @@ void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_ ...@@ -175,13 +179,15 @@ void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_
p_eit->p_first_descriptor = NULL; p_eit->p_first_descriptor = NULL;
} }
dvbpsi_atsc_eit_t *dvbpsi_atsc_NewEIT(uint8_t i_version, uint8_t i_protocol, dvbpsi_atsc_eit_t *dvbpsi_atsc_NewEIT(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, uint8_t i_protocol,
uint16_t i_source_id, bool b_current_next) uint16_t i_source_id, bool b_current_next)
{ {
dvbpsi_atsc_eit_t *p_eit; dvbpsi_atsc_eit_t *p_eit;
p_eit = (dvbpsi_atsc_eit_t*) malloc(sizeof(dvbpsi_atsc_eit_t)); p_eit = (dvbpsi_atsc_eit_t*) malloc(sizeof(dvbpsi_atsc_eit_t));
if (p_eit != NULL) if (p_eit != NULL)
dvbpsi_atsc_InitEIT(p_eit, i_version, b_current_next, i_protocol, i_source_id); dvbpsi_atsc_InitEIT(p_eit, i_table_id, i_extension, i_version,
i_protocol, i_source_id, b_current_next);
return p_eit; return p_eit;
} }
...@@ -348,7 +354,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t * ...@@ -348,7 +354,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t *
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_decoder->p_building_eit) if (!p_decoder->p_building_eit)
{ {
p_decoder->p_building_eit = dvbpsi_atsc_NewEIT(p_section->i_version, p_decoder->p_building_eit = dvbpsi_atsc_NewEIT(p_section->i_table_id,
p_section->i_extension,
p_section->i_version,
p_section->p_payload_start[0], p_section->p_payload_start[0],
p_section->i_extension, p_section->i_extension,
p_section->b_current_next); p_section->b_current_next);
......
...@@ -75,14 +75,17 @@ typedef struct dvbpsi_atsc_eit_event_s ...@@ -75,14 +75,17 @@ typedef struct dvbpsi_atsc_eit_event_s
*/ */
typedef struct dvbpsi_atsc_eit_s typedef struct dvbpsi_atsc_eit_s
{ {
uint8_t i_table_id; /*!< table id */
uint16_t i_extension; /*!< subtable id */
uint8_t i_version; /*!< version_number */ uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */ bool b_current_next; /*!< current_next_indicator */
uint16_t i_source_id; /*!< Source id used to match against channels */ uint16_t i_source_id; /*!< Source id used to match against channels */
uint8_t i_protocol; /*!< PSIP Protocol version */ uint8_t i_protocol; /*!< PSIP Protocol version */
dvbpsi_atsc_eit_event_t *p_first_event; /*!< First event information structure. */ dvbpsi_atsc_eit_event_t *p_first_event; /*!< First event information structure. */
dvbpsi_descriptor_t *p_first_descriptor; /*!< First descriptor structure. */ dvbpsi_descriptor_t *p_first_descriptor;/*!< First descriptor structure. */
} dvbpsi_atsc_eit_t; } dvbpsi_atsc_eit_t;
/***************************************************************************** /*****************************************************************************
...@@ -110,8 +113,8 @@ typedef void (* dvbpsi_atsc_eit_callback)(void* p_cb_data, dvbpsi_atsc_eit_t* p_ ...@@ -110,8 +113,8 @@ typedef void (* dvbpsi_atsc_eit_callback)(void* p_cb_data, dvbpsi_atsc_eit_t* p_
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true if everything went ok, false otherwise * \return true if everything went ok, false otherwise
*/ */
bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_extension, dvbpsi_atsc_eit_callback pf_callback, void* p_cb_data); dvbpsi_atsc_eit_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_detach * dvbpsi_eit_detach
...@@ -126,30 +129,35 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -126,30 +129,35 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_atsc_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, void dvbpsi_atsc_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_InitEIT/dvbpsi_atsc_NewEIT * dvbpsi_atsc_InitEIT/dvbpsi_atsc_NewEIT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_protocol, * \fn void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_source_id, bool b_current_next); uint8_t i_version, uint8_t i_protocol,
uint16_t i_source_id, bool b_current_next);
* \brief Initialize a user-allocated dvbpsi_atsc_eit_t structure. * \brief Initialize a user-allocated dvbpsi_atsc_eit_t structure.
* \param p_eit pointer to the EIT structure * \param p_eit pointer to the EIT structure
* \param i_table_id Table ID, 0xCB.
* \param i_extension Table ID extension, here TS ID.
* \param i_version EIT version * \param i_version EIT version
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param i_source_id Source id. * \param i_source_id Source id.
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_protocol, void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_source_id, bool b_current_next); uint8_t i_version, uint8_t i_protocol, uint16_t i_source_id, bool b_current_next);
/*! /*!
* \fn dvbpsi_atsc_eit_t *dvbpsi_atsc_NewEIT(uint8_t i_version, uint8_t i_protocol, * \fn dvbpsi_atsc_eit_t *dvbpsi_atsc_NewEIT(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, uint8_t i_protocol,
uint16_t i_source_id, bool b_current_next) uint16_t i_source_id, bool b_current_next)
* \brief Allocate and initialize a new dvbpsi_eit_t structure. Use ObjectRefDec to delete it. * \brief Allocate and initialize a new dvbpsi_eit_t structure. Use ObjectRefDec to delete it.
* \param i_table_id Table ID, 0xCB.
* \param i_extension Table ID extension, here TS ID.
* \param i_network_id network id * \param i_network_id network id
* \param i_version EIT version * \param i_version EIT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
...@@ -157,7 +165,8 @@ void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_ ...@@ -157,7 +165,8 @@ void dvbpsi_atsc_InitEIT(dvbpsi_atsc_eit_t* p_eit, uint8_t i_version, uint8_t i_
* \param b_cable_eit Whether this is CEIT or a TEIT. * \param b_cable_eit Whether this is CEIT or a TEIT.
* \return p_eit pointer to the EIT structure or NULL on error * \return p_eit pointer to the EIT structure or NULL on error
*/ */
dvbpsi_atsc_eit_t *dvbpsi_atsc_NewEIT(uint8_t i_version, uint8_t i_protocol, dvbpsi_atsc_eit_t *dvbpsi_atsc_NewEIT(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, uint8_t i_protocol,
uint16_t i_source_id, bool b_current_next); uint16_t i_source_id, bool b_current_next);
/***************************************************************************** /*****************************************************************************
......
...@@ -167,33 +167,33 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -167,33 +167,33 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_ett_t structure. * Initialize a pre-allocated dvbpsi_ett_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_atsc_InitETT(dvbpsi_atsc_ett_t *p_ett, void dvbpsi_atsc_InitETT(dvbpsi_atsc_ett_t *p_ett, uint8_t i_table_id,
uint8_t i_version, uint16_t i_extension, uint8_t i_version, uint8_t i_protocol,
uint8_t i_protocol, uint32_t i_etm_id, bool b_current_next)
uint16_t i_ett_table_id,
uint32_t i_etm_id,
bool b_current_next)
{ {
assert(p_ett); assert(p_ett);
p_ett->i_table_id = i_table_id;
p_ett->i_extension = i_extension;
p_ett->i_version = i_version; p_ett->i_version = i_version;
p_ett->b_current_next = b_current_next; p_ett->b_current_next = b_current_next;
p_ett->i_protocol = i_protocol; p_ett->i_protocol = i_protocol;
p_ett->i_ett_table_id = i_ett_table_id;
p_ett->i_etm_id = i_etm_id; p_ett->i_etm_id = i_etm_id;
p_ett->i_etm_length = 0; p_ett->i_etm_length = 0;
p_ett->p_etm_data = NULL; p_ett->p_etm_data = NULL;
p_ett->p_first_descriptor = NULL; p_ett->p_first_descriptor = NULL;
} }
dvbpsi_atsc_ett_t *dvbpsi_atsc_NewETT(uint8_t i_version, uint8_t i_protocol, dvbpsi_atsc_ett_t *dvbpsi_atsc_NewETT(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_ett_table_id, uint32_t i_etm_id, bool b_current_next) uint8_t i_version, uint8_t i_protocol,
uint32_t i_etm_id, bool b_current_next)
{ {
dvbpsi_atsc_ett_t *p_ett; dvbpsi_atsc_ett_t *p_ett;
p_ett = (dvbpsi_atsc_ett_t*)malloc(sizeof(dvbpsi_atsc_ett_t)); p_ett = (dvbpsi_atsc_ett_t*)malloc(sizeof(dvbpsi_atsc_ett_t));
if (p_ett != NULL) if (p_ett != NULL)
dvbpsi_atsc_InitETT(p_ett, i_version, b_current_next, i_protocol, dvbpsi_atsc_InitETT(p_ett, i_table_id, i_extension, i_version,
i_ett_table_id, i_etm_id); i_protocol, i_etm_id, b_current_next);
return p_ett; return p_ett;
} }
...@@ -291,9 +291,10 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t * ...@@ -291,9 +291,10 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *
((uint32_t)p_section->p_payload_start[3] << 8) | ((uint32_t)p_section->p_payload_start[3] << 8) |
((uint32_t)p_section->p_payload_start[4] << 0); ((uint32_t)p_section->p_payload_start[4] << 0);
p_decoder->p_building_ett = dvbpsi_atsc_NewETT(p_section->i_version, p_decoder->p_building_ett = dvbpsi_atsc_NewETT(p_section->i_table_id,
p_section->i_extension,
p_section->i_version,
p_section->p_payload_start[0], p_section->p_payload_start[0],
p_section->i_table_id,
i_etm_id, i_etm_id,
p_section->b_current_next); p_section->b_current_next);
if (p_decoder->p_building_ett) if (p_decoder->p_building_ett)
......
...@@ -55,13 +55,16 @@ extern "C" { ...@@ -55,13 +55,16 @@ extern "C" {
typedef struct dvbpsi_atsc_ett_s typedef struct dvbpsi_atsc_ett_s
{ {
/* general PSI table */ /* general PSI table */
uint8_t i_table_id; /*!< table id */
uint16_t i_extension; /*!< subtable id:
ETT Table ID extension,
normally 0x0000 */
uint8_t i_version; /*!< version_number */ uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */ bool b_current_next; /*!< current_next_indicator */
uint8_t i_protocol; /*!< PSIP Protocol version */ uint8_t i_protocol; /*!< PSIP Protocol version */
/* ETT specific */ /* ETT specific */
uint16_t i_ett_table_id; /*!< ETT Table ID extension,
normally 0x0000 */
uint32_t i_etm_id; /*!< ETM Identifier, made up of uint32_t i_etm_id; /*!< ETM Identifier, made up of
source id and event id source id and event id
(or 0 for channel ETT) */ (or 0 for channel ETT) */
...@@ -97,8 +100,8 @@ typedef void (* dvbpsi_atsc_ett_callback)(void* p_cb_data, dvbpsi_atsc_ett_t* p_ ...@@ -97,8 +100,8 @@ typedef void (* dvbpsi_atsc_ett_callback)(void* p_cb_data, dvbpsi_atsc_ett_t* p_
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true if everything went ok, else it returns false. * \return true if everything went ok, else it returns false.
*/ */
bool dvbpsi_atsc_AttachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_atsc_AttachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_extension, dvbpsi_atsc_ett_callback pf_callback, void* p_cb_data); dvbpsi_atsc_ett_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_DetachETT * dvbpsi_atsc_DetachETT
...@@ -119,32 +122,37 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -119,32 +122,37 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
* dvbpsi_atsc_InitETT/dvbpsi_atsc_NewETT * dvbpsi_atsc_InitETT/dvbpsi_atsc_NewETT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_atsc_InitETT(dvbpsi_atsc_ett_t *p_ett, uint8_t i_version, uint8_t i_protocol, * \fn void dvbpsi_atsc_InitETT(dvbpsi_atsc_ett_t *p_ett, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_ett_table_id, uint32_t i_etm_id, bool b_current_next); uint8_t i_version, uint8_t i_protocol, uint32_t i_etm_id, bool b_current_next);
* \brief Initialize a user-allocated dvbpsi_atsc_ett_t structure. * \brief Initialize a user-allocated dvbpsi_atsc_ett_t structure.
* \param p_ett pointer to the ETT structure * \param p_ett pointer to the ETT structure
* \param i_table_id Table ID, 0xCC.
* \param i_extension Table ID extension, normally 0x0000.
* \param i_version version * \param i_version version
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param i_ett_table_id Table ID (Normally 0x0000)
* \param i_etm_id ETM Identifier. * \param i_etm_id ETM Identifier.
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_atsc_InitETT(dvbpsi_atsc_ett_t *p_ett, uint8_t i_version, uint8_t i_protocol, void dvbpsi_atsc_InitETT(dvbpsi_atsc_ett_t *p_ett, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_ett_table_id, uint32_t i_etm_id, bool b_current_next); uint8_t i_version, uint8_t i_protocol,
uint32_t i_etm_id, bool b_current_next);
/*! /*!
* \fn dvbpsi_atsc_ett_t *dvbpsi_atsc_NewETT(uint8_t i_version, uint8_t i_protocol, * \fn dvbpsi_atsc_ett_t *dvbpsi_atsc_NewETT(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_ett_table_id, uint32_t i_etm_id, bool b_current_next) uint8_t i_version, uint8_t i_protocol,
uint32_t i_etm_id, bool b_current_next)
* \brief Allocate and initialize a new dvbpsi_atsc_ett_t structure. Use ObjectRefDec to delete it. * \brief Allocate and initialize a new dvbpsi_atsc_ett_t structure. Use ObjectRefDec to delete it.
* \param i_table_id Table ID, 0xCC.
* \param i_extension Table ID extension, normally 0x0000.
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param i_ett_table_id Table ID (Normally 0x0000)
* \param i_etm_id ETM Identifier. * \param i_etm_id ETM Identifier.
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \returns p_ett pointer to the ETT structure, NULL otherwise * \returns p_ett pointer to the ETT structure, NULL otherwise
*/ */
dvbpsi_atsc_ett_t *dvbpsi_atsc_NewETT(uint8_t i_version, uint8_t i_protocol, dvbpsi_atsc_ett_t *dvbpsi_atsc_NewETT(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_ett_table_id, uint32_t i_etm_id, bool b_current_next); uint8_t i_version, uint8_t i_protocol,
uint32_t i_etm_id, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_EmptyETT/dvbpsi_atsc_DeleteETT * dvbpsi_atsc_EmptyETT/dvbpsi_atsc_DeleteETT
......
...@@ -167,27 +167,28 @@ void dvbpsi_atsc_DetachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -167,27 +167,28 @@ void dvbpsi_atsc_DetachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_atsc_mgt_t structure. * Initialize a pre-allocated dvbpsi_atsc_mgt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_atsc_InitMGT(dvbpsi_atsc_mgt_t* p_mgt,uint8_t i_version, void dvbpsi_atsc_InitMGT(dvbpsi_atsc_mgt_t* p_mgt, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_protocol, uint16_t i_table_id_extension, bool b_current_next) uint8_t i_version, uint8_t i_protocol, bool b_current_next)
{ {
assert(p_mgt); assert(p_mgt);
p_mgt->i_table_id = i_table_id;
p_mgt->i_extension = i_extension;
p_mgt->i_version = i_version; p_mgt->i_version = i_version;
p_mgt->b_current_next = b_current_next; p_mgt->b_current_next = b_current_next;
p_mgt->i_protocol = i_protocol; p_mgt->i_protocol = i_protocol;
p_mgt->i_table_id_ext = i_table_id_extension;
p_mgt->p_first_table = NULL; p_mgt->p_first_table = NULL;
p_mgt->p_first_descriptor = NULL; p_mgt->p_first_descriptor = NULL;
} }
dvbpsi_atsc_mgt_t *dvbpsi_atsc_NewMGT(uint8_t i_version, uint8_t i_protocol, dvbpsi_atsc_mgt_t *dvbpsi_atsc_NewMGT(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_table_id_extension, bool b_current_next) uint8_t i_version, uint8_t i_protocol, bool b_current_next)
{ {
dvbpsi_atsc_mgt_t* p_mgt; dvbpsi_atsc_mgt_t* p_mgt;
p_mgt = (dvbpsi_atsc_mgt_t*)malloc(sizeof(dvbpsi_atsc_mgt_t)); p_mgt = (dvbpsi_atsc_mgt_t*)malloc(sizeof(dvbpsi_atsc_mgt_t));
if (p_mgt != NULL) if (p_mgt != NULL)
dvbpsi_atsc_InitMGT(p_mgt, i_version, b_current_next, i_protocol, dvbpsi_atsc_InitMGT(p_mgt, i_table_id, i_extension, i_version, i_protocol, b_current_next);
i_table_id_extension);
return p_mgt; return p_mgt;
} }
...@@ -378,9 +379,10 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t * ...@@ -378,9 +379,10 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t *
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_decoder->p_building_mgt) if (!p_decoder->p_building_mgt)
{ {
p_decoder->p_building_mgt = dvbpsi_atsc_NewMGT(p_section->i_version, p_decoder->p_building_mgt = dvbpsi_atsc_NewMGT(p_section->i_table_id,
p_section->p_payload_start[0],
p_section->i_extension, p_section->i_extension,
p_section->i_version,
p_section->p_payload_start[0],
p_section->b_current_next); p_section->b_current_next);
if (p_decoder->p_building_mgt) if (p_decoder->p_building_mgt)
return false; return false;
......
...@@ -75,6 +75,9 @@ typedef struct dvbpsi_atsc_mgt_table_s ...@@ -75,6 +75,9 @@ typedef struct dvbpsi_atsc_mgt_table_s
*/ */
typedef struct dvbpsi_atsc_mgt_s typedef struct dvbpsi_atsc_mgt_s
{ {
uint8_t i_table_id; /*!< Table id */
uint16_t i_extension; /*!< Subtable id */
uint8_t i_version; /*!< version_number */ uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */ bool b_current_next; /*!< current_next_indicator */
uint16_t i_table_id_ext; /*!< 0x0000 */ uint16_t i_table_id_ext; /*!< 0x0000 */
...@@ -131,31 +134,33 @@ void dvbpsi_atsc_DetachMGT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -131,31 +134,33 @@ void dvbpsi_atsc_DetachMGT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
* dvbpsi_atsc_InitMGT/dvbpsi_atsc_NewMGT * dvbpsi_atsc_InitMGT/dvbpsi_atsc_NewMGT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_atsc_InitMGT(dvbpsi_atsc_mgt_t* p_mgt, uint8_t i_version, uint8_t i_protocol, * \fn void dvbpsi_atsc_InitMGT(dvbpsi_atsc_mgt_t* p_mgt, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_table_id_extension, bool b_current_next); uint8_t i_version, uint8_t i_protocol, bool b_current_next);
* \brief Initialize a user-allocated dvbpsi_atsc_mgt_t structure. * \brief Initialize a user-allocated dvbpsi_atsc_mgt_t structure.
* \param p_mgt pointer to the MGT structure * \param p_mgt pointer to the MGT structure
* \param i_table_id Table ID, 0xC7.
* \param i_extension Table ID extension, here 0x0000.
* \param i_version MGT version * \param i_version MGT version
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param i_table_id_extension 0x0000.
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_atsc_InitMGT(dvbpsi_atsc_mgt_t* p_mgt, uint8_t i_version, uint8_t i_protocol, void dvbpsi_atsc_InitMGT(dvbpsi_atsc_mgt_t* p_mgt, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_table_id_extension, bool b_current_next); uint8_t i_version, uint8_t i_protocol, bool b_current_next);
/*! /*!
* \fn dvbpsi_atsc_mgt_t *dvbpsi_atsc_NewMGT(uint8_t i_version, uint8_t i_protocol, * \fn dvbpsi_atsc_mgt_t *dvbpsi_atsc_NewMGT(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_table_id_extension, bool b_current_next); uint8_t i_version, uint8_t i_protocol, bool b_current_next);
* \brief Allocate and initialize a new dvbpsi_mgt_t structure. * \brief Allocate and initialize a new dvbpsi_mgt_t structure.
* \param i_network_id network id * \param i_table_id Table ID, 0xC7.
* \param i_extension Table ID extension, here 0x0000.
* \param i_version MGT version * \param i_version MGT version
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_mgt pointer to the MGT structure, or NULL on failure * \return p_mgt pointer to the MGT structure, or NULL on failure
*/ */
dvbpsi_atsc_mgt_t *dvbpsi_atsc_NewMGT(uint8_t i_version, uint8_t i_protocol, dvbpsi_atsc_mgt_t *dvbpsi_atsc_NewMGT(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_table_id_extension, bool b_current_next); uint8_t i_version, uint8_t i_protocol, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_EmptyMGT/dvbpsi_atsc_DeleteMGT * dvbpsi_atsc_EmptyMGT/dvbpsi_atsc_DeleteMGT
......
...@@ -154,11 +154,17 @@ void dvbpsi_atsc_DetachSTT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -154,11 +154,17 @@ void dvbpsi_atsc_DetachSTT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_atsc_stt_t structure. * Initialize a pre-allocated dvbpsi_atsc_stt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_version) void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_table_id,
uint16_t i_extension, uint8_t i_version, bool b_current_next)
{ {
assert(p_stt); assert(p_stt);
p_stt->i_table_id = i_table_id;
p_stt->i_extension = i_extension;
p_stt->i_version = i_version; p_stt->i_version = i_version;
p_stt->b_current_next = b_current_next;
p_stt->p_first_descriptor = NULL; p_stt->p_first_descriptor = NULL;
} }
...@@ -167,12 +173,13 @@ void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_version) ...@@ -167,12 +173,13 @@ void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_version)
***************************************************************************** *****************************************************************************
* Allocate and initialize a dvbpsi_atsc_stt_t structure. * Allocate and initialize a dvbpsi_atsc_stt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_atsc_stt_t *dvbpsi_atsc_NewSTT(uint8_t i_version, bool b_current_next) dvbpsi_atsc_stt_t *dvbpsi_atsc_NewSTT(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next)
{ {
dvbpsi_atsc_stt_t *p_stt; dvbpsi_atsc_stt_t *p_stt;
p_stt = (dvbpsi_atsc_stt_t*)malloc(sizeof(dvbpsi_atsc_stt_t)); p_stt = (dvbpsi_atsc_stt_t*)malloc(sizeof(dvbpsi_atsc_stt_t));
if (p_stt != NULL) if (p_stt != NULL)
dvbpsi_atsc_InitSTT(p_stt, i_version); dvbpsi_atsc_InitSTT(p_stt, i_table_id, i_extension, i_version, b_current_next);
return p_stt; return p_stt;
} }
...@@ -279,8 +286,8 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t * ...@@ -279,8 +286,8 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t *
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_decoder->p_building_stt) if (!p_decoder->p_building_stt)
{ {
p_decoder->p_building_stt = dvbpsi_atsc_NewSTT(p_section->i_version, p_decoder->p_building_stt = dvbpsi_atsc_NewSTT(p_section->i_table_id, p_section->i_extension,
p_section->b_current_next); p_section->i_version, p_section->b_current_next);
if (p_decoder->p_building_stt) if (p_decoder->p_building_stt)
return false; return false;
......
...@@ -47,6 +47,9 @@ extern "C" { ...@@ -47,6 +47,9 @@ extern "C" {
*/ */
typedef struct dvbpsi_atsc_stt_s typedef struct dvbpsi_atsc_stt_s
{ {
uint8_t i_table_id; /*!< Table id */
uint16_t i_extension; /*!< Subtable id */
uint8_t i_version; /*!< PSIP Protocol version */ uint8_t i_version; /*!< PSIP Protocol version */
bool b_current_next; /*!< current_next_indicator */ bool b_current_next; /*!< current_next_indicator */
...@@ -103,22 +106,32 @@ void dvbpsi_atsc_DetachSTT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -103,22 +106,32 @@ void dvbpsi_atsc_DetachSTT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
* dvbpsi_atsc_InitSTT/dvbpsi_atsc_NewSTT * dvbpsi_atsc_InitSTT/dvbpsi_atsc_NewSTT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_protocol) * \fn void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_table_id,
uint16_t i_extension, uint8_t i_protocol,
bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_atsc_stt_t structure. * \brief Initialize a user-allocated dvbpsi_atsc_stt_t structure.
* \param i_table_id Table ID, 0xCD.
* \param i_extension Table extension, ignored as this should always be 0.
* \param p_stt pointer to the STT structure * \param p_stt pointer to the STT structure
* \param i_version PSIP Protocol version. * \param i_version PSIP Protocol version.
* \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_protocol); void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_protocol, bool b_current_next);
/*! /*!
* \fn dvbpsi_atsc_stt_t *dvbpsi_atsc_NewSTT(uint8_t i_version, bool b_current_next) * \fn dvbpsi_atsc_stt_t *dvbpsi_atsc_NewSTT(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next)
* \brief Allocate and initialize a new dvbpsi_atsc_stt_t structure. Use ObjectRefDec to delete it. * \brief Allocate and initialize a new dvbpsi_atsc_stt_t structure. Use ObjectRefDec to delete it.
* \param i_table_id Table ID, 0xCD.
* \param i_extension Table extension, ignored as this should always be 0.
* \param i_version PSIP Protocol version. * \param i_version PSIP Protocol version.
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_stt pointer to the STT structure * \return p_stt pointer to the STT structure
*/ */
dvbpsi_atsc_stt_t *dvbpsi_atsc_NewSTT(uint8_t i_version, bool b_current_next); dvbpsi_atsc_stt_t *dvbpsi_atsc_NewSTT(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_EmptySTT * dvbpsi_atsc_EmptySTT
......
...@@ -176,13 +176,13 @@ void dvbpsi_atsc_DetachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -176,13 +176,13 @@ void dvbpsi_atsc_DetachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
***************************************************************************** *****************************************************************************
* Allocate a new dvbpsi_atsc_vct_t structure and initialize it. * Allocate a new dvbpsi_atsc_vct_t structure and initialize it.
*****************************************************************************/ *****************************************************************************/
dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_protocol, uint16_t i_ts_id, dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_table_id, uint16_t i_extension,
bool b_cable_vct, uint8_t i_version, bool b_current_next) uint8_t i_protocol, bool b_cable_vct, uint8_t i_version, bool b_current_next)
{ {
dvbpsi_atsc_vct_t *p_vct = (dvbpsi_atsc_vct_t*)malloc(sizeof(dvbpsi_atsc_vct_t)); dvbpsi_atsc_vct_t *p_vct = (dvbpsi_atsc_vct_t*)malloc(sizeof(dvbpsi_atsc_vct_t));
if (p_vct != NULL) if (p_vct != NULL)
dvbpsi_atsc_InitVCT(p_vct, i_protocol, i_ts_id, b_cable_vct, dvbpsi_atsc_InitVCT(p_vct, i_table_id, i_extension, i_protocol,
i_version, b_current_next); b_cable_vct, i_version, b_current_next);
return p_vct; return p_vct;
} }
...@@ -191,15 +191,17 @@ dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_protocol, uint16_t i_ts_id, ...@@ -191,15 +191,17 @@ dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_protocol, uint16_t i_ts_id,
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_atsc_vct_t structure. * Initialize a pre-allocated dvbpsi_atsc_vct_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_protocol, void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_table_id,
uint16_t i_ts_id, bool b_cable_vct, uint16_t i_extension, uint8_t i_protocol, bool b_cable_vct,
uint8_t i_version, bool b_current_next) uint8_t i_version, bool b_current_next)
{ {
assert(p_vct); assert(p_vct);
p_vct->i_table_id = i_table_id;
p_vct->i_extension = i_extension;
p_vct->i_version = i_version; p_vct->i_version = i_version;
p_vct->b_current_next = b_current_next; p_vct->b_current_next = b_current_next;
p_vct->i_protocol = i_protocol; p_vct->i_protocol = i_protocol;
p_vct->i_ts_id = i_ts_id;
p_vct->b_cable_vct = b_cable_vct; p_vct->b_cable_vct = b_cable_vct;
p_vct->p_first_channel = NULL; p_vct->p_first_channel = NULL;
p_vct->p_first_descriptor = NULL; p_vct->p_first_descriptor = NULL;
...@@ -379,7 +381,7 @@ static bool dvbpsi_CheckVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *p_vct ...@@ -379,7 +381,7 @@ static bool dvbpsi_CheckVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *p_vct
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_vct_decoder); assert(p_vct_decoder);
if (p_vct_decoder->p_building_vct->i_ts_id != p_section->i_extension) if (p_vct_decoder->p_building_vct->i_extension != p_section->i_extension)
{ {
/* transport_stream_id */ /* transport_stream_id */
dvbpsi_error(p_dvbpsi, "ATSC VCT decoder", dvbpsi_error(p_dvbpsi, "ATSC VCT decoder",
...@@ -417,7 +419,8 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t * ...@@ -417,7 +419,8 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_vct_decoder->p_building_vct) if (!p_vct_decoder->p_building_vct)
{ {
p_vct_decoder->p_building_vct = dvbpsi_atsc_NewVCT(p_section->i_extension, p_vct_decoder->p_building_vct = dvbpsi_atsc_NewVCT(
p_section->i_table_id, p_section->i_extension,
p_section->p_payload_start[0], p_section->i_table_id == 0xC9, p_section->p_payload_start[0], p_section->i_table_id == 0xC9,
p_section->i_version, p_section->b_current_next); p_section->i_version, p_section->b_current_next);
if (p_vct_decoder->p_building_vct) if (p_vct_decoder->p_building_vct)
......
...@@ -88,9 +88,11 @@ typedef struct dvbpsi_atsc_vct_channel_s ...@@ -88,9 +88,11 @@ typedef struct dvbpsi_atsc_vct_channel_s
*/ */
typedef struct dvbpsi_atsc_vct_s typedef struct dvbpsi_atsc_vct_s
{ {
uint8_t i_table_id; /*!< table id */
uint16_t i_extension; /*!< subtable id */
uint8_t i_version; /*!< version_number */ uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */ bool b_current_next; /*!< current_next_indicator */
uint16_t i_ts_id; /*!< transport stream id */
uint8_t i_protocol; /*!< PSIP Protocol version */ uint8_t i_protocol; /*!< PSIP Protocol version */
bool b_cable_vct; /*!< 1 if this is a cable VCT, 0 if it is a Terrestrial VCT. */ bool b_cable_vct; /*!< 1 if this is a cable VCT, 0 if it is a Terrestrial VCT. */
...@@ -147,30 +149,34 @@ void dvbpsi_atsc_DetachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -147,30 +149,34 @@ void dvbpsi_atsc_DetachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
* dvbpsi_atsc_InitVCT * dvbpsi_atsc_InitVCT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_protocol, * \fn void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_table_id,
uint16_t i_extension, uint8_t i_protocol,
uint16_t i_ts_id, bool b_cable_vct, uint16_t i_ts_id, bool b_cable_vct,
uint8_t i_version, bool b_current_next) uint8_t i_version, bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_atsc_vct_t structure. * \brief Initialize a user-allocated dvbpsi_atsc_vct_t structure.
* \param p_vct pointer to the VCT structure * \param p_vct pointer to the VCT structure
* \param i_table_id Table ID, 0xC8 or 0xC9.
* \param i_extension Table ID extension, here TS ID.
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param i_ts_id Transport Stream id.
* \param b_cable_vct Whether this is CVCT or a TVCT. * \param b_cable_vct Whether this is CVCT or a TVCT.
* \param i_version VCT version * \param i_version VCT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_protocol, void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_table_id,
uint16_t i_ts_id, bool b_cable_vct, uint16_t i_extension, uint8_t i_protocol, bool b_cable_vct,
uint8_t i_version, bool b_current_next); uint8_t i_version, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_NewVCT * dvbpsi_atsc_NewVCT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_protocol, uint16_t i_ts_id, * \fn dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_table_id, uint16_t i_extension,
* bool b_cable_vct, uint8_t i_version, bool b_current_next); * uint8_t i_protocol, bool b_cable_vct, uint8_t i_version, bool b_current_next);
* *
* \brief Allocate and initialize a new dvbpsi_vct_t structure. * \brief Allocate and initialize a new dvbpsi_vct_t structure.
* \param i_table_id Table ID, 0xC8 or 0xC9.
* \param i_extension Table ID extension, here TS ID.
* \param i_protocol PSIP Protocol version. * \param i_protocol PSIP Protocol version.
* \param i_network_id network id * \param i_network_id network id
* \param b_cable_vct Whether this is CVCT or a TVCT. * \param b_cable_vct Whether this is CVCT or a TVCT.
...@@ -178,8 +184,9 @@ void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_protocol, ...@@ -178,8 +184,9 @@ void dvbpsi_atsc_InitVCT(dvbpsi_atsc_vct_t* p_vct, uint8_t i_protocol,
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_vct pointer to the VCT structure * \return p_vct pointer to the VCT structure
*/ */
dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_protocol, uint16_t i_ts_id, dvbpsi_atsc_vct_t *dvbpsi_atsc_NewVCT(uint8_t i_table_id, uint16_t i_extension,
bool b_cable_vct, uint8_t i_version, bool b_current_next); uint8_t i_protocol, bool b_cable_vct, uint8_t i_version,
bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_atsc_EmptyVCT * dvbpsi_atsc_EmptyVCT
......
...@@ -136,11 +136,13 @@ void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -136,11 +136,13 @@ void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_bat_t structure. * Initialize a pre-allocated dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_bat_init(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_version, void dvbpsi_bat_init(dvbpsi_bat_t* p_bat, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next) uint8_t i_version, bool b_current_next)
{ {
assert(p_bat); assert(p_bat);
p_bat->i_bouquet_id = i_bouquet_id; p_bat->i_table_id = i_table_id;
p_bat->i_extension = i_extension;
p_bat->i_version = i_version; p_bat->i_version = i_version;
p_bat->b_current_next = b_current_next; p_bat->b_current_next = b_current_next;
p_bat->p_first_ts = NULL; p_bat->p_first_ts = NULL;
...@@ -152,12 +154,12 @@ void dvbpsi_bat_init(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_versi ...@@ -152,12 +154,12 @@ void dvbpsi_bat_init(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_versi
***************************************************************************** *****************************************************************************
* Allocate and initialize a dvbpsi_bat_t structure. * Allocate and initialize a dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_bat_t *dvbpsi_bat_new(uint16_t i_bouquet_id, uint8_t i_version, dvbpsi_bat_t *dvbpsi_bat_new(uint8_t i_table_id, uint16_t i_extension,
bool b_current_next) uint8_t i_version, bool b_current_next)
{ {
dvbpsi_bat_t *p_bat = (dvbpsi_bat_t*)malloc(sizeof(dvbpsi_bat_t)); dvbpsi_bat_t *p_bat = (dvbpsi_bat_t*)malloc(sizeof(dvbpsi_bat_t));
if(p_bat != NULL) if(p_bat != NULL)
dvbpsi_bat_init(p_bat, i_bouquet_id, i_version, b_current_next); dvbpsi_bat_init(p_bat, i_table_id, i_extension, i_version, b_current_next);
return p_bat; return p_bat;
} }
...@@ -300,7 +302,7 @@ static bool dvbpsi_CheckBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat_deco ...@@ -300,7 +302,7 @@ static bool dvbpsi_CheckBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat_deco
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_bat_decoder); assert(p_bat_decoder);
if (p_bat_decoder->p_building_bat->i_bouquet_id != p_section->i_extension) if (p_bat_decoder->p_building_bat->i_extension != p_section->i_extension)
{ {
/* bouquet_id */ /* bouquet_id */
dvbpsi_error(p_dvbpsi, "BAT decoder", "'bouquet_id' differs" dvbpsi_error(p_dvbpsi, "BAT decoder", "'bouquet_id' differs"
...@@ -337,7 +339,8 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat ...@@ -337,7 +339,8 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_bat_decoder->p_building_bat) if (!p_bat_decoder->p_building_bat)
{ {
p_bat_decoder->p_building_bat = dvbpsi_bat_new(p_section->i_extension, p_bat_decoder->p_building_bat = dvbpsi_bat_new(
p_section->i_table_id, p_section->i_extension,
p_section->i_version, p_section->b_current_next); p_section->i_version, p_section->b_current_next);
if (!p_bat_decoder->p_building_bat) if (!p_bat_decoder->p_building_bat)
return false; return false;
...@@ -547,7 +550,7 @@ dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_ba ...@@ -547,7 +550,7 @@ dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_ba
p_current->b_syntax_indicator = true; p_current->b_syntax_indicator = true;
p_current->b_private_indicator = true; p_current->b_private_indicator = true;
p_current->i_length = 13; /* including CRC_32 */ p_current->i_length = 13; /* including CRC_32 */
p_current->i_extension = p_bat->i_bouquet_id; p_current->i_extension = p_bat->i_extension;
p_current->i_version = p_bat->i_version; p_current->i_version = p_bat->i_version;
p_current->b_current_next = p_bat->b_current_next; p_current->b_current_next = p_bat->b_current_next;
p_current->i_number = 0; p_current->i_number = 0;
...@@ -585,7 +588,7 @@ dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_ba ...@@ -585,7 +588,7 @@ dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_ba
p_current->b_syntax_indicator = true; p_current->b_syntax_indicator = true;
p_current->b_private_indicator = true; p_current->b_private_indicator = true;
p_current->i_length = 13; /* including CRC_32 */ p_current->i_length = 13; /* including CRC_32 */
p_current->i_extension = p_bat->i_bouquet_id; p_current->i_extension = p_bat->i_extension;
p_current->i_version = p_bat->i_version; p_current->i_version = p_bat->i_version;
p_current->b_current_next = p_bat->b_current_next; p_current->b_current_next = p_bat->b_current_next;
p_current->i_number = p_prev->i_number + 1; p_current->i_number = p_prev->i_number + 1;
...@@ -656,7 +659,7 @@ dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_ba ...@@ -656,7 +659,7 @@ dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_ba
p_current->b_syntax_indicator = true; p_current->b_syntax_indicator = true;
p_current->b_private_indicator = true; p_current->b_private_indicator = true;
p_current->i_length = 13; /* including CRC_32 */ p_current->i_length = 13; /* including CRC_32 */
p_current->i_extension = p_bat->i_bouquet_id; p_current->i_extension = p_bat->i_extension;
p_current->i_version = p_bat->i_version; p_current->i_version = p_bat->i_version;
p_current->b_current_next = p_bat->b_current_next; p_current->b_current_next = p_bat->b_current_next;
p_current->i_number = p_prev->i_number + 1; p_current->i_number = p_prev->i_number + 1;
......
...@@ -61,13 +61,12 @@ extern "C" { ...@@ -61,13 +61,12 @@ extern "C" {
*/ */
typedef struct dvbpsi_bat_ts_s typedef struct dvbpsi_bat_ts_s
{ {
uint16_t i_ts_id; /*!< transport stream id */ uint16_t i_ts_id; /*!< transport stream id */
uint16_t i_orig_network_id; /*!< original network id */ uint16_t i_orig_network_id; /*!< original network id */
dvbpsi_descriptor_t * p_first_descriptor; /*!< descriptor list */ dvbpsi_descriptor_t *p_first_descriptor; /*!< descriptor list */
struct dvbpsi_bat_ts_s *p_next; /*!< next element of
struct dvbpsi_bat_ts_s * p_next; /*!< next element of
the list */ the list */
} dvbpsi_bat_ts_t; } dvbpsi_bat_ts_t;
...@@ -89,18 +88,19 @@ typedef struct dvbpsi_bat_ts_s ...@@ -89,18 +88,19 @@ typedef struct dvbpsi_bat_ts_s
*/ */
typedef struct dvbpsi_bat_s typedef struct dvbpsi_bat_s
{ {
uint16_t i_bouquet_id; /*!< bouquet_id */ uint8_t i_table_id; /*!< table id */
uint8_t i_version; /*!< version_number */ uint16_t i_extension; /*!< subtable id (here bouquet id) */
bool b_current_next; /*!< current_next_indicator */
uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */
dvbpsi_descriptor_t * p_first_descriptor; /*!< descriptor list */ dvbpsi_descriptor_t * p_first_descriptor; /*!< descriptor list */
dvbpsi_bat_ts_t * p_first_ts; /*!< transport stream dvbpsi_bat_ts_t * p_first_ts; /*!< transport stream
description list */ description list */
} dvbpsi_bat_t; } dvbpsi_bat_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_bat_callback * dvbpsi_bat_callback
*****************************************************************************/ *****************************************************************************/
...@@ -116,8 +116,7 @@ typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat); ...@@ -116,8 +116,7 @@ typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, uint16_t i_extension, dvbpsi_bat_callback pf_callback, void* p_cb_data)
void* p_cb_data)
* \brief Creation and initialization of a BAT decoder. It will be attached to p_dvbpsi. * \brief Creation and initialization of a BAT decoder. It will be attached to p_dvbpsi.
* \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0x4a. * \param i_table_id Table ID, 0x4a.
...@@ -126,9 +125,8 @@ typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat); ...@@ -126,9 +125,8 @@ typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, dvbpsi_bat_callback pf_callback, void* p_cb_data);
void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_bat_detach * dvbpsi_bat_detach
...@@ -142,36 +140,37 @@ bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -142,36 +140,37 @@ bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
* \param i_extension Table ID extension, here bouquet ID. * \param i_extension Table ID extension, here bouquet ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_bat_init/dvbpsi_bat_new * dvbpsi_bat_init/dvbpsi_bat_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version, * \fn void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next) uint8_t i_version, bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_bat_t structure. * \brief Initialize a user-allocated dvbpsi_bat_t structure.
* \param p_bat pointer to the BAT structure * \param p_bat pointer to the BAT structure
* \param i_bouquet_id bouquet ID * \param i_table_id Table ID, 0x4a.
* \param i_extension Table ID extension, here bouquet ID.
* \param i_version BAT version * \param i_version BAT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version, void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next); uint8_t i_version, bool b_current_next);
/*! /*!
* \fn dvbpsi_bat_t *dvbpsi_bat_new(uint16_t i_bouquet_id, uint8_t i_version, * \fn dvbpsi_bat_t *dvbpsi_bat_new(uint8_t i_table_id, uint16_t i_extension,
* bool b_current_next) * uint8_t i_version, bool b_current_next)
* \brief Allocate and initialize a new dvbpsi_bat_t structure. * \brief Allocate and initialize a new dvbpsi_bat_t structure.
* \param i_bouquet_id bouquet ID * \param i_table_id Table ID, 0x4a.
* \param i_extension Table ID extension, here bouquet ID.
* \param i_version BAT version * \param i_version BAT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_bat pointer to the BAT structure * \return p_bat pointer to the BAT structure
*/ */
dvbpsi_bat_t *dvbpsi_bat_new(uint16_t i_bouquet_id, uint8_t i_version, dvbpsi_bat_t *dvbpsi_bat_new(uint8_t i_table_id, uint16_t i_extension,
bool b_current_next); uint8_t i_version, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_bat_empty/dvbpsi_bat_delete * dvbpsi_bat_empty/dvbpsi_bat_delete
......
...@@ -137,12 +137,14 @@ void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -137,12 +137,14 @@ void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_eit_t structure. * Initialize a pre-allocated dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version, void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id, uint8_t i_version, bool b_current_next, uint16_t i_ts_id,
uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
{ {
p_eit->i_service_id = i_service_id; p_eit->i_table_id = i_table_id;
p_eit->i_extension = i_extension;
p_eit->i_version = i_version; p_eit->i_version = i_version;
p_eit->b_current_next = b_current_next; p_eit->b_current_next = b_current_next;
p_eit->i_ts_id = i_ts_id; p_eit->i_ts_id = i_ts_id;
...@@ -157,15 +159,16 @@ void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versi ...@@ -157,15 +159,16 @@ void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versi
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_eit_t structure. * Allocate and Initialize a new dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_eit_t* dvbpsi_eit_new(uint16_t i_service_id, uint8_t i_version, dvbpsi_eit_t* dvbpsi_eit_new(uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next, uint16_t i_ts_id,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
{ {
dvbpsi_eit_t *p_eit = (dvbpsi_eit_t*)malloc(sizeof(dvbpsi_eit_t)); dvbpsi_eit_t *p_eit = (dvbpsi_eit_t*)malloc(sizeof(dvbpsi_eit_t));
if (p_eit != NULL) if (p_eit != NULL)
dvbpsi_eit_init(p_eit, i_service_id, i_version, b_current_next, i_ts_id, dvbpsi_eit_init(p_eit, i_table_id, i_extension, i_version,
i_network_id, i_segment_last_section_number, i_last_table_id); b_current_next, i_ts_id, i_network_id, i_segment_last_section_number,
i_last_table_id);
return p_eit; return p_eit;
} }
...@@ -280,7 +283,7 @@ static bool dvbpsi_CheckEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit_deco ...@@ -280,7 +283,7 @@ static bool dvbpsi_CheckEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit_deco
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_eit_decoder); assert(p_eit_decoder);
if (p_eit_decoder->p_building_eit->i_service_id != p_section->i_extension) if (p_eit_decoder->p_building_eit->i_extension != p_section->i_extension)
{ {
/* service_id */ /* service_id */
dvbpsi_error(p_dvbpsi, "EIT decoder", dvbpsi_error(p_dvbpsi, "EIT decoder",
...@@ -370,7 +373,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit ...@@ -370,7 +373,9 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_eit_decoder->p_building_eit) if (!p_eit_decoder->p_building_eit)
{ {
p_eit_decoder->p_building_eit = dvbpsi_eit_new(p_section->i_extension, p_eit_decoder->p_building_eit = dvbpsi_eit_new(
p_section->i_table_id,
p_section->i_extension,
p_section->i_version, p_section->i_version,
p_section->b_current_next, p_section->b_current_next,
((uint16_t)(p_section->p_payload_start[0]) << 8) ((uint16_t)(p_section->p_payload_start[0]) << 8)
...@@ -561,7 +566,7 @@ static dvbpsi_psi_section_t* NewEITSection(dvbpsi_eit_t* p_eit, int i_table_id, ...@@ -561,7 +566,7 @@ static dvbpsi_psi_section_t* NewEITSection(dvbpsi_eit_t* p_eit, int i_table_id,
p_result->b_private_indicator = 1; p_result->b_private_indicator = 1;
p_result->i_length = 15; /* header: 11B + CRC32 */ p_result->i_length = 15; /* header: 11B + CRC32 */
p_result->i_extension = p_eit->i_service_id; p_result->i_extension = p_eit->i_extension;
p_result->i_version = p_eit->i_version; p_result->i_version = p_eit->i_version;
p_result->b_current_next = p_eit->b_current_next; p_result->b_current_next = p_eit->b_current_next;
p_result->i_number = i_section_number; p_result->i_number = i_section_number;
......
...@@ -85,15 +85,17 @@ typedef struct dvbpsi_eit_event_s ...@@ -85,15 +85,17 @@ typedef struct dvbpsi_eit_event_s
*/ */
typedef struct dvbpsi_eit_s typedef struct dvbpsi_eit_s
{ {
uint16_t i_service_id; /*!< service_id */ uint8_t i_table_id; /*!< table id */
uint8_t i_version; /*!< version_number */ uint16_t i_extension; /*!< subtable id */
bool b_current_next; /*!< current_next_indicator */
uint16_t i_ts_id; /*!< transport stream id */
uint16_t i_network_id; /*!< original network id */
uint8_t i_segment_last_section_number; /*!< segment last section number */
uint8_t i_last_table_id; /*!< last table id */
dvbpsi_eit_event_t * p_first_event; /*!< event information list */ uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */
uint16_t i_ts_id; /*!< transport stream id */
uint16_t i_network_id; /*!< original network id */
uint8_t i_segment_last_section_number; /*!< segment last section number */
uint8_t i_last_table_id; /*!< last table id */
dvbpsi_eit_event_t *p_first_event; /*!< event information list */
} dvbpsi_eit_t; } dvbpsi_eit_t;
...@@ -101,8 +103,7 @@ typedef struct dvbpsi_eit_s ...@@ -101,8 +103,7 @@ typedef struct dvbpsi_eit_s
* dvbpsi_eit_callback * dvbpsi_eit_callback
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \typedef void (* dvbpsi_eit_callback)(void* p_cb_data, * \typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit)
dvbpsi_eit_t* p_new_eit)
* \brief Callback type definition. * \brief Callback type definition.
*/ */
typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit); typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit);
...@@ -122,8 +123,8 @@ typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit); ...@@ -122,8 +123,8 @@ typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_eit_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_eit_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_extension, dvbpsi_eit_callback pf_callback, void* p_cb_data); dvbpsi_eit_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_detach * dvbpsi_eit_detach
...@@ -144,13 +145,15 @@ void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -144,13 +145,15 @@ void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
* dvbpsi_eit_init/dvbpsi_eit_new * dvbpsi_eit_init/dvbpsi_eit_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, * \fn void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint8_t i_table_id,
uint16_t i_extension, uint16_t i_service_id,
uint8_t i_version, bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next, uint16_t i_ts_id,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
* \brief Initialize a user-allocated dvbpsi_eit_t structure. * \brief Initialize a user-allocated dvbpsi_eit_t structure.
* \param p_eit pointer to the EIT structure * \param p_eit pointer to the EIT structure
* \param i_service_id service ID * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID.
* \param i_version EIT version * \param i_version EIT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
...@@ -159,18 +162,20 @@ void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -159,18 +162,20 @@ void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
* \param i_last_table_id i_last_table_id * \param i_last_table_id i_last_table_id
* \return nothing. * \return nothing.
*/ */
void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version, void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint8_t i_table_id,
bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id, uint16_t i_extension, uint8_t i_version,
uint8_t i_segment_last_section_number, bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id,
uint8_t i_last_table_id); uint8_t i_segment_last_section_number,
uint8_t i_last_table_id);
/*! /*!
* \fn dvbpsi_eit_t* dvbpsi_eit_new(uint16_t i_service_id, * \fn dvbpsi_eit_t* dvbpsi_eit_new(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_ts_id, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
* \brief Allocate and initialize a new dvbpsi_eit_t structure. * \brief Allocate and initialize a new dvbpsi_eit_t structure.
* \param i_service_id service ID * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID.
* \param i_version EIT version * \param i_version EIT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
...@@ -179,10 +184,11 @@ void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versi ...@@ -179,10 +184,11 @@ void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versi
* \param i_last_table_id i_last_table_id * \param i_last_table_id i_last_table_id
* \return p_eit pointer to the EIT structure * \return p_eit pointer to the EIT structure
*/ */
dvbpsi_eit_t* dvbpsi_eit_new(uint16_t i_service_id, dvbpsi_eit_t* dvbpsi_eit_new(uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_ts_id, uint16_t i_network_id,
uint8_t i_last_table_id); uint8_t i_segment_last_section_number,
uint8_t i_last_table_id);
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_empty/dvbpsi_eit_delete * dvbpsi_eit_empty/dvbpsi_eit_delete
......
...@@ -106,8 +106,7 @@ bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -106,8 +106,7 @@ bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
***************************************************************************** *****************************************************************************
* Close a NIT decoder. * Close a NIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_nit_detach(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, void dvbpsi_nit_detach(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_extension)
uint16_t i_extension)
{ {
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_decoder; dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_decoder;
...@@ -138,9 +137,12 @@ void dvbpsi_nit_detach(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, ...@@ -138,9 +137,12 @@ void dvbpsi_nit_detach(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_nit_t structure. * Initialize a pre-allocated dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id, void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next) uint16_t i_network_id, uint8_t i_version, bool b_current_next)
{ {
p_nit->i_table_id = i_table_id;
p_nit->i_extension = i_extension;
p_nit->i_network_id = i_network_id; p_nit->i_network_id = i_network_id;
p_nit->i_version = i_version; p_nit->i_version = i_version;
p_nit->b_current_next = b_current_next; p_nit->b_current_next = b_current_next;
...@@ -153,12 +155,14 @@ void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id, ...@@ -153,12 +155,14 @@ void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
***************************************************************************** *****************************************************************************
* Allocate and initialize a dvbpsi_nit_t structure. * Allocate and initialize a dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_nit_t *dvbpsi_nit_new(uint16_t i_network_id, uint8_t i_version, dvbpsi_nit_t *dvbpsi_nit_new(uint8_t i_table_id, uint16_t i_extension,
bool b_current_next) uint16_t i_network_id, uint8_t i_version,
bool b_current_next)
{ {
dvbpsi_nit_t*p_nit = (dvbpsi_nit_t*)malloc(sizeof(dvbpsi_nit_t)); dvbpsi_nit_t*p_nit = (dvbpsi_nit_t*)malloc(sizeof(dvbpsi_nit_t));
if (p_nit != NULL) if (p_nit != NULL)
dvbpsi_nit_init(p_nit, i_network_id, i_version, b_current_next); dvbpsi_nit_init(p_nit, i_table_id, i_extension, i_network_id,
i_version, b_current_next);
return p_nit; return p_nit;
} }
...@@ -331,8 +335,9 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit ...@@ -331,8 +335,9 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (p_nit_decoder->p_building_nit == NULL) if (p_nit_decoder->p_building_nit == NULL)
{ {
p_nit_decoder->p_building_nit = dvbpsi_nit_new(p_nit_decoder->i_network_id, p_nit_decoder->p_building_nit = dvbpsi_nit_new(p_section->i_table_id,
p_section->i_version, p_section->b_current_next); p_section->i_extension, p_nit_decoder->i_network_id,
p_section->i_version, p_section->b_current_next);
if (p_nit_decoder->p_building_nit == NULL) if (p_nit_decoder->p_building_nit == NULL)
return false; return false;
p_nit_decoder->i_last_section_number = p_section->i_last_number; p_nit_decoder->i_last_section_number = p_section->i_last_number;
......
...@@ -82,13 +82,16 @@ typedef struct dvbpsi_nit_ts_s ...@@ -82,13 +82,16 @@ typedef struct dvbpsi_nit_ts_s
*/ */
typedef struct dvbpsi_nit_s typedef struct dvbpsi_nit_s
{ {
uint16_t i_network_id; /*!< network_id */ uint8_t i_table_id; /*!< table id */
uint8_t i_version; /*!< version_number */ uint16_t i_extension; /*!< subtable id */
bool b_current_next; /*!< current_next_indicator */
dvbpsi_descriptor_t * p_first_descriptor; /*!< descriptor list */ uint16_t i_network_id; /*!< network_id */
uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */
dvbpsi_nit_ts_t * p_first_ts; /*!< TS list */ dvbpsi_descriptor_t *p_first_descriptor; /*!< descriptor list */
dvbpsi_nit_ts_t * p_first_ts; /*!< TS list */
} dvbpsi_nit_t; } dvbpsi_nit_t;
...@@ -106,9 +109,8 @@ typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit); ...@@ -106,9 +109,8 @@ typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit);
* dvbpsi_nit_attach * dvbpsi_nit_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, dvbpsi_nit_callback pf_callback, void* p_cb_data)
void* p_cb_data)
* \brief Creation and initialization of a NIT decoder. It is attached to p_dvbpsi. * \brief Creation and initialization of a NIT decoder. It is attached to p_dvbpsi.
* \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F. * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
...@@ -117,9 +119,8 @@ typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit); ...@@ -117,9 +119,8 @@ typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, dvbpsi_nit_callback pf_callback, void* p_cb_data);
void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_nit_detach * dvbpsi_nit_detach
...@@ -140,28 +141,34 @@ void dvbpsi_nit_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -140,28 +141,34 @@ void dvbpsi_nit_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
* dvbpsi_nit_init/dvbpsi_nit_new * dvbpsi_nit_init/dvbpsi_nit_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id, * \fn void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next) uint16_t i_network_id, uint8_t i_version, bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_nit_t structure. * \brief Initialize a user-allocated dvbpsi_nit_t structure.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID.
* \param p_nit pointer to the NIT structure * \param p_nit pointer to the NIT structure
* \param i_network_id network id * \param i_network_id network id
* \param i_version NIT version * \param i_version NIT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id, void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next); uint16_t i_network_id, uint8_t i_version, bool b_current_next);
/*! /*!
* \fn dvbpsi_nit_t *dvbpsi_nit_new(uint16_t i_network_id, uint8_t i_version, * \fn dvbpsi_nit_t *dvbpsi_nit_new(uint8_t i_table_id, uint16_t i_extension,
* bool b_current_next); * uint16_t i_network_id, uint8_t i_version,
* bool b_current_next);
* \brief Allocate and initialize a new dvbpsi_nit_t structure. * \brief Allocate and initialize a new dvbpsi_nit_t structure.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID.
* \param i_network_id network id * \param i_network_id network id
* \param i_version NIT version * \param i_version NIT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_nit pointer to the NIT structure * \return p_nit pointer to the NIT structure
*/ */
dvbpsi_nit_t *dvbpsi_nit_new(uint16_t i_network_id, uint8_t i_version, dvbpsi_nit_t *dvbpsi_nit_new(uint8_t i_table_id, uint16_t i_extension,
uint16_t i_network_id, uint8_t i_version,
bool b_current_next); bool b_current_next);
/***************************************************************************** /*****************************************************************************
......
...@@ -124,7 +124,7 @@ dvbpsi_pmt_t* dvbpsi_pmt_new(uint16_t i_program_number, uint8_t i_version, ...@@ -124,7 +124,7 @@ dvbpsi_pmt_t* dvbpsi_pmt_new(uint16_t i_program_number, uint8_t i_version,
dvbpsi_pmt_t *p_pmt = (dvbpsi_pmt_t*)malloc(sizeof(dvbpsi_pmt_t)); dvbpsi_pmt_t *p_pmt = (dvbpsi_pmt_t*)malloc(sizeof(dvbpsi_pmt_t));
if(p_pmt != NULL) if(p_pmt != NULL)
dvbpsi_pmt_init(p_pmt, i_program_number, i_version, dvbpsi_pmt_init(p_pmt, i_program_number, i_version,
b_current_next, i_pcr_pid); b_current_next, i_pcr_pid);
return p_pmt; return p_pmt;
} }
......
...@@ -138,12 +138,14 @@ void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -138,12 +138,14 @@ void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_sdt_t structure. * Initialize a pre-allocated dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint16_t i_network_id) uint8_t i_version, bool b_current_next, uint16_t i_network_id)
{ {
assert(p_sdt); assert(p_sdt);
p_sdt->i_ts_id = i_ts_id; p_sdt->i_table_id = i_table_id;
p_sdt->i_extension = i_extension;
p_sdt->i_version = i_version; p_sdt->i_version = i_version;
p_sdt->b_current_next = b_current_next; p_sdt->b_current_next = b_current_next;
p_sdt->i_network_id = i_network_id; p_sdt->i_network_id = i_network_id;
...@@ -155,12 +157,13 @@ void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version, ...@@ -155,12 +157,13 @@ void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version,
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_sdt_t structure. * Allocate and Initialize a new dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_sdt_t *dvbpsi_sdt_new(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sdt_t *dvbpsi_sdt_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint16_t i_network_id) bool b_current_next, uint16_t i_network_id)
{ {
dvbpsi_sdt_t *p_sdt = (dvbpsi_sdt_t*)malloc(sizeof(dvbpsi_sdt_t)); dvbpsi_sdt_t *p_sdt = (dvbpsi_sdt_t*)malloc(sizeof(dvbpsi_sdt_t));
if (p_sdt != NULL) if (p_sdt != NULL)
dvbpsi_sdt_init(p_sdt, i_ts_id, i_version, b_current_next, i_network_id); dvbpsi_sdt_init(p_sdt, i_table_id, i_extension, i_version,
b_current_next, i_network_id);
return p_sdt; return p_sdt;
} }
...@@ -319,10 +322,12 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt ...@@ -319,10 +322,12 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_sdt_decoder->p_building_sdt) if (!p_sdt_decoder->p_building_sdt)
{ {
p_sdt_decoder->p_building_sdt = dvbpsi_sdt_new(p_section->i_extension, p_sdt_decoder->p_building_sdt =
dvbpsi_sdt_new(p_section->i_table_id, p_section->i_extension,
p_section->i_version, p_section->b_current_next, p_section->i_version, p_section->b_current_next,
((uint16_t)(p_section->p_payload_start[0]) << 8) ((uint16_t)(p_section->p_payload_start[0]) << 8)
| p_section->p_payload_start[1]); | p_section->p_payload_start[1]);
if (p_sdt_decoder->p_building_sdt == NULL) if (p_sdt_decoder->p_building_sdt == NULL)
return false; return false;
p_sdt_decoder->i_last_section_number = p_section->i_last_number; p_sdt_decoder->i_last_section_number = p_section->i_last_number;
......
...@@ -86,12 +86,17 @@ typedef struct dvbpsi_sdt_service_s ...@@ -86,12 +86,17 @@ typedef struct dvbpsi_sdt_service_s
*/ */
typedef struct dvbpsi_sdt_s typedef struct dvbpsi_sdt_s
{ {
uint16_t i_ts_id; /*!< transport_stream_id */ /* PSI table members */
uint8_t i_version; /*!< version_number */ uint8_t i_table_id; /*!< table id */
bool b_current_next; /*!< current_next_indicator */ uint16_t i_extension; /*!< subtable id */
uint16_t i_network_id; /*!< original network id */
dvbpsi_sdt_service_t * p_first_service; /*!< service description /* Table specific */
uint16_t i_ts_id; /*!< transport_stream_id */
uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */
uint16_t i_network_id; /*!< original network id */
dvbpsi_sdt_service_t * p_first_service; /*!< service description
list */ list */
} dvbpsi_sdt_t; } dvbpsi_sdt_t;
...@@ -142,30 +147,33 @@ void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -142,30 +147,33 @@ void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
* dvbpsi_sdt_init/dvbpsi_NewSDT * dvbpsi_sdt_init/dvbpsi_NewSDT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, * \fn void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint8_t i_table_id, uint16_t i_extension,
uint8_t i_version, bool b_current_next, uint16_t i_network_id) uint8_t i_version, bool b_current_next, uint16_t i_network_id)
* \brief Initialize a user-allocated dvbpsi_sdt_t structure. * \brief Initialize a user-allocated dvbpsi_sdt_t structure.
* \param p_sdt pointer to the SDT structure * \param p_sdt pointer to the SDT structure
* \param i_ts_id transport stream ID * \param i_table_id Table ID, 0x42 or 0x46.
* \param i_extension Table ID extension, here TS ID.
* \param i_version SDT version * \param i_version SDT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_network_id original network id * \param i_network_id original network id
* \return nothing. * \return nothing.
*/ */
void dvbpsi_sdt_init(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sdt_init(dvbpsi_sdt_t *p_sdt, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint16_t i_network_id); uint8_t i_version, bool b_current_next, uint16_t i_network_id);
/*! /*!
* \fn dvbpsi_sdt_t *dvbpsi_sdt_new(uint16_t i_ts_id, uint8_t i_version, * \fn dvbpsi_sdt_t *dvbpsi_sdt_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint16_t i_network_id) bool b_current_next, uint16_t i_network_id)
* \brief Allocate and initialize a new dvbpsi_sdt_t structure. * \brief Allocate and initialize a new dvbpsi_sdt_t structure.
* \param i_table_id Table ID, 0x42 or 0x46.
* \param i_extension Table ID extension, here TS ID.
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
* \param i_version SDT version * \param i_version SDT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_network_id original network id * \param i_network_id original network id
* \return p_sdt pointer to the SDT structure * \return p_sdt pointer to the SDT structure
*/ */
dvbpsi_sdt_t *dvbpsi_sdt_new(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sdt_t *dvbpsi_sdt_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint16_t i_network_id); bool b_current_next, uint16_t i_network_id);
/***************************************************************************** /*****************************************************************************
......
...@@ -104,8 +104,7 @@ bool dvbpsi_sis_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -104,8 +104,7 @@ bool dvbpsi_sis_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
***************************************************************************** *****************************************************************************
* Close a SIS decoder. * Close a SIS decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension)
uint16_t i_extension)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -141,10 +140,12 @@ void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -141,10 +140,12 @@ void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_sis_t structure. * Initialize a pre-allocated dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint8_t i_protocol_version) uint8_t i_version, bool b_current_next, uint8_t i_protocol_version)
{ {
p_sis->i_ts_id = i_ts_id; p_sis->i_table_id = i_table_id;
p_sis->i_extension = i_extension;
p_sis->i_version = i_version; p_sis->i_version = i_version;
p_sis->b_current_next = b_current_next; p_sis->b_current_next = b_current_next;
...@@ -178,12 +179,13 @@ void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, ...@@ -178,12 +179,13 @@ void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version,
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_sis_t structure. * Allocate and Initialize a new dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_sis_t* dvbpsi_sis_new(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sis_t* dvbpsi_sis_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint8_t i_protocol_version) bool b_current_next, uint8_t i_protocol_version)
{ {
dvbpsi_sis_t* p_sis = (dvbpsi_sis_t*)malloc(sizeof(dvbpsi_sis_t)); dvbpsi_sis_t* p_sis = (dvbpsi_sis_t*)malloc(sizeof(dvbpsi_sis_t));
if (p_sis != NULL) if (p_sis != NULL)
dvbpsi_sis_init(p_sis, i_ts_id, i_version, b_current_next, i_protocol_version); dvbpsi_sis_init(p_sis, i_table_id, i_extension, i_version,
b_current_next, i_protocol_version);
return p_sis; return p_sis;
} }
...@@ -268,7 +270,7 @@ static bool dvbpsi_CheckSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t* p_sis_deco ...@@ -268,7 +270,7 @@ static bool dvbpsi_CheckSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t* p_sis_deco
" while no discontinuity has occured"); " while no discontinuity has occured");
b_reinit = true; b_reinit = true;
} }
else if (p_sis_decoder->p_building_sis->i_ts_id != p_section->i_extension) else if (p_sis_decoder->p_building_sis->i_extension != p_section->i_extension)
{ {
dvbpsi_error(p_dvbpsi, "SIS decoder", dvbpsi_error(p_dvbpsi, "SIS decoder",
"'transport_stream_id' differs" "'transport_stream_id' differs"
...@@ -305,8 +307,9 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis ...@@ -305,8 +307,9 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_sis_decoder->p_building_sis) if (!p_sis_decoder->p_building_sis)
{ {
p_sis_decoder->p_building_sis = dvbpsi_sis_new(p_section->i_extension, p_sis_decoder->p_building_sis = dvbpsi_sis_new(
p_section->i_version, p_section->b_current_next, 0); p_section->i_table_id, p_section->i_extension,
p_section->i_version, p_section->b_current_next, 0);
if (p_sis_decoder->p_building_sis == NULL) if (p_sis_decoder->p_building_sis == NULL)
return false; return false;
p_sis_decoder->i_last_section_number = p_section->i_last_number; p_sis_decoder->i_last_section_number = p_section->i_last_number;
......
...@@ -54,6 +54,9 @@ extern "C" { ...@@ -54,6 +54,9 @@ extern "C" {
typedef struct dvbpsi_sis_s typedef struct dvbpsi_sis_s
{ {
/* section */ /* section */
uint8_t i_table_id; /*!< table id */
uint16_t i_extension; /*!< subtable id */
uint16_t i_ts_id; /*!< transport_stream_id */ uint16_t i_ts_id; /*!< transport_stream_id */
uint8_t i_version; /*!< version_number */ uint8_t i_version; /*!< version_number */
uint8_t i_protocol_version; /*!< Protocol version uint8_t i_protocol_version; /*!< Protocol version
...@@ -353,7 +356,7 @@ typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis); ...@@ -353,7 +356,7 @@ typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis);
* \brief Creation and initialization of a SIS decoder. It is attached to p_dvbpsi. * \brief Creation and initialization of a SIS decoder. It is attached to p_dvbpsi.
* \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure * \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure
* \param i_table_id Table ID, 0xFC. * \param i_table_id Table ID, 0xFC.
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension.
* \param pf_callback function to call back on new SIS. * \param pf_callback function to call back on new SIS.
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
...@@ -379,31 +382,33 @@ void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens ...@@ -379,31 +382,33 @@ void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extens
* dvbpsi_sis_init/dvbpsi_sis_new * dvbpsi_sis_init/dvbpsi_sis_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, * \fn void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint8_t i_protocol_version); uint8_t i_version, bool b_current_next, uint8_t i_protocol_version);
* \brief Initialize a user-allocated dvbpsi_sis_t structure. * \brief Initialize a user-allocated dvbpsi_sis_t structure.
* \param p_sis pointer to the SIS structure * \param p_sis pointer to the SIS structure
* \param i_ts_id transport stream ID * \param i_table_id Table ID, 0xFC.
* \param i_extension Table ID extension.
* \param i_version SIS version * \param i_version SIS version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_protocol_version SIS protocol version (currently 0) * \param i_protocol_version SIS protocol version (currently 0)
* \return nothing. * \return nothing.
*/ */
void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint8_t i_protocol_version); uint8_t i_version, bool b_current_next, uint8_t i_protocol_version);
/*! /*!
* \fn dvbpsi_sis_t* dvbpsi_sis_new(uint16_t i_ts_id, uint8_t i_version, * \fn dvbpsi_sis_t* dvbpsi_sis_new(uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint8_t i_protocol_version); uint8_t i_version, bool b_current_next, uint8_t i_protocol_version);
* \brief Allocate and initialize a new dvbpsi_sis_t structure. * \brief Allocate and initialize a new dvbpsi_sis_t structure.
* \param i_ts_id transport stream ID * \param i_table_id Table ID, 0xFC.
* \param i_extension Table ID extension.
* \param i_version SIS version * \param i_version SIS version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_protocol_version SIS protocol version (currently 0) * \param i_protocol_version SIS protocol version (currently 0)
* \return p_sis pointer to the SIS structure * \return p_sis pointer to the SIS structure
*/ */
dvbpsi_sis_t* dvbpsi_sis_new(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sis_t* dvbpsi_sis_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint8_t i_protocol_version); bool b_current_next, uint8_t i_protocol_version);
/***************************************************************************** /*****************************************************************************
* dvbpsi_sis_empty/dvbpsi_sis_delete * dvbpsi_sis_empty/dvbpsi_sis_delete
......
...@@ -142,12 +142,14 @@ void dvbpsi_tot_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -142,12 +142,14 @@ void dvbpsi_tot_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_tot_t structure. * Initialize a pre-allocated dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint64_t i_utc_time) uint8_t i_version, bool b_current_next, uint64_t i_utc_time)
{ {
assert(p_tot); assert(p_tot);
p_tot->i_ts_id = i_ts_id; p_tot->i_table_id = i_table_id;
p_tot->i_extension = i_extension;
p_tot->i_version = i_version; p_tot->i_version = i_version;
p_tot->b_current_next = b_current_next; p_tot->b_current_next = b_current_next;
...@@ -161,12 +163,13 @@ void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, ...@@ -161,12 +163,13 @@ void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version,
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_tot_t structure. * Allocate and Initialize a new dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_tot_t *dvbpsi_tot_new(uint16_t i_ts_id, uint8_t i_version, dvbpsi_tot_t *dvbpsi_tot_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint64_t i_utc_time) bool b_current_next, uint64_t i_utc_time)
{ {
dvbpsi_tot_t *p_tot = (dvbpsi_tot_t*)malloc(sizeof(dvbpsi_tot_t)); dvbpsi_tot_t *p_tot = (dvbpsi_tot_t*)malloc(sizeof(dvbpsi_tot_t));
if (p_tot != NULL) if (p_tot != NULL)
dvbpsi_tot_init(p_tot, i_ts_id, i_version, b_current_next, i_utc_time); dvbpsi_tot_init(p_tot, i_table_id, i_extension, i_version,
b_current_next, i_utc_time);
return p_tot; return p_tot;
} }
...@@ -240,7 +243,7 @@ static bool dvbpsi_CheckTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot_deco ...@@ -240,7 +243,7 @@ static bool dvbpsi_CheckTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot_deco
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_tot_decoder); assert(p_tot_decoder);
if (p_tot_decoder->p_building_tot->i_ts_id != p_section->i_extension) if (p_tot_decoder->p_building_tot->i_extension != p_section->i_extension)
{ {
/* transport_stream_id */ /* transport_stream_id */
dvbpsi_error(p_dvbpsi, "TDT/TOT decoder", dvbpsi_error(p_dvbpsi, "TDT/TOT decoder",
...@@ -278,7 +281,8 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot ...@@ -278,7 +281,8 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_tot_decoder->p_building_tot) if (!p_tot_decoder->p_building_tot)
{ {
p_tot_decoder->p_building_tot = dvbpsi_tot_new(p_section->i_extension, p_tot_decoder->p_building_tot = dvbpsi_tot_new(
p_section->i_table_id, p_section->i_extension,
p_section->i_version, p_section->b_current_next, p_section->i_version, p_section->b_current_next,
((uint64_t)p_section->p_payload_start[0] << 32) ((uint64_t)p_section->p_payload_start[0] << 32)
| ((uint64_t)p_section->p_payload_start[1] << 24) | ((uint64_t)p_section->p_payload_start[1] << 24)
......
...@@ -57,7 +57,10 @@ extern "C" { ...@@ -57,7 +57,10 @@ extern "C" {
*/ */
typedef struct dvbpsi_tot_s typedef struct dvbpsi_tot_s
{ {
uint16_t i_ts_id; /*!< transport_stream_id */ uint8_t i_table_id; /*!< table id */
uint16_t i_extension; /*!< subtable id */
/* Subtable specific */
uint8_t i_version; /*!< version_number */ uint8_t i_version; /*!< version_number */
bool b_current_next; /*!< current_next_indicator */ bool b_current_next; /*!< current_next_indicator */
...@@ -94,7 +97,7 @@ typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot); ...@@ -94,7 +97,7 @@ typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot);
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_tot_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_tot_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_tot_callback pf_callback, void* p_cb_data); dvbpsi_tot_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_tot_detach * dvbpsi_tot_detach
...@@ -114,31 +117,33 @@ void dvbpsi_tot_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -114,31 +117,33 @@ void dvbpsi_tot_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
* dvbpsi_tot_init/dvbpsi_tot_new * dvbpsi_tot_init/dvbpsi_tot_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, * \fn void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint64_t i_utc_time); uint16_t i_ts_id, uint8_t i_version, bool b_current_next, uint64_t i_utc_time);
* \brief Initialize a user-allocated dvbpsi_tot_t structure. * \brief Initialize a user-allocated dvbpsi_tot_t structure.
* \param p_tot pointer to the TDT/TOT structure * \param p_tot pointer to the TDT/TOT structure
* \param i_ts_id transport stream ID * \param i_table_id Table ID, usually 0x70
* \param i_extension Table ID extension, unused in the TDT/TOT
* \param i_version SDT version * \param i_version SDT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_utc_time the time in UTC * \param i_utc_time the time in UTC
* \return nothing. * \return nothing.
*/ */
void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint64_t i_utc_time); uint8_t i_version, bool b_current_next, uint64_t i_utc_time);
/*! /*!
* \fn dvbpsi_tot_t *dvbpsi_tot_new(uint16_t i_ts_id, uint8_t i_version, * \fn dvbpsi_tot_t *dvbpsi_tot_new(uint8_t i_table_id, uint16_t i_extension,
bool b_current_next, uint64_t i_utc_time); uint8_t i_version, bool b_current_next, uint64_t i_utc_time);
* \brief Allocate and initialize a new dvbpsi_tot_t structure. * \brief Allocate and initialize a new dvbpsi_tot_t structure.
* \param i_ts_id transport stream ID * \param i_table_id Table ID, usually 0x70
* \param i_extension Table ID extension, unused in the TDT/TOT
* \param i_version SDT version * \param i_version SDT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \param i_utc_time the time in UTC * \param i_utc_time the time in UTC
* \return p_tot pointer to the TDT/TOT structure * \return p_tot pointer to the TDT/TOT structure
*/ */
dvbpsi_tot_t *dvbpsi_tot_new(uint16_t i_ts_id, uint8_t i_version, dvbpsi_tot_t *dvbpsi_tot_new(uint8_t i_table_id, uint16_t i_extension, uint8_t i_version,
bool b_current_next, uint64_t i_utc_time); bool b_current_next, uint64_t i_utc_time);
/***************************************************************************** /*****************************************************************************
* dvbpsi_tot_empty/dvbpsi_tot_delete * dvbpsi_tot_empty/dvbpsi_tot_delete
......
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