From a08bae073a7b74a9e7f49a8da0b69d089cde0704 Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Tue, 28 Sep 2010 19:26:01 +0000 Subject: [PATCH] * mpeg/ts.h: Slightly change the API for sections to avoid bugs. --- mpeg/psi.h | 2 +- mpeg/ts.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mpeg/psi.h b/mpeg/psi.h index 9fb4acb..93d2553 100644 --- a/mpeg/psi.h +++ b/mpeg/psi.h @@ -539,7 +539,7 @@ static inline uint8_t *psi_assemble_payload(uint8_t **pp_psi_buffer, *pp_psi_buffer = psi_private_allocate(); } - memcpy( *pp_psi_buffer + *pi_psi_buffer_used, *pp_payload, i_copy_size ); + memcpy(*pp_psi_buffer + *pi_psi_buffer_used, *pp_payload, i_copy_size); *pi_psi_buffer_used += i_copy_size; if (*pi_psi_buffer_used >= PSI_HEADER_SIZE) { diff --git a/mpeg/ts.h b/mpeg/ts.h index b40cdc5..739fbc7 100644 --- a/mpeg/ts.h +++ b/mpeg/ts.h @@ -166,6 +166,14 @@ static inline uint8_t *ts_payload(uint8_t *p_ts) } static inline uint8_t *ts_section(uint8_t *p_ts) +{ + if (!ts_get_unitstart(p_ts)) + return ts_payload(p_ts); + + return ts_payload(p_ts) + 1; /* pointer_field */ +} + +static inline uint8_t *ts_next_section(uint8_t *p_ts) { uint8_t *p_payload;