@@ -31,8 +31,7 @@
#include <stdint.h>
#define DVB_MAX_PAYLOAD_PACKET_SIZE 4096
-#define DVB_PID_SDT 17
-#define DVB_PMT_TABLE_ID 2
+#define DVB_CRC_SIZE 4
struct dvb_v5_fe_parms;
@@ -222,7 +222,7 @@ static int dvb_parse_section(struct dvb_v5_fe_parms *parms,
set_bit(h->section_id, priv->is_read_bits);
if (dvb_table_initializers[tid])
- dvb_table_initializers[tid](parms, buf, buf_length,
+ dvb_table_initializers[tid](parms, buf, buf_length - DVB_CRC_SIZE,
sect->table);
else
dvb_logerr("%s: no initializer for table %d",
@@ -25,7 +25,7 @@
ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct atsc_table_eit **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4; /* minus CRC */;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct atsc_table_eit *eit;
struct atsc_table_eit_event **head;
size_t size;
@@ -25,7 +25,7 @@
ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_cat **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct dvb_table_cat *cat;
struct dvb_desc **head_desc;
size_t size;
@@ -59,7 +59,7 @@ ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
while (*head_desc != NULL)
head_desc = &(*head_desc)->next;
- size = cat->header.section_length + 3 - 4; /* plus header, minus CRC */
+ size = cat->header.section_length + 3 - DVB_CRC_SIZE; /* plus header, minus CRC */
if (buf + size > endbuf) {
dvb_logerr("%s: short read %zd/%zd bytes", __func__,
endbuf - buf, size);
@@ -25,7 +25,7 @@
ssize_t dvb_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_eit **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4; /* minus CRC */
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct dvb_table_eit *eit;
struct dvb_table_eit_event **head;
size_t size;
@@ -25,7 +25,7 @@
ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct atsc_table_mgt **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4; /* minus CRC */
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct atsc_table_mgt *mgt;
struct atsc_table_mgt_table **head;
struct dvb_desc **head_desc;
@@ -25,7 +25,7 @@
ssize_t dvb_table_nit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_nit **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct dvb_table_nit *nit;
struct dvb_table_nit_transport **head;
struct dvb_desc **head_desc;
@@ -26,7 +26,7 @@
ssize_t dvb_table_pat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_pat **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct dvb_table_pat *pat;
struct dvb_table_pat_program **head;
size_t size;
@@ -28,7 +28,7 @@
ssize_t dvb_table_pmt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_pmt **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct dvb_table_pmt *pmt;
struct dvb_table_pmt_stream **head;
struct dvb_desc **head_desc;
@@ -68,7 +68,7 @@ ssize_t dvb_table_pmt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
while (*head_desc != NULL)
head_desc = &(*head_desc)->next;
- size = pmt->header.section_length + 3 - 4; /* plus header, minus CRC */
+ size = pmt->header.section_length + 3 - DVB_CRC_SIZE; /* plus header, minus CRC */
if (buf + size > endbuf) {
dvb_logerr("%s: short read %zd/%zd bytes", __func__,
endbuf - buf, size);
@@ -26,7 +26,7 @@
ssize_t dvb_table_sdt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_sdt **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct dvb_table_sdt *sdt;
struct dvb_table_sdt_service **head;
size_t size;
@@ -61,7 +61,7 @@ ssize_t dvb_table_sdt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
while (*head != NULL)
head = &(*head)->next;
- size = sdt->header.section_length + 3 - 4; /* plus header, minus CRC */
+ size = sdt->header.section_length + 3 - DVB_CRC_SIZE; /* plus header, minus CRC */
if (buf + size > endbuf) {
dvb_logerr("%s: short read %zd/%zd bytes", __func__,
endbuf - buf, size);
@@ -27,7 +27,7 @@
ssize_t atsc_table_vct_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct atsc_table_vct **table)
{
- const uint8_t *p = buf, *endbuf = buf + buflen - 4;
+ const uint8_t *p = buf, *endbuf = buf + buflen;
struct atsc_table_vct *vct;
struct atsc_table_vct_channel **head;
size_t size;
- provide buffer without CRC to the table parsers - remove unneeded defines Signed-off-by: André Roth <neolynx@gmail.com> --- lib/include/libdvbv5/descriptors.h | 3 +-- lib/libdvbv5/dvb-scan.c | 2 +- lib/libdvbv5/tables/atsc_eit.c | 2 +- lib/libdvbv5/tables/cat.c | 4 ++-- lib/libdvbv5/tables/eit.c | 2 +- lib/libdvbv5/tables/mgt.c | 2 +- lib/libdvbv5/tables/nit.c | 2 +- lib/libdvbv5/tables/pat.c | 2 +- lib/libdvbv5/tables/pmt.c | 4 ++-- lib/libdvbv5/tables/sdt.c | 4 ++-- lib/libdvbv5/tables/vct.c | 2 +- 11 files changed, 14 insertions(+), 15 deletions(-)