ROHC compression/decompression library
c_rtp.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007,2008 CNES
3  * Copyright 2010,2011,2012,2013 Didier Barvaux
4  * Copyright 2007,2008 Thales Alenia Space
5  * Copyright 2007,2009,2010 Viveris Technologies
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file c_rtp.h
24  * @brief ROHC compression context for the RTP profile.
25  * @author David Moreau from TAS
26  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
27  */
28 
29 #ifndef ROHC_COMP_RTP_H
30 #define ROHC_COMP_RTP_H
31 
32 #include "rohc_comp_rfc3095.h"
34 #include "protocols/udp.h"
35 #include "protocols/rtp.h"
36 
37 
38 /** The RTP-specific temporary variables */
40 {
41  /** Whether the UDP checksum changed of behavior with the current packet */
43  /** Whether the UDP checksum changed of behavior with the last few packets */
45  /** Whether the RTP Version changed with the current packet */
47  /** Whether the RTP Version changed with the last few packets */
48  uint16_t rtp_version_changed:1;
49  /** Whether the RTP Padding (P) bit changed with the current packet */
51  /** Whether the RTP Padding (P) bit changed with the last few packets */
52  uint16_t rtp_padding_changed:1;
53  /** Whether the RTP eXtension (X) bit changed with the current packet */
55  /** Whether the RTP eXtension (X) bit changed with the last few packets */
56  uint16_t rtp_ext_changed:1;
57  uint16_t is_marker_bit_set:1; /**< Whether RTP Marker (M) bit is set */
58  /** Whether the RTP Payload Type (PT) changed with the current packet */
59  uint16_t rtp_pt_just_changed:1;
60  /** Whether the RTP Payload Type (PT) changed with the last few packets */
61  uint16_t rtp_pt_changed:1;
62  uint16_t unused:5;
63 
64  /** The TS field to send (ts_scaled or ts) */
65  uint32_t ts_send;
66  /** The number of bits needed to encode ts_send */
67  uint8_t nr_ts_bits;
68  /** The number of bits of TS to place in the extension 3 header */
69  uint8_t nr_ts_bits_ext3;
70 };
71 
72 
73 /**
74  * @brief Define the RTP part of the profile decompression context.
75  *
76  * This object must be used with the generic part of the decompression
77  * context rohc_comp_rfc3095_ctxt.
78  *
79  * @see rohc_comp_rfc3095_ctxt
80  */
82 {
83  /** Structure to encode the TS field */
84  struct ts_sc_comp ts_sc;
85 
86  /** The number of times the checksum field was transmitted since last change */
88  /** The nr of times the RTP Version field was added to compressed headers */
90  /** The nr of times the RTP Padding (P) bit was added to compressed headers */
92  /** The nr of times the RTP eXtension (X) bit was added to compressed headers */
94  /** The nr of times the RTP PT field was added to compressed headers */
95  uint8_t rtp_pt_trans_nr;
96 
97  uint16_t old_udp_check; /**< The UDP checksum in previous UDP header */
98  uint16_t old_rtp_version:2; /**< The RTP Version in previous RTP header */
99  uint16_t old_rtp_padding:1; /**< The RTP Padding in previous RTP header */
100  uint16_t old_rtp_extension:1; /**< The RTP Extension in previous RTP header */
101  uint16_t old_rtp_pt:7; /**< The RTP Payload Type in previous RTP header */
102  uint16_t unused:5;
103 
104  /// @brief RTP-specific temporary variables that are used during one single
105  /// compression of packet
107 };
108 
109 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
110 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
111  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
112  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
113 _Static_assert((sizeof(struct sc_rtp_context) % 8) == 0,
114  "sc_rtp_context length should be multiple of 8 bytes");
115 #endif
116 
117 
118 /*
119  * Function prototypes.
120  */
121 
122 /* no public function */
123 
124 #endif
125 
uint16_t old_rtp_pt
Definition: c_rtp.h:101
uint16_t old_rtp_version
Definition: c_rtp.h:98
Define the RTP part of the profile decompression context.
Definition: c_rtp.h:81
Generic framework for RFC3095-based compression profiles such as IP-only, UDP, UDP-Lite, ESP, and RTP profiles.
Scaled RTP Timestamp encoding object.
Definition: comp_scaled_rtp_ts.h:63
Definition: c_rtp.h:39
Scaled RTP Timestamp encoding.
uint16_t rtp_padding_just_changed
Definition: c_rtp.h:50
uint16_t rtp_version_changed
Definition: c_rtp.h:48
uint8_t rtp_version_trans_nr
Definition: c_rtp.h:89
uint16_t old_udp_check
Definition: c_rtp.h:97
uint8_t rtp_ext_trans_nr
Definition: c_rtp.h:93
uint8_t nr_ts_bits_ext3
Definition: c_rtp.h:69
uint16_t udp_check_behavior_changed
Definition: c_rtp.h:44
uint32_t ts_send
Definition: c_rtp.h:65
struct rtp_tmp_vars tmp
RTP-specific temporary variables that are used during one single compression of packet.
Definition: c_rtp.h:106
uint16_t is_marker_bit_set
Definition: c_rtp.h:57
uint16_t rtp_ext_just_changed
Definition: c_rtp.h:54
uint16_t old_rtp_padding
Definition: c_rtp.h:99
uint8_t rtp_padding_trans_nr
Definition: c_rtp.h:91
uint16_t unused
Definition: c_rtp.h:62
uint16_t rtp_padding_changed
Definition: c_rtp.h:52
struct ts_sc_comp ts_sc
Definition: c_rtp.h:84
uint16_t rtp_ext_changed
Definition: c_rtp.h:56
uint8_t rtp_pt_trans_nr
Definition: c_rtp.h:95
uint16_t udp_check_behavior_just_changed
Definition: c_rtp.h:42
uint16_t old_rtp_extension
Definition: c_rtp.h:100
uint16_t unused
Definition: c_rtp.h:102
uint16_t rtp_pt_just_changed
Definition: c_rtp.h:59
uint16_t rtp_pt_changed
Definition: c_rtp.h:61
RTP header.
uint16_t rtp_version_just_changed
Definition: c_rtp.h:46
Defines the UDP header.
uint8_t nr_ts_bits
Definition: c_rtp.h:67
uint8_t udp_checksum_trans_nr
Definition: c_rtp.h:87