From b69cc56f29a55fa64c515561ce7ae78e6b1e1622 Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Mon, 28 Oct 2013 15:15:32 +0100 Subject: [PATCH] allow to change some fields in existing packets --- mpeg/pes.h | 3 ++- mpeg/ts.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mpeg/pes.h b/mpeg/pes.h index 3a84a7c..26cac26 100644 --- a/mpeg/pes.h +++ b/mpeg/pes.h @@ -123,7 +123,8 @@ static inline void pes_set_pts(uint8_t *p_pes, uint64_t i_pts) p_pes[7] |= 0x80; if (p_pes[8] < 5) p_pes[8] = 5; - p_pes[9] = 0x21 | ((i_pts >> 29) & 0xe); + p_pes[9] &= 0x10; + p_pes[9] |= 0x21 | ((i_pts >> 29) & 0xe); p_pes[10] = (i_pts >> 22) & 0xff; p_pes[11] = 0x1 | ((i_pts >> 14) & 0xfe); p_pes[12] = (i_pts >> 7) & 0xff; diff --git a/mpeg/ts.h b/mpeg/ts.h index 175eee5..495b379 100644 --- a/mpeg/ts.h +++ b/mpeg/ts.h @@ -216,6 +216,11 @@ static inline void tsaf_set_discontinuity(uint8_t *p_ts) p_ts[5] |= 0x80; } +static inline void tsaf_clear_discontinuity(uint8_t *p_ts) +{ + p_ts[5] &= ~0x80; +} + static inline bool tsaf_has_discontinuity(const uint8_t *p_ts) { return !!(p_ts[5] & 0x80);