diff --git a/examples/Makefile b/examples/Makefile index eaebeb1..0965553 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,7 @@ CFLAGS = -Wall -O2 -g LDFLAGS = -OBJ = dvb_print_si dvb_ecmg dvb_ecmg_test mpeg_print_pcr rtp_check_cc +OBJ = dvb_print_si dvb_ecmg dvb_ecmg_test mpeg_print_pcr rtp_check_seqnum all: $(OBJ) diff --git a/examples/rtp_check_cc.c b/examples/rtp_check_seqnum.c similarity index 89% rename from examples/rtp_check_cc.c rename to examples/rtp_check_seqnum.c index 394f7ca..fba7a45 100644 --- a/examples/rtp_check_cc.c +++ b/examples/rtp_check_seqnum.c @@ -1,5 +1,5 @@ /***************************************************************************** - * rtp_check_cc.c: Prints RTP discontinuities + * rtp_check_seqnum.c: Prints RTP discontinuities ***************************************************************************** * Copyright (C) 2011 VideoLAN * $Id: dvb_print_si.c 27 2011-04-10 16:57:59Z massiot $ @@ -50,7 +50,7 @@ int main(int i_argc, char **ppsz_argv) usage(ppsz_argv[0]); uint8_t p_buffer[i_packet_size]; - uint16_t i_cc = 0; + uint16_t i_seqnum = 0; for ( ; ; ) { ssize_t toto; @@ -64,10 +64,10 @@ int main(int i_argc, char **ppsz_argv) continue; } - uint16_t i_new_cc = rtp_get_cc(p_buffer); - if (i_new_cc != i_cc) + uint16_t i_new_seqnum = rtp_get_seqnum(p_buffer); + if (i_new_seqnum != i_seqnum) fprintf(stderr, "received packet %hu while expecting %hu\n", - i_new_cc, i_cc); - i_cc = (i_new_cc + 1) % 65536; + i_new_seqnum, i_seqnum); + i_seqnum = (i_new_seqnum + 1) % 65536; } } diff --git a/ietf/rtp.h b/ietf/rtp.h index c9beae8..2998578 100644 --- a/ietf/rtp.h +++ b/ietf/rtp.h @@ -65,13 +65,13 @@ static inline uint8_t rtp_get_type(const uint8_t *p_rtp) return p_rtp[1] & 0x7f; } -static inline void rtp_set_cc(uint8_t *p_rtp, uint16_t i_rtp_cc) +static inline void rtp_set_seqnum(uint8_t *p_rtp, uint16_t i_seqnum) { - p_rtp[2] = i_rtp_cc >> 8; - p_rtp[3] = i_rtp_cc & 0xff; + p_rtp[2] = i_seqnum >> 8; + p_rtp[3] = i_seqnum & 0xff; } -static inline uint16_t rtp_get_cc(uint8_t *p_rtp) +static inline uint16_t rtp_get_seqnum(uint8_t *p_rtp) { return (p_rtp[2] << 8) | p_rtp[3]; } @@ -83,6 +83,7 @@ static inline void rtp_set_timestamp(uint8_t *p_rtp, uint32_t i_timestamp) p_rtp[6] = (i_timestamp >> 8) & 0xff; p_rtp[7] = i_timestamp & 0xff; } + static inline uint32_t rtp_get_timestamp(uint8_t *p_rtp) { return (p_rtp[4] << 24) | (p_rtp[5] << 16) | (p_rtp[6] << 8) | p_rtp[7]; diff --git a/mpeg/ts.h b/mpeg/ts.h index 739fbc7..a0a0db8 100644 --- a/mpeg/ts.h +++ b/mpeg/ts.h @@ -226,7 +226,7 @@ static inline void tsaf_set_pcrext(uint8_t *p_ts, uint16_t i_pcr_ext) p_ts[11] = i_pcr_ext & 0xff; } -static inline bool tsaf_has_pcr(uint8_t *p_ts) +static inline bool tsaf_has_pcr(const uint8_t *p_ts) { return !!(p_ts[5] & 0x10); }